Exemple #1
0
        private static void SongInfo(bool togglePermanent = false)
        {
            if (BeatmapManager.Current == null)
            {
                return;
            }

            if (!metadataEnabled)
            {
                SpriteManager.GetTagged("b").ForEach(s => s.MoveTo(s.InitialPosition, 100, EasingTypes.Out));
                SpriteManager.GetTagged("np").ForEach(s => s.FadeOut(60));
                return;
            }

            if (togglePermanent)
            {
                ConfigManager.sPermanentSongInfo.Value = !ConfigManager.sPermanentSongInfo;
            }

            SpriteManager.RemoveTagged("np");

            string npStr = BeatmapManager.Current.SortTitleAuto;

            if (npStr == null)
            {
                return;
            }

            if (npStr.Length > 54)
            {
                npStr = npStr.Substring(0, 54) + "...";
            }

            pText np = new pText(npStr, 14, Vector2.Zero, Vector2.Zero, 0.999F, ConfigManager.sPermanentSongInfo, Color.White, false);

            np.Field = Fields.TopRight;
            np.Tag   = "np";
            float textSize = np.MeasureText().X;

            Transformation t1 = new Transformation(new Vector2(-80 + textSize, 0), new Vector2(10 + textSize, 0),
                                                   GameBase.Time, GameBase.Time + 1000);

            t1.Easing = EasingTypes.Out;
            Transformation t2 = new Transformation(TransformationType.Fade, 0, 1, GameBase.Time,
                                                   GameBase.Time + 1000);

            t1.Easing = EasingTypes.Out;

            Transformation t3 = t1.CloneReverse();

            t3.Time1 = GameBase.Time + 6000;
            t3.Time2 = GameBase.Time + 8000;

            Transformation t4 = t2.CloneReverse();

            t4.Time1 = GameBase.Time + 6000;
            t4.Time2 = GameBase.Time + 8000;

            np.Transformations.Add(t1);
            np.Transformations.Add(t2);
            if (!ConfigManager.sPermanentSongInfo)
            {
                np.Transformations.Add(t3);
                np.Transformations.Add(t4);
            }

            np.OriginPosition = new Vector2(0, -2);

            SpriteManager.Add(np);

            pSprite np2 = new pSprite(TextureManager.Load(@"menu-np", SkinSource.Osu), Fields.TopRight,
                                      Origins.TopLeft,
                                      Clocks.Game,
                                      new Vector2(620, 0), 0.998F, ConfigManager.sPermanentSongInfo, Color.White, "np");

            np2.OriginPosition = new Vector2(100, 0);

            np2.Transformations.Add(t1);
            np2.Transformations.Add(t2);
            if (!ConfigManager.sPermanentSongInfo)
            {
                np2.Transformations.Add(t3);
                np2.Transformations.Add(t4);
            }

            SpriteManager.Add(np2);

            Vector2 offset = new Vector2(0, 20);

            foreach (pSprite p in SpriteManager.GetTagged("b"))
            {
                p.Transformations.Clear();

                t1           = new Transformation(p.Position, p.InitialPosition + offset, GameBase.Time, GameBase.Time + 400);
                t2           = t1.CloneReverse();
                t2.EndVector = p.InitialPosition;
                t2.Time1     = GameBase.Time + 7600;
                t2.Time2     = GameBase.Time + 8000;

                p.Transformations.Add(t1);
                if (!ConfigManager.sPermanentSongInfo)
                {
                    p.Transformations.Add(t2);
                }
            }
        }
Exemple #2
0
        private void SongInfo()
        {
            if (BeatmapManager.Current == null)
            {
                return;
            }

            ChatEngine.spriteManager.RemoveTagged("np");

            string npStr = BeatmapManager.Current.SortTitle;

            pText np = new pText(npStr, 14, Vector2.Zero, Vector2.Zero, 0.999F, false, Color.White, false);

            np.Tag = "np";
            float textSize = np.MeasureText().X;

            Transformation t1 = new Transformation(new Vector2(720 - textSize, 0), new Vector2(630 - textSize, 0),
                                                   GameBase.Time, GameBase.Time + 1000);

            t1.Easing = EasingTypes.In;
            Transformation t2 = new Transformation(TransformationType.Fade, 0, 1, GameBase.Time,
                                                   GameBase.Time + 1000);

            t1.Easing = EasingTypes.In;

            Transformation t3 = t1.CloneReverse();

            t3.Time1 = GameBase.Time + 6000;
            t3.Time2 = GameBase.Time + 8000;

            Transformation t4 = t2.CloneReverse();

            t4.Time1 = GameBase.Time + 6000;
            t4.Time2 = GameBase.Time + 8000;

            np.Transformations.Add(t1);
            np.Transformations.Add(t2);
            np.Transformations.Add(t3);
            np.Transformations.Add(t4);

            np.OriginPosition = new Vector2(0, -2);

            ChatEngine.spriteManager.Add(np);

            pSprite np2 = new pSprite(content.Load <Texture2D>("menu-np"), FieldTypes.Window,
                                      OriginTypes.TopLeft,
                                      ClockTypes.Game,
                                      new Vector2(620, 0), 0.998F, false, Color.White, "np");

            np2.OriginPosition = new Vector2(100, 0);

            np2.Transformations.Add(t1);
            np2.Transformations.Add(t2);
            np2.Transformations.Add(t3);
            np2.Transformations.Add(t4);

            ChatEngine.spriteManager.Add(np2);

            Vector2 offset = new Vector2(0, 20);

            foreach (pSprite p in ChatEngine.spriteManager.GetTagged("b"))
            {
                p.Transformations.Clear();

                t1 =
                    new Transformation(p.CurrentPosition, p.StartPosition + offset, GameBase.Time,
                                       GameBase.Time + 400);
                t2           = t1.CloneReverse();
                t2.EndVector = p.StartPosition;
                t2.Time1     = GameBase.Time + 7600;
                t2.Time2     = GameBase.Time + 8000;

                p.Transformations.Add(t1);
                p.Transformations.Add(t2);
            }
        }