Esempio n. 1
0
        internal HitCircle(HitObjectManager hit_object_manager, Vector2 pos, int startTime, bool newCombo, int comboOffset, HitObjectSoundType soundType)
            : base(hit_object_manager, pos, startTime, soundType, newCombo, comboOffset)
        {
            Type = HitObjectType.Circle;

            Color4 white = Color4.White;

            SpriteHitCircle1 =
                new pSprite(TextureManager.Load(OsuTexture.hitcircle0), FieldTypes.GamefieldSprites, OriginTypes.Centre, ClockTypes.Audio, Position, SpriteManager.drawOrderBwd(StartTime), false, white);
            Sprites.Add(SpriteHitCircle1);
            //SpriteHitCircle1.TagNumeric = 1;
            SpriteHitCircle1.TagNumeric = DIMMABLE_TAG;


            SpriteHitCircleText = new pSpriteText(null, "default", 3, //SkinManager.Current.FontHitCircle, SkinManager.Current.FontHitCircleOverlap,
                                                  FieldTypes.GamefieldSprites, OriginTypes.Centre,
                                                  ClockTypes.Audio, Position, SpriteManager.drawOrderBwd(StartTime - 1),
                                                  false, white);
            SpriteHitCircleText.TextConstantSpacing = false;

            SpriteHitCircleText.TagNumeric = DIMMABLE_TAG;

            SpriteApproachCircle          = new ApproachCircle(Position, 1, false, 1, white);
            SpriteApproachCircle.Clocking = ClockTypes.Audio;
            Sprites.Add(SpriteApproachCircle);

            if (ShowCircleText)
            {
                Sprites.Add(SpriteHitCircleText);
            }

            SpriteApproachCircle.Transform(new TransformationF(TransformationType.Fade, 0, 0.9F,
                                                               startTime - DifficultyManager.PreEmpt, Math.Min(startTime, startTime - DifficultyManager.PreEmpt + DifficultyManager.FadeIn * 2)));

            SpriteApproachCircle.Transform(new TransformationF(TransformationType.Scale, 4, 1,
                                                               startTime - DifficultyManager.PreEmpt, startTime));

            SpriteApproachCircle.Transform(new TransformationF(TransformationType.Fade, 0.9f, 0,
                                                               startTime, startTime + (int)(DifficultyManager.PreEmpt * 0.1f)));

            Transformation fadeIn = new TransformationF(TransformationType.Fade, 0, 1,
                                                        startTime - DifficultyManager.PreEmpt, startTime - DifficultyManager.PreEmpt + DifficultyManager.FadeIn);

            SpriteHitCircle1.Transform(fadeIn);
            SpriteHitCircleText.Transform(fadeIn);

            Transformation fadeOut = new TransformationF(TransformationType.Fade, 1, 0,
                                                         startTime, startTime + DifficultyManager.HitWindow50);

            SpriteHitCircle1.Transform(fadeOut);
            SpriteHitCircleText.Transform(fadeOut);
        }
Esempio n. 2
0
        public DrawableHitCircle(HitCircle h)
            : base(h)
        {
            Origin = Anchor.Centre;

            Position = HitObject.StackedPosition;

            InternalChildren = new Drawable[]
            {
                scaleContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Origin           = Anchor.Centre,
                    Anchor           = Anchor.Centre,
                    Children         = new Drawable[]
                    {
                        hitArea = new HitArea
                        {
                            Hit = () =>
                            {
                                if (AllJudged)
                                {
                                    return(false);
                                }

                                UpdateResult(true);
                                return(true);
                            },
                        },
                        new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
                        ApproachCircle = new ApproachCircle
                        {
                            Alpha = 0,
                            Scale = new Vector2(4),
                        }
                    }
                },
            };

            Size = hitArea.DrawSize;
        }
Esempio n. 3
0
        internal Spinner(HitObjectManager hitObjectManager, int startTime, int endTime, HitObjectSoundType soundType)
            : base(hitObjectManager, Vector2.Zero, startTime, soundType, true, 0)
        {
            if (SpinnerCentre == Vector2.Zero)
            {
                SpinnerCentre = GameBase.StandardToGamefield(new Vector2(GameBase.BaseSizeFixedWidth.X / 2, GameBase.BaseSizeFixedWidth.Y - (GameBase.BaseSizeFixedWidth.Y / GameBase.BaseSize.Y) * SpinnerCentreFromBottom.Y));
            }

            Position = SpinnerCentre;
            EndTime  = endTime;
            Type     = HitObjectType.Spinner;
            Colour   = Color4.Gray;

            Color4 white = Color4.White;

            //Check for a jpg background for beatmap-based skins (used to reduce filesize), then fallback to png.
            SpriteBackground =
                new pSprite(TextureManager.Load(OsuTexture.spinner_background),
                            FieldTypes.StandardSnapBottomCentre, OriginTypes.BottomCentre, ClockTypes.Audio,
                            new Vector2(0, 0), SpriteManager.drawOrderFwdLowPrio(2), false, white);
            Sprites.Add(SpriteBackground);

            spriteCircle =
                new pSprite(TextureManager.Load(OsuTexture.spinner_circle),
                            FieldTypes.StandardSnapBottomCentre, OriginTypes.Centre, ClockTypes.Audio,
                            SpinnerCentreFromBottom, SpriteManager.drawOrderFwdLowPrio(3), false, white)
            {
                ExactCoordinates = false
            };
            Sprites.Add(spriteCircle);

            //todo: possible optimisation by changing the draw method for filling of spinner metres.
            spriteScoreMetreBackground =
                new pRectangle(Vector2.Zero, new Vector2(GameBase.BaseSizeFixedWidth.X, GameBase.BaseSize.Y), false, SpriteManager.drawOrderFwdLowPrio(0), new Color4(20, 20, 20, 255))
            {
                Clocking = ClockTypes.Audio,
                Field    = FieldTypes.StandardSnapBottomCentre,
                Origin   = OriginTypes.BottomCentre
            };

            Sprites.Add(spriteScoreMetreBackground);

            spriteScoreMetreForeground =
                new pRectangle(Vector2.Zero, new Vector2(GameBase.BaseSizeFixedWidth.X, 0), false, SpriteManager.drawOrderFwdLowPrio(1), Color4.OrangeRed)
            {
                Clocking = ClockTypes.Audio,
                Field    = FieldTypes.StandardSnapBottomCentre,
                Origin   = OriginTypes.BottomCentre
            };

            Sprites.Add(spriteScoreMetreForeground);

            ApproachCircle          = new ApproachCircle(SpinnerCentreFromBottom, 1, false, SpriteManager.drawOrderFwdLowPrio(5), new Color4(77 / 255f, 139 / 255f, 217 / 255f, 1));
            ApproachCircle.Width    = 8;
            ApproachCircle.Clocking = ClockTypes.Audio;
            ApproachCircle.Field    = FieldTypes.StandardSnapBottomCentre;
            Sprites.Add(ApproachCircle);

            spriteBonus = new pSpriteText("", "score", -5, // SkinManager.Current.FontScore, SkinManager.Current.FontScoreOverlap,
                                          FieldTypes.StandardSnapBottomCentre, OriginTypes.Centre, ClockTypes.Audio,
                                          SpinnerCentreFromBottom - new Vector2(0, 80), SpriteManager.drawOrderFwdLowPrio(6), false, white);
            spriteBonus.Additive = true;
            Sprites.Add(spriteBonus);

            foreach (pDrawable p in Sprites)
            {
                p.Transformations.Clear();
                p.Transform(new TransformationF(TransformationType.Fade, 0, 1, StartTime - DifficultyManager.FadeIn, StartTime));
                p.Transform(new TransformationF(TransformationType.Fade, 1, 0, EndTime, EndTime + (spriteScoreMetreForeground == p ? DifficultyManager.FadeOut / 4 : DifficultyManager.FadeOut / 2)));
            }

            SpriteSpin =
                new pSprite(TextureManager.Load(OsuTexture.spinner_spin),
                            FieldTypes.StandardSnapBottomCentre, OriginTypes.Centre, ClockTypes.Audio,
                            SpinnerCentreFromBottom, SpriteManager.drawOrderFwdLowPrio(5), false, white);
            SpriteSpin.Transform(new TransformationF(TransformationType.Fade, 0, 1, StartTime - DifficultyManager.FadeIn / 2, StartTime));
            SpriteSpin.Transform(new TransformationF(TransformationType.Fade, 1, 0, EndTime - Math.Min(400, endTime - startTime), EndTime));
            Sprites.Add(SpriteSpin);

            ApproachCircle.Transform(new TransformationF(TransformationType.Scale, GameBase.BaseSizeFixedWidth.Y * 0.47f, 0.1f, StartTime, EndTime));

            SpriteClear =
                new pSprite(TextureManager.Load(OsuTexture.spinner_clear),
                            FieldTypes.StandardSnapBottomCentre, OriginTypes.Centre, ClockTypes.Audio,
                            SpinnerCentreFromBottom + new Vector2(0, 80), SpriteManager.drawOrderFwdLowPrio(6), false, white);
            SpriteClear.Transform(new TransformationF(TransformationType.Fade, 0, 0, startTime, endTime));
            Sprites.Add(SpriteClear);

            currentRotationCount = 0;
            rotationRequirement  = (int)((float)(EndTime - StartTime) / 1000 * DifficultyManager.SpinnerRotationRatio) * sensitivity_modifier;
        }
Esempio n. 4
0
 private void HideApproachCircle(ApproachCircle approachCircle)
 {
     // Hiding approach circles has to preempt the audio leadin
     using (approachCircle.BeginAbsoluteSequence(-3000))
         approachCircle.Hide();
 }