public void OptionsClosed() { UpdateReadyOrHost(); if (OnlineGameClient != null) { ReadyButton.Disable(); OnlineGameClient.Host.Send(new AskChangeMapScriptClient(Room.MapName, Room.MapType, Room.MapPath, Room.MinNumberOfPlayer, Room.MaxNumberOfPlayer)); } }
public void UpdateReadyOrHost() { AssignButtons(); if (IsHost) { bool IsEveryoneReady = true; foreach (BattleMapPlayer ActivePlayer in Room.ListRoomPlayer) { if (ActivePlayer.OnlinePlayerType != BattleMapPlayer.PlayerTypeHost && ActivePlayer.OnlinePlayerType != BattleMapPlayer.PlayerTypeReady) { IsEveryoneReady = false; } } if (IsEveryoneReady && Room.MapPath != null) { StartButton.Enable(); } else { StartButton.Disable(); } } else { ReadyButton.Enable(); } }
public override void Load() { #region Ressources sndBGM = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/Music/Wait Room.mp3"); sndBGM.SetLoop(true); sndBGM.PlayAsBGM(); sndButtonOver = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/SFX/Button Over.wav"); sndButtonClick = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/SFX/Button Click.wav"); fntText = Content.Load <SpriteFont>("Fonts/Arial10"); ChatInput = new TextInput(fntText, sprPixel, sprPixel, new Vector2(68, 518), new Vector2(470, 20), SendMessage); fntTest = Content.Load <Texture2D>("Triple Thunder/HUD/Menus/Numbers White"); sprHostText = Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Player Host Text"); sprReadyText = Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Player Ready Text"); int LeftSideWidth = (int)(Constants.Width * 0.7); int RoomNameHeight = (int)(Constants.Height * 0.05); int PlayerZoneY = RoomNameHeight; int PlayerZoneHeight = (int)(Constants.Height * 0.65); int ChatZoneY = PlayerZoneY + PlayerZoneHeight; int ChatZoneHeight = Constants.Height - ChatZoneY; int RightSideWidth = Constants.Width - LeftSideWidth; int MapDetailTextY = (int)(Constants.Height * 0.3); int MapDetailTextHeight = (int)(Constants.Height * 0.3); int RoomOptionWidth = (int)((RightSideWidth - 15) * 0.5); int RoomOptionHeight = (int)(Constants.Height * 0.08); RoomSettingButton = new BoxButton(new Rectangle(LeftSideWidth + 5, MapDetailTextY + 5, RoomOptionWidth, RoomOptionHeight), fntText, "Room Settings", OnButtonOver, OpenRoomSettingsScreen); PlayerSettingsButton = new BoxButton(new Rectangle(LeftSideWidth + 5 + RoomOptionWidth + 5, MapDetailTextY + 5, RoomOptionWidth, RoomOptionHeight), fntText, "Player Settings", OnButtonOver, PlayerSettingsScreen); ReadyButton = new BoxButton(new Rectangle(LeftSideWidth + 5, Constants.Height - RoomOptionHeight - 5, RoomOptionWidth, RoomOptionHeight), fntText, "Ready", OnButtonOver, Ready); StartButton = new BoxButton(new Rectangle(LeftSideWidth + 5, Constants.Height - RoomOptionHeight - 5, RoomOptionWidth, RoomOptionHeight), fntText, "Start", OnButtonOver, StartGame); BackToLobbyButton = new BoxButton(new Rectangle(LeftSideWidth + 5 + RoomOptionWidth + 5, Constants.Height - RoomOptionHeight - 5, RoomOptionWidth, RoomOptionHeight), fntText, "Leave", OnButtonOver, ReturnToLobby); sprTabChat = new AnimatedSprite(Content, "Triple Thunder/Menus/Channel/Tab Chat", new Vector2(0, 0), 0, 1, 4); #endregion StartButton.Disable(); UpdateReadyOrHost(); ListMapTeam = new List <Color>(); ListAllTeamInfo = new List <TeamInfo>(); ListAllTeamInfo.Add(new TeamInfo("Blue Team", Color.Blue)); ListAllTeamInfo.Add(new TeamInfo("Red Team", Color.Red)); ListAllTeamInfo.Add(new TeamInfo("Green Team", Color.Green)); ListAllTeamInfo.Add(new TeamInfo("Yellow Team", Color.Yellow)); sprMapImage = Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Map Icons/Random"); }
public void CreateRoom() { sndButtonClick.Play(); OKButton.Disable(); if (OnlineGameClient != null && OnlineGameClient.IsConnected) { Dictionary <string, OnlineScript> DicCreateRoomScript = new Dictionary <string, OnlineScript>(); DicCreateRoomScript.Add(SendRoomIDScriptClient.ScriptName, new SendRoomIDScriptClient(OnlineGameClient, OnlineCommunicationClient, this, RoomNameInput.Text, RoomType, RoomSubtype, MinNumberOfPlayer, MaxNumberOfPlayer)); OnlineGameClient.Host.AddOrReplaceScripts(DicCreateRoomScript); OnlineGameClient.CreateRoom(RoomNameInput.Text, RoomType, RoomSubtype, MinNumberOfPlayer, MaxNumberOfPlayer); } else { PushScreen(new GamePreparationScreen(null, null, new PVPRoomInformations("No ID needed", RoomNameInput.Text, RoomType, RoomSubtype, MinNumberOfPlayer, MaxNumberOfPlayer))); RemoveScreen(this); } }
public override void Load() { fntText = Content.Load <SpriteFont>("Fonts/Arial10"); sndButtonOver = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/SFX/Button Over.wav"); sndButtonClick = new FMODSound(FMODSystem, "Content/Triple Thunder/Menus/SFX/Button Click.wav"); ArrayOptionTab = new GameScreen[5]; ArrayOptionTab[0] = new GameOptionsGametypeScreen(Room, this); ArrayOptionTab[1] = SelectMapScreen = new GameOptionsSelectMapScreen(Room, this, Owner); ArrayOptionTab[2] = SelectGameRuleScreen = new GameOptionsGameRulesScreen(Room); ArrayOptionTab[3] = new GameOptionsMutatorsScreen(Room, this); ArrayOptionTab[4] = new GameOptionsBotConfigScreen(Room); for (int T = 0; T < ArrayOptionTab.Length; ++T) { ArrayOptionTab[T].Load(); } ActiveTab = ArrayOptionTab[0]; int HeaderHeight = (int)(Constants.Height * 0.05); int TabSectionY = HeaderHeight; int TabSectionHeight = (int)(Constants.Height * 0.06); int TabY = TabSectionY + (int)(Constants.Height * 0.005); int TabWidth = (int)(Constants.Height * 0.15); int TabHeight = (int)(Constants.Height * 0.05); int TabOffset = (int)(Constants.Height * 0.05); int X = 10 + 0 * (TabWidth + TabOffset); GametypeButton = new BoxButton(new Rectangle(X, TabY, TabWidth, TabHeight), fntText, ArrayOptionTab[0].ToString(), OnButtonOver, OnGametypePressed); X = 10 + 1 * (TabWidth + TabOffset); SelectMapButton = new BoxButton(new Rectangle(X, TabY, TabWidth, TabHeight), fntText, ArrayOptionTab[1].ToString(), OnButtonOver, OnSelectMapPressed); X = 10 + 2 * (TabWidth + TabOffset); GameRulesButton = new BoxButton(new Rectangle(X, TabY, TabWidth, TabHeight), fntText, ArrayOptionTab[2].ToString(), OnButtonOver, OnGameRulePressed); X = 10 + 3 * (TabWidth + TabOffset); MutatorsButton = new BoxButton(new Rectangle(X, TabY, TabWidth, TabHeight), fntText, ArrayOptionTab[3].ToString(), OnButtonOver, OnMutatorPressed); X = 10 + 4 * (TabWidth + TabOffset); BotsConfigButton = new BoxButton(new Rectangle(X, TabY, TabWidth, TabHeight), fntText, ArrayOptionTab[4].ToString(), OnButtonOver, OnBotsConfigPressed); int CloseButtonX = (int)(Constants.Width * 0.86); int CloseButtonY = (int)(Constants.Height * 0.92); int CloseButtonWidth = (int)(Constants.Width * 0.12); int CloseButtonHeight = (int)(Constants.Height * 0.06); CloseButton = new BoxButton(new Rectangle(CloseButtonX, CloseButtonY, CloseButtonWidth, CloseButtonHeight), fntText, "Close", OnButtonOver, OnClosePressed); GametypeButton.CanBeChecked = true; SelectMapButton.CanBeChecked = true; GameRulesButton.CanBeChecked = true; MutatorsButton.CanBeChecked = true; BotsConfigButton.CanBeChecked = true; GametypeButton.Select(); SelectMapButton.Disable(); GameRulesButton.Disable(); MutatorsButton.Disable(); BotsConfigButton.Disable(); ArrayUIElement = new IUIElement[] { GametypeButton, SelectMapButton, GameRulesButton, MutatorsButton, BotsConfigButton, CloseButton, }; }