protected override void WindowGUI(int windowID) { ggs = core.GetComputerModule<GgsModule>(); if (btNormal == null) { btNormal = new GUIStyle(GUI.skin.button); btNormal.normal.textColor = btNormal.focused.textColor = Color.white; btNormal.hover.textColor = btNormal.active.textColor = Color.yellow; btNormal.onNormal.textColor = btNormal.onFocused.textColor = btNormal.onHover.textColor = btNormal.onActive.textColor = Color.green; btNormal.padding = new RectOffset(8, 8, 8, 8); btActive = new GUIStyle(btNormal); btActive.active = btActive.onActive; btActive.normal = btActive.onNormal; btActive.onFocused = btActive.focused; btActive.hover = btActive.onHover; } if (GUILayout.Button((ggs.enabled) ? "ON" : "OFF", (ggs.enabled) ? btActive : btNormal)) { if(ggs.enabled) { core.attitude.attitudeDeactivate(); ggs.users.Remove(this); } else { Engage(); ggs.users.Add(this); } ScreenMessages.PostScreenMessage("GGS: " + ((ggs.enabled) ? "ON" : "OFF"),1,ScreenMessageStyle.UPPER_CENTER); } ggs.inpY = SimpleTextBox("HDG:",ggs.inpY,0,360); ggs.inpX = SimpleTextBox("PITCH:",ggs.inpX,-90,90); ggs.inpZ = SimpleTextBox("ROLL:",ggs.inpZ,0,360); GUILayout.BeginHorizontal(); ModeButton(GgsModule.Modo.Horizonte); ModeButton(GgsModule.Modo.Prograde); GUILayout.EndHorizontal(); if (GUI.Button(new Rect(windowPos.width - 18, 2, 16, 16), "X")) { enabled = false; } GUI.DragWindow(); }
//from MechJebModuleSmartAss public void ModeButton(GgsModule.Modo bt) { if (GUILayout.Button(ModoTexts[(int)bt], (ggs.modo == bt) ? btActive : btNormal, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false))) { ggs.modo = bt; } }