2019-01-24 16:43:03 +08: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 17:19:50 +08:00
|
|
|
|
|
2019-04-24 11:35:34 +08:00
|
|
|
|
using System;
|
2019-04-08 17:32:05 +08:00
|
|
|
|
using System.Collections.Generic;
|
2018-07-17 13:29:22 +08:00
|
|
|
|
using System.Linq;
|
2024-09-04 17:58:19 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2024-09-04 18:28:07 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Framework.Graphics;
|
2017-08-09 10:50:34 +08:00
|
|
|
|
using osu.Framework.Input;
|
2017-03-10 14:08:53 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
2018-02-28 15:34:47 +08:00
|
|
|
|
using osu.Game.Input.Handlers;
|
2018-11-28 16:20:37 +08:00
|
|
|
|
using osu.Game.Replays;
|
2019-04-08 17:32:05 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2020-11-12 13:19:26 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2019-01-23 18:46:53 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Configuration;
|
2024-05-30 18:17:18 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2017-08-24 14:36:42 +08:00
|
|
|
|
using osu.Game.Rulesets.Osu.Replays;
|
2017-04-18 15:05:58 +08:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2020-12-14 15:52:14 +08:00
|
|
|
|
using osu.Game.Scoring;
|
2019-03-25 18:21:25 +08:00
|
|
|
|
using osu.Game.Screens.Play;
|
2019-11-29 16:35:11 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.UI
|
2016-09-02 18:25:13 +08:00
|
|
|
|
{
|
2019-03-20 10:29:16 +08:00
|
|
|
|
public partial class DrawableOsuRuleset : DrawableRuleset<OsuHitObject>
|
2016-09-02 18:25:13 +08:00
|
|
|
|
{
|
2024-09-04 18:28:07 +08:00
|
|
|
|
private Bindable<bool>? cursorHideEnabled;
|
2019-01-23 18:46:53 +08:00
|
|
|
|
|
2023-02-14 17:10:25 +08:00
|
|
|
|
public new OsuInputManager KeyBindingInputManager => (OsuInputManager)base.KeyBindingInputManager;
|
2023-02-14 16:35:41 +08:00
|
|
|
|
|
2020-11-10 23:22:06 +08:00
|
|
|
|
public new OsuPlayfield Playfield => (OsuPlayfield)base.Playfield;
|
|
|
|
|
|
2024-09-04 20:16:59 +08:00
|
|
|
|
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
|
|
|
|
|
|
2024-09-04 17:58:19 +08:00
|
|
|
|
public DrawableOsuRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods = null)
|
2019-04-08 17:32:05 +08:00
|
|
|
|
: base(ruleset, beatmap, mods)
|
2017-03-10 14:08:53 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2024-09-04 17:58:19 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(ReplayPlayer? replayPlayer)
|
2024-09-04 17:35:27 +08:00
|
|
|
|
{
|
2024-09-04 17:58:19 +08:00
|
|
|
|
if (replayPlayer != null)
|
2024-09-04 18:28:07 +08:00
|
|
|
|
{
|
|
|
|
|
PlayfieldAdjustmentContainer.Add(new ReplayAnalysisOverlay(replayPlayer.Score.Replay));
|
2024-09-04 20:16:59 +08:00
|
|
|
|
replayPlayer.AddSettings(new ReplayAnalysisSettings(Config));
|
2024-09-04 18:28:07 +08:00
|
|
|
|
|
2024-09-04 20:16:59 +08:00
|
|
|
|
cursorHideEnabled = Config.GetBindable<bool>(OsuRulesetSetting.ReplayCursorHideEnabled);
|
2024-09-04 18:28:07 +08:00
|
|
|
|
cursorHideEnabled.BindValueChanged(enabled => Playfield.Cursor.FadeTo(enabled.NewValue ? 0 : 1), true);
|
|
|
|
|
}
|
2024-09-04 17:35:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:58:19 +08:00
|
|
|
|
public override DrawableHitObject<OsuHitObject>? CreateDrawableRepresentation(OsuHitObject h) => null;
|
2020-11-13 13:58:32 +08:00
|
|
|
|
|
2019-11-29 16:35:11 +08:00
|
|
|
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; // always show the gameplay cursor
|
|
|
|
|
|
2017-09-12 17:19:28 +08:00
|
|
|
|
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2023-02-14 17:10:25 +08:00
|
|
|
|
protected override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-08-04 21:43:33 +08:00
|
|
|
|
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new OsuPlayfieldAdjustmentContainer { AlignWithStoryboard = true };
|
2019-03-26 12:31:49 +08:00
|
|
|
|
|
2024-05-30 18:17:18 +08:00
|
|
|
|
protected override ResumeOverlay CreateResumeOverlay()
|
|
|
|
|
{
|
|
|
|
|
if (Mods.Any(m => m is OsuModAutopilot))
|
|
|
|
|
return new DelayedResumeOverlay { Scale = new Vector2(0.65f) };
|
|
|
|
|
|
|
|
|
|
return new OsuResumeOverlay();
|
|
|
|
|
}
|
2019-03-25 18:21:25 +08:00
|
|
|
|
|
2019-02-20 20:08:52 +08:00
|
|
|
|
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuFramedReplayInputHandler(replay);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-12-14 15:52:14 +08:00
|
|
|
|
protected override ReplayRecorder CreateReplayRecorder(Score score) => new OsuReplayRecorder(score);
|
2020-03-23 18:18:56 +08:00
|
|
|
|
|
2018-07-17 13:29:22 +08:00
|
|
|
|
public override double GameplayStartTime
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-05-15 04:18:46 +08:00
|
|
|
|
if (Objects.FirstOrDefault() is OsuHitObject first)
|
2019-05-14 11:29:24 +08:00
|
|
|
|
return first.StartTime - Math.Max(2000, first.TimePreempt);
|
2019-05-15 09:55:02 +08:00
|
|
|
|
|
|
|
|
|
return 0;
|
2018-07-17 13:29:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-02 18:25:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|