public ResultMultiplayerScoreboardList(ResultMultiplayerScoreboardTableHeader header, List <ScoreboardUser> availableItems,
                                               ScalableVector2 size, bool startFromBottom = false) : base(availableItems, int.MaxValue, 0, size, size, startFromBottom)
        {
            TableHeader          = header;
            Scrollbar.Tint       = ColorHelper.HexToColor("#eeeeee");
            Scrollbar.Width      = 6;
            Scrollbar.X          = 14;
            ScrollSpeed          = 150;
            EasingType           = Easing.OutQuint;
            TimeToCompleteScroll = 1500;
            InputEnabled         = true;
            Alpha = 0;

            switch (OnlineManager.CurrentGame.Ruleset)
            {
            case MultiplayerGameRuleset.Team:
                AvailableItems = availableItems.OrderBy(x => x.Scoreboard.Team).ThenBy(x => x.Rank).ToList();
                break;

            default:
                AvailableItems = availableItems.OrderBy(x => x.Rank).ToList();
                break;
            }

            CreatePool();

            for (var i = 0; i < Pool.Count; i++)
            {
                switch (OnlineManager.CurrentGame.Ruleset)
                {
                case MultiplayerGameRuleset.Team:
                    switch (Pool[i].Item.Scoreboard.Team)
                    {
                    case MultiplayerTeam.Red:
                        Pool[i].Image = UserInterface.ResultRedTeam;
                        break;

                    case MultiplayerTeam.Blue:
                        Pool[i].Image = UserInterface.ResultBlueTeam;
                        break;
                    }
                    break;

                default:
                    Pool[i].Image = UserInterface.ResultNoTeam;
                    break;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// </summary>
        public ResultMultiplayerScoreboard(List <ScoreboardUser> scoreboardUsers)
        {
            Size = new ScalableVector2(WindowManager.Width - 56, 490);

            if (OnlineManager.CurrentGame.Ruleset == MultiplayerGameRuleset.Team)
            {
                Height -= 46;
            }

            Image = UserInterface.ResultMultiplayerPanel;

            TableHeader = new ResultMultiplayerScoreboardTableHeader((int)Width - 4)
            {
                Parent = this
            };

            ScoreboardList = new ResultMultiplayerScoreboardList(TableHeader, scoreboardUsers, new ScalableVector2(Width - 4, Height - TableHeader.Height - 2))
            {
                Parent = this,
                Y      = TableHeader.Height + 1,
                X      = 2
            };
        }
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="container"></param>
        /// <param name="item"></param>
        /// <param name="index"></param>
        /// <param name="header"></param>
        public ResultMultiplayerScoreboardUser(PoolableScrollContainer <ScoreboardUser> container, ScoreboardUser item, int index, ResultMultiplayerScoreboardTableHeader header)
            : base(container, item, index)
        {
            Header = header;
            Size   = new ScalableVector2(container.Width, HEIGHT);
            Alpha  = 0.85f;

            Button = new ResultMultiplayerScoreboardUserButton(Item, container)
            {
                Parent = this,
                Size   = Size,
                UsePreviousSpriteBatchOptions = true
            };

            // ReSharper disable once ObjectCreationAsStatement
            var rank = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{item.Rank}.")
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                X         = 20,
                FontSize  = 16,
                Tint      = Item.Type == ScoreboardUserType.Self ? Colors.SecondaryAccent : Color.White,
                UsePreviousSpriteBatchOptions = true
            };

            var avatar = new Sprite
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                Size      = new ScalableVector2(32, 32),
                X         = 56,
                Image     = item.Avatar.Image,
                UsePreviousSpriteBatchOptions = true
            };

            avatar.AddBorder(Color.White, 2);

            var username = new SpriteTextBitmap(FontsBitmap.GothamRegular, item.UsernameRaw)
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                X         = avatar.X + avatar.Width + 16,
                FontSize  = 16,
                Tint      = Item.Type == ScoreboardUserType.Self ? Colors.SecondaryAccent : Color.White,
                UsePreviousSpriteBatchOptions = true
            };

            if (item.Processor == null)
            {
                return;
            }

            CreateData(new Dictionary <string, string>
            {
                { "Rating", item.CalculateRating().ToString("00.00") },
                { "Grade", "" },
                { "Accuracy", StringHelper.AccuracyToString(item.Processor.Accuracy) },
                { "Max Combo", item.Processor.MaxCombo + "x" },
                { "Marv", item.Processor.CurrentJudgements[Judgement.Marv].ToString() },
                { "Perf", item.Processor.CurrentJudgements[Judgement.Perf].ToString() },
                { "Great", item.Processor.CurrentJudgements[Judgement.Great].ToString() },
                { "Good", item.Processor.CurrentJudgements[Judgement.Good].ToString() },
                { "Okay", item.Processor.CurrentJudgements[Judgement.Okay].ToString() },
                { "Miss", item.Processor.CurrentJudgements[Judgement.Miss].ToString() },
                { "Mods", item.Processor.Mods <= 0 ? "None" : ModHelper.GetModsString(ModHelper.GetModsFromRate(ModHelper.GetRateFromMods(item.Processor.Mods))) }
            });

            // ReSharper disable once ObjectCreationAsStatement
            new Sprite
            {
                Parent    = this,
                Alignment = Alignment.BotLeft,
                Size      = new ScalableVector2(Width, 1),
                Alpha     = 0.3f
            };
        }