Example #1
0
        public static LuaComponent AddLuaComponent(GameObject go, string path)
        {
            LuaComponent luaComp = go.AddComponent <LuaComponent>();

            luaComp.Initilize(path);             // 手动调用脚本运行,以取得LuaTable返回值
            return(luaComp);
        }
Example #2
0
 public void CallLuaFunction(string funcName)
 {
     if (LuaCp == null)
     {
         LuaCp = GetComponent <LuaComponent>();
     }
     if (LuaCp == null)
     {
         Log.E("Not find LuaComponet");
         return;
     }
     LuaCp.CallLuaFunction(funcName);
 }
Example #3
0
        public void BindLuaComponent()
        {
            if (LuaCp == null)
            {
                LuaCp = GetComponent <LuaComponent>();
            }
            if (LuaCp == null)
            {
                Log.E("Not find LuaComponet");
                return;
            }

            if (LuaCp.Initilize(LuaPath))
            {
                CallLuaFunction(LuaMain.FuncName.Awake);
            }
        }