Esempio n. 1
0
 public void SetLuaLoadSucc(string strFile)
 {
     try
     {
         Logger.d("读取成功:" + strFile);
         for (int i = 0; i < this.aryRes.Count; i++)
         {
             CRes res  = this.aryRes[i] as CRes;
             bool flag = true;
             for (int j = 0; j < res.aryFileState.Count; j++)
             {
                 CFileState state = res.aryFileState[j] as CFileState;
                 if (state.strFileName.Equals(strFile))
                 {
                     state.iLuaState = this.iLuaWaitInit;
                 }
                 else if (state.isLua && (state.iLuaState != this.iLuaWaitInit))
                 {
                     flag = false;
                 }
             }
             if (flag)
             {
                 res.iLuaState = this.iLuaWaitInit;
             }
         }
     }
     catch (Exception exception)
     {
         Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString());
     }
 }
Esempio n. 2
0
 public void RefreshDownStatus(string strSuccFile)
 {
     try
     {
         Logger.d("刷新下载状态:" + strSuccFile);
         for (int i = 0; i < this.aryRes.Count; i++)
         {
             CRes res  = this.aryRes[i] as CRes;
             bool flag = true;
             for (int j = 0; j < res.aryFileState.Count; j++)
             {
                 CFileState state = res.aryFileState[j] as CFileState;
                 if (state.strFileName.Equals(strSuccFile))
                 {
                     state.iDownState = this.iSTATE_LOCAL;
                 }
                 else if (!this.CheckIsDown(state.iDownState))
                 {
                     flag = false;
                 }
                 if ((this.CheckIsDown(state.iDownState) && this.isLuaFile(state.strFileName)) && !this.dicLoaded.ContainsKey(state.strFileName))
                 {
                     this.dicLoaded.Add(state.strFileName, true);
                     NotificationCenter.DefaultCenter().PostNotification(null, "OnUILuaLoaded", this.GetLuaName(state.strFileName));
                 }
             }
             if (flag)
             {
                 res.iLoadState = this.iSTATE_LOCAL;
             }
             Logger.d("--Res:" + res.strResName + ",status:" + res.iLoadState.ToString());
         }
         this.Dump();
         this.SetLuaLoadSucc(string.Empty);
     }
     catch (Exception exception)
     {
         Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString());
     }
 }
Esempio n. 3
0
 public void RefreshLuaLoadStatus()
 {
     try
     {
         if (this.isNeedLoadLua && this.blIsInitFinish)
         {
             for (int i = 0; i < this.aryRes.Count; i++)
             {
                 CRes res = this.aryRes[i] as CRes;
                 if (((res.iLuaState != this.iLuaInited) && this.CheckIsDown(res.iLoadState)) && ((res.iLuaState != this.iLuaIniting) && this.CheckIsDown(res.iLoadState)))
                 {
                     bool flag  = false;
                     bool flag2 = true;
                     for (int k = 0; k < res.aryFileState.Count; k++)
                     {
                         CFileState state       = res.aryFileState[k] as CFileState;
                         string     strFileName = state.strFileName;
                         if (state.isLua)
                         {
                             flag = true;
                             if (this.isLuaFile(strFileName) && (!this.CheckIsDown(state.iDownState) || (state.iLuaState == -1)))
                             {
                                 flag2 = false;
                             }
                         }
                     }
                     if (!flag)
                     {
                         Logger.d("res:" + res.strResName + " no lua");
                         res.iLuaState = this.iLuaInited;
                     }
                     if (flag2)
                     {
                         res.iLuaState = this.iLuaWaitInit;
                     }
                     if (res.iLuaState == this.iLuaWaitInit)
                     {
                         res.iLuaState = this.iLuaIniting;
                         for (int m = 0; m < res.aryFileState.Count; m++)
                         {
                             CFileState state2 = res.aryFileState[m] as CFileState;
                             string     key    = state2.strFileName;
                             if (state2.isLua && !this.dicInitLua.ContainsKey(key))
                             {
                                 this.dicInitLua.Add(key, true);
                                 Logger.d("开始加载-》" + key);
                                 string luaName = this.GetLuaName(key);
                                 LuaHelper.GetResManager().LuaInitToVm(luaName);
                             }
                         }
                         res.iLuaState = this.iLuaInited;
                     }
                 }
             }
             bool flag3 = true;
             for (int j = 0; j < this.aryRes.Count; j++)
             {
                 CRes res2 = this.aryRes[j] as CRes;
                 if (res2.iLuaState != this.iLuaInited)
                 {
                     flag3 = false;
                     break;
                 }
             }
             if (flag3)
             {
                 Logger.d("init lua finish");
                 this.isNeedLoadLua = false;
             }
         }
     }
     catch (Exception exception)
     {
         Logger.LogNetError(Configer.iCodeCSException, exception.Message + exception.StackTrace.ToString());
     }
 }