using DSFramework;
using UnityEngine;
using UnityEngine.Events;
using XLua;
//接口不允许有成员变量
//可以使用属性来接收
[CSharpCallLua]
public interface ILuaCallInterface {
int testInt { get; set; }
bool testBool { get; set; }
float testFloat { get; set; }
string testString { get; set; }
UnityAction testFun { get; set; }
}
public class Lession8_LuaInterface : MonoBehaviour {
private void Start() {
DSLuaMgr.Instance.DoLuaFile("Main");
ILuaCallInterface luaCallInterface = DSLuaMgr.Instance.Global.Get<ILuaCallInterface>("testClass");
Debug.Log(luaCallInterface.testInt);
Debug.Log(luaCallInterface.testBool);
Debug.Log(luaCallInterface.testFloat);
Debug.Log(luaCallInterface.testString);
luaCallInterface.testFun();
//接口拷贝 是引用拷贝 改了值 lua表中的值也变了
luaCallInterface.testInt = 10000;
ILuaCallInterface obj2 = DSLuaMgr.Instance.Global.Get<ILuaCallInterface>("testClas");
Debug.Log(obj2.testInt);
}
}