示例#1
0
        private void loadScores(SlotTeams teamId, int tabId, bool slowAnimations)
        {
            bool isFruits = playMode == PlayModes.CatchTheBeat;

            int startTime = GameBase.Time;

            Score scoreEntry = tabId != 0 ? PlayerVs.LastScoreEntries[tabId - 1].Score : (teamId == SlotTeams.Blue ? team1Score : team2Score);

            //load the right scoreSprites we are about to replace
            List <pSprite> scoreSprites = teamId == SlotTeams.Blue ? scoreSpritesBlue : scoreSpritesRed;
            HealthGraph    currentHpGraph;

            spriteManagerWideScrolling.RemoveRange(scoreSprites);
            scoreSprites.Clear();
            //create new scoresprites
            const int textx1 = 80;
            const int imgx1  = 40;
            const int textx2 = 280;
            //const int imgx2 = 240;

            const int row1 = 160;
            const int row2 = 220;
            const int row3 = 280;
            const int row4 = 320;

            int textoffset = SkinManager.UseNewLayout ? -16 : -25;

            Vector2 tMove = new Vector2(0, 20);

            int            timeOffset  = slowAnimations ? 1000 : 0;
            int            timeOffset2 = slowAnimations ? 1300 : 0;
            int            length      = slowAnimations ? 400 : 20;
            pSprite        p;
            Transformation t;

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.Count300), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1, row1 + textoffset), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.Count100), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1, row2 + textoffset), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;

            t =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.Count50), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1, row3 + textoffset), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            if (!isFruits)
            {
                p =
                    new pSpriteText(String.Format("{0}x", scoreEntry.CountGeki), SkinManager.Current.FontScore,
                                    SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                    Origins.TopLeft, Clocks.Game,
                                    new Vector2(textx2, row1 + textoffset), 0.8F, true, Color.TransparentWhite);
                p.Scale = 1.12F;

                t =
                    new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                       startTime + timeOffset2 + length);
                timeOffset2 += length;
                t.Easing     = EasingTypes.Out;
                p.Transformations.Add(t);
                scoreSprites.Add(p);

                p =
                    new pSpriteText(String.Format("{0}x", scoreEntry.CountKatu), SkinManager.Current.FontScore,
                                    SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                    Origins.TopLeft, Clocks.Game,
                                    new Vector2(textx2, row2 + textoffset), 0.8F, true, Color.TransparentWhite);
                p.Scale = 1.12F;
                t       =
                    new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                       startTime + timeOffset2 + length);
                timeOffset2 += length;
                t.Easing     = EasingTypes.Out;
                p.Transformations.Add(t);
                scoreSprites.Add(p);
            }

            p =
                new pSpriteText(String.Format("{0}x", scoreEntry.CountMiss), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx2, (isFruits ? row1 : row3) + textoffset), 0.8F, true,
                                Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(tabId == 0 ? "xxxx" : String.Format("{0}x", scoreEntry.MaxCombo),
                                SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx1 - 65, row4 + 10), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            timeOffset2 += length;
            t.Easing     = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);

            p =
                new pSpriteText(String.Format("{0:0.00}%", scoreEntry.Accuracy * 100), SkinManager.Current.FontScore,
                                SkinManager.Current.FontScoreOverlap, Fields.TopLeft,
                                Origins.TopLeft, Clocks.Game,
                                new Vector2(textx2 - 86, row4 + 10), 0.8F, true, Color.TransparentWhite);
            p.Scale = 1.12F;
            t       =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length);
            t.Easing = EasingTypes.Out;
            p.Transformations.Add(t);
            scoreSprites.Add(p);
            timeOffset2 += length;

            string stringTotalScore = String.Format("{0:00000000}", scoreEntry.TotalScore);

            pSpriteText ps =
                new pSpriteText(stringTotalScore, SkinManager.Current.FontScore, SkinManager.Current.FontScoreOverlap,
                                Fields.TopLeft, Origins.Centre, Clocks.Game,
                                /*new Vector2(180, row4 + 110)*/ new Vector2(180, 94), 0.8F, true, Color.White);

            ps.Scale = SkinManager.UseNewLayout ? 1.3f : 1.2f;
            if (SkinManager.UseNewLayout)
            {
                ps.SpacingOverlap = -2;
            }
            ps.Alpha = 0;
            t        =
                new Transformation(TransformationType.Fade, 0, 1, startTime + timeOffset2,
                                   startTime + timeOffset2 + length * 2);
            t.Easing = EasingTypes.Out;
            ps.Transformations.Add(t);
            scoreSprites.Add(ps);


            int offsetX = 0;

            switch (teamId)
            {
            case SlotTeams.Blue:
                break;

            case SlotTeams.Red:
                offsetX = GameBase.WindowManager.WidthScaled - 279;
                break;
            }
            //scale and move the sprites to the correct panel
            float scale = 0.6f * 1.10f;

            for (int j = 0; j < scoreSprites.Count; j++)
            {
                pSprite pp = scoreSprites[j];
                pp.Scale     *= scale;
                pp.Position.X = imgx1 + (pp.Position.X - imgx1) * scale + offsetX;
                pp.Position.Y = row1 + (pp.Position.Y - row1) * scale + 18;
                spriteManagerWideScrolling.Add(pp);
            }

            //Actual graph position relative to the graph sprite
            float healthGraphX = rankingGraphPosition.X + (SkinManager.UseNewLayout ? 0 : 5) + offsetX;
            float healthGraphY = rankingGraphPosition.Y - (SkinManager.UseNewLayout ? 65 : 44);

            //finally create the hpGraph
            currentHpGraph = new HealthGraph(startTime, slowAnimations ? 2000 : 4000, scoreEntry, new RectangleF(healthGraphX, healthGraphY, 150, 68));

            if (teamId == SlotTeams.Blue)
            {
                team1HPgraph = currentHpGraph;
            }
            else
            {
                team2HPgraph = currentHpGraph;
            }

            spriteManagerWideScrolling.Add(currentHpGraph);
        }
示例#2
0
        protected virtual void LoadScore(Score score)
        {
            if (score == null)
            {
                return;
            }

            foreach (pSprite ps in leftPanel)
            {
                ps.FadeOut(100);
                ps.AlwaysDraw = false;
            }
            leftPanel.Clear();
            rankingElements.Clear();

            this.score = score;

            if (score.Processor != null || score.PlayMode == PlayModes.OsuMania)
            {
                stringTotalScore = string.Format("{0:0000000}", score.TotalScore);
            }
            else
            {
                stringTotalScore = string.Format("{0:00000000}", score.TotalScore);
            }

            s_score1 =
                new pSpriteText("", SkinManager.Current.FontScore, SkinManager.Current.FontScoreOverlap,
                                Fields.TopLeft, Origins.Centre, Clocks.Game,
                                new Vector2(220, 94), 0.8F, true, Color.White);
            s_score1.Scale = SkinManager.UseNewLayout ? 1.3f : 1.05f;
            if (SkinManager.UseNewLayout)
            {
                s_score1.SpacingOverlap = -2;
            }
            s_score1.TextConstantSpacing = true;
            spriteManagerWideScrolling.Add(s_score1);
            leftPanel.Add(s_score1);

            const int textx1 = 80;
            const int imgx1  = 40;
            const int textx2 = 280;
            const int imgx2  = 240;

            const int row1 = 160;
            const int row2 = 220;
            const int row3 = 280;
            const int row4 = 320;

            RankingElement e;

            switch (score.PlayMode)
            {
            case PlayModes.Osu:
            {
                rankingElements.Add(new RankingElement(@"hit300", new Vector2(imgx1, row1), String.Format("{0}x", score.Count300)));

                rankingElements.Add(new RankingElement(@"hit100", new Vector2(imgx1, row2), String.Format("{0}x", score.Count100)));

                rankingElements.Add(new RankingElement(@"hit50", new Vector2(imgx1, row3), String.Format("{0}x", score.Count50)));

                rankingElements.Add(new RankingElement(@"hit300g", new Vector2(imgx2, row1), String.Format("{0}x", score.CountGeki)));

                rankingElements.Add(new RankingElement(@"hit100k", new Vector2(imgx2, row2), String.Format("{0}x", score.CountKatu)));

                rankingElements.Add(new RankingElement(@"hit0", new Vector2(imgx2, row3), String.Format("{0}x", score.CountMiss)));

                break;
            }

            case PlayModes.Taiko:
            {
                rankingElements.Add(new RankingElement(@"taiko-hit300", new Vector2(imgx1, row1),
                                                       String.Format("{0}x", score.Count300 - score.CountGeki)));

                rankingElements.Add(new RankingElement(@"taiko-hit100", new Vector2(imgx1, row2),
                                                       String.Format("{0}x", score.Count100 - score.CountKatu)));

                rankingElements.Add(new RankingElement(@"taiko-hit0", new Vector2(imgx1, row3), String.Format("{0}x", score.CountMiss)));

                rankingElements.Add(new RankingElement(@"taiko-hit300g", new Vector2(imgx2, row1), String.Format("{0}x", score.CountGeki)));

                rankingElements.Add(new RankingElement(@"taiko-hit100k", new Vector2(imgx2, row2), String.Format("{0}x", score.CountKatu)));

                break;
            }

            case PlayModes.CatchTheBeat:
            {
                // overlays are added first to prevent a minor display bug
                rankingElements.Add(new RankingElement(@"fruit-orange-overlay", new Vector2(imgx1, row1), null, true));

                e = new RankingElement(@"fruit-orange", new Vector2(imgx1, row1), String.Format("{0}x", score.Count300));
                e.image.InitialColour = Color.Orange;
                rankingElements.Add(e);

                e = new RankingElement(@"fruit-drop", new Vector2(imgx1, row2), String.Format("{0}x", score.Count100));
                e.ChangeScale(1F, 0.6F);
                e.image.InitialColour = Color.YellowGreen;
                rankingElements.Add(e);

                e = new RankingElement(@"fruit-drop", new Vector2(imgx1, row3), String.Format("{0}x", score.Count50));
                e.ChangeScale(1F, 0.4F);
                e.ApplyRotation(4f);
                e.image.InitialColour = Color.LightBlue;
                rankingElements.Add(e);

                e = new RankingElement(@"fruit-orange-overlay", new Vector2(imgx2, row1), null, true);
                e.ChangeScale(1f, 0.4f);
                e.ApplyRotation(0.8f);
                rankingElements.Add(e);

                e = new RankingElement(@"hit0", new Vector2(imgx2, row1) - new Vector2(20, 20), null, true);
                e.ChangeScale(0.7f, 0.2f);
                rankingElements.Add(e);

                e = new RankingElement(@"fruit-orange", new Vector2(imgx2, row1), String.Format("{0}x", score.CountMiss));
                e.ChangeScale(1f, 0.4f);
                e.ApplyRotation(0.8f);
                e.image.InitialColour = Color.LightGray;
                rankingElements.Add(e);

                break;
            }

            case PlayModes.OsuMania:
            {
                rankingElements.Add(new RankingElement(@"mania-hit300", new Vector2(imgx1, row1), String.Format("{0}x", score.Count300)));

                rankingElements.Add(new RankingElement(@"mania-hit200", new Vector2(imgx1, row2), String.Format("{0}x", score.CountKatu)));

                rankingElements.Add(new RankingElement(@"mania-hit50", new Vector2(imgx1, row3), String.Format("{0}x", score.Count50)));

                rankingElements.Add(new RankingElement(@"mania-hit300g", new Vector2(imgx2, row1), String.Format("{0}x", score.CountGeki)));

                rankingElements.Add(new RankingElement(@"mania-hit100", new Vector2(imgx2, row2), String.Format("{0}x", score.Count100)));

                rankingElements.Add(new RankingElement(@"mania-hit0", new Vector2(imgx2, row3), String.Format("{0}x", score.CountMiss)));

                break;
            }
            }

            int row4Offset = (SkinManager.UseNewLayout ? 20 : 8);

            e = new RankingElement(@"ranking-maxcombo", new Vector2(imgx1 - 35, row4 - row4Offset), null, false, 0, Origins.TopLeft);
            e.ChangeScale(1F, 1F);
            e.image.Depth = 0.81F;

            // we're adding the text separately here because of the unusual offset.
            e.LoadScoreText(String.Format("{0}x", score.MaxCombo), new Vector2(textx1 - 65, row4 + 10));
            e.text.Depth = 0.8F;
            rankingElements.Add(e);

            e = new RankingElement(@"ranking-accuracy", new Vector2(imgx2 - 58, row4 - row4Offset), null, false, 0, Origins.TopLeft);
            e.ChangeScale(1F, 1F);
            e.image.Depth = 0.81F;

            e.LoadScoreText(String.Format("{0:0.00}%", score.Accuracy * 100), new Vector2(textx2 - 86, row4 + 10));
            e.text.Depth = 0.8F;
            rankingElements.Add(e);

            // show average error as hint

            string hint = "";

            if (score.HitErrors != null && score.HitErrors.Count != 0)
            {
                List <double> result = GetErrorStatisticsArray(score.HitErrors);
                if (result != null)
                {
#if DEBUG
                    hint = String.Format("Accuracy:\nError: {0:0.00}ms - {1:0.00}ms avg / {3:0.00}ms - {4:0.00}ms max \nUnstable Rate: {2:0.00}\n", result[0], result[1], result[4] * 10, result[6], result[5]);
#else
                    hint = String.Format("Accuracy:\nError: {0:0.00}ms - {1:0.00}ms avg\nUnstable Rate: {2:0.00}\n", result[0], result[1], result[4] * 10, result[6], result[5]);
#endif
                }
            }
            if (score.SpinningRates != null && score.SpinningRates.Count != 0)
            {
                List <double> result = GetErrorStatisticsArray(score.SpinningRates);
                if (result != null)
                {
                    hint += String.Format("Spin:\nSpeed: {0:000}(Max:{1:000}rpm)\nUnstable Rate: {2:0.00}\n", result[2], result[5], result[4] * 2);
                }
            }
            if (hint != "")
            {
                spriteRankingGraph.HandleInput = true;
                spriteRankingGraph.ToolTip     = hint;
            }

            if (score.Perfect)
            {
                e = new RankingElement(@"ranking-perfect", new Vector2(SkinManager.UseNewLayout ? 260 : 200, 430), null, false, 300);
                e.ChangeScale(1.1F, 1F);
                e.image.Depth = 0.99F;
                rankingElements.Add(e);
            }

            int timeOffset = AddRankingSprites();

            LoadRanking(timeOffset);

            if (healthGraph != null)
            {
                spriteManagerWideScrolling.Remove(healthGraph);
                healthGraph.Dispose();
            }

            //Actual graph position relative to the graph sprite
            float healthGraphX = spriteRankingGraph.InitialPosition.X + (SkinManager.UseNewLayout ? 5 : 10);
            float healthGraphY = spriteRankingGraph.InitialPosition.Y + (SkinManager.UseNewLayout ? 5 : 10);

            healthGraph = new HealthGraph(startTime, 4000, score, new RectangleF(healthGraphX, healthGraphY, 186, 86));
            spriteManagerWideScrolling.Add(healthGraph);
            LoadMods();

            s_white =
                new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft, Clocks.Game,
                            Vector2.Zero, 1, false,
                            Color.TransparentWhite);
            s_white.ScaleToWindowRatio = false;
            s_white.Additive           = true;
            s_white.VectorScale        = new Vector2(GameBase.WindowManager.Width, GameBase.WindowManager.Height);
            Transformation t = new Transformation(TransformationType.Fade, 0.5f, 0, startTime + timeOffset + 1000, startTime + timeOffset + 2400);
            s_white.Transformations.Add(t);
            spriteManagerWideAbove.Add(s_white);
            leftPanel.Add(s_white);
        }