コード例 #1
0
        public void SetInfo(GenericHostedGame game)
        {
            lblGameMode.Text = Renderer.GetStringWithLimitedWidth("Game mode: " + Renderer.GetSafeString(game.GameMode, lblGameMode.FontIndex),
                                                                  lblGameMode.FontIndex, Width - lblGameMode.X * 2);
            lblGameMode.Visible = true;
            lblMap.Text         = Renderer.GetStringWithLimitedWidth("Map: " + Renderer.GetSafeString(game.Map, lblMap.FontIndex),
                                                                     lblMap.FontIndex, Width - lblMap.X * 2);
            lblMap.Visible         = true;
            lblGameVersion.Text    = "Game version: " + Renderer.GetSafeString(game.GameVersion, lblGameVersion.FontIndex);
            lblGameVersion.Visible = true;
            lblHost.Text           = "Host: " + Renderer.GetSafeString(game.HostName, lblHost.FontIndex);
            lblHost.Visible        = true;
            lblPing.Text           = game.Ping > 0 ? "Ping: " + game.Ping.ToString() + " ms" : "Ping: Unknown";
            lblPing.Visible        = true;
            lblPlayers.Visible     = true;
            lblPlayers.Text        = "Players (" + game.Players.Length + " / " + game.MaxPlayers + "):";

            for (int i = 0; i < game.Players.Length; i++)
            {
                lblPlayerNames[i].Visible = true;
                lblPlayerNames[i].Text    = Renderer.GetSafeString(game.Players[i], lblPlayerNames[i].FontIndex);
            }

            for (int i = game.Players.Length; i < MAX_PLAYERS; i++)
            {
                lblPlayerNames[i].Visible = false;
            }
        }
コード例 #2
0
        private void AddGameToList(GenericHostedGame hg)
        {
            int lgTextWidth  = hg.IsLoadedGame ? loadedGameTextWidth : 0;
            int maxTextWidth = Width - hg.Game.Texture.Width -
                               (hg.Incompatible ? txIncompatibleGame.Width : 0) -
                               (hg.Locked ? txLockedGame.Width : 0) - (hg.Passworded ? txPasswordedGame.Width : 0) -
                               (ICON_MARGIN * 3) - GetScrollBarWidth() - lgTextWidth;

            var lbItem = new XNAListBoxItem();

            lbItem.Tag  = hg;
            lbItem.Text = Renderer.GetStringWithLimitedWidth(Renderer.GetSafeString(
                                                                 hg.RoomName, FontIndex), FontIndex, maxTextWidth);

            if (hg.Game.InternalName != localGameIdentifier.ToLower())
            {
                lbItem.TextColor = UISettings.ActiveSettings.TextColor;
            }
            //else // made unnecessary by new Rampastring.XNAUI
            //    lbItem.TextColor = UISettings.ActiveSettings.AltColor;

            if (hg.Incompatible || hg.Locked)
            {
                lbItem.TextColor = Color.Gray;
            }

            AddItem(lbItem);
        }
コード例 #3
0
        /// <summary>
        /// Sorts and refreshes the game information in the game list box.
        /// </summary>
        public void SortAndRefreshHostedGames()
        {
            GenericHostedGame selectedGame = null;

            if (SelectedIndex > -1 && SelectedIndex < HostedGames.Count)
            {
                selectedGame = HostedGames[SelectedIndex];
            }

            Refresh();

            if (selectedGame != null)
            {
                SelectedIndex = HostedGames.FindIndex(hg => hg == selectedGame);
            }
        }
コード例 #4
0
        /// <summary>
        /// Adds a game to the game list.
        /// </summary>
        /// <param name="game">The game to add.</param>
        public void AddGame(GenericHostedGame game)
        {
            GenericHostedGame selectedGame = null;

            if (SelectedIndex > -1 && SelectedIndex < HostedGames.Count)
            {
                selectedGame = HostedGames[SelectedIndex];
            }

            HostedGames.Add(game);

            Refresh();

            if (selectedGame != null)
            {
                SelectedIndex = HostedGames.FindIndex(hg => hg == selectedGame);
            }
        }
コード例 #5
0
        /// <summary>
        /// Sorts and refreshes the game information in the game list box.
        /// </summary>
        public void SortAndRefreshHostedGames()
        {
            GenericHostedGame selectedGame = null;

            if (SelectedIndex > -1 && SelectedIndex < HostedGames.Count)
            {
                selectedGame = HostedGames[SelectedIndex];
            }

            HostedGames = HostedGames.OrderBy(hg => hg.Passworded).OrderBy(hg =>
                                                                           hg.GameVersion != ProgramConstants.GAME_VERSION).OrderBy(hg =>
                                                                                                                                    hg.Game.InternalName.ToUpper() == localGameIdentifier.ToUpper()).OrderBy(hg =>
                                                                                                                                                                                                             hg.Locked).ToList();

            Refresh();

            if (selectedGame != null)
            {
                SelectedIndex = HostedGames.FindIndex(hg => hg == selectedGame);
            }
        }
コード例 #6
0
        private void AddGameToList(GenericHostedGame hg)
        {
            var lbItem = new XNAListBoxItem();

            lbItem.Tag  = hg;
            lbItem.Text = Renderer.GetSafeString(hg.RoomName, FontIndex);
            if (hg.Game.InternalName == localGameIdentifier.ToLower())
            {
                lbItem.TextColor = UISettings.AltColor;
            }
            else
            {
                lbItem.TextColor = UISettings.TextColor;
            }

            if (hg.Incompatible || hg.Locked)
            {
                lbItem.TextColor = Color.Gray;
            }

            AddItem(lbItem);
        }
コード例 #7
0
 public override bool Equals(GenericHostedGame other) =>
 other is HostedCnCNetGame hostedCnCNetGame?
コード例 #8
0
        /// <summary>
        /// Adds a game to the game list.
        /// </summary>
        /// <param name="game">The game to add.</param>
        public void AddGame(GenericHostedGame game)
        {
            HostedGames.Add(game);

            Refresh();
        }