Esempio n. 1
0
 /// <summary>
 ///     For multiplayer
 /// </summary>
 /// <param name="map"></param>
 /// <param name="mods"></param>
 /// <param name="multiplayerProcessor"></param>
 /// <param name="windows"></param>
 public ScoreProcessor(Qua map, ModIdentifier mods, ScoreProcessorMultiplayer multiplayerProcessor, JudgementWindows windows = null)
     : this(map, mods, windows)
 {
     MultiplayerProcessor           = multiplayerProcessor;
     MultiplayerProcessor.Processor = this;
 }
Esempio n. 2
0
 /// <inheritdoc />
 /// <summary>
 /// </summary>
 /// <param name="map"></param>
 /// <param name="mods"></param>
 /// <param name="multiplayer"></param>
 /// <param name="windows"></param>
 public ScoreProcessorKeys(Qua map, ModIdentifier mods, ScoreProcessorMultiplayer multiplayer, JudgementWindows windows = null) : base(map, mods, multiplayer, windows)
 {
     TotalJudgements = GetTotalJudgementCount();
     SummedScore     = CalculateSummedScore();
     InitializeHealthWeighting();
 }
Esempio n. 3
0
 /// <summary>
 ///     For multiplayer
 /// </summary>
 /// <param name="map"></param>
 /// <param name="mods"></param>
 /// <param name="multiplayerProcessor"></param>
 public ScoreProcessor(Qua map, ModIdentifier mods, ScoreProcessorMultiplayer multiplayerProcessor) : this(map, mods)
 {
     MultiplayerProcessor           = multiplayerProcessor;
     MultiplayerProcessor.Processor = this;
 }
Esempio n. 4
0
        /// <inheritdoc />
        /// <summary>
        ///     Ctor
        /// </summary>
        /// <param name="screen"></param>
        /// <param name="type"></param>
        /// <param name="username"></param>
        /// <param name="judgements"></param>
        /// <param name="avatar"></param>
        /// <param name="mods"></param>
        /// <param name="score"></param>
        /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException"></exception>
        internal ScoreboardUser(GameplayScreen screen, ScoreboardUserType type, string username, List <Judgement> judgements, Texture2D avatar, ModIdentifier mods, Score score = null)
        {
            Screen          = screen;
            LocalScore      = score;
            Judgements      = judgements;
            UsernameRaw     = username;
            RatingProcessor = new RatingProcessorKeys(MapManager.Selected.Value.DifficultyFromMods(mods));
            Type            = type;
            Size            = new ScalableVector2(260, 50);

            // Set position initially to offscreen
            X = -Width - 10;

            // The alpha of the tect - determined by the scoreboard user type.
            float textAlpha;

            // Set props based on the type of scoreboard user this is.
            switch (Type)
            {
            case ScoreboardUserType.Self:
                Image     = SkinManager.Skin.Scoreboard;
                Alpha     = 1f;
                textAlpha = 1f;
                break;

            case ScoreboardUserType.Other:
                Image     = SkinManager.Skin.ScoreboardOther;
                textAlpha = 0.65f;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            switch (Screen.Map.Mode)
            {
            case GameMode.Keys4:
            case GameMode.Keys7:
                if (screen.IsMultiplayerGame && Type == ScoreboardUserType.Other)
                {
                    var mp = new ScoreProcessorMultiplayer((MultiplayerHealthType)OnlineManager.CurrentGame.HealthType, OnlineManager.CurrentGame.Lives);
                    Processor = new ScoreProcessorKeys(Screen.Map, mods, mp);
                }
                else
                {
                    Processor = Type == ScoreboardUserType.Other ? new ScoreProcessorKeys(Screen.Map, mods): Screen.Ruleset.ScoreProcessor;
                }
                break;

            default:
                throw new InvalidEnumArgumentException();
            }

            // Create avatar
            Avatar = new Sprite()
            {
                Parent    = this,
                Size      = new ScalableVector2(Height, Height),
                Alignment = Alignment.MidLeft,
                Image     = avatar,
            };

            RankText = new SpriteTextBitmap(FontsBitmap.GothamRegular, "?.", false)
            {
                Parent    = this,
                Alignment = Alignment.MidLeft,
                FontSize  = 19,
                X         = Avatar.X + Avatar.Width + 14,
                Alpha     = textAlpha
            };

            if (Type != ScoreboardUserType.Self)
            {
                if (LocalScore != null && (LocalScore.IsOnline || LocalScore.IsMultiplayer))
                {
                    // Check to see if we have a Steam avatar for this user cached.
                    if (SteamManager.UserAvatars.ContainsKey((ulong)LocalScore.SteamId))
                    {
                        Avatar.Image = SteamManager.UserAvatars[(ulong)LocalScore.SteamId];
                    }
                    else
                    {
                        Avatar.Alpha = 0;
                        Avatar.Image = UserInterface.UnknownAvatar;

                        // Otherwise we need to request for it.
                        SteamManager.SteamUserAvatarLoaded += OnAvatarLoaded;
                        SteamManager.SendAvatarRetrievalRequest((ulong)LocalScore.SteamId);
                    }
                }
                else
                {
                    Avatar.Image = UserInterface.UnknownAvatar;
                }
            }

            // Create username text.
            Username = new SpriteTextBitmap(FontsBitmap.GothamRegular, GetUsernameFormatted())
            {
                Parent    = this,
                Alignment = Alignment.TopLeft,
                Alpha     = textAlpha,
                X         = RankText.X + RankText.Width + 18,
                Y         = 6,
                FontSize  = 16
            };

            // Create score text.
            Score = new SpriteTextBitmap(FontsBitmap.GothamRegular, "0.00", false)
            {
                Parent    = this,
                Alignment = Alignment.TopLeft,
                Alpha     = textAlpha,
                Y         = Username.Y + Username.Height + 4,
                X         = Username.X,
                FontSize  = 15
            };

            // Create score text.
            Combo = new SpriteTextBitmap(FontsBitmap.GothamRegular, $"{Processor.Combo:N0}x", false)
            {
                Parent    = this,
                Alignment = Alignment.MidRight,
                Alpha     = textAlpha,
                FontSize  = 15,
                X         = -5
            };
        }
Esempio n. 5
0
 /// <inheritdoc />
 /// <summary>
 /// </summary>
 /// <param name="map"></param>
 /// <param name="mods"></param>
 /// <param name="multiplayer"></param>
 public ScoreProcessorKeys(Qua map, ModIdentifier mods, ScoreProcessorMultiplayer multiplayer) : base(map, mods, multiplayer)
 {
     TotalJudgements = GetTotalJudgementCount();
     SummedScore     = CalculateSummedScore();
 }