public void Reset() { _GameLuaIsLoaded = false; if (luaState != null) { luaState.Dispose(); } if (loop != null) { Destroy(loop); loop = null; } if (loader != null) { loader.Dispose(); loader = null; } // if(manager) // { // Destroy(manager); // manager = null; // } Initialize(); StartLooper(); StartManager(); }
void Initialize() { luaState = new LuaState(); loader = new LuaResLoader(); #if UNITY_EDITOR luaState.AddSearchPath(LuaConst.luaDir); #endif #if AB_MODE luaState.AddSearchPath(AssetBundleUtility.LocalAssetBundlePath); luaState.AddSearchPath(AssetBundleUtility.GetStreamingPath()); #endif luaState.OpenLibs(LuaDLL.luaopen_pb); //if (LuaConst.openLuaSocket) //{ // OpenLuaSocket(); //} //if (LuaConst.openZbsDebugger) //{ // OpenZbsDebugger(); //} luaState.LuaSetTop(0); LuaBinder.Bind(luaState); luaState.Start(); LuaCoroutine.Register(luaState, this); }
// 更新检查完成 void OnDownloadFinish() { UpdateManager.Instance.UpdateVersion(); AssetBundleManager.InitDependenceInfo(); ResourceManager.Instance.Init(); LanguageManager.GetInstance().Init(); CfgManager.GetInstance().Init(); // 初始化lua engine LuaFileUtils loader = new LuaResLoader(); loader.beZip = GameConfig.EnableUpdate; // 是否读取assetbundle lua文件 Dictionary <string, string> localfiles = UpdateManager.Instance.LocalFiles; foreach (string file in localfiles.Keys) { if (file.Substring(0, 3) == "lua") { AssetBundle assetBundle = AssetBundleManager.GetAssetBundle(file); string name = Path.GetFileNameWithoutExtension(file); LuaFileUtils.Instance.AddSearchBundle(name, assetBundle); } } // LuaManager luaManager = LuaManager.Instance; luaManager.InitStart(); luaManager.DoFile("Game"); Util.CallMethod("Game", "OnInitOK"); }
// Use this for initialization public void Init() { m_luaResLoader = new LuaResLoader(); m_luaState = new LuaState(); InitLuaPath(); m_luaState.Start(); LuaBinder.Bind(m_luaState); }
public void Restart() { //#if !UNITY_EDITOR // instance = this; //#else instance = new LuaResLoader(); //this; //#endif }
void Awake() { //#if UNITY_EDITOR // instance = this; //#else instance = new LuaResLoader(); //this; //#endif }
public override void Dispose() { if (instance != null) { instance = null; base.Dispose(); } }
protected void Init() { luaLoader = new LuaResLoader(); luaState = new LuaState(luaLoader.ReadFile); OpenLibs(); luaState.LuaSetTop(0); Bind(); LoadLuaFiles(); }
public override void OnInit() { luaResLoader = new LuaResLoader(); lua = new LuaState(luaResLoader.ReadFile); //this.OpenLibs(); lua.LuaSetTop(0); LuaBinder.Bind(lua); luaResLoader.LoadluaChunks(); this.lua.Start(); //启动LUAVM DelegateFactory.Init(); this.StartMain(); }
public override void OnDestroy() { _GameLuaIsLoaded = false; if (luaState != null) { luaState.Dispose(); } if (loop != null) { Destroy(loop); loop = null; } if (loader != null) { loader.Dispose(); loader = null; } }
private MsgHandler() { LuaResLoader loader = new LuaResLoader(); string luaPersistentPath = AppConst.PERSISTENT_PATH + "/lua"; string[] luaList = Directory.GetFiles(luaPersistentPath); for (int i = 0; i < luaList.Length; ++i) { if (luaList[i].EndsWith(AppConst.AB_EXT_NAME)) { AssetBundle luaAB = AssetBundle.LoadFromFile(luaList[i]); if (null != luaAB) { loader.AddSearchBundle(Path.GetFileNameWithoutExtension(luaList[i]), luaAB); Debug.Log("lua res loader add search bundle ok:" + Path.GetFileNameWithoutExtension(luaList[i])); } else { Debug.LogError("Load lua AB file error:" + luaList[i]); } } } }
protected override LuaFileUtils InitLoader() { LuaResLoader ret = new LuaResLoader(); return(ret); }