private void AddColumn(string headerText) { var header = CreateColumnHeader(headerText); var xnaListBox = new XNAListBox(WindowManager); xnaListBox.RightClick += ListBox_RightClick; AddColumn(header, xnaListBox); }
public override void Initialize() { base.Initialize(); Name = "UpdaterOptionsPanel"; var lblDescription = new XNALabel(WindowManager); lblDescription.Name = "lblDescription"; lblDescription.ClientRectangle = new Rectangle(12, 12, 0, 0); lblDescription.Text = "To change download server priority, select a server from the list and" + Environment.NewLine + "use the Move Up / Down buttons to change its priority."; lbUpdateServerList = new XNAListBox(WindowManager); lbUpdateServerList.Name = "lblUpdateServerList"; lbUpdateServerList.ClientRectangle = new Rectangle(lblDescription.X, lblDescription.Bottom + 12, Width - 24, 100); lbUpdateServerList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2); lbUpdateServerList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; var btnMoveUp = new XNAClientButton(WindowManager); btnMoveUp.Name = "btnMoveUp"; btnMoveUp.ClientRectangle = new Rectangle(lbUpdateServerList.X, lbUpdateServerList.Bottom + 12, 133, 23); btnMoveUp.Text = "Move Up"; btnMoveUp.LeftClick += btnMoveUp_LeftClick; var btnMoveDown = new XNAClientButton(WindowManager); btnMoveDown.Name = "btnMoveDown"; btnMoveDown.ClientRectangle = new Rectangle( lbUpdateServerList.Right - 133, btnMoveUp.Y, 133, 23); btnMoveDown.Text = "Move Down"; btnMoveDown.LeftClick += btnMoveDown_LeftClick; chkAutoCheck = new XNAClientCheckBox(WindowManager); chkAutoCheck.Name = "chkAutoCheck"; chkAutoCheck.ClientRectangle = new Rectangle(lblDescription.X, btnMoveUp.Bottom + 24, 0, 0); chkAutoCheck.Text = "Check for updates automatically"; btnForceUpdate = new XNAClientButton(WindowManager); btnForceUpdate.Name = "btnForceUpdate"; btnForceUpdate.ClientRectangle = new Rectangle(btnMoveDown.X, btnMoveDown.Bottom + 24, 133, 23); btnForceUpdate.Text = "Force Update"; btnForceUpdate.LeftClick += BtnForceUpdate_LeftClick; AddChild(lblDescription); AddChild(lbUpdateServerList); AddChild(btnMoveUp); AddChild(btnMoveDown); AddChild(chkAutoCheck); AddChild(btnForceUpdate); }
public override void Initialize() { base.Initialize(); Name = "UpdaterOptionsPanel"; var lblDescription = new XNALabel(WindowManager); lblDescription.Name = "lblDescription"; lblDescription.ClientRectangle = new Rectangle(12, 12, 0, 0); lblDescription.Text = "欲更改优先下载的服务器,请从列表中选择一个服务器," + Environment.NewLine + "然后用 上移 或 下移 工具改变它的优先级。"; lbUpdateServerList = new XNAListBox(WindowManager); lbUpdateServerList.Name = "lblUpdateServerList"; lbUpdateServerList.ClientRectangle = new Rectangle(lblDescription.X, lblDescription.Bottom + 12, Width - 24, 100); lbUpdateServerList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2); lbUpdateServerList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; var btnMoveUp = new XNAClientButton(WindowManager); btnMoveUp.Name = "btnMoveUp"; btnMoveUp.ClientRectangle = new Rectangle(lbUpdateServerList.X, lbUpdateServerList.Bottom + 12, 133, 23); btnMoveUp.Text = "上移"; btnMoveUp.LeftClick += btnMoveUp_LeftClick; var btnMoveDown = new XNAClientButton(WindowManager); btnMoveDown.Name = "btnMoveDown"; btnMoveDown.ClientRectangle = new Rectangle( lbUpdateServerList.Right - 133, btnMoveUp.Y, 133, 23); btnMoveDown.Text = "下移"; btnMoveDown.LeftClick += btnMoveDown_LeftClick; chkAutoCheck = new XNAClientCheckBox(WindowManager); chkAutoCheck.Name = "chkAutoCheck"; chkAutoCheck.ClientRectangle = new Rectangle(lblDescription.X, btnMoveUp.Bottom + 24, 0, 0); chkAutoCheck.Text = "自动检查更新"; AddChild(lblDescription); AddChild(lbUpdateServerList); AddChild(btnMoveUp); AddChild(btnMoveDown); AddChild(chkAutoCheck); }
public override void Initialize() { Name = "LANLobby"; BackgroundTexture = AssetLoader.LoadTexture("cncnetlobbybg.png"); ClientRectangle = new Rectangle(0, 0, WindowManager.RenderResolutionX - 64, WindowManager.RenderResolutionY - 64); localGame = ClientConfiguration.Instance.LocalGame; localGameIndex = gameCollection.GameList.FindIndex( g => g.InternalName.ToUpper() == localGame.ToUpper()); btnNewGame = new XNAClientButton(WindowManager); btnNewGame.Name = "btnNewGame"; btnNewGame.ClientRectangle = new Rectangle(12, Height - 35, UIDesignConstants.BUTTON_WIDTH_133, UIDesignConstants.BUTTON_HEIGHT); btnNewGame.Text = "Create Game"; btnNewGame.LeftClick += BtnNewGame_LeftClick; btnJoinGame = new XNAClientButton(WindowManager); btnJoinGame.Name = "btnJoinGame"; btnJoinGame.ClientRectangle = new Rectangle(btnNewGame.Right + 12, btnNewGame.Y, UIDesignConstants.BUTTON_WIDTH_133, UIDesignConstants.BUTTON_HEIGHT); btnJoinGame.Text = "Join Game"; btnJoinGame.LeftClick += BtnJoinGame_LeftClick; btnMainMenu = new XNAClientButton(WindowManager); btnMainMenu.Name = "btnMainMenu"; btnMainMenu.ClientRectangle = new Rectangle(Width - 145, btnNewGame.Y, UIDesignConstants.BUTTON_WIDTH_133, UIDesignConstants.BUTTON_HEIGHT); btnMainMenu.Text = "Main Menu"; btnMainMenu.LeftClick += BtnMainMenu_LeftClick; lbGameList = new GameListBox(WindowManager, localGame, null); lbGameList.Name = "lbGameList"; lbGameList.ClientRectangle = new Rectangle(btnNewGame.X, 41, btnJoinGame.Right - btnNewGame.X, btnNewGame.Y - 53); lbGameList.GameLifetime = 15.0; // Smaller lifetime in LAN lbGameList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbGameList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbGameList.DoubleLeftClick += LbGameList_DoubleLeftClick; lbGameList.AllowMultiLineItems = false; lbPlayerList = new XNAListBox(WindowManager); lbPlayerList.Name = "lbPlayerList"; lbPlayerList.ClientRectangle = new Rectangle(Width - 202, lbGameList.Y, 190, lbGameList.Height); lbPlayerList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbPlayerList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbPlayerList.LineHeight = 16; lbChatMessages = new ChatListBox(WindowManager); lbChatMessages.Name = "lbChatMessages"; lbChatMessages.ClientRectangle = new Rectangle(lbGameList.Right + 12, lbGameList.Y, lbPlayerList.X - lbGameList.Right - 24, lbGameList.Height); lbChatMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbChatMessages.LineHeight = 16; tbChatInput = new XNAChatTextBox(WindowManager); tbChatInput.Name = "tbChatInput"; tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.X, btnNewGame.Y, lbChatMessages.Width, btnNewGame.Height); tbChatInput.Suggestion = "Type here to chat..."; tbChatInput.MaximumTextLength = 200; tbChatInput.EnterPressed += TbChatInput_EnterPressed; lblColor = new XNALabel(WindowManager); lblColor.Name = "lblColor"; lblColor.ClientRectangle = new Rectangle(lbChatMessages.X, 14, 0, 0); lblColor.FontIndex = 1; lblColor.Text = "YOUR COLOR:"; ddColor = new XNAClientDropDown(WindowManager); ddColor.Name = "ddColor"; ddColor.ClientRectangle = new Rectangle(lblColor.X + 95, 12, 150, 21); chatColors = new LANColor[] { new LANColor("Gray", Color.Gray), new LANColor("Metalic", Color.LightGray), new LANColor("Green", Color.Green), new LANColor("Lime Green", Color.LimeGreen), new LANColor("Green Yellow", Color.GreenYellow), new LANColor("Goldenrod", Color.Goldenrod), new LANColor("Yellow", Color.Yellow), new LANColor("Orange", Color.Orange), new LANColor("Red", Color.Red), new LANColor("Pink", Color.DeepPink), new LANColor("Purple", Color.MediumPurple), new LANColor("Sky Blue", Color.SkyBlue), new LANColor("Blue", Color.Blue), new LANColor("Brown", Color.SaddleBrown), new LANColor("Teal", Color.Teal) }; foreach (LANColor color in chatColors) { ddColor.AddItem(color.Name, color.XNAColor); } AddChild(btnNewGame); AddChild(btnJoinGame); AddChild(btnMainMenu); AddChild(lbPlayerList); AddChild(lbChatMessages); AddChild(lbGameList); AddChild(tbChatInput); AddChild(lblColor); AddChild(ddColor); gameCreationWindow = new LANGameCreationWindow(WindowManager); var gameCreationPanel = new DarkeningPanel(WindowManager); AddChild(gameCreationPanel); gameCreationPanel.AddChild(gameCreationWindow); gameCreationWindow.Disable(); gameCreationWindow.NewGame += GameCreationWindow_NewGame; gameCreationWindow.LoadGame += GameCreationWindow_LoadGame; unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon); sndGameCreated = new EnhancedSoundEffect("gamecreated.wav"); encoding = Encoding.UTF8; base.Initialize(); CenterOnParent(); gameCreationPanel.SetPositionAndSize(); lanGameLobby = new LANGameLobby(WindowManager, "MultiplayerGameLobby", null, gameModes, chatColors, mapLoader, discordHandler); DarkeningPanel.AddAndInitializeWithControl(WindowManager, lanGameLobby); lanGameLobby.Disable(); lanGameLoadingLobby = new LANGameLoadingLobby(WindowManager, gameModes, chatColors, discordHandler); DarkeningPanel.AddAndInitializeWithControl(WindowManager, lanGameLoadingLobby); lanGameLoadingLobby.Disable(); int selectedColor = UserINISettings.Instance.LANChatColor; ddColor.SelectedIndex = selectedColor >= ddColor.Items.Count || selectedColor < 0 ? 0 : selectedColor; SetChatColor(); ddColor.SelectedIndexChanged += DdColor_SelectedIndexChanged; lanGameLobby.GameLeft += LanGameLobby_GameLeft; lanGameLobby.GameBroadcast += LanGameLobby_GameBroadcast; lanGameLoadingLobby.GameBroadcast += LanGameLoadingLobby_GameBroadcast; lanGameLoadingLobby.GameLeft += LanGameLoadingLobby_GameLeft; WindowManager.GameClosing += WindowManager_GameClosing; }
public override void Initialize() { Name = "PrivateMessagingWindow"; ClientRectangle = new Rectangle(0, 0, 600, 600); BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png"); unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon); adminGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon); personalMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor); otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor); lblPrivateMessaging = new XNALabel(WindowManager); lblPrivateMessaging.Name = "lblPrivateMessaging"; lblPrivateMessaging.FontIndex = 1; lblPrivateMessaging.Text = "PRIVATE MESSAGING"; AddChild(lblPrivateMessaging); lblPrivateMessaging.CenterOnParent(); lblPrivateMessaging.ClientRectangle = new Rectangle( lblPrivateMessaging.ClientRectangle.X, 12, lblPrivateMessaging.ClientRectangle.Width, lblPrivateMessaging.ClientRectangle.Height); tabControl = new XNAClientTabControl(WindowManager); tabControl.Name = "tabControl"; tabControl.ClientRectangle = new Rectangle(60, 50, 0, 0); tabControl.SoundOnClick = AssetLoader.LoadSound("button.wav"); tabControl.FontIndex = 1; tabControl.AddTab("Messages", 160); tabControl.AddTab("Friend List", 160); tabControl.AddTab("All Players", 160); tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; lblPlayers = new XNALabel(WindowManager); lblPlayers.Name = "lblPlayers"; lblPlayers.ClientRectangle = new Rectangle(12, tabControl.ClientRectangle.Bottom + 24, 0, 0); lblPlayers.FontIndex = 1; lblPlayers.Text = "PLAYERS:"; lbUserList = new XNAListBox(WindowManager); lbUserList.Name = "lbUserList"; lbUserList.ClientRectangle = new Rectangle(lblPlayers.ClientRectangle.X, lblPlayers.ClientRectangle.Bottom + 6, 150, ClientRectangle.Height - lblPlayers.ClientRectangle.Bottom - 18); lbUserList.RightClick += LbUserList_RightClick; lbUserList.SelectedIndexChanged += LbUserList_SelectedIndexChanged; lbUserList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbUserList.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lblMessages = new XNALabel(WindowManager); lblMessages.Name = "lblMessages"; lblMessages.ClientRectangle = new Rectangle(lbUserList.ClientRectangle.Right + 12, lblPlayers.ClientRectangle.Y, 0, 0); lblMessages.FontIndex = 1; lblMessages.Text = "MESSAGES:"; lbMessages = new ChatListBox(WindowManager); lbMessages.Name = "lbMessages"; lbMessages.ClientRectangle = new Rectangle(lblMessages.ClientRectangle.X, lbUserList.ClientRectangle.Y, ClientRectangle.Width - lblMessages.ClientRectangle.X - 12, lbUserList.ClientRectangle.Height - 25); lbMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbMessages.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; tbMessageInput = new XNATextBox(WindowManager); tbMessageInput.Name = "tbMessageInput"; tbMessageInput.ClientRectangle = new Rectangle(lbMessages.ClientRectangle.X, lbMessages.ClientRectangle.Bottom + 6, lbMessages.ClientRectangle.Width, 19); tbMessageInput.EnterPressed += TbMessageInput_EnterPressed; tbMessageInput.MaximumTextLength = 200; tbMessageInput.Enabled = false; playerContextMenu = new PlayerContextMenu(WindowManager); playerContextMenu.Name = "playerContextMenu"; playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2); playerContextMenu.Enabled = false; playerContextMenu.Visible = false; playerContextMenu.AddItem("Add Friend"); playerContextMenu.OptionSelected += PlayerContextMenu_OptionSelected; notificationBox = new PrivateMessageNotificationBox(WindowManager); notificationBox.Enabled = false; notificationBox.Visible = false; AddChild(tabControl); AddChild(lblPlayers); AddChild(lbUserList); AddChild(lblMessages); AddChild(lbMessages); AddChild(tbMessageInput); AddChild(playerContextMenu); WindowManager.AddAndInitializeControl(notificationBox); base.Initialize(); CenterOnParent(); try { friendList = File.ReadAllLines(ProgramConstants.GamePath + FRIEND_LIST_PATH).ToList(); } catch { Logger.Log("Loading friend list failed!"); friendList = new List <string>(); } tabControl.SelectedTab = 0; connectionManager.PrivateMessageReceived += ConnectionManager_PrivateMessageReceived; sndMessageSound = new EnhancedSoundEffect("message.wav"); sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav"); sndMessageSound.Enabled = UserINISettings.Instance.MessageSound; GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited; }
public override void Initialize() { BackgroundTexture = AssetLoader.LoadTexture("missionselectorbg.png"); ClientRectangle = new Rectangle(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT); BorderColor = UISettings.ActiveSettings.PanelBorderColor; Name = "CampaignSelector"; var lblSelectCampaign = new XNALabel(WindowManager); lblSelectCampaign.Name = "lblSelectCampaign"; lblSelectCampaign.FontIndex = 1; lblSelectCampaign.ClientRectangle = new Rectangle(12, 12, 0, 0); lblSelectCampaign.Text = "MISSIONS:"; lbCampaignList = new XNAListBox(WindowManager); lbCampaignList.Name = "lbCampaignList"; lbCampaignList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2); lbCampaignList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbCampaignList.ClientRectangle = new Rectangle(12, lblSelectCampaign.Bottom + 6, 300, 516); lbCampaignList.SelectedIndexChanged += LbCampaignList_SelectedIndexChanged; var lblMissionDescriptionHeader = new XNALabel(WindowManager); lblMissionDescriptionHeader.Name = "lblMissionDescriptionHeader"; lblMissionDescriptionHeader.FontIndex = 1; lblMissionDescriptionHeader.ClientRectangle = new Rectangle( lbCampaignList.Right + 12, lblSelectCampaign.Y, 0, 0); lblMissionDescriptionHeader.Text = "MISSION DESCRIPTION:"; tbMissionDescription = new XNATextBlock(WindowManager); tbMissionDescription.Name = "tbMissionDescription"; tbMissionDescription.ClientRectangle = new Rectangle( lblMissionDescriptionHeader.X, lblMissionDescriptionHeader.Bottom + 6, Width - 24 - lbCampaignList.Right, 430); tbMissionDescription.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; tbMissionDescription.Alpha = 1.0f; tbMissionDescription.BackgroundTexture = AssetLoader.CreateTexture(AssetLoader.GetColorFromString(ClientConfiguration.Instance.AltUIBackgroundColor), tbMissionDescription.Width, tbMissionDescription.Height); var lblDifficultyLevel = new XNALabel(WindowManager); lblDifficultyLevel.Name = "lblDifficultyLevel"; lblDifficultyLevel.Text = "DIFFICULTY LEVEL"; lblDifficultyLevel.FontIndex = 1; Vector2 textSize = Renderer.GetTextDimensions(lblDifficultyLevel.Text, lblDifficultyLevel.FontIndex); lblDifficultyLevel.ClientRectangle = new Rectangle( tbMissionDescription.X + (tbMissionDescription.Width - (int)textSize.X) / 2, tbMissionDescription.Bottom + 12, (int)textSize.X, (int)textSize.Y); trbDifficultySelector = new XNATrackbar(WindowManager); trbDifficultySelector.Name = "trbDifficultySelector"; trbDifficultySelector.ClientRectangle = new Rectangle( tbMissionDescription.X, lblDifficultyLevel.Bottom + 6, tbMissionDescription.Width, 30); trbDifficultySelector.MinValue = 0; trbDifficultySelector.MaxValue = 2; trbDifficultySelector.BackgroundTexture = AssetLoader.CreateTexture( new Color(0, 0, 0, 128), 2, 2); trbDifficultySelector.ButtonTexture = AssetLoader.LoadTextureUncached( "trackbarButton_difficulty.png"); var lblEasy = new XNALabel(WindowManager); lblEasy.Name = "lblEasy"; lblEasy.FontIndex = 1; lblEasy.Text = "EASY"; lblEasy.ClientRectangle = new Rectangle(trbDifficultySelector.X, trbDifficultySelector.Bottom + 6, 1, 1); var lblNormal = new XNALabel(WindowManager); lblNormal.Name = "lblNormal"; lblNormal.FontIndex = 1; lblNormal.Text = "NORMAL"; textSize = Renderer.GetTextDimensions(lblNormal.Text, lblNormal.FontIndex); lblNormal.ClientRectangle = new Rectangle( tbMissionDescription.X + (tbMissionDescription.Width - (int)textSize.X) / 2, lblEasy.Y, (int)textSize.X, (int)textSize.Y); var lblHard = new XNALabel(WindowManager); lblHard.Name = "lblHard"; lblHard.FontIndex = 1; lblHard.Text = "HARD"; lblHard.ClientRectangle = new Rectangle( tbMissionDescription.Right - lblHard.Width, lblEasy.Y, 1, 1); btnLaunch = new XNAClientButton(WindowManager); btnLaunch.Name = "btnLaunch"; btnLaunch.ClientRectangle = new Rectangle(12, Height - 35, UIDesignConstants.BUTTON_WIDTH_133, UIDesignConstants.BUTTON_HEIGHT); btnLaunch.Text = "Launch"; btnLaunch.AllowClick = false; btnLaunch.LeftClick += BtnLaunch_LeftClick; var btnCancel = new XNAClientButton(WindowManager); btnCancel.Name = "btnCancel"; btnCancel.ClientRectangle = new Rectangle(Width - 145, btnLaunch.Y, UIDesignConstants.BUTTON_WIDTH_133, UIDesignConstants.BUTTON_HEIGHT); btnCancel.Text = "Cancel"; btnCancel.LeftClick += BtnCancel_LeftClick; AddChild(lblSelectCampaign); AddChild(lblMissionDescriptionHeader); AddChild(lbCampaignList); AddChild(tbMissionDescription); AddChild(lblDifficultyLevel); AddChild(btnLaunch); AddChild(btnCancel); AddChild(trbDifficultySelector); AddChild(lblEasy); AddChild(lblNormal); AddChild(lblHard); // Set control attributes from INI file base.Initialize(); // Center on screen CenterOnParent(); trbDifficultySelector.Value = UserINISettings.Instance.Difficulty; ParseBattleIni("INI/Battle.ini"); ParseBattleIni("INI/" + ClientConfiguration.Instance.BattleFSFileName); cheaterWindow = new CheaterWindow(WindowManager); DarkeningPanel dp = new DarkeningPanel(WindowManager); dp.AddChild(cheaterWindow); AddChild(dp); dp.CenterOnParent(); cheaterWindow.CenterOnParent(); cheaterWindow.YesClicked += CheaterWindow_YesClicked; cheaterWindow.Disable(); }
public override void Initialize() { Name = nameof(PrivateMessagingWindow); ClientRectangle = new Rectangle(0, 0, 600, 600); BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png"); unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon); adminGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon); personalMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor); otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor); lblPrivateMessaging = new XNALabel(WindowManager); lblPrivateMessaging.Name = nameof(lblPrivateMessaging); lblPrivateMessaging.FontIndex = 1; lblPrivateMessaging.Text = "PRIVATE MESSAGING"; AddChild(lblPrivateMessaging); lblPrivateMessaging.CenterOnParent(); lblPrivateMessaging.ClientRectangle = new Rectangle( lblPrivateMessaging.X, 12, lblPrivateMessaging.Width, lblPrivateMessaging.Height); tabControl = new XNAClientTabControl(WindowManager); tabControl.Name = nameof(tabControl); tabControl.ClientRectangle = new Rectangle(60, 50, 0, 0); tabControl.ClickSound = new EnhancedSoundEffect("button.wav"); tabControl.FontIndex = 1; tabControl.AddTab("Messages", 160); tabControl.AddTab("Friend List", 160); tabControl.AddTab("All Players", 160); tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; lblPlayers = new XNALabel(WindowManager); lblPlayers.Name = nameof(lblPlayers); lblPlayers.ClientRectangle = new Rectangle(12, tabControl.Bottom + 24, 0, 0); lblPlayers.FontIndex = 1; lblPlayers.Text = "PLAYERS:"; lbUserList = new XNAListBox(WindowManager); lbUserList.Name = nameof(lbUserList); lbUserList.ClientRectangle = new Rectangle(lblPlayers.X, lblPlayers.Bottom + 6, 150, Height - lblPlayers.Bottom - 18); lbUserList.RightClick += LbUserList_RightClick; lbUserList.SelectedIndexChanged += LbUserList_SelectedIndexChanged; lbUserList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbUserList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lblMessages = new XNALabel(WindowManager); lblMessages.Name = nameof(lblMessages); lblMessages.ClientRectangle = new Rectangle(lbUserList.Right + 12, lblPlayers.Y, 0, 0); lblMessages.FontIndex = 1; lblMessages.Text = "MESSAGES:"; lbMessages = new ChatListBox(WindowManager); lbMessages.Name = nameof(lbMessages); lbMessages.ClientRectangle = new Rectangle(lblMessages.X, lbUserList.Y, Width - lblMessages.X - 12, lbUserList.Height - 25); lbMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; tbMessageInput = new XNATextBox(WindowManager); tbMessageInput.Name = nameof(tbMessageInput); tbMessageInput.ClientRectangle = new Rectangle(lbMessages.X, lbMessages.Bottom + 6, lbMessages.Width, 19); tbMessageInput.EnterPressed += TbMessageInput_EnterPressed; tbMessageInput.MaximumTextLength = 200; tbMessageInput.Enabled = false; playerContextMenu = new XNAContextMenu(WindowManager); playerContextMenu.Name = nameof(playerContextMenu); playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2); playerContextMenu.Disable(); playerContextMenu.AddItem("Add Friend", PlayerContextMenu_ToggleFriend); playerContextMenu.AddItem("Toggle Block", PlayerContextMenu_ToggleIgnore, null, () => (bool)lbUserList.SelectedItem.Tag, null); playerContextMenu.AddItem("Invite", PlayerContextMenu_Invite, null, () => !string.IsNullOrEmpty(inviteChannelName)); notificationBox = new PrivateMessageNotificationBox(WindowManager); notificationBox.Enabled = false; notificationBox.Visible = false; notificationBox.LeftClick += NotificationBox_LeftClick; AddChild(tabControl); AddChild(lblPlayers); AddChild(lbUserList); AddChild(lblMessages); AddChild(lbMessages); AddChild(tbMessageInput); AddChild(playerContextMenu); WindowManager.AddAndInitializeControl(notificationBox); base.Initialize(); CenterOnParent(); tabControl.SelectedTab = 0; connectionManager.PrivateMessageReceived += ConnectionManager_PrivateMessageReceived; connectionManager.UserAdded += ConnectionManager_UserAdded; connectionManager.UserRemoved += ConnectionManager_UserRemoved; connectionManager.UserGameIndexUpdated += ConnectionManager_UserGameIndexUpdated; sndMessageSound = new EnhancedSoundEffect("message.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundMessageCooldown); sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundPrivateMessageCooldown); sndMessageSound.Enabled = UserINISettings.Instance.MessageSound; GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited; }
public override void Initialize() { BackgroundTexture = AssetLoader.LoadTexture("missionselectorbg.png"); ClientRectangle = new Rectangle(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT); BorderColor = UISettings.ActiveSettings.PanelBorderColor; Name = "CampaignSelector"; var lblSelectCampaign = new XNALabel(WindowManager); lblSelectCampaign.Name = "lblSelectCampaign"; lblSelectCampaign.FontIndex = 1; lblSelectCampaign.ClientRectangle = new Rectangle(12, 12, 0, 0); lblSelectCampaign.Text = "MISSIONS:"; lbCampaignList = new BattleListBox(WindowManager); lbCampaignList.Name = "lbCampaignList"; lbCampaignList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 2, 2); lbCampaignList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbCampaignList.ClientRectangle = new Rectangle(12, lblSelectCampaign.Bottom + 6, 300, 516); lbCampaignList.SelectedIndexChanged += LbCampaignList_SelectedIndexChanged; var lblMissionDescriptionHeader = new XNALabel(WindowManager); lblMissionDescriptionHeader.Name = "lblMissionDescriptionHeader"; lblMissionDescriptionHeader.FontIndex = 1; lblMissionDescriptionHeader.ClientRectangle = new Rectangle( lbCampaignList.Right + 12, lblSelectCampaign.Y, 0, 0); lblMissionDescriptionHeader.Text = "MISSION DESCRIPTION:"; tbMissionDescription = new MissionDescriptionBox(WindowManager); tbMissionDescription.Name = "tbMissionDescription"; tbMissionDescription.ClientRectangle = new Rectangle( lblMissionDescriptionHeader.X, lblMissionDescriptionHeader.Bottom + 6, Width - 24 - lbCampaignList.Right, 430); tbMissionDescription.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; tbMissionDescription.Alpha = 1.0f; tbMissionDescription.BackgroundTexture = AssetLoader.CreateTexture(AssetLoader.GetColorFromString(ClientConfiguration.Instance.AltUIBackgroundColor), tbMissionDescription.Width, tbMissionDescription.Height); var lblDifficultyLevel = new XNALabel(WindowManager); lblDifficultyLevel.Name = "lblDifficultyLevel"; lblDifficultyLevel.Text = "DIFFICULTY LEVEL"; lblDifficultyLevel.FontIndex = 1; Vector2 textSize = Renderer.GetTextDimensions(lblDifficultyLevel.Text, lblDifficultyLevel.FontIndex); lblDifficultyLevel.ClientRectangle = new Rectangle( tbMissionDescription.X + (tbMissionDescription.Width - (int)textSize.X) / 2, tbMissionDescription.Bottom + 12, (int)textSize.X, (int)textSize.Y); trbDifficultySelector = new XNATrackbar(WindowManager); trbDifficultySelector.Name = "trbDifficultySelector"; trbDifficultySelector.ClientRectangle = new Rectangle( tbMissionDescription.X, lblDifficultyLevel.Bottom + 6, tbMissionDescription.Width, 30); trbDifficultySelector.MinValue = 0; trbDifficultySelector.MaxValue = 2; trbDifficultySelector.BackgroundTexture = AssetLoader.CreateTexture( new Color(0, 0, 0, 128), 2, 2); trbDifficultySelector.ButtonTexture = AssetLoader.LoadTextureUncached( "trackbarButton_difficulty.png"); int y = lblDifficultyLevel.Y - UIDesignConstants.EMPTY_SPACE_BOTTOM; // Create controls for global variable customization // The indexes increase from bottom to top, meaning // that with 4 lines the global indexes go like this: // global slot #3 // global slot #2 // global slot #1 // global slot #0 for (int i = 0; i < MAX_GLOBAL_COUNT; i++) { globalVariableValues[i] = new XNADropDown(WindowManager); globalVariableValues[i].Name = "globalVariableValue" + i; globalVariableValues[i].X = trbDifficultySelector.X; globalVariableValues[i].Width = trbDifficultySelector.Width; globalVariableValues[i].AddItem("Disabled"); globalVariableValues[i].AddItem("Enabled"); AddChild(globalVariableValues[i]); globalVariableValues[i].Y = y - (UIDesignConstants.EMPTY_SPACE_BOTTOM * 2) - globalVariableValues[i].Height; globalVariableValues[i].Disable(); globalVariableNames[i] = new XNALabel(WindowManager); globalVariableNames[i].Name = "globalVariableName" + i; globalVariableNames[i].Text = "Global Variable #" + i; globalVariableNames[i].TextAnchor = LabelTextAnchorInfo.RIGHT; globalVariableNames[i].AnchorPoint = new Vector2(globalVariableValues[i].X, globalVariableValues[i].Y - globalVariableNames[i].Height); AddChild(globalVariableNames[i]); globalVariableNames[i].Disable(); y = globalVariableNames[i].Y; } lblPreconditionsHeader = new XNALabel(WindowManager); lblPreconditionsHeader.Name = nameof(lblPreconditionsHeader); lblPreconditionsHeader.FontIndex = UIDesignConstants.BOLD_FONT_INDEX; lblPreconditionsHeader.TextAnchor = LabelTextAnchorInfo.HORIZONTAL_CENTER; lblPreconditionsHeader.AnchorPoint = new Vector2(trbDifficultySelector.ClientRectangle.Center.X, globalVariableNames[0].Y - UIDesignConstants.CONTROL_VERTICAL_MARGIN * 2); lblPreconditionsHeader.Text = "PRECONDITIONS"; AddChild(lblPreconditionsHeader); lblPreconditionsHeader.Disable(); PreconditionUIConfig(null); lblEasy = new XNALabel(WindowManager); lblEasy.Name = "lblEasy"; lblEasy.TextAnchor = LabelTextAnchorInfo.RIGHT; lblEasy.AnchorPoint = new Vector2(trbDifficultySelector.X, trbDifficultySelector.Bottom + UIDesignConstants.CONTROL_VERTICAL_MARGIN); lblEasy.FontIndex = 1; lblEasy.Text = DifficultyNamesUIDefault[0]; lblNormal = new XNALabel(WindowManager); lblNormal.Name = "lblNormal"; lblNormal.TextAnchor = LabelTextAnchorInfo.HORIZONTAL_CENTER; lblNormal.AnchorPoint = new Vector2(trbDifficultySelector.ClientRectangle.Center.X, lblEasy.AnchorPoint.Y); lblNormal.FontIndex = 1; lblNormal.Text = DifficultyNamesUIDefault[1]; lblHard = new XNALabel(WindowManager); lblHard.Name = "lblHard"; lblHard.TextAnchor = LabelTextAnchorInfo.LEFT; lblHard.AnchorPoint = new Vector2(trbDifficultySelector.Right, lblEasy.AnchorPoint.Y); lblHard.FontIndex = 1; lblHard.Text = DifficultyNamesUIDefault[2]; btnLaunch = new XNAClientButton(WindowManager); btnLaunch.Name = "btnLaunch"; btnLaunch.ClientRectangle = new Rectangle(12, Height - 35, 133, 23); btnLaunch.Text = "Launch"; btnLaunch.AllowClick = false; btnLaunch.LeftClick += BtnLaunch_LeftClick; var btnCancel = new XNAClientButton(WindowManager); btnCancel.Name = "btnCancel"; btnCancel.ClientRectangle = new Rectangle(Width - 145, btnLaunch.Y, 133, 23); btnCancel.Text = "Cancel"; btnCancel.LeftClick += BtnCancel_LeftClick; AddChild(lblSelectCampaign); AddChild(lblMissionDescriptionHeader); AddChild(lbCampaignList); AddChild(tbMissionDescription); AddChild(lblDifficultyLevel); AddChild(btnLaunch); AddChild(btnCancel); AddChild(trbDifficultySelector); AddChild(lblEasy); AddChild(lblNormal); AddChild(lblHard); // Set control attributes from INI file base.Initialize(); // Center on screen CenterOnParent(); trbDifficultySelector.Value = UserINISettings.Instance.Difficulty; cheaterWindow = new CheaterWindow(WindowManager); DarkeningPanel dp = new DarkeningPanel(WindowManager); dp.AddChild(cheaterWindow); AddChild(dp); dp.CenterOnParent(); cheaterWindow.CenterOnParent(); cheaterWindow.YesClicked += CheaterWindow_YesClicked; cheaterWindow.Disable(); EnabledChanged += CampaignSelector_EnabledChanged; missionCompletionNotification = new MissionCompletionNotification(WindowManager); WindowManager.AddAndInitializeControl(missionCompletionNotification); missionCompletionNotification.DrawOrder = 9999; missionCompletionNotification.UpdateOrder = 9999; missionCompletionNotification.Disable(); CampaignHandler.Instance.MissionRankUpdated += CampaignHandler_MissionRankUpdated; CampaignHandler.Instance.MissionCompleted += CampaignHandler_MissionCompleted; }
public override void Initialize() { Name = nameof(PrivateMessagingWindow); ClientRectangle = new Rectangle(0, 0, 600, 600); BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png"); unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon); adminGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon); personalMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor); otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor); lblPrivateMessaging = new XNALabel(WindowManager); lblPrivateMessaging.Name = nameof(lblPrivateMessaging); lblPrivateMessaging.FontIndex = 1; lblPrivateMessaging.Text = "PRIVATE MESSAGING"; AddChild(lblPrivateMessaging); lblPrivateMessaging.CenterOnParent(); lblPrivateMessaging.ClientRectangle = new Rectangle( lblPrivateMessaging.X, 12, lblPrivateMessaging.Width, lblPrivateMessaging.Height); tabControl = new XNAClientTabControl(WindowManager); tabControl.Name = nameof(tabControl); tabControl.ClientRectangle = new Rectangle(34, 50, 0, 0); tabControl.ClickSound = new EnhancedSoundEffect("button.wav"); tabControl.FontIndex = 1; tabControl.AddTab("Messages", UIDesignConstants.BUTTON_WIDTH_133); tabControl.AddTab("Friend List", UIDesignConstants.BUTTON_WIDTH_133); tabControl.AddTab("All Players", UIDesignConstants.BUTTON_WIDTH_133); tabControl.AddTab("Recent Players", UIDesignConstants.BUTTON_WIDTH_133); tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged; lblPlayers = new XNALabel(WindowManager); lblPlayers.Name = nameof(lblPlayers); lblPlayers.ClientRectangle = new Rectangle(12, tabControl.Bottom + 24, 0, 0); lblPlayers.FontIndex = 1; lblPlayers.Text = DEFAULT_PLAYERS_TEXT; lbUserList = new XNAListBox(WindowManager); lbUserList.Name = nameof(lbUserList); lbUserList.ClientRectangle = new Rectangle(lblPlayers.X, lblPlayers.Bottom + 6, LB_USERS_WIDTH, Height - lblPlayers.Bottom - 18); lbUserList.RightClick += LbUserList_RightClick; lbUserList.SelectedIndexChanged += LbUserList_SelectedIndexChanged; lbUserList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbUserList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbUserList.DoubleLeftClick += UserList_LeftDoubleClick; lblMessages = new XNALabel(WindowManager); lblMessages.Name = nameof(lblMessages); lblMessages.ClientRectangle = new Rectangle(lbUserList.Right + 12, lblPlayers.Y, 0, 0); lblMessages.FontIndex = 1; lblMessages.Text = "MESSAGES:"; lbMessages = new ChatListBox(WindowManager); lbMessages.Name = nameof(lbMessages); lbMessages.ClientRectangle = new Rectangle(lblMessages.X, lbUserList.Y, Width - lblMessages.X - 12, lbUserList.Height - 25); lbMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbMessages.RightClick += ChatListBox_RightClick; tbMessageInput = new XNATextBox(WindowManager); tbMessageInput.Name = nameof(tbMessageInput); tbMessageInput.ClientRectangle = new Rectangle(lbMessages.X, lbMessages.Bottom + 6, lbMessages.Width, 19); tbMessageInput.EnterPressed += TbMessageInput_EnterPressed; tbMessageInput.MaximumTextLength = 200; tbMessageInput.Enabled = false; mclbRecentPlayerList = new RecentPlayerTable(WindowManager, connectionManager); mclbRecentPlayerList.ClientRectangle = new Rectangle(lbUserList.X, lbUserList.Y, lbMessages.Right - lbUserList.X, lbUserList.Height); mclbRecentPlayerList.PlayerRightClick += RecentPlayersList_RightClick; mclbRecentPlayerList.Disable(); globalContextMenu = new GlobalContextMenu(WindowManager, connectionManager, cncnetUserData, this); globalContextMenu.JoinEvent += PlayerContextMenu_JoinUser; notificationBox = new PrivateMessageNotificationBox(WindowManager); notificationBox.Enabled = false; notificationBox.Visible = false; notificationBox.LeftClick += NotificationBox_LeftClick; AddChild(tabControl); AddChild(lblPlayers); AddChild(lbUserList); AddChild(lblMessages); AddChild(lbMessages); AddChild(tbMessageInput); AddChild(mclbRecentPlayerList); AddChild(globalContextMenu); WindowManager.AddAndInitializeControl(notificationBox); base.Initialize(); CenterOnParent(); tabControl.SelectedTab = MESSAGES_INDEX; privateMessageHandler.PrivateMessageReceived += PrivateMessageHandler_PrivateMessageReceived; connectionManager.UserAdded += ConnectionManager_UserAdded; connectionManager.UserRemoved += ConnectionManager_UserRemoved; connectionManager.UserGameIndexUpdated += ConnectionManager_UserGameIndexUpdated; sndMessageSound = new EnhancedSoundEffect("message.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundMessageCooldown); sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav", 0.0, 0.0, ClientConfiguration.Instance.SoundPrivateMessageCooldown); sndMessageSound.Enabled = UserINISettings.Instance.MessageSound; GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited; }
public override void Initialize() { Name = "LANLobby"; BackgroundTexture = AssetLoader.LoadTexture("cncnetlobbybg.png"); ClientRectangle = new Rectangle(0, 0, WindowManager.RenderResolutionX - 64, WindowManager.RenderResolutionY - 64); localGame = ClientConfiguration.Instance.LocalGame; localGameIndex = gameCollection.GameList.FindIndex( g => g.InternalName.ToUpper() == localGame.ToUpper()); btnNewGame = new XNAClientButton(WindowManager); btnNewGame.Name = "btnNewGame"; btnNewGame.ClientRectangle = new Rectangle(12, ClientRectangle.Height - 35, 133, 23); btnNewGame.Text = "Create Game"; btnNewGame.LeftClick += BtnNewGame_LeftClick; btnJoinGame = new XNAClientButton(WindowManager); btnJoinGame.Name = "btnJoinGame"; btnJoinGame.ClientRectangle = new Rectangle(btnNewGame.ClientRectangle.Right + 12, btnNewGame.ClientRectangle.Y, 133, 23); btnJoinGame.Text = "Join Game"; btnJoinGame.LeftClick += BtnJoinGame_LeftClick; btnMainMenu = new XNAClientButton(WindowManager); btnMainMenu.Name = "btnMainMenu"; btnMainMenu.ClientRectangle = new Rectangle(ClientRectangle.Width - 145, btnNewGame.ClientRectangle.Y, 133, 23); btnMainMenu.Text = "Main Menu"; btnMainMenu.LeftClick += BtnMainMenu_LeftClick; btnForums = new LinkButton(WindowManager); btnForums.Name = "btnForums"; btnForums.ClientRectangle = new Rectangle(ClientRectangle.Width - 33, 12, 21, 21); btnForums.IdleTexture = AssetLoader.LoadTexture("forumsInactive.png"); btnForums.HoverTexture = AssetLoader.LoadTexture("forumsActive.png"); btnForums.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnForums.URL = ClientConfiguration.Instance.ForumURL; btnTwitter = new LinkButton(WindowManager); btnTwitter.Name = "btnTwitter"; btnTwitter.ClientRectangle = new Rectangle(ClientRectangle.Width - 61, 12, 21, 21); btnTwitter.IdleTexture = AssetLoader.LoadTexture("twitterInactive.png"); btnTwitter.HoverTexture = AssetLoader.LoadTexture("twitterActive.png"); btnTwitter.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnTwitter.URL = ClientConfiguration.Instance.TwitterURL; btnGooglePlus = new LinkButton(WindowManager); btnGooglePlus.Name = "btnGooglePlus"; btnGooglePlus.ClientRectangle = new Rectangle(ClientRectangle.Width - 89, 12, 21, 21); btnGooglePlus.IdleTexture = AssetLoader.LoadTexture("googlePlusInactive.png"); btnGooglePlus.HoverTexture = AssetLoader.LoadTexture("googlePlusActive.png"); btnGooglePlus.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnGooglePlus.URL = ClientConfiguration.Instance.GooglePlusURL; btnYoutube = new LinkButton(WindowManager); btnYoutube.Name = "btnYoutube"; btnYoutube.ClientRectangle = new Rectangle(ClientRectangle.Width - 117, 12, 21, 21); btnYoutube.IdleTexture = AssetLoader.LoadTexture("youtubeInactive.png"); btnYoutube.HoverTexture = AssetLoader.LoadTexture("youtubeActive.png"); btnYoutube.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnYoutube.URL = ClientConfiguration.Instance.YoutubeURL; btnFacebook = new LinkButton(WindowManager); btnFacebook.Name = "btnFacebook"; btnFacebook.ClientRectangle = new Rectangle(ClientRectangle.Width - 145, 12, 21, 21); btnFacebook.IdleTexture = AssetLoader.LoadTexture("facebookInactive.png"); btnFacebook.HoverTexture = AssetLoader.LoadTexture("facebookActive.png"); btnFacebook.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnFacebook.URL = ClientConfiguration.Instance.FacebookURL; btnModDB = new LinkButton(WindowManager); btnModDB.Name = "btnModDB"; btnModDB.ClientRectangle = new Rectangle(ClientRectangle.Width - 173, 12, 21, 21); btnModDB.IdleTexture = AssetLoader.LoadTexture("moddbInactive.png"); btnModDB.HoverTexture = AssetLoader.LoadTexture("moddbActive.png"); btnModDB.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnModDB.URL = ClientConfiguration.Instance.ModDBURL; btnHomepage = new LinkButton(WindowManager); btnHomepage.Name = "btnHomepage"; btnHomepage.ClientRectangle = new Rectangle(ClientRectangle.Width - 201, 12, 21, 21); btnHomepage.IdleTexture = AssetLoader.LoadTexture("homepageInactive.png"); btnHomepage.HoverTexture = AssetLoader.LoadTexture("homepageActive.png"); btnHomepage.HoverSoundEffect = AssetLoader.LoadSound("button.wav"); btnHomepage.URL = ClientConfiguration.Instance.HomepageURL; lbGameList = new GameListBox(WindowManager, localGame); lbGameList.Name = "lbGameList"; lbGameList.ClientRectangle = new Rectangle(btnNewGame.ClientRectangle.X, 41, btnJoinGame.ClientRectangle.Right - btnNewGame.ClientRectangle.X, btnNewGame.ClientRectangle.Top - 53); lbGameList.GameLifetime = 15.0; // Smaller lifetime in LAN lbGameList.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbGameList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbGameList.DoubleLeftClick += LbGameList_DoubleLeftClick; lbGameList.AllowMultiLineItems = false; lbPlayerList = new XNAListBox(WindowManager); lbPlayerList.Name = "lbPlayerList"; lbPlayerList.ClientRectangle = new Rectangle(ClientRectangle.Width - 202, lbGameList.ClientRectangle.Y, 190, lbGameList.ClientRectangle.Height); lbPlayerList.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbPlayerList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbPlayerList.LineHeight = 16; lbChatMessages = new ChatListBox(WindowManager); lbChatMessages.Name = "lbChatMessages"; lbChatMessages.ClientRectangle = new Rectangle(lbGameList.ClientRectangle.Right + 12, lbGameList.ClientRectangle.Y, lbPlayerList.ClientRectangle.Left - lbGameList.ClientRectangle.Right - 24, lbGameList.ClientRectangle.Height); lbChatMessages.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbChatMessages.LineHeight = 16; tbChatInput = new XNATextBox(WindowManager); tbChatInput.Name = "tbChatInput"; tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.X, btnNewGame.ClientRectangle.Y, lbChatMessages.ClientRectangle.Width, btnNewGame.ClientRectangle.Height); tbChatInput.MaximumTextLength = 200; tbChatInput.EnterPressed += TbChatInput_EnterPressed; lblColor = new XNALabel(WindowManager); lblColor.Name = "lblColor"; lblColor.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.X, 14, 0, 0); lblColor.FontIndex = 1; lblColor.Text = "YOUR COLOR:"; ddColor = new XNAClientDropDown(WindowManager); ddColor.Name = "ddColor"; ddColor.ClientRectangle = new Rectangle(lblColor.ClientRectangle.X + 95, 12, 150, 21); chatColors = new LANColor[] { new LANColor("Gray", Color.Gray), new LANColor("Metalic", Color.LightGray), new LANColor("Green", Color.Green), new LANColor("Lime Green", Color.LimeGreen), new LANColor("Green Yellow", Color.GreenYellow), new LANColor("Goldenrod", Color.Goldenrod), new LANColor("Yellow", Color.Yellow), new LANColor("Orange", Color.Orange), new LANColor("Red", Color.Red), new LANColor("Pink", Color.DeepPink), new LANColor("Purple", Color.MediumPurple), new LANColor("Sky Blue", Color.SkyBlue), new LANColor("Blue", Color.Blue), new LANColor("Brown", Color.SaddleBrown), new LANColor("Teal", Color.Teal) }; foreach (LANColor color in chatColors) { ddColor.AddItem(color.Name, color.XNAColor); } AddChild(btnNewGame); AddChild(btnJoinGame); AddChild(btnMainMenu); AddChild(btnForums); AddChild(btnTwitter); AddChild(btnGooglePlus); AddChild(btnYoutube); AddChild(btnFacebook); AddChild(btnModDB); AddChild(btnHomepage); AddChild(lbPlayerList); AddChild(lbChatMessages); AddChild(lbGameList); AddChild(tbChatInput); AddChild(lblColor); AddChild(ddColor); gameCreationWindow = new LANGameCreationWindow(WindowManager); var gameCreationPanel = new DarkeningPanel(WindowManager); AddChild(gameCreationPanel); gameCreationPanel.AddChild(gameCreationWindow); gameCreationWindow.Disable(); gameCreationWindow.NewGame += GameCreationWindow_NewGame; gameCreationWindow.LoadGame += GameCreationWindow_LoadGame; unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon); SoundEffect gameCreatedSoundEffect = AssetLoader.LoadSound("gamecreated.wav"); if (gameCreatedSoundEffect != null) { sndGameCreated = new ToggleableSound(gameCreatedSoundEffect.CreateInstance()); } encoding = Encoding.UTF8; base.Initialize(); CenterOnParent(); gameCreationPanel.SetPositionAndSize(); lanGameLobby = new LANGameLobby(WindowManager, "MultiplayerGameLobby", null, gameModes, chatColors); DarkeningPanel.AddAndInitializeWithControl(WindowManager, lanGameLobby); lanGameLobby.Disable(); lanGameLoadingLobby = new LANGameLoadingLobby(WindowManager, gameModes, chatColors); DarkeningPanel.AddAndInitializeWithControl(WindowManager, lanGameLoadingLobby); lanGameLoadingLobby.Disable(); int selectedColor = UserINISettings.Instance.LANChatColor; ddColor.SelectedIndex = selectedColor >= ddColor.Items.Count || selectedColor < 0 ? 0 : selectedColor; SetChatColor(); ddColor.SelectedIndexChanged += DdColor_SelectedIndexChanged; lanGameLobby.GameLeft += LanGameLobby_GameLeft; lanGameLobby.GameBroadcast += LanGameLobby_GameBroadcast; lanGameLoadingLobby.GameBroadcast += LanGameLoadingLobby_GameBroadcast; lanGameLoadingLobby.GameLeft += LanGameLoadingLobby_GameLeft; WindowManager.GameClosing += WindowManager_GameClosing; lbChatMessages.AddMessage(null, "Please note that LAN game support is currently work-in-progress. " + "While basic functionality should work, it is possible that you'll encounter various kinds of bugs and possibly even crashes. Please report all issues to the client lead developer (Rampastring) at " + "http://www.moddb.com/members/rampastring so we can fix the issues for future builds.", Color.Yellow); }
public override void Initialize() { ClientRectangle = new Rectangle(0, 0, WindowManager.RenderResolutionX - 64, WindowManager.RenderResolutionY - 64); Name = "CnCNetLobby"; BackgroundTexture = AssetLoader.LoadTexture("cncnetlobbybg.png"); localGameID = ClientConfiguration.Instance.LocalGame; localGame = gameCollection.GameList.Find(g => g.InternalName.ToUpper() == localGameID.ToUpper()); btnNewGame = new XNAClientButton(WindowManager); btnNewGame.Name = "btnNewGame"; btnNewGame.ClientRectangle = new Rectangle(12, ClientRectangle.Height - 29, 133, 23); btnNewGame.Text = "Create Game"; btnNewGame.AllowClick = false; btnNewGame.LeftClick += BtnNewGame_LeftClick; btnJoinGame = new XNAClientButton(WindowManager); btnJoinGame.Name = "btnJoinGame"; btnJoinGame.ClientRectangle = new Rectangle(btnNewGame.ClientRectangle.Right + 12, btnNewGame.ClientRectangle.Y, 133, 23); btnJoinGame.Text = "Join Game"; btnJoinGame.AllowClick = false; btnJoinGame.LeftClick += BtnJoinGame_LeftClick; btnLogout = new XNAClientButton(WindowManager); btnLogout.Name = "btnLogout"; btnLogout.ClientRectangle = new Rectangle(ClientRectangle.Width - 145, btnNewGame.ClientRectangle.Y, 133, 23); btnLogout.Text = "Log Out"; btnLogout.LeftClick += BtnLogout_LeftClick; lbGameList = new GameListBox(WindowManager, localGameID); lbGameList.Name = "lbGameList"; lbGameList.ClientRectangle = new Rectangle(btnNewGame.ClientRectangle.X, 41, btnJoinGame.ClientRectangle.Right - btnNewGame.ClientRectangle.X, btnNewGame.ClientRectangle.Top - 47); lbGameList.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbGameList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbGameList.DoubleLeftClick += LbGameList_DoubleLeftClick; lbGameList.AllowMultiLineItems = false; lbPlayerList = new XNAListBox(WindowManager); lbPlayerList.Name = "lbPlayerList"; lbPlayerList.ClientRectangle = new Rectangle(ClientRectangle.Width - 202, 20, 190, btnLogout.ClientRectangle.Top - 26); lbPlayerList.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbPlayerList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbPlayerList.LineHeight = 16; lbPlayerList.DoubleLeftClick += LbPlayerList_DoubleLeftClick; lbPlayerList.RightClick += LbPlayerList_RightClick; playerContextMenu = new PlayerContextMenu(WindowManager); playerContextMenu.Name = "playerContextMenu"; playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2); playerContextMenu.Enabled = false; playerContextMenu.Visible = false; playerContextMenu.AddItem("Private Message"); playerContextMenu.AddItem("Add Friend"); playerContextMenu.OptionSelected += PlayerContextMenu_OptionSelected; lbChatMessages = new ChatListBox(WindowManager); lbChatMessages.Name = "lbChatMessages"; lbChatMessages.ClientRectangle = new Rectangle(lbGameList.ClientRectangle.Right + 12, lbGameList.ClientRectangle.Y, lbPlayerList.ClientRectangle.Left - lbGameList.ClientRectangle.Right - 24, lbPlayerList.ClientRectangle.Height); lbChatMessages.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbChatMessages.LineHeight = 16; tbChatInput = new XNATextBox(WindowManager); tbChatInput.Name = "tbChatInput"; tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.X, btnNewGame.ClientRectangle.Y, lbChatMessages.ClientRectangle.Width, btnNewGame.ClientRectangle.Height); tbChatInput.Enabled = false; tbChatInput.MaximumTextLength = 200; tbChatInput.EnterPressed += TbChatInput_EnterPressed; lblColor = new XNALabel(WindowManager); lblColor.Name = "lblColor"; lblColor.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.X, 14, 0, 0); lblColor.FontIndex = 1; lblColor.Text = "YOUR COLOR:"; ddColor = new XNAClientDropDown(WindowManager); ddColor.Name = "ddColor"; ddColor.ClientRectangle = new Rectangle(lblColor.ClientRectangle.X + 95, 12, 150, 21); chatColors = connectionManager.GetIRCColors(); foreach (IRCColor color in connectionManager.GetIRCColors()) { if (!color.Selectable) { continue; } XNADropDownItem ddItem = new XNADropDownItem(); ddItem.Text = color.Name; ddItem.TextColor = color.XnaColor; ddItem.Tag = color; ddColor.AddItem(ddItem); } int selectedColor = UserINISettings.Instance.ChatColor; ddColor.SelectedIndex = selectedColor >= ddColor.Items.Count || selectedColor < 0 ? ClientConfiguration.Instance.DefaultPersonalChatColorIndex: selectedColor; SetChatColor(); ddColor.SelectedIndexChanged += DdColor_SelectedIndexChanged; ddCurrentChannel = new XNAClientDropDown(WindowManager); ddCurrentChannel.Name = "ddCurrentChannel"; ddCurrentChannel.ClientRectangle = new Rectangle( lbChatMessages.ClientRectangle.Right - 200, ddColor.ClientRectangle.Y, 200, 21); ddCurrentChannel.SelectedIndexChanged += DdCurrentChannel_SelectedIndexChanged; ddCurrentChannel.AllowDropDown = false; lblCurrentChannel = new XNALabel(WindowManager); lblCurrentChannel.Name = "lblCurrentChannel"; lblCurrentChannel.ClientRectangle = new Rectangle( ddCurrentChannel.ClientRectangle.X - 150, ddCurrentChannel.ClientRectangle.Y + 2, 0, 0); lblCurrentChannel.FontIndex = 1; lblCurrentChannel.Text = "CURRENT CHANNEL:"; InitializeGameList(); AddChild(btnNewGame); AddChild(btnJoinGame); AddChild(btnLogout); AddChild(lbPlayerList); AddChild(lbChatMessages); AddChild(lbGameList); AddChild(tbChatInput); AddChild(lblColor); AddChild(ddColor); AddChild(lblCurrentChannel); AddChild(ddCurrentChannel); AddChild(playerContextMenu); base.Initialize(); WindowManager.CenterControlOnScreen(this); PostUIInit(); }