コード例 #1
0
        public bool OnPressed(ManiaAction action)
        {
            if (AllJudged)
            {
                return(false);
            }

            if (action != Action.Value)
            {
                return(false);
            }

            // The tail has a lenience applied to it which is factored into the miss window (i.e. the miss judgement will be delayed).
            // But the hold cannot ever be started within the late-lenience window, so we should skip trying to begin the hold during that time.
            // Note: Unlike below, we use the tail's start time to determine the time offset.
            if (Time.Current > Tail.HitObject.StartTime && !Tail.HitObject.HitWindows.CanBeHit(Time.Current - Tail.HitObject.StartTime))
            {
                return(false);
            }

            beginHoldAt(Time.Current - Head.HitObject.StartTime);
            Head.UpdateResult();

            return(true);
        }
コード例 #2
0
        public void OnReleased(ManiaAction action)
        {
            if (AllJudged)
            {
                return;
            }

            if (action != Action.Value)
            {
                return;
            }

            // Make sure a hold was started
            if (HoldStartTime == null)
            {
                return;
            }

            Tail.UpdateResult();
            endHold();

            // If the key has been released too early, the user should not receive full score for the release
            if (!Tail.IsHit)
            {
                HasBroken = true;
            }
        }
コード例 #3
0
            public override bool OnPressed(ManiaAction action)
            {
                if (!base.OnPressed(action))
                {
                    return(false);
                }

                // We only want to trigger a holding state from the head if the head has received a judgement
                if (!Judged)
                {
                    return(false);
                }

                // If the key has been released too early, the user should not receive full score for the release
                if (Judgement.Result == HitResult.Miss)
                {
                    holdNote.hasBroken = true;
                }

                // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held
                // The body doesn't handle these early early hits, so we have to explicitly set the holding state here
                holdNote.holdStartTime = Time.Current;

                return(true);
            }
コード例 #4
0
            public DrawableTailNote(DrawableHoldNote holdNote, ManiaAction action)
                : base(holdNote.HitObject.Tail, action)
            {
                this.holdNote = holdNote;

                GlowPiece.Alpha = 0;
            }
コード例 #5
0
        public void OnReleased(ManiaAction action)
        {
            if (AllJudged)
            {
                return;
            }

            if (action != Action.Value)
            {
                return;
            }

            // do not run any of this logic when rewinding, as it inverts order of presses/releases.
            if (Time.Elapsed < 0)
            {
                return;
            }

            // Make sure a hold was started
            if (HoldStartTime == null)
            {
                return;
            }

            Tail.UpdateResult();
            endHold();

            // If the key has been released too early, the user should not receive full score for the release
            if (!Tail.IsHit)
            {
                HoldBrokenTime = Time.Current;
            }

            releaseTime = Time.Current;
        }
コード例 #6
0
        public bool OnPressed(ManiaAction action)
        {
            if (AllJudged)
            {
                return(false);
            }

            if (action != Action.Value)
            {
                return(false);
            }

            // do not run any of this logic when rewinding, as it inverts order of presses/releases.
            if (Time.Elapsed < 0)
            {
                return(false);
            }

            if (CheckHittable?.Invoke(this, Time.Current) == false)
            {
                return(false);
            }

            // The tail has a lenience applied to it which is factored into the miss window (i.e. the miss judgement will be delayed).
            // But the hold cannot ever be started within the late-lenience window, so we should skip trying to begin the hold during that time.
            // Note: Unlike below, we use the tail's start time to determine the time offset.
            if (Time.Current > Tail.HitObject.StartTime && !Tail.HitObject.HitWindows.CanBeHit(Time.Current - Tail.HitObject.StartTime))
            {
                return(false);
            }

            beginHoldAt(Time.Current - Head.HitObject.StartTime);

            return(Head.UpdateResult());
        }
コード例 #7
0
            public DrawableTailNote(DrawableHoldNote holdNote, ManiaAction action)
                : base(holdNote.HitObject.Tail, action)
            {
                this.holdNote = holdNote;

                RelativePositionAxes = Axes.None;
                Y = 0;
            }
コード例 #8
0
        public virtual bool OnPressed(ManiaAction action)
        {
            if (action != Action.Value)
            {
                return(false);
            }

            return(UpdateResult(true));
        }
コード例 #9
0
        public virtual bool OnPressed(ManiaAction action)
        {
            if (action != Action)
            {
                return(false);
            }

            return(UpdateJudgement(true));
        }
コード例 #10
0
ファイル: Column.cs プロジェクト: starrodkirby86/osu
        private bool onPressed(ManiaAction action)
        {
            if (action == Action)
            {
                background.FadeTo(0.6f, 50, Easing.OutQuint);
                keyIcon.ScaleTo(1.4f, 50, Easing.OutQuint);
            }

            return(false);
        }
コード例 #11
0
ファイル: Column.cs プロジェクト: starrodkirby86/osu
        private bool onReleased(ManiaAction action)
        {
            if (action == Action)
            {
                background.FadeTo(0.2f, 800, Easing.OutQuart);
                keyIcon.ScaleTo(1f, 400, Easing.OutQuart);
            }

            return(false);
        }
コード例 #12
0
        protected DrawableManiaHitObject(TObject hitObject, ManiaAction?action = null)
            : base(hitObject)
        {
            HitObject = hitObject;

            if (action != null)
            {
                Action = action.Value;
            }
        }
コード例 #13
0
        protected DrawableManiaHitObject(TObject hitObject, ManiaAction?action = null)
            : base(hitObject)
        {
            RelativePositionAxes = Axes.Y;
            HitObject            = hitObject;

            if (action != null)
            {
                Action = action.Value;
            }
        }
コード例 #14
0
        public DrawableNote(Note hitObject, ManiaAction action)
            : base(hitObject, action)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            CornerRadius = 5;
            Masking      = true;

            InternalChild = headPiece = new NotePiece();
        }
コード例 #15
0
ファイル: DrawableHoldNote.cs プロジェクト: Aikoyori/osu
        public DrawableHoldNote(HoldNote hitObject, ManiaAction action)
            : base(hitObject, action)
        {
            RelativeSizeAxes = Axes.Both;
            Height           = (float)HitObject.Duration;

            AddRange(new Drawable[]
            {
                // The hit object itself cannot be used for various elements because the tail overshoots it
                // So a specialized container that is updated to contain the tail height is used
                fullHeightContainer = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Child            = glowPiece = new GlowPiece()
                },
                bodyPiece = new BodyPiece
                {
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    RelativeSizeAxes = Axes.X,
                },
                tickContainer = new Container <DrawableHoldNoteTick>
                {
                    RelativeSizeAxes    = Axes.Both,
                    RelativeChildOffset = new Vector2(0, (float)HitObject.StartTime),
                    RelativeChildSize   = new Vector2(1, (float)HitObject.Duration)
                },
                head = new DrawableHeadNote(this, action)
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre
                },
                tail = new DrawableTailNote(this, action)
                {
                    Anchor = Anchor.BottomCentre,
                    Origin = Anchor.TopCentre
                }
            });

            foreach (var tick in HitObject.NestedHitObjects.OfType <HoldNoteTick>())
            {
                var drawableTick = new DrawableHoldNoteTick(tick)
                {
                    HoldStartTime = () => holdStartTime
                };

                tickContainer.Add(drawableTick);
                AddNested(drawableTick);
            }

            AddNested(head);
            AddNested(tail);
        }
コード例 #16
0
        public DrawableNote(Note hitObject, ManiaAction action)
            : base(hitObject, action)
        {
            RelativeSizeAxes = Axes.X;
            Height           = 100;

            Add(headPiece = new NotePiece
            {
                Anchor = Anchor.TopCentre,
                Origin = Anchor.TopCentre
            });
        }
コード例 #17
0
        protected DrawableManiaHitObject(TObject hitObject, ManiaAction?action = null)
            : base(hitObject)
        {
            Anchor = Anchor.TopCentre;
            Origin = Anchor.TopCentre;

            HitObject = hitObject;

            if (action != null)
            {
                Action = action.Value;
            }
        }
コード例 #18
0
        public ColumnTestContainer(int column, ManiaAction action)
        {
            this.column = new Column(column)
            {
                Action       = { Value = action },
                AccentColour = Color4.Orange
            };

            InternalChild = content = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)
            {
                RelativeSizeAxes = Axes.Both
            };
        }
コード例 #19
0
        public virtual bool OnPressed(ManiaAction action)
        {
            if (action != Action.Value)
            {
                return(false);
            }

            if (CheckHittable?.Invoke(this, Time.Current) == false)
            {
                return(false);
            }

            return(UpdateResult(true));
        }
コード例 #20
0
        public DrawableHoldNote(HoldNote hitObject, ManiaAction action)
            : base(hitObject, action)
        {
            Container <DrawableHoldNoteTick> tickContainer;

            RelativeSizeAxes = Axes.X;

            InternalChildren = new Drawable[]
            {
                // The hit object itself cannot be used for various elements because the tail overshoots it
                // So a specialized container that is updated to contain the tail height is used
                fullHeightContainer = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Child            = glowPiece = new GlowPiece()
                },
                bodyPiece = new BodyPiece
                {
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    RelativeSizeAxes = Axes.X,
                },
                tickContainer = new Container <DrawableHoldNoteTick>
                {
                    RelativeSizeAxes   = Axes.Both,
                    ChildrenEnumerable = HitObject.NestedHitObjects.OfType <HoldNoteTick>().Select(tick => new DrawableHoldNoteTick(tick)
                    {
                        HoldStartTime = () => holdStartTime
                    })
                },
                head = new DrawableHeadNote(this, action)
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre
                },
                tail = new DrawableTailNote(this, action)
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre
                }
            };

            foreach (var tick in tickContainer)
            {
                AddNested(tick);
            }

            AddNested(head);
            AddNested(tail);
        }
コード例 #21
0
ファイル: DrawableHoldNote.cs プロジェクト: Aikoyori/osu
            public DrawableTailNote(DrawableHoldNote holdNote, ManiaAction action)
                : base(holdNote.HitObject.Tail, action)
            {
                this.holdNote = holdNote;

                RelativePositionAxes = Axes.None;
                Y = 0;

                // Life time managed by the parent DrawableHoldNote
                LifetimeStart = double.MinValue;
                LifetimeEnd   = double.MaxValue;

                GlowPiece.Alpha = 0;
            }
コード例 #22
0
ファイル: TestSceneStage.cs プロジェクト: zi-jing/osu
        private void load()
        {
            SetContents(_ =>
            {
                ManiaAction normalAction  = ManiaAction.Key1;
                ManiaAction specialAction = ManiaAction.Special1;

                return(new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)
                {
                    Child = new Stage(0, new StageDefinition {
                        Columns = 4
                    }, ref normalAction, ref specialAction)
                });
            });
        }
コード例 #23
0
        public DrawableHoldNote(HoldNote hitObject, ManiaAction action)
            : base(hitObject, action)
        {
            RelativeSizeAxes = Axes.Both;
            Height           = (float)HitObject.Duration;

            AddRange(new Drawable[]
            {
                // For now the body piece covers the entire height of the container
                // whereas possibly in the future we don't want to extend under the head/tail.
                // This will be fixed when new designs are given or the current design is finalized.
                bodyPiece = new BodyPiece
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre,
                },
                tickContainer = new Container <DrawableHoldNoteTick>
                {
                    RelativeSizeAxes    = Axes.Both,
                    RelativeChildOffset = new Vector2(0, (float)HitObject.StartTime),
                    RelativeChildSize   = new Vector2(1, (float)HitObject.Duration)
                },
                head = new DrawableHeadNote(this, action)
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre
                },
                tail = new DrawableTailNote(this, action)
                {
                    Anchor = Anchor.BottomCentre,
                    Origin = Anchor.TopCentre
                }
            });

            foreach (var tick in HitObject.Ticks)
            {
                var drawableTick = new DrawableHoldNoteTick(tick)
                {
                    HoldStartTime = () => holdStartTime
                };

                tickContainer.Add(drawableTick);
                AddNested(drawableTick);
            }

            AddNested(head);
            AddNested(tail);
        }
コード例 #24
0
ファイル: DrawableHoldNote.cs プロジェクト: media-library/osu
        public bool OnPressed(ManiaAction action)
        {
            if (AllJudged)
            {
                return(false);
            }

            if (action != Action.Value)
            {
                return(false);
            }

            beginHoldAt(Time.Current - Head.HitObject.StartTime);
            Head.UpdateResult();

            return(true);
        }
コード例 #25
0
            public override bool OnPressed(ManiaAction action) => false; // Tail doesn't handle key down

            public override bool OnReleased(ManiaAction action)
            {
                // Make sure that the user started holding the key during the hold note
                if (!holdNote.holdStartTime.HasValue)
                {
                    return(false);
                }

                if (action != Action)
                {
                    return(false);
                }

                UpdateJudgement(true);

                // Handled by the hold note, which will set holding = false
                return(false);
            }
コード例 #26
0
 public ColumnTestContainer(int column, ManiaAction action, bool showColumn = false)
 {
     InternalChildren = new[]
     {
         this.column = new Column(column)
         {
             Action       = { Value = action },
             AccentColour = Colour4.Orange,
             ColumnType   = column % 2 == 0 ? ColumnType.Even : ColumnType.Odd,
             Alpha        = showColumn ? 1 : 0
         },
         content = new ManiaInputManager(new ManiaRuleset().RulesetInfo, 4)
         {
             RelativeSizeAxes = Axes.Both
         },
         this.column.TopLevelContainer.CreateProxy()
     };
 }
コード例 #27
0
        public DrawableNote(Note hitObject, ManiaAction action)
            : base(hitObject, action)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            CornerRadius = 5;
            Masking      = true;

            InternalChildren = new Drawable[]
            {
                headPiece = new NotePiece
                {
                    Anchor = Anchor.TopCentre,
                    Origin = Anchor.TopCentre
                }
            };
        }
コード例 #28
0
            public override bool OnPressed(ManiaAction action)
            {
                if (!base.OnPressed(action))
                {
                    return(false);
                }

                // If the key has been released too early, the user should not receive full score for the release
                if (Result.Type == HitResult.Miss)
                {
                    holdNote.hasBroken = true;
                }

                // The head note also handles early hits before the body, but we want accurate early hits to count as the body being held
                // The body doesn't handle these early early hits, so we have to explicitly set the holding state here
                holdNote.BeginHold();

                return(true);
            }
コード例 #29
0
        public bool OnPressed(ManiaAction action)
        {
            // Make sure the action happened within the body of the hold note
            if (Time.Current < HitObject.StartTime || Time.Current > HitObject.EndTime)
            {
                return(false);
            }

            if (action != Action.Value)
            {
                return(false);
            }

            // The user has pressed during the body of the hold note, after the head note and its hit windows have passed
            // and within the limited range of the above if-statement. This state will be managed by the head note if the
            // user has pressed during the hit windows of the head note.
            BeginHold();
            return(true);
        }
コード例 #30
0
ファイル: ManiaRulesetContainer.cs プロジェクト: weebaka/osu
        protected override DrawableHitObject <ManiaHitObject> GetVisualRepresentation(ManiaHitObject h)
        {
            ManiaAction action = Playfield.Columns.ElementAt(h.Column).Action;

            var holdNote = h as HoldNote;

            if (holdNote != null)
            {
                return(new DrawableHoldNote(holdNote, action));
            }

            var note = h as Note;

            if (note != null)
            {
                return(new DrawableNote(note, action));
            }

            return(null);
        }