public virtual void Start() { this.name = this.name.Replace("(Clone)", ""); if (exporter == null) { string scriptName = name + "View"; object[] obj = Lua.Call(scriptName, param); LuaController = obj[0] as LuaTable; } else { LuaController = exporter.InitLuaController(param); LuaController["gameObject"] = this.gameObject; LuaController["transform"] = transform; } LuaController["this"] = this; UILayer layer = this.GetComponent <UILayer>(); if (layer != null) { LuaController["layer"] = layer; } updateFunc = LuaController["Update"] as LuaFunction; CallLuaMethod("Start", this, gameObject); }
public void InitSubController(IntPtr L) { if (subCtrlList == null || subCtrlList.Count == 0) { return; } int oldTop = LuaDLL.lua_gettop(L); Lua.state.Push(luaController); for (int i = 0; i < subCtrlList.Count; ++i) { LuaDLL.lua_pushstring(L, subCtrlList[i].name); if (subCtrlList[i].next) { UILuaExporter p = subCtrlList[i]; LuaDLL.lua_newtable(L); int n = 1; while (p != null) { p.InitLuaController(L); Lua.state.Push(p.luaController); LuaDLL.lua_rawseti(L, -2, n++); p = p.next; } } else { subCtrlList[i].InitLuaController(L); Lua.state.Push(subCtrlList[i].luaController); } LuaDLL.lua_settable(L, -3); } LuaDLL.lua_settop(L, oldTop); }