internal void PushButtonsDownwards(int p)
        {
            int amount = 55;

            if (buttonFF != null)
            {
                buttonFF.MoveToRelative(new Vector2(0, amount), 500, EasingTypes.Out);
            }
            if (buttonEndReplay != null)
            {
                buttonEndReplay.MoveToRelative(new Vector2(0, amount), 500, EasingTypes.Out);
            }
            if (buttonComments != null)
            {
                buttonComments.MoveToRelative(new Vector2(0, amount), 500, EasingTypes.Out);
            }

            commentBoxSprites.ForEach(s => { s.MoveToRelative(new Vector2(0, amount), 500, EasingTypes.Out); s.InitialPosition.Y += amount; });
        }
Exemple #2
0
        public override void Initialize()
        {
            ReplayMode = InputManager.ReplayMode;

            Player.scoreBoard.topLeft = new Vector2(530, 120);
            foreach (ScoreboardEntry sbe in Player.scoreBoard.Entries)
            {
                sbe.spriteBackground.OriginPosition = new Vector2(26, 20);
                sbe.spriteBackground.OnClick       += spriteBackground_OnClick;
                sbe.spriteBackground.IsClickable    = true;
                sbe.spriteBackground.Tag            = sbe;
                sbe.spriteBackground.HoverEffect    = new Transformation(sbe.spriteBackground.StartColour,
                                                                         Color.YellowGreen, 0, 100);
            }

            Player.scoreBoard.spriteManager.Alpha = 1;

            InputManager.ReplayMode           = false;
            InputManager.ReplayStreaming      = false;
            InputManager.ReplayStreamingStart = 0;

            Randomizer = new Random();

            KeyboardHandler.OnKeyPressed += GameBase_OnKeyPressed;
            MouseHandler.OnClick         += GameBase_OnClick;

            spriteManager = new SpriteManager();

            pText noMatches = new pText("Click a player tab to view their score!\nHit F2 to export your replay.", 14
                                        , new Vector2(400, 60), new Vector2(240, 0), 1, true, Color.White, false);

            noMatches.TextBold = true;
            //noMatches.CurrentColour = Color.TransparentWhite;
            //noMatches.TextAlignment = Alignment.Centre;
            //noMatches.OriginType = OriginTypes.Centre;
            spriteManager.Add(noMatches);

            Texture2D ss = null;

            if (SkinManager.Current.RawName == "Default")
            {
                try
                {
                    ss = content.Load <Texture2D>("ranking-background");
                }
                catch
                {
                }
            }

            pSprite bg =
                new pSprite(ss ?? SkinManager.Load("playfield"), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Game, Vector2.Zero, 0, true, ss != null ? Color.White : new Color(146, 148, 214));

            spriteManager.Add(bg);

            pSprite p =
                new pSprite(SkinManager.Load("ranking-title"), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Game, new Vector2(360, 0), 0.8F, true, Color.White);

            spriteManager.Add(p);

            p =
                new pSprite(SkinManager.Load("ranking-graph"), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Game, new Vector2(20, 360), 0.8F, true, Color.White);
            spriteManager.Add(p);

            p =
                new pSprite(SkinManager.Load("ranking-panel"), FieldTypes.Window, OriginTypes.TopLeft,
                            ClockTypes.Game, new Vector2(0, 46), 0.2F, true, Color.White);
            spriteManager.Add(p);

            startTime = GameBase.Time + 300;

            Player.scoreBoard.trackingEntry.spriteBackground.Click();

            pSprite detailsBack =
                new pSprite(GameBase.WhitePixel, FieldTypes.Window,
                            OriginTypes.TopLeft,
                            ClockTypes.Game,
                            new Vector2(0, 0), 0.7F, true, Color.Black);

            detailsBack.VectorScale    = new Vector2(1024, 83);
            detailsBack.UseVectorScale = true;
            spriteManager.Add(detailsBack);

            pText pt =
                new pText("Multiplayer Results", 22, new Vector2(0, 0), Vector2.Zero, 0.79F, true,
                          Color.White, false);

            spriteManager.Add(pt);

            pt =
                new pText("Beatmap: " + BeatmapManager.Current.DisplayTitle, 16, new Vector2(1, 20), Vector2.Zero, 0.79F,
                          true, Color.White, false);
            spriteManager.Add(pt);
            pt = new pText("Match played at " +
                           score.date.ToString("yy/MM/dd hh:mm:ss", GameBase.nfi), 16, new Vector2(1, 34), Vector2.Zero,
                           0.79F, true, Color.White, false);
            spriteManager.Add(pt);

            b_back =
                new pSprite(SkinManager.Load("ranking-back"), FieldTypes.Window,
                            OriginTypes.Centre,
                            ClockTypes.Game,
                            new Vector2(520, 430), 0.94F, true,
                            new Color(255, 255, 255, 178));
            b_back.OnClick    += return_OnClick;
            b_back.IsClickable = true;
            b_back.HoverEffect = new Transformation(TransformationType.Fade, 0.7F, 1, 0, 200);
            spriteManager.Add(b_back);

            int   time = 0;
            float dep  = 0;
            int   x    = 360;

            foreach (Mods m in Enum.GetValues(typeof(Mods)))
            {
                if (ModManager.CheckActive(score.enabledMods, m))
                {
                    Transformation t2 =
                        new Transformation(TransformationType.Scale, 2, 1, GameBase.Time + time,
                                           GameBase.Time + time + 400);
                    Transformation t3 =
                        new Transformation(TransformationType.Fade, 0, 1, GameBase.Time + time,
                                           GameBase.Time + time + 400);
                    t2.Easing = EasingTypes.In;
                    t3.Easing = EasingTypes.In;

                    p =
                        new pSprite(SkinManager.Load("selection-mod-" + m.ToString().ToLower()),
                                    FieldTypes.Window,
                                    OriginTypes.Centre,
                                    ClockTypes.Game,
                                    new Vector2(x, 440), 0.92F + dep, true,
                                    Color.TransparentWhite);
                    p.Transformations.Add(t2);
                    p.Transformations.Add(t3);
                    spriteManager.Add(p);

                    time += 500;
                    dep  += 0.00001f;
                    x    -= 20;
                }
            }

            graphLine = new List <Line>();

            if (score.hpGraph != null && score.hpGraph.Count > 0)
            {
                float time1   = score.hpGraph[0].X;
                float time2   = score.hpGraph[score.hpGraph.Count - 1].X;
                float ratio   = 186 / (time2 - time1);
                int   height  = 86;
                int   offsetX = 94;
                int   offsetY = 373;

                Vector2[] va = score.hpGraph.ToArray();

                for (int i = 0; i < va.Length; i++)
                {
                    va[i].X = GameBase.WindowRatio * ((va[i].X - time1) * ratio + offsetX);
                    bool ok = va[i].Y > 0.5;
                    va[i].Y = GameBase.WindowRatio * ((1 - va[i].Y) * height + offsetY);

                    if (i > 0)
                    {
                        Line l = new Line(va[i - 1], va[i], 1, (ok ? Color.YellowGreen : Color.Red));
                        graphLine.Add(l);
                        graphLength += l.rho;
                    }
                }
            }

            Texture2D winner   = ((ScoreboardEntryExtended)Player.scoreBoard.Entries[0]).spriteAvatar.Texture;
            pSprite   winnerBg = new pSprite(SkinManager.Load("ranking-winner"), new Vector2(395, 70), 0.4f, true, Color.White);

            spriteManager.Add(winnerBg);
            if (winner != null)
            {
                pSprite largeAvatar = new pSprite(winner, OriginTypes.Centre, new Vector2(457.5f, 142f), 0.41f, true, Color.White);
                largeAvatar.CurrentScale = 185F / Math.Max(largeAvatar.Width, largeAvatar.Height);
                spriteManager.Add(largeAvatar);
                largeAvatar.MoveToRelative(new Vector2(0, 200), 2000, EasingTypes.In);
                largeAvatar.FadeInFromZero(1500);
            }

            winnerBg.MoveToRelative(new Vector2(0, 200), 2000, EasingTypes.In);
            winnerBg.FadeInFromZero(1500);

            Console.WriteLine("graph length is " + graphLength);
            drawList = new List <Line>();

            base.Initialize();

            GameBase.LoadComplete();

            if (ReplayMode)
            {
                Progress(false);
            }
            else
            {
                ApplauseChannel = AudioEngine.PlaySample(AudioEngine.s_Applause);
            }
        }
Exemple #3
0
        protected override void InitializeSpecifics()
        {
            Player.ScoreBoard.topLeft = new Vector2(GameBase.WindowManager.WidthScaled - 125, 120);

            foreach (ScoreboardEntry sbe in Player.ScoreBoard.Entries)
            {
                sbe.SpriteBackground.Texture        = TextureManager.Load(@"menu-button-background");
                sbe.SpriteBackground.OriginPosition = new Vector2(26, 20);
                sbe.SpriteBackground.OnClick       += spriteBackground_OnClick;
                sbe.SpriteBackground.HandleInput    = true;
                sbe.SpriteBackground.Tag            = sbe;
                sbe.SpriteBackground.HoverEffect    = new Transformation(sbe.SpriteBackground.InitialColour,
                                                                         Color.YellowGreen, 0, 100);
                if (sbe.name == GameBase.User.Name)
                {
                    ChatEngine.AddUserLog(string.Format(LocalisationManager.GetString(OsuString.Userlog_Multiplayer), sbe.rank, Player.ScoreBoard.Entries.Count, BeatmapManager.Current.DisplayTitleFull, OsuCommon.PlayModeString(Player.Mode)));
                }
            }

            Player.ScoreBoard.spriteManager.Alpha = 1;

            pText noMatches = new pText("Click a player tab to view their score! Hit F2 to export your replay.", 14
                                        , new Vector2(GameBase.WindowManager.WidthScaled, 60), Vector2.Zero, 1, true, Color.White, false)
            {
                TextAlignment    = Graphics.Renderers.TextAlignment.Right,
                Origin           = Origins.TopRight,
                ViewOffsetImmune = true
            };

            noMatches.TextBold = true;
            spriteManagerWideScrolling.Add(noMatches);

            startTime = GameBase.Time + 300;

            if (Player.ScoreBoard.trackingEntry != null)
            {
                Player.ScoreBoard.trackingEntry.SpriteBackground.Click();
            }

            pText pt =
                new pText(BeatmapManager.Current.DisplayTitle, 22, new Vector2(0, 0), Vector2.Zero, 0.991F, true,
                          Color.White, false);

            pt.ViewOffsetImmune = true;
            spriteManagerWideScrolling.Add(pt);

            pt =
                new pText("Beatmap by " + BeatmapManager.Current.Creator, 16, new Vector2(1, 20), Vector2.Zero, 0.991F,
                          true, Color.White, false);
            pt.ViewOffsetImmune = true;
            spriteManagerWideScrolling.Add(pt);

            pt = new pText("Match played at " + score.Date.ToString("yy/MM/dd hh:mm:ss", GameBase.nfi), 16, new Vector2(1, 34), Vector2.Zero,
                           0.991F, true, Color.White, false);
            pt.ViewOffsetImmune = true;
            spriteManagerWideScrolling.Add(pt);

            if (!MatchSetup.Match.TeamMode && Player.ScoreBoard.Entries.Count > 1 && Player.ScoreBoard.Entries[0].score != Player.ScoreBoard.Entries[1].score) //don't display in a tied situation.
            {
                pTexture winner   = ((ScoreboardEntryExtended)Player.ScoreBoard.Entries[0]).SpriteAvatar.Texture;
                pSprite  winnerBg = new pSprite(TextureManager.Load(@"ranking-winner"), new Vector2(395, 10), 0.4f, true, Color.White);
                spriteManagerWideScrolling.Add(winnerBg);
                if (winner != null)
                {
                    pSprite largeAvatar = new pSprite(winner, Origins.Centre, new Vector2(457.5f, 89f), 0.41f, true, Color.White);
                    largeAvatar.Scale = 185F / Math.Max(largeAvatar.Width, largeAvatar.Height);
                    spriteManagerWideScrolling.Add(largeAvatar);
                    largeAvatar.MoveToRelative(new Vector2(0, 200), 2000, EasingTypes.Out);
                    largeAvatar.FadeInFromZero(1500);
                }

                winnerBg.MoveToRelative(new Vector2(0, 200), 2000, EasingTypes.Out);
                winnerBg.FadeInFromZero(1500);
            }
        }