コード例 #1
0
 protected override void OnPrefabInit()
 {
     ModScreen.Instance = this;
     base.OnPrefabInit();
     this.saveButtonPool = new UIPool <KButton>(this.saveButtonPrefab);
     if (SpeedControlScreen.Instance != null)
     {
         SpeedControlScreen.Instance.Pause(false);
     }
     if (this.onClick == null)
     {
         this.onClick = new Action <string>(this.SetSelectedGame);
     }
     if (this.closeButton != null)
     {
         this.closeButton.onClick += delegate
         {
             base.Show(false);
         };
     }
     if (this.loadButton != null)
     {
         this.loadButton.onClick += new System.Action(this.Load);
     }
     if (this.deleteButton != null)
     {
         this.deleteButton.onClick += new System.Action(this.Delete);
     }
     if (this.moreInfoButton != null)
     {
         this.moreInfoButton.onClick += new System.Action(this.MoreInfo);
     }
 }
コード例 #2
0
        // MainMenu
        private void ModOptions()
        {
            if (ModScreen.Instance == null)
            {
                GameObject gameObject = Util.KInstantiateUI(ModScreen.Instance?.gameObject, this.menu.gameObject, true);
                ModScreen  component  = gameObject.GetComponent <ModScreen>();
                component.requireConfirmation = false;
                component.SetBackgroundActive(true);
            }

            ModScreen.Instance?.gameObject.SetActive(true);
        }
コード例 #3
0
    private void DoLoad()
    {
        ReportErrorDialog.MOST_RECENT_SAVEFILE = this.selectedFileName;
        bool flag = true;

        SaveGame.Header   header;
        SaveGame.GameInfo gameInfo = SaveLoader.LoadHeader(this.selectedFileName, out header);
        string            arg      = null;
        string            arg2     = null;

        if (header.buildVersion > 260525u)
        {
            arg  = header.buildVersion.ToString();
            arg2 = 260525u.ToString();
        }
        else if (gameInfo.saveMajorVersion < 7)
        {
            arg  = string.Format("v{0}.{1}", gameInfo.saveMajorVersion, gameInfo.saveMinorVersion);
            arg2 = string.Format("v{0}.{1}", 7, 3);
        }
        if (!flag)
        {
            GameObject          parent    = (!(FrontEndManager.Instance == null)) ? FrontEndManager.Instance.gameObject : GameScreenManager.Instance.ssOverlayCanvas;
            ConfirmDialogScreen component = Util.KInstantiateUI(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, parent, true).GetComponent <ConfirmDialogScreen>();
            component.PopupConfirmDialog(string.Format(UI.CRASHSCREEN.LOADFAILED, "Version Mismatch", arg, arg2), null, null, null, null, null, null, null);
        }
        else
        {
            if (Game.Instance != null)
            {
                ModScreen.ForceStopGame();
            }
            SaveLoader.SetActiveSaveFilePath(this.selectedFileName);
            Time.timeScale = 0f;
            App.LoadScene("backend");
            this.Deactivate();
        }
    }
コード例 #4
0
 private void SetSelectedGame(string filename)
 {
     if (string.IsNullOrEmpty(filename) || !File.Exists(filename))
     {
         global::Debug.LogError("The filename provided is not valid.", null);
     }
     else
     {
         KButton kButton = (this.selectedFileName == null) ? null : this.fileButtonMap[this.selectedFileName];
         if (kButton != null)
         {
             kButton.GetComponent <ImageToggleState>().SetState(ImageToggleState.State.Inactive);
         }
         this.selectedFileName = filename;
         kButton = this.fileButtonMap[this.selectedFileName];
         kButton.GetComponent <ImageToggleState>().SetState(ImageToggleState.State.Active);
         this.moreInfoButton.gameObject.SetActive(false);
         try
         {
             SaveGame.Header   header;
             SaveGame.GameInfo gameInfo = SaveLoader.LoadHeader(filename, out header);
             string            format   = UI.FRONTEND.LOADSCREEN.SAVEDETAILS;
             string            text     = string.Format("{0:H:mm:ss}\n" + Localization.GetFileDateFormat(0), File.GetLastWriteTime(filename));
             string            text2    = Path.GetFileName(filename);
             if (gameInfo.isAutoSave)
             {
                 text2 += UI.FRONTEND.LOADSCREEN.AUTOSAVEWARNING;
             }
             string text3 = string.Format(format, new object[]
             {
                 text2,
                 text,
                 gameInfo.baseName,
                 gameInfo.numberOfDuplicants.ToString(),
                 gameInfo.numberOfCycles.ToString()
             });
             this.saveDetails.text = text3;
             if (ModScreen.IsSaveFileFromUnsupportedFutureBuild(header))
             {
                 this.saveDetails.text          = string.Format(UI.FRONTEND.LOADSCREEN.SAVE_TOO_NEW, filename, header.buildVersion, 260525u);
                 this.loadButton.isInteractable = false;
                 this.loadButton.GetComponent <ImageToggleState>().SetState(ImageToggleState.State.Disabled);
             }
             else if (gameInfo.saveMajorVersion < 7)
             {
                 this.saveDetails.text = string.Format(UI.FRONTEND.LOADSCREEN.UNSUPPORTED_SAVE_VERSION, new object[]
                 {
                     filename,
                     gameInfo.saveMajorVersion,
                     gameInfo.saveMinorVersion,
                     7,
                     3
                 });
                 this.loadButton.isInteractable = false;
                 this.loadButton.GetComponent <ImageToggleState>().SetState(ImageToggleState.State.Disabled);
             }
             else if (!this.loadButton.isInteractable)
             {
                 this.loadButton.isInteractable = true;
                 this.loadButton.GetComponent <ImageToggleState>().SetState(ImageToggleState.State.Inactive);
             }
         }
         catch (Exception obj)
         {
             global::Debug.LogWarning(obj, null);
             this.saveDetails.text = string.Format(UI.FRONTEND.LOADSCREEN.CORRUPTEDSAVE, filename);
             if (this.loadButton.isInteractable)
             {
                 this.loadButton.isInteractable = false;
                 this.loadButton.GetComponent <ImageToggleState>().SetState(ImageToggleState.State.Disabled);
             }
         }
     }
 }