Example #1
0
 public void OnFinish()
 {
     TsAudio.RefreshAllAudioVolumes();
     if (SystemInfo.processorCount == 1)
     {
         TsAudio.SetDisableDownloadAudio(EAudioType.AMBIENT, true);
         TsAudio.SetDisableDownloadAudio(EAudioType.ENVIRONMENT, true);
     }
     FacadeHandler.EndNPATCHDownLoad(false);
 }
Example #2
0
 protected override void OnUpdateAfterStagePrework()
 {
     if (NPatchLauncherBehaviour.Instance.IsFinish)
     {
         if (NPatchLauncherBehaviour.Instance.ErrorString == string.Empty)
         {
             if ((int)Launcher.Instance._status.totalSize > 0)
             {
                 FacadeHandler.EndNPATCHDownLoad(true);
                 if (!this.bPatchEnd)
                 {
                     if (!Launcher.Instance.IsFullPatchLevel)
                     {
                         NrTSingleton <MATEventManager> .Instance.MeasureEvent("Content DL end");
                     }
                     else
                     {
                         NrTSingleton <MATEventManager> .Instance.MeasureEvent("Add Content DL end");
                     }
                 }
                 this.bPatchEnd = true;
             }
             else
             {
                 FacadeHandler.EndNPATCHDownLoad(false);
             }
         }
         else
         {
             new MB_PatchError
             {
                 OK = NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("40")
             }.Show(NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("41"), NrTSingleton <NrTextMgr> .Instance.GetTextFromPreloadText("2"), MessageBox.Type.OK);
         }
         return;
     }
     if (this.PreDownloadDlg != null)
     {
         float num = 0f;
         this.PreDownloadDlg.SetTotalProgress(0f, 0f, string.Empty);
         long   num2       = Launcher.Instance._status.totalSize;
         long   num3       = Launcher.Instance._status.totalProcessedSize;
         string taskStatus = Launcher.Instance._status.taskStatus;
         if (num2 == 0L || num3 == 0L)
         {
         }
         num3 = Launcher.Instance._status.taskProcessedSize;
         num2 = Launcher.Instance._status.taskSize;
         float num4 = (float)num3 / (float)num2;
         if (Launcher.Instance._status.fullPackCount * 2 > Launcher.Instance._status.totalTaskProcessedCount)
         {
             int   fullPackCount = Launcher.Instance._status.fullPackCount;
             float num5          = 1f / (float)fullPackCount;
             if (Launcher.Instance._status.taskType == TASKTYPE.DOWNLOAD)
             {
                 num3 = (long)Launcher.Instance._status.totalTaskProcessedCount;
                 num2 = (long)Launcher.Instance._status.fullPackCount;
                 if (Launcher.Instance._status.totalTaskProcessedCount <= 0)
                 {
                     num = num4 * num5 * 0.8f;
                 }
                 else
                 {
                     if (num4 == 1f)
                     {
                         num = ((float)Launcher.Instance._status.totalTaskProcessedCount - 1f) * num5 * 0.8f + num4 * num5 * 0.8f;
                     }
                     else
                     {
                         num = (float)Launcher.Instance._status.totalTaskProcessedCount * num5 * 0.8f + num4 * num5 * 0.8f;
                     }
                     if (num > 0.8f)
                     {
                         num = 0.8f;
                     }
                 }
             }
             else if (Launcher.Instance._status.taskType == TASKTYPE.INSTALL)
             {
                 int num6 = Launcher.Instance._status.totalTaskProcessedCount - Launcher.Instance._status.fullPackCount;
                 num = (float)num6 * num5 * 0.1f + num4 * num5 * 0.1f + 0.8f;
             }
         }
         else
         {
             num2 = (long)(Launcher.Instance._status.totalTaskCount - Launcher.Instance._status.fullPackCount * 2);
             num3 = (long)(Launcher.Instance._status.totalTaskProcessedCount - Launcher.Instance._status.fullPackCount * 2);
             num  = (float)num3 / (float)num2 * 0.1f + 0.9f;
             if (num > 1f)
             {
                 num = 1f;
             }
             if (Time.realtimeSinceStartup - this.fTime > 0.2f)
             {
                 this.fTime = Time.realtimeSinceStartup;
             }
         }
         if (Launcher.Instance.IsRunning)
         {
             this.PreDownloadDlg.SetTotalProgress(num, num4, taskStatus);
         }
         else
         {
             this.PreDownloadDlg.UpdateTotalProgress(num, num4, num2, taskStatus);
         }
     }
 }