public static void VerifyTranslationModSubscription(GameObject context)
 {
     if (GetSelectedLanguageType() == SelectedLanguageType.UGC && SteamManager.Initialized && !LanguageOptionsScreen.HasInstalledLanguage())
     {
         PublishedFileId_t invalid           = PublishedFileId_t.Invalid;
         PublishedFileId_t publishedFileId_t = new PublishedFileId_t((uint)KPlayerPrefs.GetInt("InstalledLanguage", (int)invalid.m_PublishedFileId));
         Label             label             = default(Label);
         label.distribution_platform = Label.DistributionPlatform.Steam;
         label.id = publishedFileId_t.ToString();
         Label  rhs = label;
         string arg = UI.FRONTEND.TRANSLATIONS_SCREEN.UNKNOWN;
         foreach (Mod mod in Global.Instance.modManager.mods)
         {
             if (mod.label.Match(rhs))
             {
                 arg = mod.title;
                 break;
             }
         }
         ClearLanguage();
         GameObject gameObject = KScreenManager.AddChild(context, ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject);
         KScreen    component  = gameObject.GetComponent <KScreen>();
         component.Activate();
         ConfirmDialogScreen component2          = component.GetComponent <ConfirmDialogScreen>();
         ConfirmDialogScreen confirmDialogScreen = component2;
         string        title_text   = UI.CONFIRMDIALOG.DIALOG_HEADER;
         string        text         = string.Format(UI.FRONTEND.TRANSLATIONS_SCREEN.MISSING_LANGUAGE_PACK, arg);
         string        confirm_text = UI.FRONTEND.TRANSLATIONS_SCREEN.RESTART;
         System.Action on_confirm   = App.instance.Restart;
         confirmDialogScreen.PopupConfirmDialog(text, on_confirm, null, null, null, title_text, confirm_text, null, null, true);
     }
 }
Example #2
0
 public void ConfirmDoAction(string message, System.Action action, Transform parent)
 {
     ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)KScreenManager.Instance.StartScreen(Instance.ConfirmDialogScreen.gameObject, parent.gameObject);
     confirmDialogScreen.PopupConfirmDialog(message, action, delegate
     {
     }, null, null, null, null, null, null, true);
 }
Example #3
0
    private void ConfirmLanguageChoiceDialog(string[] lines, bool is_template, System.Action install_language)
    {
        Localization.Locale         locale             = Localization.GetLocale(lines);
        Dictionary <string, string> translated_strings = Localization.ExtractTranslatedStrings(lines, is_template);
        TMP_FontAsset        font             = Localization.GetFont(locale.FontName);
        ConfirmDialogScreen  screen           = GetConfirmDialog();
        HashSet <MemberInfo> excluded_members = new HashSet <MemberInfo>(typeof(ConfirmDialogScreen).GetMember("cancelButton", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy));

        Localization.SetFont(screen, font, locale.IsRightToLeft, excluded_members);
        Func <LocString, string> func = delegate(LocString loc_string)
        {
            Dictionary <string, string> dictionary = translated_strings;
            StringKey key = loc_string.key;
            string    value;
            return((!dictionary.TryGetValue(key.String, out value)) ? ((string)loc_string) : value);
        };

        screen.PopupConfirmDialog(title_text: func(UI.CONFIRMDIALOG.DIALOG_HEADER), text: func(UI.FRONTEND.TRANSLATIONS_SCREEN.PLEASE_REBOOT), cancel_text: UI.FRONTEND.TRANSLATIONS_SCREEN.CANCEL, on_confirm: delegate
        {
            install_language();
            App.instance.Restart();
        }, on_cancel: delegate
        {
            Localization.SetFont(screen, Localization.FontAsset, Localization.IsRightToLeft, excluded_members);
        }, configurable_text: null, on_configurable_clicked: null, confirm_text: func(UI.FRONTEND.TRANSLATIONS_SCREEN.RESTART), image_sprite: null, activateBlackBackground: true);
    }
        private static void Postfix(MainMenu __instance, KButton ___buttonPrefab, GameObject ___buttonParent)
        {
            KButton kButton = Util.KInstantiateUI <KButton>(___buttonPrefab.gameObject, ___buttonParent, force_active: true);

            kButton.onClick += () => {
                ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)KScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, Global.Instance.globalCanvas);
                var text = new StringBuilder();
                text.AppendLine("Duplicants rescued:");
                var state = EndpointState.Load();
                foreach (var item in from x in state.times_rescued orderby - x.Value, x.Key select x)
                {
                    if (item.Value == 1)
                    {
                        text.AppendLine(item.Key);
                    }
                    else
                    {
                        text.AppendLine(item.Key + " x" + item.Value);
                    }
                }
                confirmDialogScreen.PopupConfirmDialog(text.ToString(), null, null, null, null, "Endpoint Population");
            };
            LocText loctext = kButton.GetComponentInChildren <LocText>();

            loctext.text     = "ENDPOINT";
            loctext.fontSize = 14.0f;
        }
    private void OnBack()
    {
        string text;

        switch (NumUnboundActions())
        {
        case 0:
            Deactivate();
            return;

        case 1:
        {
            BindingEntry firstUnbound = GetFirstUnbound();
            text = string.Format(UI.FRONTEND.INPUT_BINDINGS_SCREEN.UNBOUND_ACTION, firstUnbound.mAction.ToString());
            break;
        }

        default:
            text = UI.FRONTEND.INPUT_BINDINGS_SCREEN.MULTIPLE_UNBOUND_ACTIONS;
            break;
        }
        confirmDialog = Util.KInstantiateUI(confirmPrefab.gameObject, base.transform.gameObject, false).GetComponent <ConfirmDialogScreen>();
        confirmDialog.PopupConfirmDialog(text, delegate
        {
            Deactivate();
        }, delegate
        {
            confirmDialog.Deactivate();
        }, null, null, null, null, null, null, true);
        confirmDialog.gameObject.SetActive(true);
    }
Example #6
0
    private void InstallLanguage(PublishedFileId_t item)
    {
        SetCurrentLanguage(item);
        ConfirmDialogScreen confirmDialog = GetConfirmDialog();

        confirmDialog.PopupConfirmDialog(UI.FRONTEND.TRANSLATIONS_SCREEN.PLEASE_REBOOT, App.instance.Restart, Deactivate, null, null, null, null, null, null, true);
    }
    protected override void OnSpawn()
    {
        Debug.Log("-- MAIN MENU -- ");
        base.OnSpawn();
        Canvas.ForceUpdateCanvases();
        ShowLanguageConfirmation();
        string savePrefix = SaveLoader.GetSavePrefix();

        try
        {
            string path = Path.Combine(savePrefix, "__SPCCHK");
            using (FileStream fileStream = File.OpenWrite(path))
            {
                byte[] array = new byte[1024];
                for (int i = 0; i < 15360; i++)
                {
                    fileStream.Write(array, 0, array.Length);
                }
            }
            File.Delete(path);
        }
        catch (Exception ex)
        {
            string format = (!(ex is IOException)) ? string.Format(UI.FRONTEND.SUPPORTWARNINGS.SAVE_DIRECTORY_READ_ONLY, savePrefix) : string.Format(UI.FRONTEND.SUPPORTWARNINGS.SAVE_DIRECTORY_INSUFFICIENT_SPACE, savePrefix);
            string text   = string.Format(format, savePrefix);
            ConfirmDialogScreen confirmDialogScreen = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.gameObject, true);
            confirmDialogScreen.PopupConfirmDialog(text, null, null, null, null, null, null, null, null, true);
        }
        Global.Instance.modManager.Report(base.gameObject);
        if ((GenericGameSettings.instance.autoResumeGame && !HasAutoresumedOnce) || !string.IsNullOrEmpty(GenericGameSettings.instance.performanceCapture.saveGame))
        {
            HasAutoresumedOnce = true;
            ResumeGame();
        }
    }
    private void ConfirmDecision(string text, System.Action onConfirm)
    {
        base.gameObject.SetActive(value: false);
        ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)GameScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.transform.parent.gameObject);

        confirmDialogScreen.PopupConfirmDialog(text, onConfirm, OnCancelPopup);
    }
Example #9
0
    private void ConfirmDecision(string text, System.Action onConfirm)
    {
        base.gameObject.SetActive(false);
        ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)GameScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.transform.parent.gameObject, GameScreenManager.UIRenderTarget.ScreenSpaceOverlay);

        confirmDialogScreen.PopupConfirmDialog(text, onConfirm, OnCancelPopup, null, null, null, null, null, null, true);
    }
Example #10
0
    public static List <string> GetSaveFiles(string save_dir)
    {
        List <string> list = new List <string>();

        try
        {
            if (!System.IO.Directory.Exists(save_dir))
            {
                System.IO.Directory.CreateDirectory(save_dir);
            }
            string[]             files = System.IO.Directory.GetFiles(save_dir, "*.sav", SearchOption.AllDirectories);
            List <SaveFileEntry> list2 = new List <SaveFileEntry>();
            string[]             array = files;
            foreach (string text in array)
            {
                try
                {
                    System.DateTime lastWriteTime = File.GetLastWriteTime(text);
                    SaveFileEntry   saveFileEntry = default(SaveFileEntry);
                    saveFileEntry.path      = text;
                    saveFileEntry.timeStamp = lastWriteTime;
                    SaveFileEntry item = saveFileEntry;
                    list2.Add(item);
                }
                catch (Exception ex)
                {
                    Debug.LogWarning("Problem reading file: " + text + "\n" + ex.ToString());
                }
            }
            list2.Sort((SaveFileEntry x, SaveFileEntry y) => y.timeStamp.CompareTo(x.timeStamp));
            foreach (SaveFileEntry item2 in list2)
            {
                SaveFileEntry current = item2;
                list.Add(current.path);
            }
            return(list);
        }
        catch (Exception ex2)
        {
            string text2 = null;
            if (ex2 is UnauthorizedAccessException)
            {
                text2 = string.Format(UI.FRONTEND.SUPPORTWARNINGS.SAVE_DIRECTORY_READ_ONLY, save_dir);
            }
            else if (ex2 is IOException)
            {
                text2 = string.Format(UI.FRONTEND.SUPPORTWARNINGS.SAVE_DIRECTORY_INSUFFICIENT_SPACE, save_dir);
            }
            if (text2 == null)
            {
                throw ex2;
            }
            GameObject          parent    = (!((UnityEngine.Object)FrontEndManager.Instance == (UnityEngine.Object)null)) ? FrontEndManager.Instance.gameObject : GameScreenManager.Instance.ssOverlayCanvas;
            ConfirmDialogScreen component = Util.KInstantiateUI(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, parent, true).GetComponent <ConfirmDialogScreen>();
            component.PopupConfirmDialog(text2, null, null, null, null, null, null, null, null, true);
            return(list);
        }
    }
Example #11
0
 private void ConfirmDoAction(string message, System.Action action)
 {
     if (this.confirmScreen == null)
     {
         this.confirmScreen = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.gameObject, false);
         this.confirmScreen.PopupConfirmDialog(message, action, delegate
         {
         }, null, null, null, null, null);
         this.confirmScreen.gameObject.SetActive(true);
     }
 }
Example #12
0
    private void ShowErrorDialog(string msg)
    {
        GameObject          parent = CreateUIRoot();
        ConfirmDialogScreen confirmDialogScreen = Util.KInstantiateUI <ConfirmDialogScreen>(this.confirmDialogScreen.gameObject, parent, true);
        ConfirmDialogScreen obj = confirmDialogScreen;

        System.Action on_confirm   = Quit;
        System.Action on_cancel    = null;
        Sprite        image_sprite = sadDupe;

        obj.PopupConfirmDialog(msg, on_confirm, on_cancel, null, null, null, null, null, image_sprite, true);
    }
    private void OnTutorialReset()
    {
        ConfirmDialogScreen component = ActivateChildScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject).GetComponent <ConfirmDialogScreen>();

        component.PopupConfirmDialog(UI.FRONTEND.OPTIONS_SCREEN.RESET_TUTORIAL_WARNING, delegate
        {
            Tutorial.ResetHiddenTutorialMessages();
        }, delegate
        {
        }, null, null, null, null, null, null, true);
        component.Activate();
    }
Example #14
0
 private void ConfirmDoAction(string message, System.Action action)
 {
     if ((UnityEngine.Object)confirmScreen == (UnityEngine.Object)null)
     {
         confirmScreen = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.gameObject, false);
         confirmScreen.PopupConfirmDialog(message, action, delegate
         {
         }, null, null, null, null, null, null, true);
         confirmScreen.GetComponent <LayoutElement>().ignoreLayout = true;
         confirmScreen.gameObject.SetActive(true);
     }
 }
    private void CheckDoubleBoundKeys()
    {
        string text = string.Empty;
        HashSet <BindingEntry> hashSet = new HashSet <BindingEntry>();

        for (int i = 0; i < GameInputMapping.KeyBindings.Length; i++)
        {
            if (GameInputMapping.KeyBindings[i].mKeyCode != KKeyCode.Mouse1)
            {
                for (int j = 0; j < GameInputMapping.KeyBindings.Length; j++)
                {
                    if (i != j)
                    {
                        BindingEntry bindingEntry = GameInputMapping.KeyBindings[j];
                        if (!hashSet.Contains(bindingEntry))
                        {
                            BindingEntry bindingEntry2 = GameInputMapping.KeyBindings[i];
                            if (bindingEntry2.mKeyCode != 0 && bindingEntry2.mKeyCode == bindingEntry.mKeyCode && bindingEntry2.mModifier == bindingEntry.mModifier && bindingEntry2.mRebindable && bindingEntry.mRebindable)
                            {
                                string mGroup  = GameInputMapping.KeyBindings[i].mGroup;
                                string mGroup2 = GameInputMapping.KeyBindings[j].mGroup;
                                if ((mGroup == "Root" || mGroup2 == "Root" || mGroup == mGroup2) && (!(mGroup == "Root") || !bindingEntry.mIgnoreRootConflics) && (!(mGroup2 == "Root") || !bindingEntry2.mIgnoreRootConflics))
                                {
                                    string text2 = text;
                                    text = text2 + "\n\n" + bindingEntry2.mAction + ": <b>" + bindingEntry2.mKeyCode + "</b>\n" + bindingEntry.mAction + ": <b>" + bindingEntry.mKeyCode + "</b>";
                                    BindingEntry bindingEntry3 = bindingEntry2;
                                    bindingEntry3.mKeyCode          = KKeyCode.None;
                                    bindingEntry3.mModifier         = Modifier.None;
                                    GameInputMapping.KeyBindings[i] = bindingEntry3;
                                    bindingEntry3                   = bindingEntry;
                                    bindingEntry3.mKeyCode          = KKeyCode.None;
                                    bindingEntry3.mModifier         = Modifier.None;
                                    GameInputMapping.KeyBindings[j] = bindingEntry3;
                                }
                            }
                        }
                    }
                }
                hashSet.Add(GameInputMapping.KeyBindings[i]);
            }
        }
        if (text != string.Empty)
        {
            ConfirmDialogScreen confirmDialogScreen  = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.gameObject, true);
            ConfirmDialogScreen confirmDialogScreen2 = confirmDialogScreen;
            string        text2      = string.Format(UI.FRONTEND.SUPPORTWARNINGS.DUPLICATE_KEY_BINDINGS, text);
            System.Action on_confirm = null;
            System.Action on_cancel  = null;
            Sprite        sadDupe    = GlobalResources.Instance().sadDupe;
            confirmDialogScreen2.PopupConfirmDialog(text2, on_confirm, on_cancel, null, null, null, null, null, sadDupe, true);
        }
    }
Example #16
0
    private void Uninstall()
    {
        ConfirmDialogScreen confirmDialog = GetConfirmDialog();

        confirmDialog.PopupConfirmDialog(UI.FRONTEND.TRANSLATIONS_SCREEN.ARE_YOU_SURE, delegate
        {
            Localization.ClearLanguage();
            ConfirmDialogScreen confirmDialog2 = GetConfirmDialog();
            confirmDialog2.PopupConfirmDialog(UI.FRONTEND.TRANSLATIONS_SCREEN.PLEASE_REBOOT, App.instance.Restart, Deactivate, null, null, null, null, null, null, true);
        }, delegate
        {
        }, null, null, null, null, null, null, true);
    }
 private void CheckPlayerPrefsCorruption()
 {
     if (KPlayerPrefs.HasCorruptedFlag())
     {
         KPlayerPrefs.ResetCorruptedFlag();
         ConfirmDialogScreen confirmDialogScreen  = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.gameObject, true);
         ConfirmDialogScreen confirmDialogScreen2 = confirmDialogScreen;
         string        text       = UI.FRONTEND.SUPPORTWARNINGS.PLAYER_PREFS_CORRUPTED;
         System.Action on_confirm = null;
         System.Action on_cancel  = null;
         Sprite        sadDupe    = GlobalResources.Instance().sadDupe;
         confirmDialogScreen2.PopupConfirmDialog(text, on_confirm, on_cancel, null, null, null, null, null, sadDupe, true);
     }
 }
 private void DisplayErrors()
 {
     errorMutex.WaitOne();
     if (errors.Count > 0)
     {
         foreach (ErrorInfo error in errors)
         {
             ErrorInfo           current             = error;
             ConfirmDialogScreen confirmDialogScreen = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, FrontEndManager.Instance.gameObject, true);
             confirmDialogScreen.PopupConfirmDialog(current.errorDesc, OnConfirmExit, null, null, null, null, null, null, null, true);
         }
     }
     errorMutex.ReleaseMutex();
 }
Example #19
0
 public void Sim1000ms(float dt)
 {
     if (AutosaveConfigChecker.SendAutosaveWarning && !hasActivated &&
         ((GameClock.Instance.GetCycle() + 1) % SaveGame.Instance.AutoSaveCycleInterval) == 0 &&
         GameClock.Instance.GetTimeSinceStartOfCycle() >= CalculateSeconds())
     {
         ConfirmDialogScreen dialog = UIUtils.ShowConfirmDialog("Announcer", this.annouceMessage, null, null);
         hasActivated = true;
     }
     else if (AutosaveConfigChecker.SendAutosaveWarning && hasActivated && GameClock.Instance.GetTimeSinceStartOfCycle() <= 1f)
     {
         hasActivated = false;
     }
 }
 private void CheckForAudioDriverIssue()
 {
     if (!KFMOD.didFmodInitializeSuccessfully)
     {
         ConfirmDialogScreen confirmDialogScreen  = Util.KInstantiateUI <ConfirmDialogScreen>(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.gameObject, true);
         ConfirmDialogScreen confirmDialogScreen2 = confirmDialogScreen;
         string        text                    = UI.FRONTEND.SUPPORTWARNINGS.AUDIO_DRIVERS;
         System.Action on_confirm              = null;
         System.Action on_cancel               = null;
         string        configurable_text       = UI.FRONTEND.SUPPORTWARNINGS.AUDIO_DRIVERS_MORE_INFO;
         System.Action on_configurable_clicked = delegate
         {
             Application.OpenURL("http://support.kleientertainment.com/customer/en/portal/articles/2947881-no-audio-when-playing-oxygen-not-included");
         };
         Sprite sadDupeAudio = GlobalResources.Instance().sadDupeAudio;
         confirmDialogScreen2.PopupConfirmDialog(text, on_confirm, on_cancel, configurable_text, on_configurable_clicked, null, null, null, sadDupeAudio, true);
     }
 }
Example #21
0
        public static ConfirmDialogScreen ShowConfirmDialog(string title, string message, System.Action confirm_action, System.Action cancel_action)
        {
            ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)KScreenManager.Instance.StartScreen
                                                          (ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, PauseScreen.Instance.transform.parent.gameObject);

            confirmDialogScreen.PopupConfirmDialog(
                message,
                confirm_action,
                cancel_action,
                message,
                null,
                title,
                UI.FRONTEND.DONE_BUTTON.text,
                null,
                null
                );
            return(confirmDialogScreen);
        }
Example #22
0
    private void ApplyConfirmSettings(Settings new_settings, System.Action on_confirm)
    {
        Settings current_settings = CaptureSettings();

        ApplySettings(new_settings);
        confirmDialog = Util.KInstantiateUI(confirmPrefab.gameObject, base.transform.gameObject, false).GetComponent <ConfirmDialogScreen>();
        System.Action action = delegate
        {
            ApplySettings(current_settings);
        };
        Coroutine timer = StartCoroutine(Timer(15f, action));

        confirmDialog.onDeactivateCB = delegate
        {
            StopCoroutine(timer);
        };
        confirmDialog.PopupConfirmDialog(UI.FRONTEND.GRAPHICS_OPTIONS_SCREEN.ACCEPT_CHANGES.text, on_confirm, action, null, null, null, null, null, null, true);
        confirmDialog.gameObject.SetActive(true);
    }
Example #23
0
    private void OnSave()
    {
        string filename = SaveLoader.GetActiveSaveFilePath();

        if (!string.IsNullOrEmpty(filename) && File.Exists(filename))
        {
            base.gameObject.SetActive(false);
            ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)GameScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.transform.parent.gameObject, GameScreenManager.UIRenderTarget.ScreenSpaceOverlay);
            confirmDialogScreen.PopupConfirmDialog(string.Format(UI.FRONTEND.SAVESCREEN.OVERWRITEMESSAGE, Path.GetFileNameWithoutExtension(filename)), delegate
            {
                DoSave(filename);
                base.gameObject.SetActive(true);
            }, OnCancelPopup, null, null, null, null, null, null, true);
        }
        else
        {
            OnSaveAs();
        }
    }
    private void Bind(KKeyCode kkey_code, Modifier modifier)
    {
        BindingEntry bindingEntry = new BindingEntry(screens[activeScreen], GamepadButton.NumButtons, kkey_code, modifier, actionToRebind, true, ignoreRootConflicts);
        int          num          = 0;

        while (true)
        {
            if (num >= GameInputMapping.KeyBindings.Length)
            {
                return;
            }
            BindingEntry bindingEntry2 = GameInputMapping.KeyBindings[num];
            if (bindingEntry2.mRebindable && bindingEntry2.mAction == actionToRebind)
            {
                break;
            }
            num++;
        }
        BindingEntry duplicatedBinding = GetDuplicatedBinding(screens[activeScreen], bindingEntry);

        GameInputMapping.KeyBindings[num] = bindingEntry;
        LocText componentInChildren = activeButton.GetComponentInChildren <LocText>();

        componentInChildren.text = GetBindingText(bindingEntry);
        if (duplicatedBinding.mAction != 0 && duplicatedBinding.mAction != actionToRebind)
        {
            confirmDialog = Util.KInstantiateUI(confirmPrefab.gameObject, base.transform.gameObject, false).GetComponent <ConfirmDialogScreen>();
            string key         = "STRINGS.INPUT_BINDINGS." + duplicatedBinding.mGroup.ToUpper() + "." + duplicatedBinding.mAction.ToString().ToUpper();
            string arg         = Strings.Get(key);
            string bindingText = GetBindingText(duplicatedBinding);
            string text        = string.Format(UI.FRONTEND.INPUT_BINDINGS_SCREEN.DUPLICATE, arg, bindingText);
            Unbind(duplicatedBinding.mAction);
            confirmDialog.PopupConfirmDialog(text, null, null, null, null, null, null, null, null, true);
            confirmDialog.gameObject.SetActive(true);
        }
        Global.Instance.GetInputManager().RebindControls();
        waitingForKeyPress = false;
        actionToRebind     = Action.NumActions;
        activeButton       = null;
        BuildDisplay();
    }
Example #25
0
 private void DoSave(string filename)
 {
     try
     {
         SaveLoader.Instance.Save(filename, false, true);
         ReportErrorDialog.MOST_RECENT_SAVEFILE = filename;
     }
     catch (IOException ex)
     {
         IOException         e;
         IOException         ex2       = e = ex;
         ConfirmDialogScreen component = Util.KInstantiateUI(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, base.transform.parent.gameObject, true).GetComponent <ConfirmDialogScreen>();
         component.PopupConfirmDialog(string.Format(UI.FRONTEND.SAVESCREEN.IO_ERROR, e.ToString()), delegate
         {
             Deactivate();
         }, null, UI.FRONTEND.SAVESCREEN.REPORT_BUG, delegate
         {
             KCrashReporter.ReportError(e.Message, e.StackTrace.ToString(), null, null, string.Empty);
         }, null, null, null, null, true);
     }
 }
Example #26
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();
        }
    }
Example #27
0
    private static void DoLoad(string filename)
    {
        ReportErrorDialog.MOST_RECENT_SAVEFILE = filename;
        bool flag = true;

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

        if (header.buildVersion > 365655)
        {
            arg  = header.buildVersion.ToString();
            arg2 = 365655.ToString();
        }
        else if (gameInfo.saveMajorVersion < 7)
        {
            arg  = $"v{gameInfo.saveMajorVersion}.{gameInfo.saveMinorVersion}";
            arg2 = $"v{7}.{11}";
        }
        if (!flag)
        {
            GameObject          parent    = (!((UnityEngine.Object)FrontEndManager.Instance == (UnityEngine.Object)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, null, true);
        }
        else
        {
            if ((UnityEngine.Object)Game.Instance != (UnityEngine.Object)null)
            {
                ForceStopGame();
            }
            SaveLoader.SetActiveSaveFilePath(filename);
            Time.timeScale = 0f;
            App.LoadScene("backend");
        }
    }
    private void OnUnlockSandboxMode()
    {
        ConfirmDialogScreen component = ActivateChildScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject).GetComponent <ConfirmDialogScreen>();

        component.PopupConfirmDialog(UI.FRONTEND.OPTIONS_SCREEN.TOGGLE_SANDBOX_SCREEN.UNLOCK_SANDBOX_WARNING, delegate
        {
            SaveGame.Instance.sandboxEnabled = true;
            SetSandboxModeActive(SaveGame.Instance.sandboxEnabled);
            TopLeftControlScreen.Instance.UpdateSandboxToggleState();
            Deactivate();
        }, delegate
        {
            string savePrefixAndCreateFolder = SaveLoader.GetSavePrefixAndCreateFolder();
            string text2 = savePrefixAndCreateFolder;
            savePrefixAndCreateFolder = text2 + "\\" + SaveGame.Instance.BaseName + UI.FRONTEND.OPTIONS_SCREEN.TOGGLE_SANDBOX_SCREEN.BACKUP_SAVE_GAME_APPEND + ".sav";
            SaveLoader.Instance.Save(savePrefixAndCreateFolder, false, false);
            SetSandboxModeActive(SaveGame.Instance.sandboxEnabled);
            TopLeftControlScreen.Instance.UpdateSandboxToggleState();
            Deactivate();
        }, UI.FRONTEND.OPTIONS_SCREEN.TOGGLE_SANDBOX_SCREEN.CANCEL, delegate
        {
        }, cancel_text: UI.FRONTEND.OPTIONS_SCREEN.TOGGLE_SANDBOX_SCREEN.CONFIRM_SAVE_BACKUP, title_text: null, confirm_text: UI.FRONTEND.OPTIONS_SCREEN.TOGGLE_SANDBOX_SCREEN.CONFIRM, image_sprite: null, activateBlackBackground: true);
        component.Activate();
    }
 public static void ReportError(string msg, string stack_trace, string save_file_hash, ConfirmDialogScreen confirm_prefab, string userMessage = "")
 {
     if (!ignoreAll)
     {
         Debug.Log("Reporting error.\n");
         if (msg != null)
         {
             Debug.Log(msg);
         }
         if (stack_trace != null)
         {
             Debug.Log(stack_trace);
         }
         hasReportedError = true;
         if (!KPrivacyPrefs.instance.disableDataCollection)
         {
             string obj2 = default(string);
             using (WebClient webClient = new WebClient())
             {
                 webClient.Encoding = Encoding.UTF8;
                 if (string.IsNullOrEmpty(msg))
                 {
                     msg = "No message";
                 }
                 Match match = failedToLoadModuleRegEx.Match(msg);
                 if (match.Success)
                 {
                     string path     = match.Groups[1].ToString();
                     string text     = match.Groups[2].ToString();
                     string fileName = Path.GetFileName(path);
                     msg = "Failed to load '" + fileName + "' with error '" + text + "'.";
                 }
                 if (string.IsNullOrEmpty(stack_trace))
                 {
                     string arg = "LU-" + 365655.ToString();
                     stack_trace = $"No stack trace {arg}\n\n{msg}";
                 }
                 List <string> list = new List <string>();
                 if (debugWasUsed)
                 {
                     list.Add("(Debug Used)");
                 }
                 if (haveActiveMods)
                 {
                     list.Add("(Mods Active)");
                 }
                 list.Add(msg);
                 string[] array = new string[8]
                 {
                     "Debug:LogError",
                     "UnityEngine.Debug",
                     "Output:LogError",
                     "DebugUtil:Assert",
                     "System.Array",
                     "System.Collections",
                     "KCrashReporter.Assert",
                     "No stack trace."
                 };
                 string[] array2 = stack_trace.Split('\n');
                 foreach (string text2 in array2)
                 {
                     if (list.Count >= 5)
                     {
                         break;
                     }
                     if (!string.IsNullOrEmpty(text2))
                     {
                         bool     flag   = false;
                         string[] array3 = array;
                         foreach (string value in array3)
                         {
                             if (text2.StartsWith(value))
                             {
                                 flag = true;
                                 break;
                             }
                         }
                         if (!flag)
                         {
                             list.Add(text2);
                         }
                     }
                 }
                 if (userMessage == UI.CRASHSCREEN.BODY.text)
                 {
                     userMessage = string.Empty;
                 }
                 Error error = new Error();
                 error.user      = GetUserID();
                 error.callstack = stack_trace;
                 if (disableDeduping)
                 {
                     error.callstack = error.callstack + "\n" + Guid.NewGuid().ToString();
                 }
                 error.fullstack    = $"{msg}\n\n{stack_trace}";
                 error.build        = 365655;
                 error.log          = GetLogContents();
                 error.summaryline  = string.Join("\n", list.ToArray());
                 error.user_message = userMessage;
                 if (!string.IsNullOrEmpty(save_file_hash))
                 {
                     error.save_hash = save_file_hash;
                 }
                 if (DistributionPlatform.Initialized)
                 {
                     error.steam64_verified = DistributionPlatform.Inst.LocalUser.Id.ToInt64();
                 }
                 string data    = JsonConvert.SerializeObject(error);
                 string empty   = string.Empty;
                 Uri    address = new Uri("http://crashes.klei.ca/submitCrash");
                 Debug.Log("Submitting crash:");
                 try
                 {
                     webClient.UploadStringAsync(address, data);
                 }
                 catch (Exception obj)
                 {
                     Debug.Log(obj);
                 }
                 if ((UnityEngine.Object)confirm_prefab != (UnityEngine.Object)null)
                 {
                     ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)KScreenManager.Instance.StartScreen(confirm_prefab.gameObject, null);
                     confirmDialogScreen.PopupConfirmDialog("Reported Error", null, null, null, null, null, null, null, null, true);
                 }
                 obj2 = empty;
             }
             if (KCrashReporter.onCrashReported != null)
             {
                 KCrashReporter.onCrashReported(obj2);
             }
         }
     }
 }
Example #30
0
        public static void Dialog(GameObject parent = null, string title = null, string text = null, string confirm_text = null, System.Action on_confirm = null, string cancel_text = null, System.Action on_cancel = null, string configurable_text = null, System.Action on_configurable_clicked = null, Sprite image_sprite = null, bool activateBlackBackground = true)
        {
            ConfirmDialogScreen confirmDialogScreen = (ConfirmDialogScreen)KScreenManager.Instance.StartScreen(ScreenPrefabs.Instance.ConfirmDialogScreen.gameObject, parent ?? Global.Instance.globalCanvas);

            confirmDialogScreen.PopupConfirmDialog(text, on_confirm, on_cancel, configurable_text, on_configurable_clicked, title, confirm_text, cancel_text, image_sprite, activateBlackBackground);
        }