示例#1
0
        private void DrawStartWindow(int id)
        {
            GUILayout.BeginVertical();

            GUILayout.Box(Locales.currentLocale.Values["misc_lang"], Textures.sectionTitleStyle);
            for (int i = 0; i < Locales.locales.Count; i++)
            {
                if (GUILayout.Button(Locales.locales[i].LocaleFull))
                {
                    Locales.currentLocale = Locales.locales[i];
                    Locales.Save(Locales.locales[i]);
                    Locales.LoadDiscoveryMessages();
                    OnLocaleChanged(Locales.currentLocale);
                }
            }

            difficulty = GUILayout.Toolbar(difficulty, Database.instance.difficultyStrings);

            GUILayout.Label(Database.instance.GetIgnoredBodies((Level)difficulty));

            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("<size=11>" + Locales.currentLocale.Values["start_researchPlanCost"] + "</size>", Locales.currentLocale.Values["start_researchPlanCostTT"]), GUILayout.Width(152));
            ResearchCost = (float)Math.Round(GUILayout.HorizontalSlider(ResearchCost, 10f, 50f, GUILayout.Width(270)));
            GUILayout.Label(Convert.ToInt32(ResearchCost + ProgressResearchCost).ToString(), GUILayout.Width(30));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("<size=11>" + Locales.currentLocale.Values["start_researchProgress"] + "</size>", Locales.currentLocale.Values["start_researchProgressTT"]), GUILayout.Width(152));
            ProgressResearchCost = (float)Math.Round(GUILayout.HorizontalSlider(ProgressResearchCost, 5f, 15f, GUILayout.Width(270)));
            GUILayout.Label(Convert.ToInt32(ProgressResearchCost).ToString(), GUILayout.Width(30));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(new GUIContent("<size=11>" + Locales.currentLocale.Values["start_scienceRewards"] + "</size>", Locales.currentLocale.Values["start_scienceRewardsTT"]), GUILayout.Width(152));
            ScienceReward = (float)Math.Round(GUILayout.HorizontalSlider(ScienceReward, 5f, 60f, GUILayout.Width(270)));
            GUILayout.Label(Convert.ToInt32(ScienceReward).ToString(), GUILayout.Width(30));
            GUILayout.EndHorizontal();

            if (GUILayout.Button("OK"))
            {
                foreach (KeyValuePair <CelestialBody, CelestialBodyInfo> CB in Database.instance.CelestialBodies)
                {
                    CB.Value.ignore = CB.Value.IgnoreData.GetLevel((Level)difficulty);
                    if (CB.Value.ignore)
                    {
                        CB.Value.isResearched  = true;
                        CB.Value.researchState = 100;
                    }
                }
                ResearchBodies.Instance.RBgameSettings.Difficulty    = difficulty;
                ResearchBodies.Instance.RBgameSettings.ResearchCost  = Convert.ToInt32(ResearchCost);
                ResearchBodies.Instance.RBgameSettings.ScienceReward = Convert.ToInt32(ScienceReward);
                SetBodyDiscoveryLevels();
                showStartUI = false;
            }
            GUILayout.EndVertical();
            Utilities.SetTooltipText();
            GUI.DragWindow();
        }
        private void DrawSettings(int id)
        {
            GUIContent closeContent = new GUIContent(Textures.BtnRedCross, "Close Window");
            Rect       closeRect    = new Rect(settingsRect.width - 21, 4, 16, 16);

            if (GUI.Button(closeRect, closeContent, Textures.ClosebtnStyle))
            {
                showSettings = false;
                return;
            }

            GUILayout.BeginVertical();
            langSettingsScroll = GUILayout.BeginScrollView(langSettingsScroll);
            GUILayout.BeginVertical();
            GUILayout.Box(Locales.currentLocale.Values["misc_lang"], Textures.sectionTitleStyle);
            for (int i = 0; i < Locales.locales.Count; i++)
            {
                if (GUILayout.Button(Locales.locales[i].LocaleFull))
                {
                    Locales.currentLocale = Locales.locales[i];
                    Locales.Save(Locales.locales[i]);
                    Locales.LoadDiscoveryMessages();
                    OnLocaleChanged(Locales.currentLocale);
                }
            }

            bool _inputAppL = Database.UseAppLauncher;

            if (!ToolbarManager.ToolbarAvailable)
            {
                GUI.enabled = false;
                tmpToolTip  = Locales.currentLocale.Values["settings_useAppLTT_TBNA"];
            }
            else
            {
                tmpToolTip = Locales.currentLocale.Values["settings_useAppLTT_TBA"];
            }

            GUILayout.BeginHorizontal();
            GUILayout.Box(new GUIContent(Locales.currentLocale.Values["settings_useAppL"], tmpToolTip), Textures.statusStyle, GUILayout.Width(250));
            _inputAppL = GUILayout.Toggle(_inputAppL, "", GUILayout.MinWidth(30.0F)); //you can play with the width of the text box
            GUILayout.EndHorizontal();
            if (Database.UseAppLauncher != _inputAppL)
            {
                Database.UseAppLauncher = _inputAppL;
                RBMenuAppLToolBar.chgAppIconStockToolBar(Database.UseAppLauncher);
            }
            GUI.enabled = true;

            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            /* GUI.Label(new Rect(10, 195, 280, 32), Locales.currentLocale.Values["misc_instructor"]);
             * if (GUI.Button(new Rect(10, 232, 130, 32), "Wernher von Kerman"))
             * {
             *  if (File.Exists("GameData/ResearchBodies/PluginData/cacheInstructor"))
             *  {
             *      StreamReader sr = new StreamReader("GameData/ResearchBodies/PluginData/cacheInstructor");
             *      string line = sr.ReadLine();
             *
             *      sr.Close();
             *  }
             * }
             * if (GUI.Button(new Rect(150, 232, 130, 32), "Gene Kerman"))
             * { } */
            GUILayout.EndVertical();
            Utilities.SetTooltipText();
            GUI.DragWindow();
        }