2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-04-24 03:35:34 +00:00
|
|
|
|
using System;
|
2019-04-08 09:32:05 +00:00
|
|
|
|
using System.Collections.Generic;
|
2018-07-17 05:29:22 +00:00
|
|
|
|
using System.Linq;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Input.Handlers;
|
2018-11-28 08:20:37 +00:00
|
|
|
|
using osu.Game.Replays;
|
2019-04-08 09:32:05 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2019-01-23 10:46:53 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Configuration;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Replays;
|
|
|
|
|
using osu.Game.Rulesets.UI;
|
2019-03-25 10:21:25 +00:00
|
|
|
|
using osu.Game.Screens.Play;
|
2019-11-29 08:35:11 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.UI
|
|
|
|
|
{
|
2019-03-20 02:29:16 +00:00
|
|
|
|
public class DrawableOsuRuleset : DrawableRuleset<OsuHitObject>
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2019-01-25 10:14:37 +00:00
|
|
|
|
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
|
2019-01-23 10:46:53 +00:00
|
|
|
|
|
2019-12-12 06:58:11 +00:00
|
|
|
|
public DrawableOsuRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
2019-04-08 09:32:05 +00:00
|
|
|
|
: base(ruleset, beatmap, mods)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-29 08:35:11 +00:00
|
|
|
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // always show the gameplay cursor
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
|
|
|
|
|
2019-03-19 11:21:31 +00:00
|
|
|
|
protected override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-03-30 16:29:37 +00:00
|
|
|
|
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new OsuPlayfieldAdjustmentContainer();
|
2019-03-26 04:31:49 +00:00
|
|
|
|
|
2019-03-25 10:21:25 +00:00
|
|
|
|
protected override ResumeOverlay CreateResumeOverlay() => new OsuResumeOverlay();
|
|
|
|
|
|
2019-03-24 14:40:43 +00:00
|
|
|
|
public override DrawableHitObject<OsuHitObject> CreateDrawableRepresentation(OsuHitObject h)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2018-07-17 05:35:09 +00:00
|
|
|
|
switch (h)
|
|
|
|
|
{
|
|
|
|
|
case HitCircle circle:
|
|
|
|
|
return new DrawableHitCircle(circle);
|
2019-04-01 03:44:46 +00:00
|
|
|
|
|
2018-07-17 05:35:09 +00:00
|
|
|
|
case Slider slider:
|
|
|
|
|
return new DrawableSlider(slider);
|
2019-04-01 03:44:46 +00:00
|
|
|
|
|
2018-07-17 05:35:09 +00:00
|
|
|
|
case Spinner spinner:
|
|
|
|
|
return new DrawableSpinner(spinner);
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-20 12:08:52 +00:00
|
|
|
|
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuFramedReplayInputHandler(replay);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-03-23 10:18:56 +00:00
|
|
|
|
protected override ReplayRecorder CreateReplayRecorder(Replay replay) => new OsuReplayRecorder(replay);
|
|
|
|
|
|
2018-07-17 05:29:22 +00:00
|
|
|
|
public override double GameplayStartTime
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-05-14 20:18:46 +00:00
|
|
|
|
if (Objects.FirstOrDefault() is OsuHitObject first)
|
2019-05-14 03:29:24 +00:00
|
|
|
|
return first.StartTime - Math.Max(2000, first.TimePreempt);
|
2019-05-15 01:55:02 +00:00
|
|
|
|
|
|
|
|
|
return 0;
|
2018-07-17 05:29:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|