private GUISkin GetGUISkin() { return(GUISkinUtils.RegisterDerivedOnce("menus.server", s => { s.textField.fontSize = 14; s.textField.richText = false; s.textField.alignment = TextAnchor.MiddleLeft; s.textField.wordWrap = true; s.textField.stretchHeight = true; s.textField.padding = new RectOffset(10, 10, 5, 5); s.label.fontSize = 14; s.label.alignment = TextAnchor.MiddleRight; s.label.stretchHeight = true; s.label.fixedWidth = 80; //change this when adding new labels that need more space. s.button.fontSize = 14; s.button.stretchHeight = true; })); }
private void RenderUnableToJoinDialog(int windowId) { Event e = Event.current; if (e.isKey) { switch (e.keyCode) { case KeyCode.Return: joiningServer = true; notifyingUnableToJoin = false; break; case KeyCode.Escape: joiningServer = true; notifyingUnableToJoin = false; break; } } GUISkinUtils.RenderWithSkin(GetGUISkin("dialogs.server.rejected", 490), () => { using (new GUILayout.VerticalScope("Box")) { using (new GUILayout.HorizontalScope()) { PlayerSlotReservationState reservationState = Multiplayer.Logic.ClientBridge.ReservationState; string reservationStateDescription = reservationState.Describe(); GUILayout.Label(reservationStateDescription); } if (GUILayout.Button("OK")) { joiningServer = true; notifyingUnableToJoin = false; } } }); }
private void DoAddServerWindow(int windowId) { Event e = Event.current; if (e.isKey) { switch (e.keyCode) { case KeyCode.Return: OnAddServerButtonClicked(); break; case KeyCode.Escape: OnCancelButtonClicked(); break; } } GUISkinUtils.RenderWithSkin(GetGUISkin(), () => { using (new GUILayout.VerticalScope("Box")) { using (new GUILayout.HorizontalScope()) { GUILayout.Label(Language.main.Get("Nitrox_AddServerName")); GUI.SetNextControlName("serverNameField"); // 120 so users can't go too crazy. serverNameInput = GUILayout.TextField(serverNameInput, 120); } using (new GUILayout.HorizontalScope()) { GUILayout.Label(Language.main.Get("Nitrox_AddServerHost")); GUI.SetNextControlName("serverHostField"); // 120 so users can't go too crazy. serverHostInput = GUILayout.TextField(serverHostInput, 120); } using (new GUILayout.HorizontalScope()) { GUILayout.Label(Language.main.Get("Nitrox_AddServerPort")); GUI.SetNextControlName("serverPortField"); serverPortInput = GUILayout.TextField(serverPortInput); } if (GUILayout.Button(Language.main.Get("Nitrox_AddServerAdd"))) { OnAddServerButtonClicked(); } if (GUILayout.Button(Language.main.Get("Nitrox_Cancel"))) { OnCancelButtonClicked(); } } }); if (shouldFocus) { GUI.FocusControl("serverNameField"); shouldFocus = false; } }