public override void Initialize() { Name = "MultiplayerGameLobby"; base.Initialize(); InitPlayerOptionDropdowns(); ReadyBoxes = new XNACheckBox[MAX_PLAYER_COUNT]; int readyBoxX = GameOptionsIni.GetIntValue(Name, "PlayerReadyBoxX", 7); int readyBoxY = GameOptionsIni.GetIntValue(Name, "PlayerReadyBoxY", 4); for (int i = 0; i < MAX_PLAYER_COUNT; i++) { XNACheckBox chkPlayerReady = new XNACheckBox(WindowManager); chkPlayerReady.Name = "chkPlayerReady" + i; chkPlayerReady.Checked = false; chkPlayerReady.AllowChecking = false; chkPlayerReady.ClientRectangle = new Rectangle(readyBoxX, ddPlayerTeams[i].ClientRectangle.Y + readyBoxY, 0, 0); PlayerOptionsPanel.AddChild(chkPlayerReady); chkPlayerReady.DisabledClearTexture = chkPlayerReady.ClearTexture; chkPlayerReady.DisabledCheckedTexture = chkPlayerReady.CheckedTexture; ReadyBoxes[i] = chkPlayerReady; ddPlayerSides[i].AddItem("Spectator", AssetLoader.LoadTexture("spectatoricon.png")); } ddGameMode.ClientRectangle = new Rectangle( MapPreviewBox.ClientRectangle.X - 12 - ddGameMode.ClientRectangle.Width, MapPreviewBox.ClientRectangle.Y, ddGameMode.ClientRectangle.Width, ddGameMode.ClientRectangle.Height); lblGameModeSelect.ClientRectangle = new Rectangle( btnLaunchGame.ClientRectangle.X, ddGameMode.ClientRectangle.Y + 1, lblGameModeSelect.ClientRectangle.Width, lblGameModeSelect.ClientRectangle.Height); lbMapList.ClientRectangle = new Rectangle(btnLaunchGame.ClientRectangle.X, MapPreviewBox.ClientRectangle.Y + 23, MapPreviewBox.ClientRectangle.X - btnLaunchGame.ClientRectangle.X - 12, MapPreviewBox.ClientRectangle.Height - 23); lbChatMessages = new ChatListBox(WindowManager); lbChatMessages.Name = "lbChatMessages"; lbChatMessages.ClientRectangle = new Rectangle(lbMapList.ClientRectangle.Left, GameOptionsPanel.ClientRectangle.Y, lbMapList.ClientRectangle.Width, GameOptionsPanel.ClientRectangle.Height - 24); lbChatMessages.DrawMode = PanelBackgroundImageDrawMode.STRETCHED; lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1); lbChatMessages.LineHeight = 16; tbChatInput = new XNASuggestionTextBox(WindowManager); tbChatInput.Name = "tbChatInput"; tbChatInput.Suggestion = "Type here to chat.."; tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.ClientRectangle.Left, lbChatMessages.ClientRectangle.Bottom + 3, lbChatMessages.ClientRectangle.Width, 21); tbChatInput.MaximumTextLength = 150; tbChatInput.EnterPressed += TbChatInput_EnterPressed; btnLockGame = new XNAClientButton(WindowManager); btnLockGame.Name = "btnLockGame"; btnLockGame.ClientRectangle = new Rectangle(btnLaunchGame.ClientRectangle.Right + 12, btnLaunchGame.ClientRectangle.Y, 133, 23); btnLockGame.Text = "Lock Game"; btnLockGame.LeftClick += BtnLockGame_LeftClick; AddChildToFirstIndex(lbChatMessages); AddChildToFirstIndex(tbChatInput); AddChild(btnLockGame); MapPreviewBox.LocalStartingLocationSelected += MapPreviewBox_LocalStartingLocationSelected; MapPreviewBox.StartingLocationApplied += MapPreviewBox_StartingLocationApplied; InitializeWindow(); sndJoinSound = new PrioritizedSound("joingame.wav"); sndLeaveSound = new PrioritizedSound("leavegame.wav"); sndMessageSound = new PrioritizedSound("message.wav"); sndGetReadySound = new PrioritizedSound("getready.wav", 0.0, 0.0, 5.0f); if (SavedGameManager.AreSavedGamesAvailable()) { fsw = new FileSystemWatcher(ProgramConstants.GamePath + "Saved Games", "*.NET"); fsw.EnableRaisingEvents = false; fsw.Created += fsw_Created; fsw.Changed += fsw_Created; } else { Logger.Log("MultiplayerGameLobby: Saved games are not available!"); } CenterOnParent(); // To move the lblMapAuthor label into its correct position // if it was moved in the theme description INI file LoadDefaultMap(); }