void InitProjSpecific() { var buttonContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ButtonAreaTop, inGameHUD.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterRight) { CanBeFocused = false }; var endRoundButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) }, TextManager.Get("EndRound")) { OnClicked = (btn, userdata) => { EndGame(); return(true); } }; showLogButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) }, TextManager.Get("ServerLog")) { OnClicked = (GUIButton button, object userData) => { if (ServerLog.LogFrame == null) { ServerLog.CreateLogFrame(); } else { ServerLog.LogFrame = null; GUI.KeyboardDispatcher.Subscriber = null; } return(true); } }; GUIButton settingsButton = new GUIButton(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) }, TextManager.Get("ServerSettingsButton")) { OnClicked = ToggleSettingsFrame, UserData = "settingsButton" }; }
private void InitProjSpecific() { inGameHUD = new GUIFrame(new Rectangle(0, 0, 0, 0), null, null); inGameHUD.CanBeFocused = false; showLogButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170 - 170, 20, 150, 20), "Server Log", Alignment.TopLeft, "", inGameHUD) { OnClicked = (GUIButton button, object userData) => { if (ServerLog.LogFrame == null) { ServerLog.CreateLogFrame(); } else { ServerLog.LogFrame = null; GUIComponent.KeyboardDispatcher.Subscriber = null; } return(true); } }; int width = (int)MathHelper.Clamp(GameMain.GraphicsWidth * 0.35f, 350, 500); int height = (int)MathHelper.Clamp(GameMain.GraphicsHeight * 0.15f, 100, 200); chatBox = new GUIListBox(new Rectangle( GameMain.GraphicsWidth - 20 - width, GameMain.GraphicsHeight - 40 - 25 - height, width, height), Color.White * 0.5f, "", inGameHUD); chatBox.Padding = Vector4.Zero; chatMsgBox = new GUITextBox( new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25), Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, "", inGameHUD); chatMsgBox.Font = GUI.SmallFont; chatMsgBox.MaxTextLength = ChatMessage.MaxLength; chatMsgBox.Padding = Vector4.Zero; chatMsgBox.OnEnterPressed = EnterChatMessage; chatMsgBox.OnTextChanged = TypingChatMessage; }