Пример #1
0
        protected void Awake()
        {
            if (luaPath == "")
            {
                Debug.LogError("### LuaBehaviour Error, Empty luaPath :" + name);
            }

            if (luaName == "")
            {
                Debug.LogError("### LuaBehaviour Error, Empty luaName :" + name);
            }

            LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua);
            object     luaRet = luaMgr.Require <object>(luaPath);

            mSelfTable = luaRet as LuaTable;

            if (mSelfTable == null)
            {
                Debug.LogError("Lua must return a table " + luaPath);
            }
            awake      = mSelfTable.GetLuaFunction("Awake");
            start      = mSelfTable.GetLuaFunction("Start");
            on_enable  = mSelfTable.GetLuaFunction("OnEnable");
            update     = mSelfTable.GetLuaFunction("Update");
            on_destroy = mSelfTable.GetLuaFunction("OnDestroy");
            Util.CallLuaFunction(awake, mSelfTable, gameObject);
        }
Пример #2
0
 protected void OnDestroy()
 {
     Util.CallLuaFunction(on_destroy, name);
     Util.ClearMemory();
 }
Пример #3
0
 protected void Update()
 {
     Util.CallLuaFunction(update, name);
 }
Пример #4
0
 protected void OnEnable()
 {
     Util.CallLuaFunction(on_enable, name);
 }
Пример #5
0
 protected void Start()
 {
     Util.CallLuaFunction(start, name);
 }