static public int load_s(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (matchType(l, argc, 1, typeof(List <System.String>), typeof(System.Action <XLoadDesc>))) { System.Collections.Generic.List <System.String> a1; checkType(l, 1, out a1); System.Action <XLoadDesc> a2; LuaDelegation.checkDelegate(l, 2, out a2); var ret = XLoad.load(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 1, typeof(List <XLoadRes>), typeof(System.Action <XLoadDesc>))) { System.Collections.Generic.List <XLoadRes> a1; checkType(l, 1, out a1); System.Action <XLoadDesc> a2; LuaDelegation.checkDelegate(l, 2, out a2); var ret = XLoad.load(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (matchType(l, argc, 1, typeof(string), typeof(System.Action <XLoadDesc>))) { System.String a1; checkType(l, 1, out a1); System.Action <XLoadDesc> a2; LuaDelegation.checkDelegate(l, 2, out a2); var ret = XLoad.load(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { System.String a1; checkType(l, 1, out a1); System.Type a2; checkType(l, 2, out a2); System.Action <XLoadDesc> a3; LuaDelegation.checkDelegate(l, 3, out a3); var ret = XLoad.load(a1, a2, a3); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function load to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
// XApp 启动 IEnumerator init() { XDebug.Log("init:" + Time.realtimeSinceStartup); // 先启动装载服务器 yield return(StartCoroutine(XLoad.instance.init())); if (!XLoad.instance.isOK) { // 弹对话框 XDebug.LogError("致命错误XLoad没有装载成功"); } else { // 先加载进度条 XLoadDesc desc = XLoad.load("Assets/Res/progress/style1.prefab"); yield return(desc); if (desc.ob == null) { XDebug.LogError("Assets/Res/progress/style1.prefab not exist, quit!!!"); yield break; } XDebug.Log("onLoadProgress:" + Time.realtimeSinceStartup); xloading = this.gameObject.AddComponent <XLoading>(); xpool = this.gameObject.AddComponent <XPoolManager>(); GameObject loadingStyle0 = GameObject.Instantiate(desc.ob, uiProgress) as GameObject; xloading.addStyle(0, loadingStyle0, loadingStyle0.transform.Find("Slider").GetComponent <UnityEngine.UI.Slider>(), null, loadingStyle0.transform.Find("Info").GetComponent <UnityEngine.UI.Text>(), null); // 切换进度条 XLoading.instance.beginShow(0); bool wantUpdateVersion = XConf.isUpdateVersion; // 是否更新 if (!XLoad.instance.isLoadFromAB) { // editor状态下并不更新版本 wantUpdateVersion = false; } if (wantUpdateVersion) { // 创建更新对象 XUpdate xup = new XUpdate(); // 开启更新协程 yield return(StartCoroutine(xup.updateVersion(XConf.publishUrl))); if (xup.isFail) { // 失败了MSGBOX,重新更新,下载链接?都是从头走,清除已装载的东西 yield break; } else { // 成功了,那么走正式流程,再次来一发 // 清理操作------- // StartCoroutine(init()); // yield break; } } XLoadDesc descBack = XLoad.load("Assets/Res/ui/uiBack.prefab"); XLoading.instance.beginShow(0, descBack); yield return(descBack); if (descBack.ob != null) { GameObject.Instantiate(descBack.ob, this.uiBack); } #region 装载lua // 开始装载lua文件 XLoadDesc descLua = loadLua(); XLoading.instance.beginShow(0, descLua); yield return(descLua); var luaAsInfo = descLua.assetInfo; if (luaAsInfo.isSuccess) { luaDict = descLua.obDict; } // 装载lua函数 LuaState.loaderDelegate += loadLuaFile; // 创建一个luaSvr luaSvr = new LuaSvr(); luaSvr.init(); XLuaBind luaBind = new XLuaBind { luaSvr = luaSvr }; XLoading.instance.beginShow(0, luaBind); // 全局装载函数 // 绑定的时间 yield return(luaBind); // 绑定完成后从Main开始执行 luaSvr.onBindComplete(() => { // 初始化调试器 ldb = new DebugInterface(luaSvr.luaState); ldb.init(); XDebug.Log("luaBindComplete start Main" + Time.realtimeSinceStartup); luaSvr.start(XConf.luastart); XDebug.Log("luaBindComplete end Main" + Time.realtimeSinceStartup); }); #endregion } }