Exemplo n.º 1
0
        private void addSwell(double duration = default_duration)
        {
            var swell = new Swell
            {
                StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
                Duration  = duration,
            };

            swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

            drawableRuleset.Playfield.Add(new DrawableSwell(swell));
        }
Exemplo n.º 2
0
        public override Replay Generate()
        {
            bool hitButton = true;

            Frames.Add(new TaikoReplayFrame(-100000));
            Frames.Add(new TaikoReplayFrame(Beatmap.HitObjects[0].StartTime - 1000));

            for (int i = 0; i < Beatmap.HitObjects.Count; i++)
            {
                TaikoHitObject h = Beatmap.HitObjects[i];

                IHasEndTime endTimeData = h as IHasEndTime;
                double      endTime     = endTimeData?.EndTime ?? h.StartTime;

                Swell    swell    = h as Swell;
                DrumRoll drumRoll = h as DrumRoll;
                Hit      hit      = h as Hit;

                if (swell != null)
                {
                    int    d       = 0;
                    int    count   = 0;
                    int    req     = swell.RequiredHits;
                    double hitRate = Math.Min(swell_hit_speed, swell.Duration / req);
                    for (double j = h.StartTime; j < endTime; j += hitRate)
                    {
                        TaikoAction action;

                        switch (d)
                        {
                        default:
                        case 0:
                            action = TaikoAction.LeftCentre;
                            break;

                        case 1:
                            action = TaikoAction.LeftRim;
                            break;

                        case 2:
                            action = TaikoAction.RightCentre;
                            break;

                        case 3:
                            action = TaikoAction.RightRim;
                            break;
                        }

                        Frames.Add(new TaikoReplayFrame(j, action));
                        d = (d + 1) % 4;
                        if (++count == req)
                        {
                            break;
                        }
                    }
                }
                else if (drumRoll != null)
                {
                    foreach (var tick in drumRoll.NestedHitObjects.OfType <DrumRollTick>())
                    {
                        Frames.Add(new TaikoReplayFrame(tick.StartTime, hitButton ? TaikoAction.LeftCentre : TaikoAction.RightCentre));
                        hitButton = !hitButton;
                    }
                }
                else if (hit != null)
                {
                    TaikoAction[] actions;

                    if (hit is CentreHit)
                    {
                        actions = h.IsStrong
                            ? new[] { TaikoAction.LeftCentre, TaikoAction.RightCentre }
                            : new[] { hitButton?TaikoAction.LeftCentre : TaikoAction.RightCentre };
                    }
                    else
                    {
                        actions = h.IsStrong
                            ? new[] { TaikoAction.LeftRim, TaikoAction.RightRim }
                            : new[] { hitButton?TaikoAction.LeftRim : TaikoAction.RightRim };
                    }

                    Frames.Add(new TaikoReplayFrame(h.StartTime, actions));
                }
                else
                {
                    throw new InvalidOperationException("Unknown hit object type.");
                }

                Frames.Add(new TaikoReplayFrame(endTime + KEY_UP_DELAY));

                if (i < Beatmap.HitObjects.Count - 1)
                {
                    double waitTime = Beatmap.HitObjects[i + 1].StartTime - 1000;
                    if (waitTime > endTime)
                    {
                        Frames.Add(new TaikoReplayFrame(waitTime));
                    }
                }

                hitButton = !hitButton;
            }

            return(Replay);
        }
Exemplo n.º 3
0
        public DrawableSwell(Swell swell)
            : base(swell)
        {
            this.swell = swell;

            Children = new Framework.Graphics.Drawable[]
            {
                bodyContainer = new Container
                {
                    Children = new Framework.Graphics.Drawable[]
                    {
                        expandingRing = new CircularContainer
                        {
                            Name         = "Expanding ring",
                            Anchor       = Anchor.Centre,
                            Origin       = Anchor.Centre,
                            Alpha        = 0,
                            Size         = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2),
                            BlendingMode = BlendingMode.Additive,
                            Masking      = true,
                            Children     = new []
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Alpha            = inner_ring_alpha,
                                }
                            }
                        },
                        targetRing = new CircularContainer
                        {
                            Name            = "Target ring (thick border)",
                            Anchor          = Anchor.Centre,
                            Origin          = Anchor.Centre,
                            Size            = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2),
                            Masking         = true,
                            BorderThickness = target_ring_thick_border,
                            BlendingMode    = BlendingMode.Additive,
                            Children        = new Framework.Graphics.Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Alpha            = 0,
                                    AlwaysPresent    = true
                                },
                                new CircularContainer
                                {
                                    Name             = "Target ring (thin border)",
                                    Anchor           = Anchor.Centre,
                                    Origin           = Anchor.Centre,
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = true,
                                    BorderThickness  = target_ring_thin_border,
                                    BorderColour     = Color4.White,
                                    Children         = new[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Alpha            = 0,
                                            AlwaysPresent    = true
                                        }
                                    }
                                }
                            }
                        },
                        circlePiece = new CirclePiece
                        {
                            Children = new []
                            {
                                symbol = new SwellSymbolPiece()
                            }
                        }
                    }
                }
            };

            circlePiece.KiaiMode = HitObject.Kiai;
        }
Exemplo n.º 4
0
        private void createAutoReplay()
        {
            bool hitButton = true;

            Frames.Add(new ReplayFrame(-100000, null, null, ReplayButtonState.None));
            Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, null, null, ReplayButtonState.None));

            for (int i = 0; i < beatmap.HitObjects.Count; i++)
            {
                TaikoHitObject h = beatmap.HitObjects[i];

                ReplayButtonState button;

                IHasEndTime endTimeData = h as IHasEndTime;
                double      endTime     = endTimeData?.EndTime ?? h.StartTime;

                Swell    swell    = h as Swell;
                DrumRoll drumRoll = h as DrumRoll;
                Hit      hit      = h as Hit;

                if (swell != null)
                {
                    int    d       = 0;
                    int    count   = 0;
                    int    req     = swell.RequiredHits;
                    double hitRate = swell.Duration / req;
                    for (double j = h.StartTime; j < endTime; j += hitRate)
                    {
                        switch (d)
                        {
                        default:
                            button = ReplayButtonState.Left1;
                            break;

                        case 1:
                            button = ReplayButtonState.Right1;
                            break;

                        case 2:
                            button = ReplayButtonState.Left2;
                            break;

                        case 3:
                            button = ReplayButtonState.Right2;
                            break;
                        }

                        Frames.Add(new ReplayFrame(j, null, null, button));
                        d = (d + 1) % 4;
                        if (++count > req)
                        {
                            break;
                        }
                    }
                }
                else if (drumRoll != null)
                {
                    foreach (var tick in drumRoll.Ticks)
                    {
                        Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
                        hitButton = !hitButton;
                    }
                }
                else if (hit != null)
                {
                    if (hit is CentreHit)
                    {
                        if (h.IsStrong)
                        {
                            button = ReplayButtonState.Right1 | ReplayButtonState.Right2;
                        }
                        else
                        {
                            button = hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2;
                        }
                    }
                    else
                    {
                        if (h.IsStrong)
                        {
                            button = ReplayButtonState.Left1 | ReplayButtonState.Left2;
                        }
                        else
                        {
                            button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2;
                        }
                    }

                    Frames.Add(new ReplayFrame(h.StartTime, null, null, button));
                }
                else
                {
                    throw new Exception("Unknown hit object type.");
                }

                Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, null, null, ReplayButtonState.None));

                if (i < beatmap.HitObjects.Count - 1)
                {
                    double waitTime = beatmap.HitObjects[i + 1].StartTime - 1000;
                    if (waitTime > endTime)
                    {
                        Frames.Add(new ReplayFrame(waitTime, null, null, ReplayButtonState.None));
                    }
                }

                hitButton = !hitButton;
            }
        }
Exemplo n.º 5
0
        public override Replay Generate()
        {
            bool hitButton = true;

            Frames.Add(new TaikoReplayFrame(-100000, ReplayButtonState.None));
            Frames.Add(new TaikoReplayFrame(Beatmap.HitObjects[0].StartTime - 1000, ReplayButtonState.None));

            for (int i = 0; i < Beatmap.HitObjects.Count; i++)
            {
                TaikoHitObject h = Beatmap.HitObjects[i];

                ReplayButtonState button;

                IHasEndTime endTimeData = h as IHasEndTime;
                double      endTime     = endTimeData?.EndTime ?? h.StartTime;

                Swell    swell    = h as Swell;
                DrumRoll drumRoll = h as DrumRoll;
                Hit      hit      = h as Hit;

                if (swell != null)
                {
                    int    d       = 0;
                    int    count   = 0;
                    int    req     = swell.RequiredHits;
                    double hitRate = Math.Min(swell_hit_speed, swell.Duration / req);
                    for (double j = h.StartTime; j < endTime; j += hitRate)
                    {
                        switch (d)
                        {
                        default:
                        case 0:
                            button = ReplayButtonState.Left1;
                            break;

                        case 1:
                            button = ReplayButtonState.Right1;
                            break;

                        case 2:
                            button = ReplayButtonState.Left2;
                            break;

                        case 3:
                            button = ReplayButtonState.Right2;
                            break;
                        }

                        Frames.Add(new TaikoReplayFrame(j, button));
                        d = (d + 1) % 4;
                        if (++count == req)
                        {
                            break;
                        }
                    }
                }
                else if (drumRoll != null)
                {
                    foreach (var tick in drumRoll.NestedHitObjects.OfType <DrumRollTick>())
                    {
                        Frames.Add(new TaikoReplayFrame(tick.StartTime, hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2));
                        hitButton = !hitButton;
                    }
                }
                else if (hit != null)
                {
                    if (hit is CentreHit)
                    {
                        if (h.IsStrong)
                        {
                            button = ReplayButtonState.Right1 | ReplayButtonState.Right2;
                        }
                        else
                        {
                            button = hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2;
                        }
                    }
                    else
                    {
                        if (h.IsStrong)
                        {
                            button = ReplayButtonState.Left1 | ReplayButtonState.Left2;
                        }
                        else
                        {
                            button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2;
                        }
                    }

                    Frames.Add(new TaikoReplayFrame(h.StartTime, button));
                }
                else
                {
                    throw new InvalidOperationException("Unknown hit object type.");
                }

                Frames.Add(new TaikoReplayFrame(endTime + KEY_UP_DELAY, ReplayButtonState.None));

                if (i < Beatmap.HitObjects.Count - 1)
                {
                    double waitTime = Beatmap.HitObjects[i + 1].StartTime - 1000;
                    if (waitTime > endTime)
                    {
                        Frames.Add(new TaikoReplayFrame(waitTime, ReplayButtonState.None));
                    }
                }

                hitButton = !hitButton;
            }

            return(Replay);
        }