Exemplo n.º 1
0
        protected void drawCommandView()
        {
            commandModule = this.part.FindModuleImplementing <ModuleCommand>();
            switcher      = this.part.FindModuleImplementing <WBIResourceSwitcher>();
            lightModule   = this.part.FindModuleImplementing <WBILight>();

            GUILayout.BeginVertical();

            GUILayout.BeginScrollView(new Vector2(), new GUIStyle(GUI.skin.textArea), new GUILayoutOption[] { GUILayout.Height(480) });
            if (!HighLogic.LoadedSceneIsFlight)
            {
                GUILayout.Label("This configuration is working, but the contents can only be accessed in flight.");
                GUILayout.EndScrollView();
                GUILayout.EndVertical();
                return;
            }

            //Control From Here
            if (commandModule != null)
            {
                if (GUILayout.Button("Control From Here"))
                {
                    commandModule.MakeReference();
                }

                //Rename Vessel
                if (GUILayout.Button("Rename Base"))
                {
                    commandModule.RenameVessel();
                }
            }

            //Toggle Decals
            if (switcher != null)
            {
                if (!string.IsNullOrEmpty(switcher.logoPanelTransforms))
                {
                    if (GUILayout.Button("Toggle Decals"))
                    {
                        switcher.ToggleDecals();
                    }
                }

                //Dump Resources
                if (GUILayout.Button("Dump Resources"))
                {
                    switcher.DumpResources();
                }
            }

            //Toggle Lights
            if (lightModule != null)
            {
                if (lightModule.isDeployed)
                {
                    if (GUILayout.Button(lightModule.endEventGUIName))
                    {
                        lightModule.TurnOffLights();
                    }
                }

                else
                {
                    if (GUILayout.Button(lightModule.startEventGUIName))
                    {
                        lightModule.TurnOnLights();
                    }
                }
            }

            GUILayout.EndScrollView();
            GUILayout.EndVertical();
        }
Exemplo n.º 2
0
        protected virtual void drawModuleManagementPane()
        {
            GUILayout.BeginVertical(GUILayout.MaxWidth(350f));
            GUILayout.Space(4);

            managementTab = GUILayout.SelectionGrid(managementTab, managementTabs, tabs.Length);
            if (managementTab == 0)
            {
                //Draw converters
                drawConverters();

                //Depending upon loaded scene, we'll either show the module next/prev buttons and labels
                //or we'll show the module preview buttons.
                if (!HighLogic.LoadedSceneIsEditor)
                {
                    drawPreviewGUI();
                }
                else
                {
                    drawEditorGUI();
                }
            }

            else //C&C tab
            {
                //Control From Here
                if (commandModule != null)
                {
                    if (GUILayout.Button("Control From Here"))
                    {
                        commandModule.MakeReference();
                    }

                    //Rename Vessel
                    if (GUILayout.Button("Rename Base"))
                    {
                        commandModule.RenameVessel();
                    }
                }

                //Toggle Decals
                if (switcher != null)
                {
                    if (GUILayout.Button("Toggle Decals"))
                    {
                        switcher.ToggleDecals();
                    }
                }

                //Toggle Lights
                if (lightModule != null)
                {
                    if (GUILayout.Button("Toggle Lights"))
                    {
                        lightModule.ToggleAnimation();
                    }
                }
            }

            GUILayout.EndVertical();
        }