Beispiel #1
0
        /// <inheritdoc />
        /// <summary>
        ///     Ctor -
        /// </summary>
        public JudgementCounter(GameplayScreen screen)
        {
            Screen = screen;

            // Create the judgement displays.
            JudgementDisplays = new Dictionary <Judgement, JudgementCounterItem>();
            for (var i = 0; i < Screen.Ruleset.ScoreProcessor.CurrentJudgements.Count; i++)
            {
                var key   = (Judgement)i;
                var color = SkinManager.Skin.Keys[Screen.Map.Mode].JudgeColors[key];

                // Default it to an inactive color.
                JudgementDisplays[key] = new JudgementCounterItem(this, key, new Color(color.R / 2, color.G / 2, color.B / 2), new Vector2(DisplayItemSize.Y, DisplayItemSize.Y))
                {
                    Alignment = Alignment.MidRight,
                    Parent    = this,
                    Image     = SkinManager.Skin.JudgementOverlay,
                };

                // Normalize the position of the first one so that all the rest will be completely in the middle.
                if (i == 0)
                {
                    Y = Screen.Ruleset.ScoreProcessor.CurrentJudgements.Count * -JudgementDisplays[key].Height / 2f;
                    continue;
                }

                JudgementDisplays[key].Y = JudgementDisplays[(Judgement)(i - 1)].Y + JudgementDisplays[key].Height + 5;
            }
        }
Beispiel #2
0
 /// <summary>
 ///     Makes sure that the text is changed to a singular number when collapsing.
 /// </summary>
 /// <param name="counterItem"></param>
 /// <param name="dt"></param>
 private static void UpdateTextAndSize(JudgementCounterItem counterItem, double dt)
 {
     // Tween size and pos back to normal
     counterItem.Width  = MathHelper.Lerp(counterItem.Width, DisplayItemSize.Y, (float)Math.Min(dt / 180, 1));
     counterItem.Height = MathHelper.Lerp(counterItem.Height, DisplayItemSize.Y, (float)Math.Min(dt / 180, 1));
     counterItem.X      = MathHelper.Lerp(counterItem.X, 0, (float)Math.Min(dt / 180, 1));
 }