Exemple #1
0
        private void SetupGUI()
        {
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                if (appLauncherButton == null)
                {
                    appLauncherButton = ApplicationLauncher.Instance.AddModApplication(ToggleGUI, ToggleGUI, null, null, null, null, ApplicationLauncher.AppScenes.ALWAYS, appIcon);
                }

                //Show the play modes window if we have no config file.
                if (string.IsNullOrEmpty(playModesWindow.playModeHelper.GetPlayModeFromFile()))
                {
                    playModesWindow.playModeHelper.CreateModeFile();
                    playModesWindow.SetVisible(true);
                }
            }

            else if (appLauncherButton != null)
            {
                ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton);
            }
        }
        protected override void DrawWindowContents(int windowId)
        {
            GUILayout.BeginVertical();

            //At the space center, draw the play modes
            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                GUILayout.BeginHorizontal();
                if (string.IsNullOrEmpty(playModeName))
                {
                    GUILayout.Label("Play Mode: Default");
                }
                else
                {
                    GUILayout.Label("Play Mode: " + playModeName);
                }
                if (GUILayout.Button("Change...", new GUILayoutOption[] { GUILayout.Width(64) }))
                {
                    playModesView.SetVisible(true);
                }
                GUILayout.EndHorizontal();
            }

            //In flight, switch between resources and settings
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (GUILayout.Button("Manage Operations"))
                {
                    localOpsManager.SetVisible(true);
                }

                configIndex = GUILayout.SelectionGrid(configIndex, configOptions, 2);

                switch (configIndex)
                {
                case 0:     //Resources
                    drawDistributionGUI();
                    break;

                case 1:     //Settings
                    drawCheatsGUI();
                    break;
                }
            }

            GUILayout.EndVertical();
        }