Ejemplo n.º 1
0
        public TestSceneStarCounter()
        {
            starCounter = new StarCounter
            {
                Origin = Anchor.Centre,
                Anchor = Anchor.Centre,
            };

            Add(starCounter);

            starsLabel = new OsuSpriteText
            {
                Origin = Anchor.Centre,
                Anchor = Anchor.Centre,
                Scale  = new Vector2(2),
                Y      = 50,
            };

            Add(starsLabel);

            setStars(5);

            AddRepeatStep("random value", () => setStars(RNG.NextSingle() * (starCounter.StarCount + 1)), 10);
            AddSliderStep("exact value", 0f, 10f, 5f, setStars);
            AddStep("stop animation", () => starCounter.StopAnimation());
            AddStep("reset", () => setStars(0));
        }
Ejemplo n.º 2
0
        public TestSceneStarCounter()
        {
            StarCounter stars = new StarCounter
            {
                Origin  = Anchor.Centre,
                Anchor  = Anchor.Centre,
                Current = 5,
            };

            Add(stars);

            SpriteText starsLabel = new OsuSpriteText
            {
                Origin = Anchor.Centre,
                Anchor = Anchor.Centre,
                Scale  = new Vector2(2),
                Y      = 50,
                Text   = stars.Current.ToString("0.00"),
            };

            Add(starsLabel);

            AddRepeatStep(@"random value", delegate
            {
                stars.Current   = RNG.NextSingle() * (stars.StarCount + 1);
                starsLabel.Text = stars.Current.ToString("0.00");
            }, 10);

            AddStep(@"Stop animation", delegate
            {
                stars.StopAnimation();
            });

            AddStep(@"Reset", delegate
            {
                stars.Current   = 0;
                starsLabel.Text = stars.Current.ToString("0.00");
            });
        }
Ejemplo n.º 3
0
        public override void Reset()
        {
            base.Reset();

            int numerator = 0, denominator = 0;

            bool maniaHold = false;

            ScoreCounter score = new ScoreCounter(7)
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                TextSize = 40,
                Count    = 0,
                Margin   = new MarginPadding(20),
            };

            Add(score);

            ComboCounter standardCombo = new OsuComboCounter
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Margin   = new MarginPadding(10),
                Count    = 0,
                TextSize = 40,
            };

            Add(standardCombo);

            CatchComboCounter catchCombo = new CatchComboCounter
            {
                Origin   = Anchor.Centre,
                Anchor   = Anchor.Centre,
                Count    = 0,
                TextSize = 40,
            };

            Add(catchCombo);

            ComboCounter taikoCombo = new TaikoComboCounter
            {
                Origin   = Anchor.BottomCentre,
                Anchor   = Anchor.Centre,
                Position = new Vector2(0, -160),
                Count    = 0,
                TextSize = 40,
            };

            Add(taikoCombo);

            ManiaComboCounter maniaCombo = new ManiaComboCounter
            {
                Origin   = Anchor.Centre,
                Anchor   = Anchor.Centre,
                Position = new Vector2(0, -80),
                Count    = 0,
                TextSize = 40,
            };

            Add(maniaCombo);


            PercentageCounter accuracyCombo = new PercentageCounter
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                Position = new Vector2(-20, 60),
            };

            Add(accuracyCombo);

            StarCounter stars = new StarCounter
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Position = new Vector2(20, -160),
                Count    = 5,
            };

            Add(stars);

            SpriteText starsLabel = new SpriteText
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Position = new Vector2(20, -190),
                Text     = stars.Count.ToString("0.00"),
            };

            Add(starsLabel);

            AddButton(@"Reset all", delegate
            {
                score.Count         = 0;
                standardCombo.Count = 0;
                taikoCombo.Count    = 0;
                maniaCombo.Count    = 0;
                catchCombo.Count    = 0;
                numerator           = denominator = 0;
                accuracyCombo.SetFraction(0, 0);
                stars.Count     = 0;
                starsLabel.Text = stars.Count.ToString("0.00");
            });

            AddButton(@"Hit! :D", delegate
            {
                score.Count += 300 + (ulong)(300.0 * (standardCombo.Count > 0 ? standardCombo.Count - 1 : 0) / 25.0);
                standardCombo.Count++;
                taikoCombo.Count++;
                maniaCombo.Count++;
                catchCombo.CatchFruit(new Color4(
                                          Math.Max(0.5f, RNG.NextSingle()),
                                          Math.Max(0.5f, RNG.NextSingle()),
                                          Math.Max(0.5f, RNG.NextSingle()),
                                          1)
                                      );
                numerator++; denominator++;
                accuracyCombo.SetFraction(numerator, denominator);
            });

            AddButton(@"miss...", delegate
            {
                standardCombo.Roll();
                taikoCombo.Roll();
                maniaCombo.Roll();
                catchCombo.Roll();
                denominator++;
                accuracyCombo.SetFraction(numerator, denominator);
            });

            AddButton(@"mania hold", delegate
            {
                if (!maniaHold)
                {
                    maniaCombo.HoldStart();
                }
                else
                {
                    maniaCombo.HoldEnd();
                }
                maniaHold = !maniaHold;
            });

            AddButton(@"Alter stars", delegate
            {
                stars.Count     = RNG.NextSingle() * (stars.MaxStars + 1);
                starsLabel.Text = stars.Count.ToString("0.00");
            });

            AddButton(@"Stop counters", delegate
            {
                score.StopRolling();
                standardCombo.StopRolling();
                catchCombo.StopRolling();
                taikoCombo.StopRolling();
                maniaCombo.StopRolling();
                accuracyCombo.StopRolling();
                stars.StopAnimation();
            });
        }
Ejemplo n.º 4
0
        public TestCaseScoreCounter()
        {
            int numerator = 0, denominator = 0;

            ScoreCounter score = new ScoreCounter(7)
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                TextSize = 40,
                Margin   = new MarginPadding(20),
            };

            Add(score);

            ComboCounter comboCounter = new StandardComboCounter
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Margin   = new MarginPadding(10),
                TextSize = 40,
            };

            Add(comboCounter);

            PercentageCounter accuracyCounter = new PercentageCounter
            {
                Origin   = Anchor.TopRight,
                Anchor   = Anchor.TopRight,
                Position = new Vector2(-20, 60),
            };

            Add(accuracyCounter);

            StarCounter stars = new StarCounter
            {
                Origin     = Anchor.BottomLeft,
                Anchor     = Anchor.BottomLeft,
                Position   = new Vector2(20, -160),
                CountStars = 5,
            };

            Add(stars);

            SpriteText starsLabel = new SpriteText
            {
                Origin   = Anchor.BottomLeft,
                Anchor   = Anchor.BottomLeft,
                Position = new Vector2(20, -190),
                Text     = stars.CountStars.ToString("0.00"),
            };

            Add(starsLabel);

            AddStep(@"Reset all", delegate
            {
                score.Current.Value        = 0;
                comboCounter.Current.Value = 0;
                numerator = denominator = 0;
                accuracyCounter.SetFraction(0, 0);
                stars.CountStars = 0;
                starsLabel.Text  = stars.CountStars.ToString("0.00");
            });

            AddStep(@"Hit! :D", delegate
            {
                score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0);
                comboCounter.Increment();
                numerator++;
                denominator++;
                accuracyCounter.SetFraction(numerator, denominator);
            });

            AddStep(@"miss...", delegate
            {
                comboCounter.Current.Value = 0;
                denominator++;
                accuracyCounter.SetFraction(numerator, denominator);
            });

            AddStep(@"Alter stars", delegate
            {
                stars.CountStars = RNG.NextSingle() * (stars.StarCount + 1);
                starsLabel.Text  = stars.CountStars.ToString("0.00");
            });

            AddStep(@"Stop counters", delegate
            {
                score.StopRolling();
                comboCounter.StopRolling();
                accuracyCounter.StopRolling();
                stars.StopAnimation();
            });
        }