Inheritance: UnityEngine.MonoBehaviour
Exemplo n.º 1
0
        internal static void MakeSettings_General(ExtUITabstrip tabStrip)
        {
            UIHelper panelHelper = tabStrip.AddTabPage(T("Tab:General"));

            UIHelperBase generalGroup = panelHelper.AddGroup(T("Tab:General"));

            string[] languageLabels = new string[Translation.AvailableLanguageCodes.Count + 1];
            languageLabels[0] = T("General.Dropdown.Option:Game language");

            for (int i = 0; i < Translation.AvailableLanguageCodes.Count; ++i)
            {
                languageLabels[i + 1] = Translation.Options.Get(
                    lang: Translation.AvailableLanguageCodes[i],
                    key: "General.Dropdown.Option:Language Name");
            }

            int    languageIndex = 0;
            string curLangCode   = GlobalConfig.Instance.LanguageCode;

            if (curLangCode != null)
            {
                languageIndex = Translation.AvailableLanguageCodes.IndexOf(curLangCode);
                if (languageIndex < 0)
                {
                    languageIndex = 0;
                }
                else
                {
                    ++languageIndex;
                }
            }

            _languageDropdown = generalGroup.AddDropdown(
                text: T("General.Dropdown:Select language") + ":",
                options: languageLabels,
                defaultSelection: languageIndex,
                eventCallback: OnLanguageChanged) as UIDropDown;
            _lockButtonToggle = generalGroup.AddCheckbox(
                text: T("General.Checkbox:Lock main menu button position"),
                defaultValue: GlobalConfig.Instance.Main.MainMenuButtonPosLocked,
                eventCallback: OnLockButtonChanged) as UICheckBox;
            _lockMenuToggle = generalGroup.AddCheckbox(
                text: T("General.Checkbox:Lock main menu window position"),
                defaultValue: GlobalConfig.Instance.Main.MainMenuPosLocked,
                eventCallback: OnLockMenuChanged) as UICheckBox;

            _guiScaleSlider = generalGroup.AddSlider(
                text: T("General.Slider:GUI scale") + ":",
                min: 50,
                max: 200,
                step: 5,
                defaultValue: GlobalConfig.Instance.Main.GuiScale,
                eventCallback: OnGuiScaleChanged) as UISlider;
            _guiScaleSlider.parent.Find <UILabel>("Label").width = 500;

            _guiOpacitySlider = generalGroup.AddSlider(
                text: T("General.Slider:Window transparency") + ":",
                min: 0,
                max: 100,
                step: 5,
                defaultValue: GlobalConfig.Instance.Main.GuiOpacity,
                eventCallback: OnGuiOpacityChanged) as UISlider;
            _guiOpacitySlider.parent.Find <UILabel>("Label").width = 500;

            _overlayTransparencySlider = generalGroup.AddSlider(
                text: T("General.Slider:Overlay transparency") + ":",
                min: 0,
                max: 100,
                step: 5,
                defaultValue: GlobalConfig.Instance.Main.OverlayTransparency,
                eventCallback: OnOverlayTransparencyChanged) as UISlider;
            _overlayTransparencySlider.parent.Find <UILabel>("Label").width = 500;
            _enableTutorialToggle = generalGroup.AddCheckbox(
                T("General.Checkbox:Enable tutorials"),
                GlobalConfig.Instance.Main.EnableTutorial,
                OnEnableTutorialsChanged) as UICheckBox;
            _showCompatibilityCheckErrorToggle
                = generalGroup.AddCheckbox(
                      T("General.Checkbox:Notify me about TM:PE startup conflicts"),
                      GlobalConfig.Instance.Main.ShowCompatibilityCheckErrorMessage,
                      OnShowCompatibilityCheckErrorChanged) as UICheckBox;
            _scanForKnownIncompatibleModsToggle
                = generalGroup.AddCheckbox(
                      Translation.ModConflicts.Get("Checkbox:Scan for known incompatible mods on startup"),
                      GlobalConfig.Instance.Main.ScanForKnownIncompatibleModsAtStartup,
                      OnScanForKnownIncompatibleModsChanged) as UICheckBox;
            _ignoreDisabledModsToggle = generalGroup.AddCheckbox(
                text: Translation.ModConflicts.Get("Checkbox:Ignore disabled mods"),
                defaultValue: GlobalConfig.Instance.Main.IgnoreDisabledMods,
                eventCallback: OnIgnoreDisabledModsChanged) as UICheckBox;
            Options.Indent(_ignoreDisabledModsToggle);

            // General: Speed Limits
            SetupSpeedLimitsPanel(generalGroup);

            // General: Simulation
            UIHelperBase simGroup = panelHelper.AddGroup(T("General.Group:Simulation"));

            _simulationAccuracyDropdown = simGroup.AddDropdown(
                text: T("General.Dropdown:Simulation accuracy") + ":",
                options: new[] {
                T("General.Dropdown.Option:Very low"),
                T("General.Dropdown.Option:Low"),
                T("General.Dropdown.Option:Medium"),
                T("General.Dropdown.Option:High"),
                T("General.Dropdown.Option:Very high"),
            },
                defaultSelection: (int)Options.simulationAccuracy,
                eventCallback: OnSimulationAccuracyChanged) as UIDropDown;

            _instantEffectsToggle = simGroup.AddCheckbox(
                text: T("General.Checkbox:Apply AI changes right away"),
                defaultValue: Options.instantEffects,
                eventCallback: OnInstantEffectsChanged) as UICheckBox;
        }