示例#1
0
        private void addDrumRoll(bool strong)
        {
            var d = new DrumRoll
            {
                StartTime = Time.Current + 1000,
                Distance  = 20000,
                PreEmpt   = 1000,
            };

            playfield.Add(strong ? new DrawableStrongDrumRoll(d) : new DrawableDrumRoll(d));
        }
示例#2
0
        private void addDrumRoll(bool strong, double duration = default_duration)
        {
            addBarLine(true);
            addBarLine(true, scroll_time + duration);

            var d = new DrumRoll
            {
                StartTime = rulesetContainer.Playfield.Time.Current + scroll_time,
                IsStrong  = strong,
                Duration  = duration,
            };

            rulesetContainer.Playfield.Add(new DrawableDrumRoll(d));
        }
示例#3
0
        private void addDrumRoll(bool strong, double duration = default_duration)
        {
            addBarLine(true);
            addBarLine(true, scroll_time + duration);

            var d = new DrumRoll
            {
                StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
                IsStrong  = strong,
                Duration  = duration,
            };

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

            drawableRuleset.Playfield.Add(new DrawableDrumRoll(d));
        }
        private DrumRoll createDrumRollAtCurrentTime(bool strong = false)
        {
            var drumroll = new DrumRoll
            {
                IsStrong  = strong,
                StartTime = Time.Current + 1000,
                Duration  = 4000,
            };

            var cpi = new ControlPointInfo();

            cpi.Add(0, new TimingControlPoint {
                BeatLength = 500
            });

            drumroll.ApplyDefaults(cpi, new BeatmapDifficulty());

            return(drumroll);
        }
示例#5
0
        private void addDrumRoll(bool strong, double duration = default_duration, bool kiai = false)
        {
            addBarLine(true);
            addBarLine(true, scroll_time + duration);

            var d = new DrumRoll
            {
                StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
                IsStrong  = strong,
                Duration  = duration,
                TickRate  = 8,
            };

            var cpi = new ControlPointInfo();

            cpi.Add(-10000, new EffectControlPoint {
                KiaiMode = kiai
            });

            d.ApplyDefaults(cpi, new BeatmapDifficulty());

            drawableRuleset.Playfield.Add(new DrawableDrumRoll(d));
        }
示例#6
0
        public DrawableDrumRoll(DrumRoll drumRoll)
            : base(drumRoll)
        {
            this.drumRoll = drumRoll;

            RelativeSizeAxes = Axes.X;
            Width            = (float)(drumRoll.Duration / drumRoll.PreEmpt);

            Add(circle      = CreateCirclePiece());
            circle.KiaiMode = HitObject.Kiai;

            foreach (var tick in drumRoll.Ticks)
            {
                var newTick = new DrawableDrumRollTick(tick)
                {
                    X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration)
                };

                newTick.OnJudgement += onTickJudgement;

                AddNested(newTick);
                Add(newTick);
            }
        }
示例#7
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);
        }
示例#8
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;
            }
        }
示例#9
0
        ///<inheritdoc/>
        public override IHitObject CreateHitObject(string data)
        {
            IHitObject hitobject = null;
            var        d         = data.Split(',');
            var        types     = new HitObjectTypesConverter().Convert(int.Parse(d[3]), out var maybeBestVal);
            var        hitSounds = new HitSoundsConverter().Convert(int.Parse(d[4]), out _);

            if (types.Contains(HitObjectTypes.Slider) || types.Contains(HitObjectTypes.Spinner))
            {
                hitobject = new DrumRoll();
            }
            if (maybeBestVal == HitObjectTypes.HitCircle)
            {
                //根据音效选择红色
                //有Finish音效则是双打
                if (hitSounds.Contains(HitSounds.Finish))
                {
                    hitobject = new LargeTaikoRedHit();
                }
                if (hitSounds.Contains(HitSounds.Normal))
                {
                    if (hitSounds.Contains(HitSounds.Finish))
                    {
                        //有Finish音效则是双打
                        hitobject = new LargeTaikoRedHit();
                    }
                    //否则是单打
                    else
                    {
                        hitobject = new TaikoRedHit();
                    }
                }
                //根据音效选择蓝色
                if (hitSounds.Contains(HitSounds.Whistle) || hitSounds.Contains(HitSounds.Clap))
                {
                    if (hitSounds.Contains(HitSounds.Finish))
                    {
                        //有Finish音效则是双打
                        hitobject = new LargeTaikoBlueHit();
                    }
                    else
                    {
                        //否则是单打
                        hitobject = new TaikoBlueHit();
                    }
                }
            }

            if (hitobject == null)
            {
                var builder = new StringBuilder("HitObject类型:");
                for (var i = 0; i < types.Count; i++)
                {
                    builder.Append(types[i]);
                    if (i != types.Count - 1)
                    {
                        builder.Append(", ");
                    }
                }

                builder.Append("  HitSounds:");
                for (var i = 0; i < hitSounds.Count; i++)
                {
                    builder.Append(hitSounds[i]);
                    if (i != hitSounds.Count - 1)
                    {
                        builder.Append(", ");
                    }
                }

                throw new IncorrectHitObjectException(this, types[0], builder.ToString());
            }

            hitobject.Parse(data);
            return(hitobject);
        }
示例#10
0
 public DrawableStrongDrumRoll(DrumRoll drumRoll)
     : base(drumRoll)
 {
 }
示例#11
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);
        }