Пример #1
0
        public void DrawOpsWindow(string buttonLabel)
        {
            GUILayout.BeginVertical();

            if (GUILayout.Button("Toggle GUI"))
            {
                isGUIVisible = !isGUIVisible;

                if (isGUIVisible)
                {
                    exSurveyStation.Events["ShowUI"].Invoke();
                }
                else
                {
                    exSurveyStation.Events["HideUI"].Invoke();
                }
            }

            if (light == null)
            {
                return;
            }

            if (GUILayout.Button(light.Events["ToggleAnimation"].guiName))
            {
                light.ToggleAnimation();
            }

            light.red   = GUILayout.HorizontalSlider(light.red, 0f, 1f);
            light.green = GUILayout.HorizontalSlider(light.green, 0f, 1f);
            light.blue  = GUILayout.HorizontalSlider(light.blue, 0f, 1f);
            light.level = GUILayout.HorizontalSlider(light.level, 0f, 1f);

            GUILayout.EndVertical();
        }
Пример #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();
        }
Пример #3
0
        public void SetupLights()
        {
            Light[] lights      = internalModel.FindModelComponents <Light>();
            bool    lightsAreOn = false;

            if (lightState != ELightStates.Off)
            {
                lightsAreOn = true;
            }

            if (lights != null && lights.Length > 0)
            {
                foreach (Light light in lights)
                {
                    //Set enabled/disabled and color
                    if (light.name.Contains(lightName))
                    {
                        switch (lightState)
                        {
                        case ELightStates.Off:
                        default:
                            light.enabled = false;
                            break;

                        case ELightStates.On:
                        case ELightStates.MainColor:
                            light.enabled = true;
                            light.color   = mainLightColor;
                            break;

                        case ELightStates.AltColor:
                            light.enabled = true;
                            light.color   = altLightColor;
                            break;
                        }
                    }
                }
            }

            //Set the emissives for the lamps
            if (string.IsNullOrEmpty(cockpitLampName) == false)
            {
                Transform lampTransform = internalModel.FindModelTransform(cockpitLampName);
                Renderer  rendererMaterial;
                Color     colorOn  = new Color(1, 1, 1, 1);
                Color     colorOff = new Color(0, 0, 0, 0);

                if (lampTransform != null)
                {
                    rendererMaterial = lampTransform.GetComponent <Renderer>();
                    if (lightsAreOn)
                    {
                        rendererMaterial.material.SetColor("_EmissiveColor", colorOn);
                    }
                    else
                    {
                        rendererMaterial.material.SetColor("_EmissiveColor", colorOff);
                    }
                }
            }

            //External light
            if (lightModule != null)
            {
                if (lightsAreOn && lightModule.isDeployed == false)
                {
                    lightModule.ToggleAnimation();
                }
                else if (lightsAreOn == false && lightModule.isDeployed)
                {
                    lightModule.ToggleAnimation();
                }
            }
        }