コード例 #1
0
ファイル: OptionWindow.cs プロジェクト: jaenudin86/RemoteTech
        /// <summary>
        /// Draws the content of the Presets section
        /// </summary>
        private void drawPresetsContent()
        {
            GUILayout.Label("A third-party mod can replace your current RemoteTech settings with its own settings (GameData/ExampleMod/RemoteTechSettings.cfg).\nAlso, you can revert to RemoteTech's default settings.\nHere you can see what presets are available:", this.mGuiRunningText);
            GUILayout.Space(15);

            List <String> presetList = this.mSettings.PreSets;

            if (this.mSettings.PreSets.Count <= 0)
            {
                GUILayout.Label("No presets are found", this.mGuiRunningText);
            }

            for (int i = presetList.Count - 1; i >= 0; --i)
            {
                GUILayout.BeginHorizontal("box", GUILayout.MaxHeight(15));
                {
                    string folderName = presetList[i];
                    int    index      = folderName.LastIndexOf("/RemoteTechSettings");
                    folderName = folderName.Substring(0, index) + folderName.Substring(index).Replace("/RemoteTechSettings", ".cfg").Trim();

                    GUILayout.Space(15);
                    GUILayout.Label("- " + folderName, this.mGuiListText, GUILayout.ExpandWidth(true));
                    if (GUILayout.Button("Overwrite", this.mGuiListButton, GUILayout.Width(70), GUILayout.Height(20)))
                    {
                        RTSettings.ReloadSettings(this.mSettings, presetList[i]);
                        ScreenMessages.PostScreenMessage(string.Format("Your RemoteTech settings are set to {0}", folderName), 15);
                        RTLog.Notify("Overwrote current settings with this cfg {0}", RTLogLevel.LVL3, presetList[i]);
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
コード例 #2
0
        /// <summary>
        /// Draws the content of the Presets section
        /// </summary>
        private void drawPresetsContent()
        {
            GUILayout.Label(Localizer.Format("#RT_OptionWindow_Presets_HelpText"), this.mGuiRunningText);//"You can revert your current settings to the starting settings, constructed from installed mods' MM patches. Also, you can reload your current settings with a third-party mod's own RemoteTech settings (the fallback in the event of no MM patch).\n\nHere you can see what presets are available:"
            GUILayout.Space(15);

            List <String> presetList = this.mSettings.PreSets;

            if (this.mSettings.PreSets.Count <= 0)
            {
                GUILayout.Label(Localizer.Format("#RT_OptionWindow_Presets_NotFound"), this.mGuiRunningText);//"No presets are found"
            }

            for (int i = presetList.Count - 1; i >= 0; --i)
            {
                GUILayout.BeginHorizontal("box", GUILayout.MaxHeight(15));
                {
                    string folderName = presetList[i];

                    //remove the node name
                    int index = folderName.LastIndexOf("/RemoteTechSettings");
                    folderName = folderName.Substring(0, index) + folderName.Substring(index).Replace("/RemoteTechSettings", "").Trim();

                    //change default name to better name for MM-patched settings
                    index = folderName.LastIndexOf("/Default_Settings");
                    if (index >= 0)
                    {
                        folderName = folderName.Substring(0, index) + " " + folderName.Substring(index).Replace("/Default_Settings", "starting settings");
                    }

                    GUILayout.Space(15);
                    GUILayout.Label(folderName, this.mGuiListText, GUILayout.ExpandWidth(true));
                    if (GUILayout.Button(Localizer.Format("#RT_OptionWindow_Presets_Reload"), this.mGuiListButton, GUILayout.Width(70), GUILayout.Height(20)))//"Reload"
                    {
                        RTSettings.ReloadSettings(this.mSettings, presetList[i]);
                        ScreenMessages.PostScreenMessage(Localizer.Format("#RT_OptionWindow_Presets_msg1", folderName), 10);//string.Format("Your RemoteTech settings are set to {0}", )
                        RTLog.Notify("Overwrote current settings with this cfg {0}", RTLogLevel.LVL3, presetList[i]);
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
コード例 #3
0
ファイル: OptionWindow.cs プロジェクト: deimos790/RemoteTech
        /// <summary>
        /// Draws the content of the Presets section
        /// </summary>
        private void drawPresetsContent()
        {
            GUILayout.Label("Other mods can deliver their own RemoteTech_Settings.cfg and override config values. Here you can see what presets we've loaded:", this.mGuiRunningText);
            GUILayout.Space(15);

            List <String> presetList = this.mSettings.PreSets;

            if (this.mSettings.PreSets.Count <= 0)
            {
                GUILayout.Label("- no presets found", this.mGuiRunningText);
            }

            for (int i = presetList.Count - 1; i >= 0; i--)
            {
                String FolderName = presetList[i].Replace("/RemoteTechSettings", ".cfg").Trim();
                GUILayout.BeginHorizontal("box", GUILayout.MaxHeight(15));
                {
                    GUILayout.Space(15);
                    GUILayout.Label("- " + FolderName, this.mGuiListText, GUILayout.ExpandWidth(true));
                    if (GUILayout.Button("Reload", this.mGuiListButton, GUILayout.Width(50), GUILayout.Height(20)))
                    {
                        RTLog.Notify("Reload cfg {0}", RTLogLevel.LVL3, presetList[i]);
                        this.mSettings.PreSets.RemoveAt(i);
                        RTSettings.ReloadSettings();
                    }
                }
                GUILayout.EndHorizontal();
            }

            // Reload all button
            if (presetList.Count >= 2)
            {
                if (GUILayout.Button("Reload All", this.mGuiListButton))
                {
                    this.mSettings.PreSets.Clear();
                    RTSettings.ReloadSettings();
                }
            }
        }