Ejemplo n.º 1
0
        private void AssignButtons()
        {
            IsHost = false;
            foreach (BattleMapPlayer ActivePlayer in Room.GetLocalPlayers())
            {
                if (ActivePlayer.IsHost())
                {
                    IsHost = true;
                }
            }

            List <IUIElement> ListButton = new List <IUIElement>()
            {
                RoomSettingButton, PlayerSettingsButton,
                BackToLobbyButton,
            };

            if (IsHost)
            {
                ListButton.Add(StartButton);
            }
            else
            {
                ListButton.Add(ReadyButton);
            }

            ArrayMenuButton = ListButton.ToArray();
        }
Ejemplo n.º 2
0
        private void AssignButtons()
        {
            IsHost = false;
            foreach (Player ActivePlayer in Room.GetLocalPlayers())
            {
                if (ActivePlayer.IsHost())
                {
                    IsHost = true;
                }
            }

            if (IsHost)
            {
                ArrayMenuButton = new InteractiveButton[]
                {
                    ChangeRoomNameButton, CharacterSelectButton, ActivateItemButton, WeaponLimitButton,
                    MapSelectButton, ModeSelectButton, MatchTypeButton,
                    RedTeamButton, BlueTeamButton, KillPlusButton, KillMinusButton, TimePlusButton, TimeMinusButton,
                    InviteButton, BackToLobbyButton, StartButton,
                };
            }
            else
            {
                ArrayMenuButton = new InteractiveButton[]
                {
                    ChangeRoomNameButton, CharacterSelectButton, ActivateItemButton, WeaponLimitButton,
                    MapSelectButton, ModeSelectButton, MatchTypeButton,
                    RedTeamButton, BlueTeamButton, KillPlusButton, KillMinusButton, TimePlusButton, TimeMinusButton,
                    InviteButton, BackToLobbyButton, ReadyButton,
                };
            }
        }
        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");

            sprBackground = Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Background Mission");
            sprHostText   = Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Player Host Text");
            sprReadyText  = Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Player Ready Text");

            DicCharacterIconByName = new Dictionary <string, Texture2D>();
            foreach (string ActiveCharacterPath in Directory.EnumerateFiles("Content/Triple Thunder/Menus/Wait Room/Character Icons/", "*"))
            {
                string ActiveCharacter = ActiveCharacterPath.Remove(0, 55);
                ActiveCharacter = ActiveCharacter.Remove(ActiveCharacter.Length - 4);
                DicCharacterIconByName.Add(ActiveCharacter, Content.Load <Texture2D>("Triple Thunder/Menus/Wait Room/Character Icons/" + ActiveCharacter));
            }

            sprActivePlayerIcon = DicCharacterIconByName["Jack"];

            ChangeRoomNameButton  = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Change Room Name Button", new Vector2(350, 17), OnButtonOver, null);
            CharacterSelectButton = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Character Select Button", new Vector2(678, 160), OnButtonOver, OpenCharacterSelectScreen);
            ActivateItemButton    = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Activate Item Button", new Vector2(628, 202), OnButtonOver, null);
            InviteButton          = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Invite Button", new Vector2(490, 30), OnButtonOver, null);
            QuestEasyButton       = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Quest Easy Button", new Vector2(230, 67), OnButtonOver, OnEasySelected);
            QuestNormalButton     = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Quest Normal Button", new Vector2(340, 67), OnButtonOver, OnNormalSelected);
            QuestHardButton       = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Quest Hard Button", new Vector2(480, 67), OnButtonOver, OnHardSelected);
            ReadyButton           = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Ready Button", new Vector2(680, 500), 8, OnButtonOver, Ready);
            StartButton           = new InteractiveButton(Content, "Triple Thunder/Menus/Wait Room/Start Button", new Vector2(680, 500), OnButtonOver, StartGame);
            BackToLobbyButton     = new InteractiveButton(Content, "Triple Thunder/Menus/Common/Back To Lobby", new Vector2(678, 565),
                                                          "Triple Thunder/Menus/Common/Back Arrow Icon", new Vector2(-86, 0), 6, OnButtonOver, ReturnToLobby);

            PlayerInfo        = new AnimatedSprite(Content, "Triple Thunder/Menus/Wait Room/Player Info", new Vector2(0, 0), 0, 1, 3);
            PlayerInfoOutline = new AnimatedSprite(Content, "Triple Thunder/Menus/Wait Room/Player Info Outline", new Vector2(0, 0), 0, 1, 4);
            PlayerInfoOutline.SetFrame(2);

            QuestButton        = new AnimatedSprite(Content, "Triple Thunder/Menus/Wait Room/Quest Button", new Vector2(0, 0), 0, 1, 3);
            QuestOutlineButton = new AnimatedSprite(Content, "Triple Thunder/Menus/Wait Room/Quest Button Outline", new Vector2(0, 0), 0, 1, 4);
            QuestOutlineButton.SetFrame(2);

            QuestEasyButton.CanBeChecked   = true;
            QuestNormalButton.CanBeChecked = true;
            QuestHardButton.CanBeChecked   = true;

            IsHost = false;
            foreach (Player ActivePlayer in Room.GetLocalPlayers())
            {
                if (ActivePlayer.IsHost())
                {
                    IsHost = true;
                }
            }

            if (IsHost)
            {
                ArrayMenuButton = new InteractiveButton[]
                {
                    ChangeRoomNameButton, CharacterSelectButton, ActivateItemButton, InviteButton,
                    QuestEasyButton, QuestNormalButton, QuestHardButton,
                    BackToLobbyButton, StartButton,
                };
            }
            else
            {
                ArrayMenuButton = new InteractiveButton[]
                {
                    ChangeRoomNameButton, CharacterSelectButton, ActivateItemButton, InviteButton,
                    QuestEasyButton, QuestNormalButton, QuestHardButton,
                    BackToLobbyButton, ReadyButton,
                };
            }

            #endregion

            ChangeDifficulty(Room.CurrentDifficulty);

            if (IsHost)
            {
                UpdateSelectedMission(ListMissionInfo[0]);
            }
            else if (string.IsNullOrEmpty(Room.MapPath))
            {
                UpdateSelectedMap(Room.CurrentDifficulty, ListMissionInfo[0].MissionPath);
            }
            else
            {
                UpdateSelectedMap(Room.CurrentDifficulty, Room.MapPath);
            }

            foreach (Player ActivePlayer in Room.ListRoomPlayer)
            {
                ActivePlayer.CharacterPreview = new RobotAnimation("Players/" + ActivePlayer.Equipment.CharacterType, null, Vector2.Zero, 0, new PlayerEquipment(), new MuteSFXGenerator(), new List <Weapon>());
            }
        }