Example #1
0
        public override void Update()
        {
            if (s_Accuracy != null && Math.Abs(displayAccuracy - currentAccuracy) > 0.005)
            {
                if (displayAccuracy - currentAccuracy <= -0.005)
                {
                    displayAccuracy = Math.Round(displayAccuracy + Math.Max(0.01, (currentAccuracy - displayAccuracy) / 5), 2);
                }
                else if (displayAccuracy - currentAccuracy >= 0.005)
                {
                    displayAccuracy = Math.Round(displayAccuracy - Math.Max(0.01, (displayAccuracy - currentAccuracy) / 5), 2);
                }
                s_Accuracy.ShowDouble(displayAccuracy, 2, 2, '%');
            }

            if (s_Score != null)
            {
                if (displayScore != currentScore)
                {
                    int change = (int)((currentScore - displayScore) / (6f / Clock.ElapsedRatioToSixty));

                    //in case it gets rounded too close to zero.
                    if (change == 0)
                    {
                        change = currentScore - displayScore;
                    }

                    displayScore += change;
                    s_Score.ShowInt(displayScore, 6);
                }
            }

            base.Update();
        }
Example #2
0
        public override void Update()
        {
            base.Update();

            EnsureVisible();

            //Hit combo display (bottom-left)
            if (displayCombo != currentCombo)
            {
                if (displayCombo > currentCombo)
                {
                    OnDecrease(currentCombo);
                }
                else if (displayCombo < currentCombo)
                {
                    OnIncrease(currentCombo);
                }

                s_hitCombo_Incoming.TagNumeric = displayCombo;

                s_hitCombo_Incoming.ShowInt(displayCombo, 0, false, 'x');
            }

            if (s_hitCombo_Incoming.Transformations.Count > 0)
            {
                if (s_hitCombo_Incoming.Transformations[0].EndTime < Clock.Time + 140 && s_hitCombo.TagNumeric != s_hitCombo_Incoming.TagNumeric)
                {
                    transferToMainCounter();
                }
            }
            else if (s_hitCombo.TagNumeric != s_hitCombo_Incoming.TagNumeric)
            {
                s_hitCombo.TextArray  = s_hitCombo_Incoming.TextArray;
                s_hitCombo.TagNumeric = s_hitCombo_Incoming.TagNumeric;
            }
        }
Example #3
0
        internal ScorePanel(Score score, EventHandler action)
        {
            Score = score;

            base_depth += 0.0001f * score.OnlineRank;

            s_BackingPlate = new pRectangle(Vector2.Zero, new Vector2(GameBase.BaseSize.X, PANEL_HEIGHT), true, base_depth, new Color4(0, 0, 0, 40))
            {
                Tag = this
            };

            s_BackingPlate.OnHover     += delegate { s_BackingPlate.FadeColour(new Color4(83, 156, 224, 80), 100); };
            s_BackingPlate.OnHoverLost += delegate { s_BackingPlate.FadeColour(new Color4(0, 0, 0, 40), 100); };

            Sprites.Add(s_BackingPlate);

            if (action != null)
            {
                s_BackingPlate.OnClick += action;
            }

            s_BackingPlate.HandleClickOnUp = true;

            pSpriteText rankNumber = new pSpriteText(score.OnlineRank.ToString(), "score", 0, FieldTypes.Standard, OriginTypes.CentreRight, ClockTypes.Mode, Vector2.Zero, 0.9f, true, new Color4(100, 100, 100, 255));

            rankNumber.Offset = new Vector2(GameBase.SuperWidePadding + 20, PANEL_HEIGHT / 2);
            rankNumber.TextConstantSpacing = true;
            rankNumber.SpacingOverlap      = 8;
            rankNumber.ZeroAlpha           = 0.5f;
            rankNumber.ScaleScalar         = 0.5f;
            Sprites.Add(rankNumber);

            pSprite rankingSprite = new pSprite(score.RankingTextureTiny, Vector2.Zero)
            {
                Origin    = OriginTypes.CentreLeft,
                DrawDepth = base_depth + 0.06f,
                Offset    = new Vector2(GameBase.SuperWidePadding + 23, PANEL_HEIGHT / 2)
            };

            Sprites.Add(rankingSprite);

            if (!score.guest)
            {
                pSpriteWeb avatar = new pSpriteWeb(@"https://api.twitter.com/1/users/profile_image/" + score.Username)
                {
                    Offset = new Vector2(GameBase.SuperWidePadding + 80, PANEL_HEIGHT / 2),
                    Origin = OriginTypes.Centre
                };
                Sprites.Add(avatar);
            }


            s_Text        = new pText(score.Username, 26, Vector2.Zero, Vector2.Zero, 0.5f, true, score.guest ? Color4.LightGray : Color4.White, false);
            s_Text.Bold   = true;
            s_Text.Offset = new Vector2(GameBase.SuperWidePadding + 100, 0);
            Sprites.Add(s_Text);

            pSpriteText scoreText = new pSpriteText("000000", "score", 0, FieldTypes.StandardSnapRight, OriginTypes.CentreRight, ClockTypes.Mode, Vector2.Zero, 0.9f, true, new Color4(255, 166, 0, 255));

            scoreText.Offset = new Vector2(GameBase.SuperWidePadding + 200, PANEL_HEIGHT / 2);
            scoreText.ShowInt(score.totalScore, 6, true);
            scoreText.TextConstantSpacing = true;
            scoreText.ZeroAlpha           = 0.5f;
            scoreText.ScaleScalar         = 0.8f;
            Sprites.Add(scoreText);

            pSpriteText accuracy = new pSpriteText((score.accuracy * 100).ToString("00.00", GameBase.nfi) + "%", "score", 0, FieldTypes.StandardSnapRight, OriginTypes.CentreRight, ClockTypes.Mode, Vector2.Zero, 0.9f, true, new Color4(0, 180, 227, 255));

            accuracy.Offset              = new Vector2(GameBase.SuperWidePadding + 20, PANEL_HEIGHT / 2);
            accuracy.ScaleScalar         = 0.8f;
            accuracy.TextConstantSpacing = true;
            Sprites.Add(accuracy);
        }
Example #4
0
        public override void Update()
        {
            if (!AudioEngine.Music.IsElapsing)
            {
                InitializeBgm();
            }

            if (!Director.IsTransitioning)
            {
                if (finishedDisplaying)
                {
                    if (!InputManager.IsPressed)
                    {
                        offset *= 1 - 0.1f * Clock.ElapsedRatioToSixty;
                    }

                    float thisOffset = 0;
                    if (offset != 0)
                    {
                        thisOffset = (offset > 0 ? 1 : -1) * (float)Math.Pow(Math.Abs(offset), 0.8);
                    }


                    foreach (pDrawable p in fillSprites)
                    {
                        p.Scale.Y = fill_height + thisOffset * 0.5f;
                    }
                    layer1.Position.Y = thisOffset * 0.6f;
                    layer2.Position.Y = thisOffset;

                    layer1.ExactCoordinates = thisOffset == 0;
                    layer2.ExactCoordinates = thisOffset == 0;
                }

                fallingSprites.RemoveAll(p => p.Transformations.Count == 0);
                foreach (pSprite p in fallingSprites)
                {
                    p.Position.Y += p.TagNumeric * Clock.ElapsedRatioToSixty * 0.003f * (float)Clock.ElapsedMilliseconds;
                    p.TagNumeric++;
                }

                if (fallingSprites.Count < 20 && frameCount++ % 5 == 0)
                {
                    float pos = (float)GameBase.Random.NextDouble() * GameBase.BaseSizeFixedWidth.X;

                    pTexture tex = null;
                    if (pos < fillSprites[1].Position.X)
                    {
                        tex = TextureManager.Load(OsuTexture.hit300);
                    }
                    else if (pos < fillSprites[2].Position.X)
                    {
                        tex = TextureManager.Load(OsuTexture.hit100);
                    }
                    else if (pos < fillSprites[3].Position.X)
                    {
                        tex = TextureManager.Load(OsuTexture.hit50);
                    }

                    if (tex != null)
                    {
                        pSprite f = new pSprite(tex, FieldTypes.Standard, OriginTypes.TopLeft, ClockTypes.Mode, new Vector2(pos, fillSprites[0].Scale.Y - 30), 0.3f, false, Color4.White);
                        f.ScaleScalar = 0.2f;
                        f.Transform(new TransformationF(TransformationType.Fade, 0, 1, Clock.ModeTime, Clock.ModeTime + 150));
                        f.Transform(new TransformationF(TransformationType.Fade, 1, 0, Clock.ModeTime + 250, Clock.ModeTime + 1000 + (int)(GameBase.Random.NextDouble() * 1000)));
                        fallingSprites.Add(f);
                        spriteManager.Add(f);
                    }
                }
            }

            int increaseAmount = (int)Math.Max(1, Clock.ElapsedMilliseconds / 8);

            if (count300.LastInt < RankableScore.count300)
            {
                count300.ShowInt(Math.Min(RankableScore.count300, count300.LastInt + increaseAmount), 0, false, 'x');
            }
            else if (count100.LastInt < RankableScore.count100)
            {
                count100.ShowInt(Math.Min(RankableScore.count100, count100.LastInt + increaseAmount), 0, false, 'x');
            }
            else if (count50.LastInt < RankableScore.count50)
            {
                count50.ShowInt(Math.Min(RankableScore.count50, count50.LastInt + increaseAmount), 0, false, 'x');
            }
            else if (count0.LastInt < RankableScore.countMiss)
            {
                count0.ShowInt(Math.Min(RankableScore.countMiss, count0.LastInt + increaseAmount), 0, false, 'x');
            }

            base.Update();
            layer1.Update();
            layer2.Update();
            topMostLayer.Update();
        }
Example #5
0
        private void Director_OnTransitionEnded()
        {
            //hit -> combo -> accuracy -> spin

            int time      = cameFromSongSelect ? 0 : 500;
            int increment = cameFromSongSelect ? 0 : 500;

            GameBase.Scheduler.Add(delegate
            {
                AudioEngine.PlaySample(OsuSamples.RankingBam);
                countScoreHit.ShowInt(RankableScore.hitScore, 6);
                countScoreHit.AdditiveFlash(500, 1);

                addedScore += RankableScore.hitScore;
                countTotalScore.ShowInt(addedScore, 6, true);
                countTotalScore.FlashColour(Color4.White, 1000);
            }, time);

            time += increment;

            GameBase.Scheduler.Add(delegate
            {
                AudioEngine.PlaySample(OsuSamples.RankingBam);
                countScoreCombo.ShowInt(RankableScore.comboBonusScore, 6);
                countScoreCombo.AdditiveFlash(500, 1);


                addedScore += RankableScore.comboBonusScore;
                countTotalScore.ShowInt(addedScore, 6, true);
                countTotalScore.FlashColour(Color4.White, 1000);
            }, time);

            time += increment;

            GameBase.Scheduler.Add(delegate
            {
                AudioEngine.PlaySample(OsuSamples.RankingBam);
                countScoreAccuracy.ShowInt(RankableScore.accuracyBonusScore, 6);
                countScoreAccuracy.AdditiveFlash(500, 1);

                addedScore += RankableScore.accuracyBonusScore;
                countTotalScore.ShowInt(addedScore, 6, true);
                countTotalScore.FlashColour(Color4.White, 1000);
            }, time);

            time += increment;

            GameBase.Scheduler.Add(delegate
            {
                AudioEngine.PlaySample(OsuSamples.RankingBam);
                countScoreSpin.ShowInt(RankableScore.spinnerBonusScore, 6);
                countScoreSpin.AdditiveFlash(500, 1);

                addedScore += RankableScore.spinnerBonusScore;
                countTotalScore.ShowInt(addedScore, 6, true);
                countTotalScore.FlashColour(Color4.White, 1000);
            }, time);

            time += increment;

            GameBase.Scheduler.Add(delegate
            {
                if (RankableScore.Ranking == Rank.D)
                {
                    AudioEngine.PlaySample(OsuSamples.RankFail);
                    rankGraphic.FadeIn(2000);
                    rankGraphic.ScaleScalar = 0.7f;
                    rankGraphic.ScaleTo(1, 1400, EasingTypes.In);
                    GameBase.Scheduler.Add(delegate
                    {
                        int interval = 100;
                        rankGraphic.Transform(new TransformationF(TransformationType.Rotation, 0, 0.3f, Clock.Time, Clock.Time + interval));
                        rankGraphic.Transform(new TransformationF(TransformationType.Rotation, 0.3f, -0.3f, Clock.Time + interval, Clock.Time + interval * 3));
                        rankGraphic.Transform(new TransformationF(TransformationType.Rotation, -0.3f, 0, Clock.Time + interval * 3, Clock.Time + interval * 4));
                    }, 1550);
                }
                else
                {
                    AudioEngine.PlaySample(OsuSamples.RankPass);
                    rankGraphic.FadeIn(4000);

                    GameBase.Scheduler.Add(delegate
                    {
                        rankGraphic.Transformations.Clear();
                        rankGraphic.Alpha = 1;
                        rankGraphic.AdditiveFlash(1500, 1);
                    }, 1400);
                }
            }, time);

            time += increment + 1200;

            if (isPersonalBest)
            {
                GameBase.Scheduler.Add(delegate
                {
                    pSprite personalBest = new pSprite(TextureManager.Load(OsuTexture.personalbest), FieldTypes.StandardSnapBottomRight, OriginTypes.Centre, ClockTypes.Mode, new Vector2(80, 250),
                                                       1, true, Color4.White);
                    personalBest.FadeInFromZero(250);
                    personalBest.ScaleScalar = 1.6f;
                    personalBest.RotateTo(0.2f, 250);
                    personalBest.ScaleTo(1, 250, EasingTypes.Out);

                    GameBase.Scheduler.Add(delegate { personalBest.AdditiveFlash(1000, 1).ScaleTo(1.05f, 1000); }, 250);

                    layer1.Add(personalBest);
                }, time);
            }

            time += increment;

            if (!cameFromSongSelect)
            {
                GameBase.Scheduler.Add(finishDisplaying, time);
            }
        }