mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 16:12:57 +08:00
Add bindable mods and autoplay support.
This commit is contained in:
parent
1ea21daa91
commit
76ef8c1a6c
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Beatmaps.IO;
|
using osu.Game.Beatmaps.IO;
|
||||||
@ -26,6 +27,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu;
|
public PlayMode PlayMode => beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu;
|
||||||
|
|
||||||
|
public readonly Bindable<Mod[]> Mods = new Bindable<Mod[]>();
|
||||||
|
|
||||||
public readonly bool WithStoryboard;
|
public readonly bool WithStoryboard;
|
||||||
|
|
||||||
protected abstract ArchiveReader GetReader();
|
protected abstract ArchiveReader GetReader();
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Modes.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Modes
|
namespace osu.Game.Modes
|
||||||
{
|
{
|
||||||
@ -41,6 +43,12 @@ namespace osu.Game.Modes
|
|||||||
/// The mods this mod cannot be enabled with.
|
/// The mods this mod cannot be enabled with.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract Mods[] DisablesMods { get; }
|
public abstract Mods[] DisablesMods { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Direct access to the Player before load has run.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="player"></param>
|
||||||
|
public virtual void PlayerLoading(Player player) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MultiMod : Mod
|
public class MultiMod : Mod
|
||||||
@ -150,6 +158,12 @@ namespace osu.Game.Modes
|
|||||||
public override double ScoreMultiplier => 0;
|
public override double ScoreMultiplier => 0;
|
||||||
public override bool Ranked => false;
|
public override bool Ranked => false;
|
||||||
public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect };
|
public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect };
|
||||||
|
|
||||||
|
public override void PlayerLoading(Player player)
|
||||||
|
{
|
||||||
|
base.PlayerLoading(player);
|
||||||
|
player.ReplayInputHandler = Ruleset.GetRuleset(player.Beatmap.PlayMode).CreateAutoplayScore(player.Beatmap.Beatmap)?.Replay?.GetInputHandler();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ModPerfect : ModSuddenDeath
|
public abstract class ModPerfect : ModSuddenDeath
|
||||||
|
@ -17,6 +17,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
@ -66,6 +67,17 @@ namespace osu.Game.Screens.Play
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
|
var beatmap = Beatmap.Beatmap;
|
||||||
|
|
||||||
|
if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu)
|
||||||
|
{
|
||||||
|
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
||||||
|
Exit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Beatmap.Mods.Value.ForEach(m => m.PlayerLoading(this));
|
||||||
|
|
||||||
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel);
|
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel);
|
||||||
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
|
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
|
||||||
|
|
||||||
@ -102,15 +114,6 @@ namespace osu.Game.Screens.Play
|
|||||||
sourceClock.Reset();
|
sourceClock.Reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
var beatmap = Beatmap.Beatmap;
|
|
||||||
|
|
||||||
if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu)
|
|
||||||
{
|
|
||||||
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
|
||||||
Exit();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
||||||
|
|
||||||
scoreOverlay = ruleset.CreateScoreOverlay();
|
scoreOverlay = ruleset.CreateScoreOverlay();
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Configuration;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Input.Handlers;
|
using osu.Framework.Input.Handlers;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using KeyboardState = osu.Framework.Input.KeyboardState;
|
using KeyboardState = osu.Framework.Input.KeyboardState;
|
||||||
|
@ -337,6 +337,8 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.OnBeatmapChanged(beatmap);
|
base.OnBeatmapChanged(beatmap);
|
||||||
|
|
||||||
|
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
||||||
|
|
||||||
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
||||||
changeBackground(beatmap);
|
changeBackground(beatmap);
|
||||||
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user