void Start() { InputMgr.Instance.initialize(); ManifestMgr.Init(); AtlasMgr.Instance.Init(); #if UNITY_5 || UNITY_2017 || UNITY_2018 Application.logMessageReceived += Log; #else Application.RegisterLogCallback(Log); #endif lua = new LuaState(); lua.Start(); LuaBinder.Bind(lua); lua.OpenLibs(LuaDLL.luaopen_pb); lua.OpenLibs(LuaDLL.luaopen_struct); lua.OpenLibs(LuaDLL.luaopen_lpeg); #if UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX luaState.OpenLibs(LuaDLL.luaopen_bit); #endif DelegateFactory.Register(); string dataPath = Application.dataPath; int index = dataPath.LastIndexOf("/"); dataPath = dataPath.Substring(0, index); //lua.AddSearchPath(fullPath); lua.DoFile(Path.Combine(dataPath, "Client/Scripts/__init.lua")); LogicFrame.Instance.initialize(lua); GameSocket.Instance.run("192.168.1.108", "8007"); }
void Start() { lua = new LuaState(); lua.LuaSetTop(0); LuaCoroutine.Register(lua, this); LuaBinder.Bind(lua); DelegateFactory.Register(); lua.Start(); loop = gameObject.AddComponent <LuaLooper> (); loop.luaState = lua; gameObject.AddComponent <LuaObject> (); }
public void Init() { _loader = new LuaLoader(); _lua = new LuaState(); OpenLibs(); LuaBinder.Bind(_lua); DelegateFactory.Register(); LuaCoroutine.Register(_lua, this); // Lua读取路径 LuaFileUtils.Instance.beZip = AppConst.resourceMode != 0; // 如果是打包模式,读AB,否则读Lua目录 if (LuaFileUtils.Instance.beZip) { _loader.AddBundle("lua_ui"); _loader.AddBundle("lua_logic"); _loader.AddBundle("lua_protobuf"); _loader.AddBundle("lua_protocols"); _loader.AddBundle("lua_tolua"); _loader.AddBundle("lua_fight"); _loader.AddBundle("lua_character"); _loader.AddBundle("lua_utils"); _loader.AddBundle("lua_skill"); _loader.AddBundle("lua_cache"); } else { _lua.AddSearchPath(LuaConst.luaDir); } //启动LuaVM _lua.Start(); // Lua计时 gameObject.AddComponent <LuaLooper>().luaState = _lua; // 添加lua之间的引用关系 DoFile("logic/Main"); }
static DelegateFactory() { DelegateFactory.dict = new Dictionary <Type, DelegateFactory.DelegateValue>(); DelegateFactory.Register(); }