Esempio n. 1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public LobbyScreenView(LobbyScreen screen) : base(screen)
        {
            LobbyScreen = screen;

            CreateBackground();
            CreateHeader();
            CreateFooter();

            Visualizer = new MenuAudioVisualizer((int)WindowManager.Width, 400, 150, 5)
            {
                Parent    = Container,
                Alignment = Alignment.BotLeft,
                Y         = -Footer.Height
            };

            Visualizer.Bars.ForEach(x =>
            {
                x.Alpha = 0.30f;
            });

            CreateSearchBox();
            CreateMatchContainer();

            Jukebox = new Jukebox(true);

            FilterBackground = new Sprite()
            {
                Parent   = Container,
                Position = new ScalableVector2(-Searchbox.X, Searchbox.Y),
                Size     = new ScalableVector2(762, Searchbox.Height),
                Tint     = Color.Black,
                Alpha    = 0.75f
            };

            FilterBackground.AddBorder(Color.White, 2);

            const float spacing = 60f;

            var locked = new LabelledCheckbox("Display Locked", ConfigManager.LobbyFilterHasPassword)
            {
                Parent    = FilterBackground,
                Alignment = Alignment.MidLeft,
                X         = 14
            };

            var full = new LabelledCheckbox("Display Full", ConfigManager.LobbyFilterFullGame)
            {
                Parent    = FilterBackground,
                Alignment = Alignment.MidLeft,
                X         = locked.X + locked.Width + spacing
            };

            var owned = new LabelledCheckbox("Map Downloaded", ConfigManager.LobbyFilterOwnsMap)
            {
                Parent    = FilterBackground,
                Alignment = Alignment.MidLeft,
                X         = full.X + full.Width + spacing
            };

            var friends = new LabelledCheckbox("Friends In Game", ConfigManager.LobbyFilterHasFriends)
            {
                Parent    = FilterBackground,
                Alignment = Alignment.MidLeft,
                X         = owned.X + owned.Width + spacing
            };

            ConfigManager.LobbyFilterHasPassword.ValueChanged += RefilterGames;
            ConfigManager.LobbyFilterFullGame.ValueChanged    += RefilterGames;
            ConfigManager.LobbyFilterOwnsMap.ValueChanged     += RefilterGames;
            ConfigManager.LobbyFilterHasFriends.ValueChanged  += RefilterGames;
        }
 /// <summary>
 ///     Creates the audio visaulizer container for the screen
 /// </summary>12
 private void CreateAudioVisualizer() => Visualizer = new MenuAudioVisualizer((int)WindowManager.Width, 400, 150, 5)
 {
     Parent    = Container,
     Alignment = Alignment.BotLeft
 };
Esempio n. 3
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public MultiplayerScreenView(MultiplayerScreen screen) : base(screen)
        {
            MultiplayerScreen = screen;

            CreateBackground();
            CreateHeader();
            CreateFooter();

            Visualizer = new MenuAudioVisualizer((int)WindowManager.Width, 400, 150, 5)
            {
                Parent    = Container,
                Alignment = Alignment.BotLeft,
                Y         = -Footer.Height
            };

            Visualizer.Bars.ForEach(x =>
            {
                x.Alpha = 0.30f;
            });

            CreateGameTitleHeader();
            CreateMap();
            CreateSettings();

            PlayerListHeader = new PlayerListHeader(MultiplayerScreen.Game)
            {
                Parent    = Container,
                Alignment = Alignment.TopRight,
                X         = -24,
                Y         = Header.Height + 20
            };

            // Get a list of all the online users in the game from the player ids.
            var players = new List <OnlineUser>();

            MultiplayerScreen.Game.PlayerIds.ForEach(x =>
            {
                if (!players.Contains(OnlineManager.OnlineUsers[x].OnlineUser))
                {
                    players.Add(OnlineManager.OnlineUsers[x].OnlineUser);
                }
            });

            PlayerList = new PlayerList(players, int.MaxValue, 0,
                                        new ScalableVector2(PlayerListHeader.Width, 600),
                                        new ScalableVector2(PlayerListHeader.Width, 600))
            {
                Parent    = Container,
                Alignment = Alignment.TopRight,
                Position  = new ScalableVector2(-24, PlayerListHeader.Y + PlayerListHeader.Height + 10)
            };

            Feed = new MultiplayerFeed()
            {
                Parent    = Container,
                Alignment = Alignment.BotLeft,
                Position  = new ScalableVector2(24, -Footer.Height - 24)
            };

            OnlineManager.Client.OnUserJoinedGame      += OnUserJoinedGame;
            OnlineManager.Client.OnUserLeftGame        += OnUserLeftGame;
            OnlineManager.Client.OnChatMessageReceived += OnChatMessageReceived;
            BackgroundHelper.Blurred += OnBackgroundBlurred;
        }