示例#1
0
        public ScoreboardOneVsOneWins(Scoreboard scoreboard)
        {
            Scoreboard = scoreboard;
            Size       = new ScalableVector2(260, 34);
            Image      = UserInterface.WinsPanel;

            var myWins = OnlineManager.CurrentGame.PlayerWins.Find(x => x.UserId == OnlineManager.Self.OnlineUser.Id);

            var myWinCount = 0;

            if (myWins != null)
            {
                myWinCount = myWins.Wins;
            }

            SelfWins = new SpriteTextBitmap(FontsBitmap.GothamRegular, myWinCount.ToString())
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                X         = Spacing,
                FontSize  = 18,
                Tint      = new Color(249, 13, 63)
            };

            var otherPlayerScore = MapManager.Selected.Value.Scores.Value.First();

            var otherWins = 0;

            if (otherPlayerScore != null)
            {
                var otherPlayerWinCount = OnlineManager.CurrentGame.PlayerWins.Find(x => x.UserId == otherPlayerScore.PlayerId);

                if (otherPlayerWinCount != null)
                {
                    otherWins = otherPlayerWinCount.Wins;
                }
            }

            OtherWins = new SpriteTextBitmap(FontsBitmap.GothamRegular, otherWins.ToString())
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                X         = -Spacing,
                FontSize  = 18,
                Tint      = new Color(13, 148, 253)
            };
        }
        public ScoreboardBattleRoyaleBanner(Scoreboard scoreboard)
        {
            Scoreboard = scoreboard;
            Size       = new ScalableVector2(260, 34);
            Image      = UserInterface.BattleRoyalePanel;

            PlayersLeft = new SpriteTextBitmap(FontsBitmap.GothamRegular, Scoreboard.BattleRoyalePlayersLeft + " Left")
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                FontSize  = 18,
                X         = 52
            };

            TimeLeft = new SpriteTextBitmap(FontsBitmap.GothamRegular, "-00:00", false)
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                FontSize  = 18,
                X         = 184
            };

            Scoreboard.BattleRoyalePlayersLeft.ValueChanged += OnBattleRoyaleRoyalePlayersLeftChanged;
        }
        public ScoreboardTeamBanner(Scoreboard scoreboard)
        {
            Scoreboard = scoreboard;
            Size       = new ScalableVector2(260, 34);

            // Set the correct image to use
            switch (Scoreboard.Team)
            {
            case MultiplayerTeam.Red:
                Image = UserInterface.TeamBannerRed;
                break;

            case MultiplayerTeam.Blue:
                Image = UserInterface.TeamBannerBlue;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            var pointsContainer = new Sprite()
            {
                Parent    = this,
                Size      = new ScalableVector2(48, 30),
                Alignment = Alignment.MidLeft,
                Alpha     = 0,
            };

            pointsContainer.X = Scoreboard.Team == MultiplayerTeam.Blue ? Width - 1 - pointsContainer.Width : 0;

            Points = new SpriteTextBitmap(FontsBitmap.GothamRegular, "0")
            {
                Parent    = pointsContainer,
                Alignment = Alignment.MidCenter,
                FontSize  = 18
            };

            switch (Scoreboard.Team)
            {
            case MultiplayerTeam.Red:
                Points.Text = OnlineManager.CurrentGame.RedTeamWins.ToString();
                break;

            case MultiplayerTeam.Blue:
                Points.Text = OnlineManager.CurrentGame.BlueTeamWins.ToString();
                break;
            }

            var ratingContainer = new Sprite()
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                Size      = new ScalableVector2(60, 30),
                Alpha     = 0
            };

            ratingContainer.X = Scoreboard.Team == MultiplayerTeam.Blue ? -Width + 1 + ratingContainer.Width : 0;

            TeamRating = new SpriteTextBitmap(FontsBitmap.GothamRegular, "0.00", false)
            {
                Parent    = ratingContainer,
                Alignment = Alignment.MidCenter,
                FontSize  = 17
            };

            OnlineManager.Client.OnGameTeamWinCount += OnTeamWinCountChanged;
        }