예제 #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);
 }