예제 #1
0
        /// <summary>
        /// Performs all advanced computation needed to draw sliders in a particular beatmap.
        /// </summary>
        internal void Init()
        {
            numVertices_quad   = 6;
            numPrimitives_quad = 4;
            numIndices_quad    = 6;

            numVertices_cap   = MAXRES + 2;
            numPrimitives_cap = MAXRES;
            numIndices_cap    = 3 * MAXRES;

            pTexture texture = TextureManager.Load(OsuTexture.tracks);

            float retinaWidth = texture.TextureGl.TextureWidth;

            retinaHeight = texture.TextureGl.TextureHeight;
            float sheetX = texture.X;

            sheetY = texture.Y;

            float texel_origin = GameBase.SpriteSheetResolution == 960 ? TEXEL_ORIGIN : 0.375f;

            sheetStart = (2.0f + sheetX + texel_origin) / retinaWidth;
            sheetEnd   = (-3.0f + sheetX + texture.Width + texel_origin - TEXTURE_SHRINKAGE_FACTOR) / retinaWidth;

            CalculateCapMesh();
            CalculateQuadMesh();

            am_initted_geom = true;

            trackTexture = TextureManager.Load(OsuTexture.tracks);
        }
예제 #2
0
        internal pSprite(pTexture texture, FieldTypes field, OriginTypes origin, ClockTypes clocking, Vector2 position,
                         float depth, bool alwaysDraw, Color4 colour)
        {
            Field    = field;
            Origin   = origin;
            Clocking = clocking;

            Position = position;
            Colour   = colour;

            Scale      = Vector2.One;
            Rotation   = 0;
            DrawDepth  = depth;
            AlwaysDraw = alwaysDraw;

            if (!alwaysDraw)
            {
                Alpha = 0;
            }
            else
            {
                Alpha = 1;
            }

            Texture      = texture;
            UsesTextures = true;
        }
예제 #3
0
        internal static pTexture CreateBlurTexture(pTexture texture, int radius, BlurType type)
        {
            if (!ConfigManager.sShaders || radius == 0 || texture.TextureGl.IsTransparent)
            {
                return(texture);
            }

            List <BlurTexturePair> currentCache = null;

            if (!blurCache.TryGetValue(texture, out currentCache))
            {
                currentCache = new List <BlurTexturePair>();
            }

            int currentIndex = currentCache.FindIndex(c => c.Radius == radius && c.Type == type);

            if (currentIndex != -1)
            {
                return(currentCache[currentIndex].Texture);
            }

            if (vShader == null || hShader == null)
            {
                Initialize();
            }

            vShader.Properties[@"texSize"] = hShader.Properties[@"texSize"] = new OpenTK.Vector2(texture.Width, texture.Height);

            using (RenderTarget2D target = new RenderTarget2D(texture.Width, texture.Height))
            {
                target.Bind();

                texture.TextureGl.Draw(Vector2.Zero, Vector2.Zero, Color.White, new Vector2(1, -1), 0, null);

                for (int i = 0; i < (int)type; i++)
                {
                    hShader.Begin();
                    hShader.Properties[@"radius"] = radius;
                    target.Texture.Draw(Vector2.Zero, Vector2.Zero, Color.White, new Vector2(1, -1), 0, null);
                    hShader.End();

                    vShader.Begin();
                    vShader.Properties[@"radius"] = radius;
                    target.Texture.Draw(Vector2.Zero, Vector2.Zero, Color.White, new Vector2(1, -1), 0, null);
                    vShader.End();
                }

                target.Unbind();

                target.Texture.WrapMode = texture.TextureGl.WrapMode; // We want to retain the wrap mode we had prior to blurring.
                pTexture newTex = new pTexture(target.Texture);

                currentCache.Add(new BlurTexturePair()
                {
                    Type = type, Radius = radius, Texture = newTex
                });
                blurCache[texture] = currentCache;
                return(newTex);
            }
        }
예제 #4
0
        internal override bool Load()
        {
            if (Loaded)
            {
                return(false);
            }

            Loaded = true;

            pTexture[] textures = null;

            if (useSkinSprites)
            {
                textures = TextureManager.LoadAll(Filename, SkinSource.All, false);
            }

            if (textures == null)
            {
                textures = new pTexture[FrameCount];

                if (Filenames != null)
                {
                    for (int i = 0; i < FrameCount; i++)
                    {
                        textures[i] = TextureManager.Load(Filenames[i], SkinSource.Beatmap);
                    }
                }
            }

            Animation.TextureArray = textures;

            return(true);
        }
예제 #5
0
        internal pCheckbox(string text, float size, Vector2 position, float depth, bool defaultStatus, float maxWidth = 0)
        {
            pos = position;

            localChecked = defaultStatus;
            this.size    = size;

            t_checked   = TextureManager.Load(@"circle-full", SkinSource.Osu);
            t_unchecked = TextureManager.Load(@"circle-empty", SkinSource.Osu);

            sBox             = new pSprite(localChecked ? t_checked : t_unchecked, Fields.TopLeft, Origins.Centre, Clocks.Game, position + new Vector2(8, 8), depth, true, SkinManager.NEW_SKIN_COLOUR_MAIN);
            sBox.HandleInput = true;
            sBox.Scale       = size;
            sBox.OnClick    += p_OnClick;
            sBox.ClickRequiresConfirmation = true;

            sText        = new pText(text, 15 * size, position + (new Vector2(20 * size, 8)), new Vector2(Math.Max(0, maxWidth - 20 * size), 0), depth, true, Color.White, true);
            sText.Origin = Origins.CentreLeft;
            sText.ClickRequiresConfirmation = true;
            sText.HandleInput = true;
            sText.OnClick    += p_OnClick;


            SpriteCollection.Add(sBox);
            SpriteCollection.Add(sText);
        }
예제 #6
0
 internal pParticleBatch(int amountParticles, float radius, float gravity, pTexture texture, Fields fieldType, Origins origin, Clocks clock, Vector2 startPosition, float drawDepth, bool alwaysDraw, Color colour)
     : base(texture, fieldType, origin, clock, startPosition, drawDepth, alwaysDraw, colour)
 {
     this.amountParticles = amountParticles;
     this.radius          = radius;
     this.gravity         = gravity;
     startTime            = getClockTime();
 }
예제 #7
0
        internal void UpdateBackground(AlignmentMode alignmentMode = AlignmentMode.Default, BackgroundAdjustmentDelegate backgroundAdjustment = null)
        {
            BackgroundTexture = null;
            showBackground    = true;
            backgroundUpdateCount++;

            updateBackground(alignmentMode, backgroundAdjustment);
        }
예제 #8
0
        public static void LoadSkinElements()
        {
            colourTextActive        = SkinManager.Colours[@"SongSelectActiveText"];
            colourTextInactive      = SkinManager.Colours[@"SongSelectInactiveText"];
            colourTextInactiveFaded = ColourHelper.ChangeAlpha(colourTextInactive, 50);

            s_menuButtonBackground = TextureManager.Load(@"menu-button-background");
            s_star = TextureManager.Load(@"star");
        }
예제 #9
0
        internal pTexture Load(string imageMapName, string defaultName, SkinSource skinSource)
        {
            pTexture p = null;

            if (imageMap[imageMapName] != null)
            {
                p = TextureManager.Load(imageMap[imageMapName], skinSource);
            }
            return(p ?? TextureManager.Load(defaultName, skinSource));
        }
예제 #10
0
        private pTexture GetThumbnail()
        {
            pTexture thumb = null;

            byte[] bytes = Beatmap.GetFileBytes("thumb-128.jpg");
            if (bytes != null)
            {
                thumb = pTexture.FromBytes(bytes);
            }
            return(thumb);
        }
예제 #11
0
        internal HpBar(SpriteManager spriteManager)
        {
            this.spriteManager = spriteManager;

            pTexture[] fillTextures = loadSpritesFromSource(@"scorebar-colour");
            pTexture[] markerSprite = loadSpritesFromSource(@"scorebar-marker");
            newDefault = (fillTextures[0].Source == SkinSource.Osu || markerSprite[0].Source == SkinSource.Skin);

            if (newDefault)
            {
                if (fillTextures[0].AssetName == @"scorebar-colour-0" && fillTextures[0].Source == SkinSource.Osu)
                {
                    fillTextures = new pTexture[] { loadSpriteFromSource(@"scorebar-colour") }; // replace the old ugly bar if osu! tries to load it
                }
                t_kiNormal        = markerSprite[0];
                t_kiDanger        = markerSprite[0];
                t_kiDanger2       = markerSprite[0];
                s_barFill         = new pAnimation(fillTextures, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(7.5f, 7.8f), 0.965F, true, Color.White, null);
                s_kiIcon          = new pSprite(t_kiNormal, Fields.NativeStandardScale, Origins.Centre, Clocks.Game, new Vector2(CurrentXPosition, (8.125f + 2.5f) * GameBase.WindowManager.Ratio), 0.97F, true, Color.White, null);
                s_kiIcon.Additive = true;
            }
            else
            {
                t_kiNormal  = loadSpriteFromSource(@"scorebar-ki");
                t_kiDanger  = loadSpriteFromSource(@"scorebar-kidanger");
                t_kiDanger2 = loadSpriteFromSource(@"scorebar-kidanger2");
                s_barFill   = new pAnimation(fillTextures, Fields.TopLeft, Origins.TopLeft, Clocks.Game, new Vector2(3, 10), 0.965F, true, Color.White, null);
                s_kiIcon    = new pSprite(t_kiNormal, Fields.NativeStandardScale, Origins.Centre, Clocks.Game, new Vector2(0, 10 * GameBase.WindowManager.Ratio), 0.97F, true, Color.White, null);
            }

            s_barFill.DrawWidth = 0;
            s_barFill.SetFramerateFromSkin();
            s_barFill.DrawDimensionsManualOverride = true;



            s_barBg = new pSprite(loadSpriteFromSource(@"scorebar-bg"), Fields.TopLeft, Origins.TopLeft, Clocks.Game, Vector2.Zero, 0.96F, true, Color.White, null);

            SpriteCollection.Add(s_barBg);
            SpriteCollection.Add(s_barFill);
            SpriteCollection.Add(s_kiIcon);

            if (Player.Relaxing || Player.Relaxing2)
            {
                Visible = false;
            }
            else if (spriteManager != null)
            {
                spriteManager.Add(SpriteCollection);
            }

            Update();
        }
예제 #12
0
        internal virtual Vector2 MeasureText()
        {
            pTexture tex = Texture; // calling this will refresh the texture if required.

            if (TextRenderSpecific)
            {
                return(lastMeasure / GameBase.WindowManager.Ratio);
            }
            else
            {
                return(lastMeasure * 0.625f);
            }
        }
예제 #13
0
        private pSprite createBackgroundSprite(AlignmentMode alignmentMode)
        {
            if (BackgroundTexture == null || BackgroundTexture.IsDisposed)
            {
                BackgroundTexture = TextureManager.Load(@"menu-background", SkinSource.Osu);
            }

            Fields field = (alignmentMode & AlignmentMode.Storyboard) != 0 ?
                           Fields.StoryboardCentre : Fields.Centre;

            pSprite s = new pSprite(BackgroundTexture, field, Origins.Centre, Clocks.Game, Vector2.Zero, SpriteManager.drawOrderBwd(GameBase.Time), true, Color.White);

            return(s);
        }
예제 #14
0
        private void Initialize()
        {
            byte[] black = new byte[width * height * 4];
            for (int j = 0; j < black.Length - 1; j++)
            {
                black[j] = (byte)(j % 4 == 3 ? 255 : 0);
            }

            for (int i = 0; i < FRAME_BUFFER; i++)
            {
                videoTextures[i] = new pTexture(width, height);
                videoTextures[i].SetData(black);
            }
        }
예제 #15
0
        internal virtual pTexture CreateText(string text, float size, Vector2 restrictBounds, Color4 Color4, bool shadow,
                                             bool bold, bool underline, TextAlignment alignment, bool forceAa,
                                             out Vector2 measured,
                                             Color4 background, Color4 border, int borderWidth, bool measureOnly, string fontFace)
        {
            byte[] bytes = new byte[text.Length * 32 * 26 * 4];
            for (int i = 0; i < bytes.Length; i++)
            {
                bytes[i] = 200;
            }

            pTexture tex = pTexture.FromRawBytes(bytes, text.Length * 32, 26);

            measured = new Vector2(tex.Width, tex.Height);
            return(tex);
        }
예제 #16
0
        private void add(Vector2 offset)
        {
            pTexture trailTexture = SkinManager.t_cursortrail;

            if (trailTexture == null)
            {
                return;
            }

            float drawSize = trailTexture.DisplayWidth * GameBase.WindowManager.RatioInverse * osu.Input.InputManager.s_Cursor.Scale * osu.Input.InputManager.s_Cursor.VectorScale.X;

            RectangleF texCoordsRect = new RectangleF(0, 0,
                                                      (float)trailTexture.Width / TextureGl.GetPotDimension(trailTexture.Width),
                                                      (float)trailTexture.Height / TextureGl.GetPotDimension(trailTexture.Height));

            int   vertexIndex = currentIndex * 4;
            float fadeTime    = fadeClock + 1f;

            vertexBuffer.Vertices[vertexIndex].Position        = offset + new Vector2(-drawSize / 2, -drawSize / 2);
            vertexBuffer.Vertices[vertexIndex].TexturePosition = new Vector2(0, 0);
            vertexBuffer.Vertices[vertexIndex].Colour          = Color.White;
            vertexBuffer.Vertices[vertexIndex].Time            = fadeTime;

            vertexBuffer.Vertices[vertexIndex + 1].Position        = offset + new Vector2(-drawSize / 2, drawSize / 2);
            vertexBuffer.Vertices[vertexIndex + 1].TexturePosition = new Vector2(0, texCoordsRect.Height);
            vertexBuffer.Vertices[vertexIndex + 1].Colour          = Color.White;
            vertexBuffer.Vertices[vertexIndex + 1].Time            = fadeTime;

            vertexBuffer.Vertices[vertexIndex + 2].Position        = offset + new Vector2(drawSize / 2, drawSize / 2);
            vertexBuffer.Vertices[vertexIndex + 2].TexturePosition = new Vector2(texCoordsRect.Width, texCoordsRect.Height);
            vertexBuffer.Vertices[vertexIndex + 2].Colour          = Color.White;
            vertexBuffer.Vertices[vertexIndex + 2].Time            = fadeTime;

            vertexBuffer.Vertices[vertexIndex + 3].Position        = offset + new Vector2(drawSize / 2, -drawSize / 2);
            vertexBuffer.Vertices[vertexIndex + 3].TexturePosition = new Vector2(texCoordsRect.Width, 0);
            vertexBuffer.Vertices[vertexIndex + 3].Colour          = Color.White;
            vertexBuffer.Vertices[vertexIndex + 3].Time            = fadeTime;

            fadeTimes[currentIndex]   = fadeTime;
            needsUpload[currentIndex] = true;

            currentIndex = (currentIndex + 1) % MAX_SPRITES;
        }
예제 #17
0
        internal static void DoOnGamePress()
        {
            if (ConfigManager.sCursorRipple && (GameBase.Mode != OsuModes.Play || !ModManager.CheckActive(Mods.Cinema)) && (Player.Instance == null || !Player.Instance.HideMouse))
            {
                pTexture ripple = TextureManager.Load(@"cursor-ripple");
                if (ripple == null)
                {
                    ripple = TextureManager.Load(@"menu-osu-shockwave", SkinSource.Osu);
                }

                pSprite rippleSprite = new pSprite(ripple, Fields.Native, Origins.Centre, Clocks.Game, InputManager.CursorPosition, 0.2F, false, Color.White);
                rippleSprite.Additive = true;
                rippleSprite.Alpha    = 0.2f;
                rippleSprite.FadeOut(700);
                rippleSprite.Transformations.Add(new Transformation(TransformationType.Scale, 0.05f, 0.5f, GameBase.Time, GameBase.Time + 700, EasingTypes.Out));
                GameBase.spriteManagerOverlay.Add(rippleSprite);
            }

            InputManager.TriggerEvent(InputEventType.OnGamePress);
        }
예제 #18
0
        internal override void InitializeSprites()
        {
            if (GameBase.GameField.CorrectionOffsetActive)
            {
                spinnerTopOffset -= 16;
            }

            //this is madness, but works.
            posTopLeftCentre = new Vector2(GameBase.WindowManager.WidthScaled / Math.Max(1, GameBase.WindowManager.WidthWidescreenRatio) / 2f, spinnerTopOffset + 219);

            Color fade = (GameBase.Mode == OsuModes.Play &&
                          (ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.SpunOut) || Player.Relaxing2)
                              ? Color.Gray
                              : Color.White);

            SpriteCircleTop =
                new pSprite(TextureManager.Load(@"spinner-circle", SkinSource.Osu | SkinSource.Skin), Fields.TopLeft,
                            Origins.Centre,
                            Clocks.Audio, posTopLeftCentre, SpriteManager.drawOrderBwd(EndTime), false,
                            fade);
            SpriteCollection.Add(SpriteCircleTop);

            if (!ModManager.CheckActive(hitObjectManager.ActiveMods, Mods.Hidden))
            {
                pTexture highRes = TextureManager.Load(@"spinner-approachcircle", SkinSource.Skin);

                SpriteApproachCircle =
                    new pSprite(TextureManager.Load(@"spinner-approachcircle", SkinSource.Osu | SkinSource.Skin), Fields.TopLeft, Origins.Centre,
                                Clocks.Audio, posTopLeftCentre, SpriteManager.drawOrderBwd(EndTime - 2), false, fade);
                SpriteCollection.Add(SpriteApproachCircle);
            }

            SpriteBonusCounter = new pSpriteText("", SkinManager.Current.FontScore, SkinManager.Current.FontScoreOverlap,
                                                 Fields.TopLeft, Origins.Centre,
                                                 Clocks.Audio, new Vector2(posTopLeftCentre.X, posTopLeftCentre.Y + 80),
                                                 SpriteManager.drawOrderBwd(EndTime - 3), false,
                                                 fade);
            SpriteCollection.Add(SpriteBonusCounter);

            SpriteCircleTop.Scale *= 0.8f;
        }
예제 #19
0
        void wb_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
        {
            if (e.CurrentProgress != e.MaximumProgress)
            {
                return;
            }

            if (Loaded)
            {
                return;
            }
            Loaded = true;

            GameBase.Scheduler.AddDelayed(delegate
            {
                try
                {
                    if (bitmapBacking == null)
                    {
                        bitmapBacking = new Bitmap(Width, Height);
                    }

                    wb.DrawToBitmap(bitmapBacking, new Rectangle(0, 0, Width, Height));
                    if (tex == null)
                    {
                        tex = pTexture.FromBitmap(bitmapBacking);
                    }
                    else
                    {
                        tex.SetData(bitmapBacking);
                    }

                    if (OnLoaded != null)
                    {
                        OnLoaded();
                    }
                }
                catch { }
            }, 300);
        }
예제 #20
0
        public override bool Draw()
        {
            if (!base.Draw())
            {
                return(false);
            }

            for (int i = 0; i < renderCoordinates.Count; i++)
            {
                pTexture tex = renderTextures[i];

                if (i == 0 && tex.DpiScale != 1)
                {
                    drawScaleVector *= 1f / tex.DpiScale;
                }

                drawPosition = new Vector2(renderCoordinates[i].X * drawScale + drawRectangle.X, drawRectangle.Y);
                tex.TextureGl?.Draw(drawPosition, Vector2.Zero, drawColour, drawScaleVector, Rotation, null, SpriteManager.Current.SpriteBatch);
            }

            return(true);
        }
예제 #21
0
        public void Draw()
        {
            if (ConfigManager.dDisableSpriteDraw)
            {
                return;
            }

            pTexture trail = SkinManager.t_cursortrail;

            if (amountVisibleRanges == 0 || trail == null || trail.IsDisposed)
            {
                return;
            }

            if (trail.TextureGl.Bind())
            {
                cursorTrailShader.Properties[@"g_FadeClock"] = fadeClock;
                cursorTrailShader.Begin();

                OsuGlControl.SetBlend(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.One);

                for (int i = 0; i < amountNewRanges; i += 2)
                {
                    for (int j = newIndexRanges[i]; j < newIndexRanges[i + 1]; ++j)
                    {
                        needsUpload[j] = false;
                    }

                    vertexBuffer.UpdateRange(newIndexRanges[i] * 4, newIndexRanges[i + 1] * 4);
                }

                for (int i = 0; i < amountVisibleRanges; i += 2)
                {
                    vertexBuffer.DrawRange(visibleIndexRanges[i] * 4, visibleIndexRanges[i + 1] * 4);
                }

                cursorTrailShader.End();
            }
        }
예제 #22
0
        public override bool Draw()
        {
            if (!base.Draw())
            {
                return(false);
            }

            pTexture texture = Texture;

            if (texture == null || texture.TextureGl == null)
            {
                return(false);
            }

            if (texture.TextureGl.Id == -1)
            {
                texture.ReloadIfPossible();
            }

            texture.TextureGl.Draw(FieldPosition, OriginVector, AlphaAppliedColour, FieldScale, Rotation, TextureRectangle);
            return(true);
        }
        private void addTriangle(bool startOnScreen = false)
        {
            if (!ProduceTriangles || Colours.Count == 0)
            {
                return;
            }

            Color col = Colours[RNG.Next(0, Colours.Count)];

            float scale = RNG.NextSingle(0.2f, 1.0f);

            pTexture t_triangle = TextureManager.Load(@"triangle", (BanchoClient.Permission & Permissions.Supporter) > 0 ? SkinSource.All : SkinSource.Osu);

            pSprite triangle = new pSprite(t_triangle, Fields.TopLeft, Origins.Centre, Clocks.Game,
                                           new Vector2(RNG.NextSingle(GameBase.WindowManager.WidthScaled), startOnScreen ? RNG.NextSingle(GameBase.WindowManager.HeightScaled) : GameBase.WindowManager.HeightScaled + padding), 0.8f - scale * 0.01f, true, Color.White)
            {
                //Rotation = (float)(Math.PI * GameBase.random.Next(0, 2)),
                InitialColour = col,
                Scale         = scale
            };

            spriteManager.Add(triangle);
        }
예제 #24
0
        /// <summary>
        /// Creates a new stage with start position and columns defined by the skin.
        /// </summary>
        /// <param name="skin">The skin to use.</param>
        /// <param name="posY">The vertical position of the stage.</param>
        /// <param name="height">The height of the stage.</param>
        /// <param name="minimal">Should we draw sprites?</param>
        /// <param name="columnOffset">The skin column offset for this stage (used for coop)</param>
        internal StageMania(SkinMania skin, bool minimal = false, float posY = 0f, float height = 480f, float posX = float.NaN, float widthScale = 1f, int stageIndex = 0, int columnOffset = 0)
        {
            Minimal           = minimal;
            Height            = height;
            Skin              = skin;
            this.stageIndex   = stageIndex;
            this.ColumnOffset = columnOffset;

            if (!minimal)
            {
                SpriteManager      = new SpriteManager(true);
                SpriteManagerBelow = new SpriteManager(true);
                SpriteManagerAbove = new SpriteManager(true);
                SpriteManagerNotes = new SpriteManager(true);

                stageHint              = new pSprite(Skin.Load(@"StageHint", @"mania-stage-hint", SkinSource), Fields.TopLeft, Origins.CentreLeft, Clocks.Audio, new Vector2(0, HitPosition), 0.62f, true, Color.White);
                stageHint.Alpha        = 0.9f;
                stageHint.VectorScale  = new Vector2(0, 0.9f);
                stageHint.Scale        = 1.6026f;
                stageHint.FlipVertical = UpsideDown;
                SpriteManager.Add(stageHint);

                pSprite p = new pSprite(Skin.Load(@"StageLeft", @"mania-stage-left", SkinSource), Fields.TopLeft, Origins.TopRight, Clocks.Audio, new Vector2(0.05f, Top), 0.8f, true, Color.White);
                p.VectorScale = new Vector2(HeightRatio, Height / (float)p.Height * 1.6f);
                SpriteManagerBelow.Add(p);

                stageRight             = new pSprite(Skin.Load(@"StageRight", @"mania-stage-right", SkinSource), Fields.TopLeft, Origins.TopLeft, Clocks.Audio, new Vector2(0.05f, Top), 0.8f, true, Color.White);
                stageRight.VectorScale = new Vector2(HeightRatio, Height / (float)stageRight.Height * 1.6f);
                SpriteManagerBelow.Add(stageRight);

                pTexture[] pt = Skin.LoadAll(@"StageBottom", @"mania-stage-bottom", SkinSource);
                if (pt != null && pt.Length > 0)
                {
                    stageBottom            = new pAnimation(pt, Fields.TopLeft, FlipOrigin(Origins.BottomCentre), Clocks.Audio, new Vector2(0, ActualBottom), 0.94f, true, Color.White);
                    stageBottom.FrameDelay = 1000 / 60f;
                    stageBottom.Scale      = 1.6f;
                    SpriteManagerAbove.Add(stageBottom);
                }

                if (Skin.JudgementLine)
                {
                    judgementLine             = new pSprite(GameBase.WhitePixel, Fields.TopLeft, FlipOrigin(Origins.TopLeft), Clocks.Audio, new Vector2(0, HitPosition), 0.62f, true, Skin.GetColour(@"JudgementLine"));
                    judgementLine.Alpha       = 0.9f;
                    judgementLine.VectorScale = new Vector2(0, 0.7f);
                    judgementLine.Scale       = 1.6026f;
                    SpriteManager.Add(judgementLine);
                }

                p             = new pSprite(TextureManager.Load("mania-stage-light", SkinSource.Osu), Fields.TopLeft, Origins.BottomRight, Clocks.Audio, new Vector2(0, Top), 0.5f, true, Color.TransparentWhite);
                p.Rotation    = -(float)(Math.PI / 2);
                p.VectorScale = new Vector2(Height / (float)p.Width, 0.27f) * 1.6f;
                SpriteManagerBelow.Add(p);

                waveRight             = new pSprite(TextureManager.Load("mania-stage-light", SkinSource.Osu), Fields.TopLeft, Origins.BottomLeft, Clocks.Audio, new Vector2(0, Top), 0.5f, true, Color.TransparentWhite);
                waveRight.Rotation    = (float)(Math.PI / 2);
                waveRight.VectorScale = new Vector2(Height / (float)waveRight.Width, 0.27f) * 1.6f;
                SpriteManagerBelow.Add(waveRight);

                hitScore            = new pAnimation(null, Fields.TopLeft, Origins.Centre, Clocks.Audio, new Vector2(0, ScaleFlipPosition(Skin.ScorePosition)), 0.998f, true, Color.White);
                hitScore.FrameDelay = 1000 / 20f;
                SpriteManagerAbove.Add(hitScore);

                foreach (string hitType in new[] { @"0", @"50", @"100", @"200", @"300", @"300g" })
                {
                    hitTextures.Add(hitType, Skin.LoadAll($@"Hit{hitType}", $@"mania-hit{hitType}", SkinSource));
                }

                if (hasHiddenSprites)
                {
                    bool fromKeyLayer = ModManager.CheckActive(Player.currentScore.EnabledMods, Mods.Hidden);

                    pTexture hiddenSprite = TextureManager.Load(@"mania-stage-hidden", SkinSource.Osu);

                    if (hiddenSprite == null)
                    {
                        GameBase.ChangeMode(OsuModes.Menu);
                    }

                    if (UpsideDown)
                    {
                        hiddenMask = new pSprite(GameBase.WhitePixel, Fields.TopLeft, fromKeyLayer ? Origins.TopLeft : Origins.BottomLeft, Clocks.Audio,
                                                 new Vector2(0, fromKeyLayer ? HitPosition : 480), 0.81f, true, Color.Black);
                        hiddenFade = new pSprite(hiddenSprite, Fields.TopLeft, fromKeyLayer ? Origins.TopLeft : Origins.BottomLeft, Clocks.Audio,
                                                 new Vector2(0, fromKeyLayer ? (HitPosition + 160 / 1.6f) : (320 / 1.6f)), 0.81f, true, Color.TransparentWhite);
                    }
                    else
                    {
                        hiddenMask = new pSprite(GameBase.WhitePixel, Fields.TopLeft, fromKeyLayer ? Origins.BottomLeft : Origins.TopLeft, Clocks.Audio,
                                                 new Vector2(0, fromKeyLayer ? HitPosition : 0), 0.81f, true, Color.Black);
                        hiddenFade = new pSprite(hiddenSprite, Fields.TopLeft, fromKeyLayer ? Origins.BottomLeft : Origins.TopLeft, Clocks.Audio,
                                                 new Vector2(0, fromKeyLayer ? (HitPosition - 160 / 1.6f) : (160 / 1.6f)), 0.81f, true, Color.TransparentWhite);
                    }

                    SpriteManagerAbove.Add(hiddenMask);
                    SpriteManagerAbove.Add(hiddenFade);
                }
            }

            //We must set these later as they position the spritemanagers
            Left = float.IsNaN(posX) ? Skin.ColumnStart : posX;
            Top  = posY;

            //Scale the width of columns, column spacing, and stage separation to fit everything on the screen
            //NOTE: This logic assumes there are a maximim of two stages
            if (!minimal && columnOffset == 0)
            {
                //Flip left and right offsets if they overlap
                float left  = Math.Min(Left, GameBase.WindowManager.WidthScaled - Skin.ColumnRight);
                float right = Math.Min(Skin.ColumnRight, GameBase.WindowManager.WidthScaled - Left);
                Left = left;

                //resizeWidth is the width of everything we're scaling that is to the right of "Left"
                float resizeWidth = 0;
                for (int i = 0; i < Skin.Columns; i++)
                {
                    resizeWidth += Skin.ColumnWidth[i] + (i > 0 ? Skin.ColumnSpacing[i - 1] : 0);
                }
                resizeWidth += Skin.SplitStages && SecondaryStageColumns != -1 ? Skin.StageSeparation : 0;

                float totalWidth     = Left + resizeWidth + right;
                float screenOverflow = Math.Max(0, totalWidth - GameBase.WindowManager.WidthScaled);

                widthScale = (resizeWidth - screenOverflow) / resizeWidth;
            }
            this.widthScale = widthScale;

            for (int i = columnOffset; i < columnOffset + PrimaryStageColumns; i++)
            {
                Columns.Add(new ColumnMania(this, i, widthScale));
            }

            if (!minimal)
            {
                //Set the visible area of the notes now that we know the width of the columns
                SpriteManagerNotes.SetVisibleArea(new RectangleF(Left, Top, Width, Height));
                SpriteManagerNotes.ForwardPlayOptimisations = true;
            }

            if (!minimal)
            {
                stageHint.VectorScale.X = Width / stageHint.Width;
                stageRight.Position.X  += Width;
                if (stageBottom != null)
                {
                    stageBottom.Position.X += Width / 2f;
                }
                if (judgementLine != null)
                {
                    judgementLine.VectorScale.X = Width;
                }
                waveRight.Position.X += Width;
                hitScore.Position.X  += Width / 2f;

                //Scale is used for sprite transformations, so we use vectorscale instead
                if (SkinManager.Current.Version >= 2.4 || HeightRatio < 1f)
                {
                    hitScore.VectorScale = Vector2.One * MinimumRatio;
                }

                //Hidden masks
                if (hasHiddenSprites)
                {
                    bool fromKeyLayer = ModManager.CheckActive(Player.currentScore.EnabledMods, Mods.Hidden);
                    hiddenMask.VectorScale = new Vector2(Width * 1.6f, 160);
                    hiddenMask.Alpha       = 0;
                    hiddenFade.VectorScale = new Vector2(Width * 1.6f, 180 / 250f);
                    if ((!fromKeyLayer && !UpsideDown) || (fromKeyLayer && UpsideDown))
                    {
                        hiddenFade.FlipVertical = true;
                    }
                    hiddenFade.Alpha = 0;
                }

                if (SecondaryStageColumns == -1)
                {
                    HPBar = new HpBarMania(this);
                }
            }

            if (SecondaryStageColumns != -1)
            {
                posX           = Left + Width + Skin.StageSeparation * widthScale;
                SecondaryStage = new StageMania(Skin, minimal, posY, height, posX, widthScale, stageIndex + 1, columnOffset + PrimaryStageColumns);
                Columns.AddRange(SecondaryStage.Columns);
                HPBar = SecondaryStage.HPBar;
            }

            bindColumnKeys();
        }
예제 #25
0
        protected virtual void PopulateSprites()
        {
            Debug.Assert(SpriteCollection == null && !IsLoaded);

            SpriteCollection = new List <pDrawable>();

            if (Beatmap != null)
            {
                PlayModes?mode = modeOverride;
                if (Beatmap != null && Beatmap.PlayMode != PlayModes.Osu)
                {
                    mode = Beatmap.PlayMode;
                }

                OldLayout = SkinManager.Current.Version < 2.2 && TextureManager.Load(@"menu-button-background").Source != SkinSource.Osu;

                string text  = Beatmap.SortTitleAuto;
                string text2 = Beatmap.Creator.Length > 0 ? Beatmap.Creator : "unknown creator";

                backgroundSprite =
                    new pSprite(s_menuButtonBackground, Fields.TopLeft,
                                Origins.CentreLeft,
                                Clocks.Game,
                                new Vector2((float)Position.X, (float)Position.Y), StartDepth, true, BackgroundColour, this);
                backgroundSprite.HandleInput = true;
                SpriteCollection.Add(backgroundSprite);

                bool thumb = shouldShowThumbnail;

                float xPadding     = OldLayout ? 15 : 5;
                float thumbPadding = thumb ? 75 : 5;
                float yPadding     = OldLayout ? -3 : 0;

                float titleSize = GameBase.TournamentDrawings ? 22 : 16;
                textTitle        = new pText(Name, titleSize, Vector2.Zero, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, colourTextInactive, false);
                textTitle.Origin = Origins.CentreLeft;
                textTitle.Tag    = new Vector2(thumbPadding, yPadding - (GameBase.Tournament ? 0 : 16));
                blackSprites.Add(textTitle);
                SpriteCollection.Add(textTitle);

                textArtist        = new pText(Beatmap.ArtistAuto + @" // " + Beatmap.Creator, 12, Vector2.Zero, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, colourTextInactive, false);
                textArtist.Origin = Origins.CentreLeft;
                textArtist.Tag    = new Vector2(thumbPadding + 1, yPadding - 4);
                blackSprites.Add(textArtist);
                if (!GameBase.TournamentDrawings)
                {
                    SpriteCollection.Add(textArtist);
                }


                if (thumb)
                {
                    bool highres = GameBase.WindowManager.Height >= 768;
                    thumbnail = new pSpriteDynamic(General.STATIC_WEB_ROOT_BEATMAP + @"/thumb/" + Beatmap.BeatmapSetId + (highres ? @"l" : @"") + @".jpg", Path.Combine(OsuMain.UserPath, @"Data", @"bt", Beatmap.BeatmapSetId + (highres ? @"l" : @"") + @".jpg"), 500, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP);
                    if (GameBase.TournamentDrawings)
                    {
                        thumbnail.Url        = string.Empty;
                        thumbnail.LocalCache = Path.Combine(Beatmap.ContainingFolderAbsolute, Beatmap.BackgroundImage);
                        thumbnail.State      = LoadState.Unloaded;
                        thumbnail.OnUnload  += delegate
                        {
                            if (thumbnail != null)
                            {
                                thumbnail.State = LoadState.Unloaded;
                            }
                        };
                    }

                    ((pSpriteDynamic)thumbnail).OnTextureLoaded += delegate
                    {
                        thumbnail.FadeInFromZero(400);
                        if (GameBase.TournamentDrawings)
                        {
                            thumbnail.VectorScale = Vector2.One;
                            thumbnail.Scale       = Math.Min(114f / thumbnail.Width, 85.5f / thumbnail.Height);
                        }
                    };

                    thumbnail.InitialColour = new Color(50, 50, 50, 255);
                    thumbnail.Additive      = true;
                    thumbnail.VectorScale   = new Vector2(1.425f, 1.425f) * (highres ? 0.5f : 1);
                    thumbnail.Origin        = Origins.CentreLeft;
                    thumbnail.Tag           = new Vector2(5.2f, 0.25f);
                    SpriteCollection.Add(thumbnail);
                }

                AlwaysVisibleSprites = SpriteCollection.Count;

                float starScale;
                if (OldLayout)
                {
                    starScale = 0.6f;
                }
                else
                {
                    starScale = 0.8f;
                }

                textDifficulty          = new pText(string.Empty, 12, Vector2.Zero, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, colourTextInactive, false);
                textDifficulty.Origin   = Origins.CentreLeft;
                textDifficulty.TextBold = true;
                textDifficulty.Tag      = new Vector2(thumbPadding + 1, yPadding + 7);
                blackSprites.Add(textDifficulty);
                SpriteCollection.Add(textDifficulty);

                UpdateDifficultyText();

                if (mode.HasValue)
                {
                    hasMode = true;
                    pTexture modeTexture = null;
                    switch (mode)
                    {
                    case PlayModes.Osu:
                        modeTexture = TextureManager.Load(@"mode-osu-small", SkinSource.Osu);
                        break;

                    case PlayModes.Taiko:
                        modeTexture = TextureManager.Load(@"mode-taiko-small", SkinSource.Osu);
                        break;

                    case PlayModes.CatchTheBeat:
                        modeTexture = TextureManager.Load(@"mode-fruits-small", SkinSource.Osu);
                        break;

                    case PlayModes.OsuMania:
                        modeTexture = TextureManager.Load(@"mode-mania-small", SkinSource.Osu);
                        break;
                    }

                    modeSprite             = new pSprite(modeTexture, Fields.TopLeft, Origins.CentreLeft, Clocks.Game, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, Color.White);
                    modeSprite.VectorScale = new Vector2(0.8f, 0.8f);
                    modeSprite.Tag         = new Vector2(xPadding + thumbPadding + 1, yPadding - 13);
                    blackSprites.Add(modeSprite);
                    SpriteCollection.Add(modeSprite);
                }

                rankSprite     = new pSprite(null, Origins.CentreLeft, Vector2.Zero, StartDepth + DEPTH_INCREASE_STEP, true, Color.White);
                rankSprite.Tag = new Vector2(xPadding + thumbPadding - 1, yPadding + (hasMode ? 14 : 0));
                SpriteCollection.Add(rankSprite);
                UpdateRank();
            }

            for (int i = 0; i < SpriteCollection.Count; i++)
            {
                SpriteCollection[i].Alpha = 0;
            }
        }
예제 #26
0
        internal override void InitializeSprites()
        {
            hitObjectManager.spriteManager.WidescreenAutoOffset = false;

            mascot = new TaikoMascot();
            mascot.Initialize();
            mascot.Position = new Vector2(0, TAIKO_BAR_Y + 25);


            s_BarRight =
                new pSprite(TextureManager.Load(@"approachcircle", SkinSource.Skin | SkinSource.Osu), Fields.GamefieldWide, Origins.Centre,
                            Clocks.Game, HitObjectManagerTaiko.HIT_LOCATION, 0.021f, true,
                            new Color(255, 255, 255, 180));
            s_BarRight.Scale = 0.73f;
            hitObjectManager.spriteManager.Add(s_BarRight);

            s_BarRight =
                new pSprite(TextureManager.Load(@"taikobigcircle", SkinSource.Skin | SkinSource.Osu), Fields.GamefieldWide, Origins.Centre,
                            Clocks.Game, HitObjectManagerTaiko.HIT_LOCATION, 0.021f, true,
                            new Color(255, 255, 255, 120));
            s_BarRight.Scale = 0.7f;
            hitObjectManager.spriteManager.Add(s_BarRight);

            s_KiaiGlow =
                new pSprite(TextureManager.Load(@"taiko-glow", SkinSource.Skin | SkinSource.Osu), Fields.GamefieldWide, Origins.Centre,
                            Clocks.Game, HitObjectManagerTaiko.HIT_LOCATION, 0.02f, true,
                            new Color(255, 228, 0, 0));
            s_KiaiGlow.Scale = 0.7f;
            hitObjectManager.spriteManager.Add(s_KiaiGlow);

            s_BarLeft =
                new pSprite(TextureManager.Load(@"taiko-bar-left", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                            Clocks.Game, new Vector2(0, TAIKO_BAR_Y), 0.95f, true, Color.White);
            hitObjectManager.spriteManager.Add(s_BarLeft);

            if (SkinManager.Current.Version >= 2.1)
            {
                s_BarRight =
                    new pSprite(TextureManager.Load(@"taiko-bar-right", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                Clocks.Game, new Vector2(0, TAIKO_BAR_Y), 0, true, Color.White);

                s_BarRight_Kiai =
                    new pSprite(TextureManager.Load(@"taiko-bar-right-glow", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                Clocks.Game, new Vector2(0, TAIKO_BAR_Y), 0.0001f, true, Color.TransparentWhite);
            }

            else
            {
                s_BarRight =
                    new pSprite(TextureManager.Load(@"taiko-bar-right", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                Clocks.Game, new Vector2(113, TAIKO_BAR_Y), 0, true, Color.White);

                s_BarRight_Kiai =
                    new pSprite(TextureManager.Load(@"taiko-bar-right-glow", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                Clocks.Game, new Vector2(113, TAIKO_BAR_Y), 0.0001f, true, Color.TransparentWhite);
            }

            if (GameBase.WindowManager.IsWidescreen)
            {
                s_BarRight_Kiai.VectorScale = s_BarRight.VectorScale = new Vector2(2 + (2 * GameBase.WindowManager.NonWidescreenOffsetX / GameBase.WindowManager.RatioInverse) / s_BarRight.Texture.DisplayWidth, 1);
            }

            hitObjectManager.spriteManager.Add(s_BarRight);
            hitObjectManager.spriteManager.Add(s_BarRight_Kiai);

            if (!ModManager.CheckActive(Mods.Cinema))
            {
                pSprite pb =
                    new pSprite(GameBase.WhitePixel, Fields.TopLeft, Origins.TopLeft,
                                Clocks.Game, new Vector2(0, TAIKO_BAR_Y + TAIKO_BAR_HEIGHT), 0, true, Color.Black);
                pb.ScaleToWindowRatio = false;
                pb.Alpha       = 0.9f;
                pb.VectorScale = new Vector2(GameBase.WindowManager.Width, title_height * GameBase.WindowManager.Ratio);
                player.spriteManagerBelowScoreboardWidescreen.Add(pb);

                metadataBarTitle = new pText(BeatmapManager.Current.SortTitleAuto, 19, new Vector2(-20, TAIKO_BAR_Y + TAIKO_BAR_HEIGHT + title_height / 2), 0.00001f, true, Color.TransparentWhite)
                {
                    Origin   = Origins.CentreRight,
                    Field    = Fields.TopRight,
                    TextBold = true,
                    FontFace = FontFace.SkinTaiko
                };
                player.spriteManagerBelowScoreboardWidescreen.Add(metadataBarTitle);
            }

            if (GameBase.WindowManager.IsWidescreen && ModManager.CheckActive(Player.currentScore.EnabledMods, Mods.Hidden))
            {
                pSprite s_BarRightExtra =
                    new pSprite(TextureManager.Load(@"taiko-bar-right", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                Clocks.Game, new Vector2(GameBase.WindowManager.WidthScaled - 2 * GameBase.WindowManager.NonWidescreenOffsetX / GameBase.WindowManager.Ratio, TAIKO_BAR_Y), 0.1f, true, new Color(0, 0, 0, 255));
                s_BarRightExtra.DrawWidth = (int)(2 * GameBase.WindowManager.NonWidescreenOffsetX / GameBase.WindowManager.RatioInverse) + 1;
                player.spriteManagerBelowHitObjectsWidescreen.Add(s_BarRightExtra);
            }


            int   bindingOffset = SkinManager.Current.Version >= 2.1 ? 5 : 0;
            pText binding       = new pText(BindingManager.NiceName(Bindings.TaikoInnerLeft), 18, new Vector2(25 + bindingOffset, TAIKO_BAR_Y + 50), Vector2.Zero,
                                            0.98f, false, Color.White, true);

            binding.TextBold = true;
            binding.FadeOut(5000);
            hitObjectManager.spriteManager.Add(binding);

            binding = new pText(BindingManager.NiceName(Bindings.TaikoInnerRight), 18, new Vector2(64 + bindingOffset, TAIKO_BAR_Y + 50), Vector2.Zero, 0.98f,
                                false, Color.White, true);
            binding.TextBold = true;
            binding.FadeOut(5000);
            hitObjectManager.spriteManager.Add(binding);

            binding = new pText(BindingManager.NiceName(Bindings.TaikoOuterLeft), 18, new Vector2(8 + bindingOffset, TAIKO_BAR_Y + 23), Vector2.Zero, 0.98f,
                                false, Color.White, true);
            binding.TextBold = true;
            binding.FadeOut(5000);
            hitObjectManager.spriteManager.Add(binding);

            binding = new pText(BindingManager.NiceName(Bindings.TaikoOuterRight), 18, new Vector2(75 + bindingOffset, TAIKO_BAR_Y + 23), Vector2.Zero, 0.98f,
                                false, Color.White, true);
            binding.TextBold = true;
            binding.FadeOut(5000);
            hitObjectManager.spriteManager.Add(binding);


            if (SkinManager.Current.Version >= 2.1)
            {
                taikoInnerLeft = new pSprite(TextureManager.Load(@"taiko-drum-inner", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                             Clocks.Game, new Vector2(0, TAIKO_BAR_Y), 0.96f, true, Color.TransparentWhite);
                hitObjectManager.spriteManager.Add(taikoInnerLeft);

                taikoInnerRight = new pSprite(TextureManager.Load(@"taiko-drum-inner", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                              Clocks.Game, new Vector2(56, TAIKO_BAR_Y), 0.96f, true, Color.TransparentWhite);
                taikoInnerRight.FlipHorizontal = true;
                hitObjectManager.spriteManager.Add(taikoInnerRight);

                taikoOuterLeft = new pSprite(TextureManager.Load(@"taiko-drum-outer", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                             Clocks.Game, new Vector2(0, TAIKO_BAR_Y), 0.96f, true, Color.TransparentWhite);
                taikoOuterLeft.FlipHorizontal = true;
                hitObjectManager.spriteManager.Add(taikoOuterLeft);

                taikoOuterRight = new pSprite(TextureManager.Load(@"taiko-drum-outer", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                              Clocks.Game, new Vector2(56, TAIKO_BAR_Y), 0.96f, true, Color.TransparentWhite);
                hitObjectManager.spriteManager.Add(taikoOuterRight);
            }
            else
            {
                taikoInnerLeft = new pSprite(TextureManager.Load(@"taiko-drum-inner", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                             Clocks.Game, new Vector2(18, TAIKO_BAR_Y + 31), 0.96f, true, Color.TransparentWhite);
                hitObjectManager.spriteManager.Add(taikoInnerLeft);

                taikoInnerRight = new pSprite(TextureManager.Load(@"taiko-drum-inner", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                              Clocks.Game, new Vector2(54, TAIKO_BAR_Y + 31), 0.96f, true, Color.TransparentWhite);
                taikoInnerRight.FlipHorizontal = true;
                hitObjectManager.spriteManager.Add(taikoInnerRight);

                taikoOuterLeft = new pSprite(TextureManager.Load(@"taiko-drum-outer", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                             Clocks.Game, new Vector2(8, TAIKO_BAR_Y + 23), 0.96f, true, Color.TransparentWhite);
                taikoOuterLeft.FlipHorizontal = true;
                hitObjectManager.spriteManager.Add(taikoOuterLeft);

                taikoOuterRight = new pSprite(TextureManager.Load(@"taiko-drum-outer", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                              Clocks.Game, new Vector2(53, TAIKO_BAR_Y + 23), 0.96f, true, Color.TransparentWhite);
                hitObjectManager.spriteManager.Add(taikoOuterRight);
            }

            if (!player.eventManager.HasStoryboard || player.eventManager.spriteManagerBG.TotalSpriteCount + player.eventManager.spriteManagerFG.TotalSpriteCount < 10)
            {
                taikoSlider = new pSprite(TextureManager.Load(@"taiko-slider", SkinSource.Skin | SkinSource.Osu), Fields.TopLeft, Origins.TopLeft,
                                          Clocks.Audio, new Vector2(0, 0), 0f, false, Color.White);
                player.spriteManagerBelowHitObjectsWidescreen.Add(taikoSlider);

                taikoSlider.Scale = 1.4f;

                taikoSlider.Transformations.Add(new Transformation(Vector2.Zero, new Vector2(-1400, 0), -player.leadInTime, -player.leadInTime + 34400));

                taikoSliderActiveCollection.Add(taikoSlider);
            }

            if (ConfigManager.sComboBurst)
            {
                comboBurstSprites = TextureManager.LoadAll(@"taiko-flower-group");
            }

            //Load in advance
            TextureManager.Load(@"taiko-bar-right-glow", SkinSource.Skin | SkinSource.Osu);


            sliderTexturePass = TextureManager.Load(@"taiko-slider", SkinSource.Skin | SkinSource.Osu);
            sliderTextureFail = TextureManager.Load(@"taiko-slider-fail", SkinSource.Skin | SkinSource.Osu);

            base.InitializeSprites();
        }
예제 #27
0
        internal float Display()
        {
            pTexture notificationTexture = TextureManager.Load(@"notification", SkinSource.Osu);

            float total_width    = notificationTexture.DisplayWidth * 0.625f;
            float drawable_width = total_width * 0.90f;

            float resulting_padding = (total_width - drawable_width) / 2;

            float currentHeight = GameBase.WindowManager.HeightScaled;

            content = new pText(Text, 9f - ((GameBase.WindowManager.Height - 1024) / 256f), new Vector2(3 + resulting_padding + drawable_width, currentHeight + resulting_padding), new Vector2(drawable_width, 0), 1, false, Color.White, false);
            //content.BorderColour = new Color(20, 20, 20);
            content.Field    = Fields.TopRight;
            content.Origin   = Origins.TopLeft;
            content.TextBold = true;

            Vector2 size = content.MeasureText();

            top = new pSprite(notificationTexture, Fields.TopRight, Origins.TopRight, Clocks.Game, new Vector2(0, currentHeight), 0.98f, false, Colour);
            top.ExactCoordinates = false;
            top.DrawHeight       = TOP_HEIGHT;
            top.OnClick         += onClick;
            top.HandleInput      = true;
            top.OnHover         += onHover;
            top.OnHoverLost     += onHoverLost;

            currentHeight += TOP_HEIGHT_WINDOW;

            float excessHeight = size.Y - (TOP_HEIGHT_WINDOW + BOTTOM_HEIGHT_WINDOW - resulting_padding * 2);

            if (excessHeight > 0)
            {
                middle = new pSprite(notificationTexture, Fields.TopRight, Origins.TopRight, Clocks.Game, new Vector2(0, currentHeight), 0.98f, false, Colour);
                middle.ExactCoordinates = false;
                middle.DrawTop          = TOP_HEIGHT;
                middle.DrawHeight       = MIDDLE_HEIGHT;
                middle.OnClick         += onClick;
                middle.HandleInput      = true;
                middle.OnHover         += onHover;
                middle.OnHoverLost     += onHoverLost;
                middle.VectorScale.Y    = excessHeight / MIDDLE_HEIGHT_WINDOW;

                SpriteCollection.Add(middle);

                currentHeight += MIDDLE_HEIGHT_WINDOW * middle.VectorScale.Y;
            }

            bottom = new pSprite(notificationTexture, Fields.TopRight, Origins.TopRight, Clocks.Game, new Vector2(0, currentHeight), 0.98f, false, Colour);
            bottom.ExactCoordinates = false;
            bottom.DrawTop          = TOP_HEIGHT + MIDDLE_HEIGHT;
            bottom.DrawHeight       = BOTTOM_HEIGHT;
            bottom.HandleInput      = true;
            bottom.OnHover         += onHover;
            bottom.OnHoverLost     += onHoverLost;
            bottom.OnClick         += onClick;

            currentHeight += BOTTOM_HEIGHT_WINDOW;

            SpriteCollection.Add(top);
            SpriteCollection.Add(content);
            SpriteCollection.Add(bottom);

            totalHeight = currentHeight - GameBase.WindowManager.HeightScaled;

            DisplayTime = GameBase.Time;

            foreach (pSprite p in SpriteCollection)
            {
                p.Position.Y -= totalHeight + BUFFER;

                p.Position.X -= 100;

                p.MoveToRelative(new Vector2(100, 0), 800, EasingTypes.OutElasticHalf);

                p.Transformations.Add(new Transformation(TransformationType.Fade, 0, 1, GameBase.Time, GameBase.Time + 200));
                p.Transformations.Add(new Transformation(TransformationType.Fade, 1, 0, GameBase.Time + 200 + Duration - 500, GameBase.Time + 200 + Duration, EasingTypes.In));
                p.Tag = @"notice";

                GameBase.Scheduler.AddDelayed(delegate { content.ExactCoordinates = true; }, 200);
            }

            return(totalHeight);
        }
예제 #28
0
 public static void RegisterUnrecoverableTexture(pTexture texture)
 {
     Unloadables.Add(texture);
 }
예제 #29
0
        internal static void LoadCursor(bool force = true)
        {
            if (!force && InputManager.s_Cursor != null && InputManager.s_Cursor.Texture != null && !InputManager.s_Cursor.Texture.IsDisposed)
            {
                return;
            }

            if (Current == null)
            {
                return;
            }

            pTexture t_cursor = TextureManager.Load(@"cursor", ConfigManager.sUseSkinCursor ? SkinSource.Skin | SkinSource.Osu : SkinSource.All);

            t_cursortrail = TextureManager.Load(@"cursortrail", ConfigManager.sUseSkinCursor ? SkinSource.Skin | SkinSource.Osu : SkinSource.All);

            if (t_cursor == null || t_cursortrail == null)
            {
                return;
            }

            InputManager.CursorExpand = Current.CursorExpand;

            pSprite cursor  = InputManager.s_Cursor;
            pSprite cursor2 = InputManager.s_Cursor2;

            if (cursor == null)
            {
                cursor = InputManager.s_Cursor = new pSprite(null, Fields.NativeStandardScale, Origins.TopLeft, Clocks.Game, Vector2.Zero, 0.999F, true, Color.White)
                {
                    Alpha = 0
                };
                GameBase.spriteManagerCursor.Add(cursor);

                cursor2 = InputManager.s_Cursor2 = new pSprite(null, Fields.NativeStandardScale, Origins.TopLeft, Clocks.Game, Vector2.Zero, 1, true, Color.White)
                {
                    Alpha = 0
                };
                GameBase.spriteManagerCursor.Add(cursor2);
            }

            bool alreadyRotating = false;

            for (int i = 0; i < cursor.Transformations.Count; i++)
            {
                if (cursor.Transformations[i].Type == TransformationType.Rotation)
                {
                    alreadyRotating = true;
                    //Optimize a bit if later we will put add
                    //more transformations to the cursor
                    break;
                }
            }

            if (!Current.CursorRotate)
            {
                //Stop the rotation and reset to original position
                cursor.Transformations.Clear();
                cursor.Rotation = 0;
            }
            else if (!alreadyRotating)
            {
                //Begin the rotation
                cursor.Transformations.Add(new Transformation(TransformationType.Rotation, 0, (float)Math.PI * 2, 0, 10000)
                {
                    Loop = true
                });
            }

            cursor.Origin = cursor2.Origin = Current.CursorCentre ? Origins.Centre : Origins.TopLeft;
            cursor.Scale  = 1;

            cursor.Texture  = t_cursor;
            cursor2.Texture = TextureManager.Load(@"cursormiddle", t_cursor.Source);

            InputManager.UpdateCursorSize();
        }
예제 #30
0
        private void checkImageElements()
        {
            string[] files = Directory.GetFiles(BeatmapManager.Current.ContainingFolderAbsolute, @"*", SearchOption.AllDirectories);

            Dictionary <string, bool> fileDict = new Dictionary <string, bool>(files.Length);

            foreach (string file in files)
            {
                FileType ext = GeneralHelper.GetFileType(file);
                if (ext != FileType.Image)
                {
                    continue;
                }

                string strippedFilename = GeneralHelper.PathSanitise(GeneralHelper.GetRelativePath(file, BeatmapManager.Current.ContainingFolderAbsolute));
                string fileKey          = strippedFilename.ToLower();

                fileDict[fileKey] = true;

                int    scale = 1;
                string name  = strippedFilename;
                if (name.Contains(@"@2x"))
                {
                    scale = 2;
                    name  = name.Replace(@"@2x", string.Empty);
                }

                switch (name.ToLower())
                {
                case @"hitcircle":
                case @"hitcircleoverlay":
                case @"approachcircle":
                case @"reversearrow":
                    pTexture p = TextureManager.Load(strippedFilename, SkinSource.Beatmap);
                    if (p != null && (p.DisplayWidth != 128 * scale || p.DisplayHeight != 128 * scale))
                    {
                        addSkinReport(strippedFilename, 128 * scale);
                    }
                    break;
                }
            }

            //sprite events check
            EventManager manager = Editor.Instance.eventManager;

            for (int i = 0; i < manager.storyLayerSprites.Length; i++)
            {
                for (int j = 0; j < manager.storyLayerSprites[i].Count; j++)
                {
                    Event e = manager.storyLayerSprites[i][j];

                    string name    = e.Filename;
                    string fileKey = name.ToLower();

                    if (!fileDict.ContainsKey(fileKey))
                    {
                        if (BeatmapManager.Current.UseSkinSpritesInSB)
                        {
                            if (TextureManager.Load(name, SkinSource.Osu | SkinSource.Beatmap) != null)
                            {
                                continue;
                            }

                            if (TextureManager.LoadAll(name, SkinSource.Osu | SkinSource.Beatmap, false) != null)
                            {
                                continue;
                            }
                        }
                        else // check for sprite animation
                        {
                            int animationSuffix = name.LastIndexOf('.');
                            if (animationSuffix >= 0 &&
                                fileDict.ContainsKey(fileKey.Insert(animationSuffix, "0")) &&
                                fileDict.ContainsKey(fileKey.Insert(animationSuffix, "1")))
                            {
                                continue; // at least two frames of sprite animation detected, don't display missing file warning
                            }
                        }
                        fileDict[fileKey] = true; // add fake file,ensure file missing just report once.
                        Reports.Add(new AiReport(Severity.Error, LocalisationManager.GetString(OsuString.AIDesign_FileMissing) + name));
                    }
                }
            }
        }