mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Remove PlayMode game-wide.
This commit is contained in:
parent
a89af273be
commit
0a1376c2db
@ -26,10 +26,9 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
});
|
||||
|
||||
AddStep("Toggle", modSelect.ToggleVisibility);
|
||||
AddStep("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu);
|
||||
AddStep("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko);
|
||||
AddStep("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch);
|
||||
AddStep("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania);
|
||||
|
||||
foreach (var ruleset in RulesetCollection.AllRulesets)
|
||||
AddStep(ruleset.Description, () => modSelect.Ruleset.Value = ruleset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,8 +76,6 @@ namespace osu.Game.Modes.Catch
|
||||
}
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Catch;
|
||||
|
||||
public override string Description => "osu!catch";
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
|
||||
|
@ -96,8 +96,6 @@ namespace osu.Game.Modes.Mania
|
||||
}
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Mania;
|
||||
|
||||
public override string Description => "osu!mania";
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
|
||||
|
@ -99,8 +99,6 @@ namespace osu.Game.Modes.Osu
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap);
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Osu;
|
||||
|
||||
public override string Description => "osu!";
|
||||
|
||||
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new KeyCounter[]
|
||||
|
@ -76,8 +76,6 @@ namespace osu.Game.Modes.Taiko
|
||||
}
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Taiko;
|
||||
|
||||
public override string Description => "osu!taiko";
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.AreEqual(false, beatmapInfo.Countdown);
|
||||
Assert.AreEqual(0.7f, beatmapInfo.StackLeniency);
|
||||
Assert.AreEqual(false, beatmapInfo.SpecialStyle);
|
||||
Assert.AreEqual(PlayMode.Osu, beatmapInfo.Mode);
|
||||
Assert.IsTrue(beatmapInfo.Ruleset is OsuRuleset);
|
||||
Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks);
|
||||
Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard);
|
||||
}
|
||||
|
@ -18,14 +18,6 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public readonly BeatmapSetInfo BeatmapSetInfo;
|
||||
|
||||
/// <summary>
|
||||
/// A play mode that is preferred for this beatmap. PlayMode will become this mode where conversion is feasible,
|
||||
/// or otherwise to the beatmap's default.
|
||||
/// </summary>
|
||||
public PlayMode? PreferredPlayMode;
|
||||
|
||||
public PlayMode PlayMode => Beatmap?.BeatmapInfo?.Mode > (int)PlayMode.Osu ? (PlayMode)Beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu;
|
||||
|
||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>();
|
||||
|
||||
public readonly bool WithStoryboard;
|
||||
|
@ -17,8 +17,6 @@ namespace osu.Game.Configuration
|
||||
Set(OsuConfig.Username, string.Empty);
|
||||
Set(OsuConfig.Token, string.Empty);
|
||||
|
||||
Set(OsuConfig.PlayMode, PlayMode.Osu);
|
||||
|
||||
Set(OsuConfig.AudioDevice, string.Empty);
|
||||
Set(OsuConfig.SavePassword, false);
|
||||
Set(OsuConfig.SaveUsername, true);
|
||||
@ -196,7 +194,7 @@ namespace osu.Game.Configuration
|
||||
public enum OsuConfig
|
||||
{
|
||||
// New osu:
|
||||
PlayMode,
|
||||
Ruleset,
|
||||
Token,
|
||||
// Imported from old osu:
|
||||
BeatmapDirectory,
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Database
|
||||
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
|
||||
using (SerializationReader sr = new SerializationReader(s))
|
||||
{
|
||||
var ruleset = RulesetCollection.GetRuleset((PlayMode)sr.ReadByte());
|
||||
var ruleset = RulesetCollection.GetRuleset((int)sr.ReadByte());
|
||||
score = ruleset.CreateScoreProcessor().CreateScore();
|
||||
|
||||
/* score.Pass = true;*/
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Modes
|
||||
{
|
||||
public enum PlayMode
|
||||
{
|
||||
Osu = 0,
|
||||
Taiko = 1,
|
||||
Catch = 2,
|
||||
Mania = 3
|
||||
}
|
||||
}
|
@ -32,8 +32,6 @@ namespace osu.Game.Modes
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor();
|
||||
|
||||
protected abstract PlayMode PlayMode { get; }
|
||||
|
||||
public virtual FontAwesome Icon => FontAwesome.fa_question_circle;
|
||||
|
||||
public abstract string Description { get; }
|
||||
|
@ -21,11 +21,6 @@ namespace osu.Game.Modes
|
||||
available_rulesets.TryAdd(available_rulesets.Count, ruleset);
|
||||
}
|
||||
|
||||
public static Ruleset GetRuleset(PlayMode playMode)
|
||||
{
|
||||
return GetRuleset((int)playMode);
|
||||
}
|
||||
|
||||
public static Ruleset GetRuleset(int rulesetId)
|
||||
{
|
||||
Ruleset ruleset;
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game
|
||||
|
||||
private VolumeControl volume;
|
||||
|
||||
public Bindable<PlayMode> PlayMode;
|
||||
public Bindable<Ruleset> Ruleset;
|
||||
|
||||
private readonly string[] args;
|
||||
|
||||
@ -88,7 +88,8 @@ namespace osu.Game
|
||||
|
||||
Dependencies.Cache(this);
|
||||
|
||||
PlayMode = LocalConfig.GetBindable<PlayMode>(OsuConfig.PlayMode);
|
||||
// Todo: I don't think this'll work, need BindableRuleset
|
||||
Ruleset = new Bindable<Ruleset>();
|
||||
}
|
||||
|
||||
private ScheduledDelegate scoreLoad;
|
||||
@ -199,11 +200,11 @@ namespace osu.Game
|
||||
{
|
||||
Depth = -3,
|
||||
OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); },
|
||||
OnPlayModeChange = m => PlayMode.Value = m,
|
||||
OnRulesetChange = r => Ruleset.Value = r,
|
||||
}, t =>
|
||||
{
|
||||
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
|
||||
PlayMode.TriggerChange();
|
||||
Ruleset.ValueChanged += delegate { Toolbar.SetGameMode(Ruleset.Value); };
|
||||
Ruleset.TriggerChange();
|
||||
overlayContent.Add(Toolbar);
|
||||
});
|
||||
|
||||
|
@ -37,13 +37,12 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>();
|
||||
|
||||
public readonly Bindable<PlayMode> PlayMode = new Bindable<PlayMode>();
|
||||
public readonly Bindable<Ruleset> Ruleset = new Bindable<Ruleset>();
|
||||
|
||||
private void modeChanged(PlayMode newMode)
|
||||
private void rulesetChanged(Ruleset newRuleset)
|
||||
{
|
||||
var ruleset = RulesetCollection.GetRuleset(newMode);
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
|
||||
section.Buttons = newRuleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
@ -54,9 +53,9 @@ namespace osu.Game.Overlays.Mods
|
||||
highMultiplierColour = colours.Green;
|
||||
|
||||
if (osu != null)
|
||||
PlayMode.BindTo(osu.PlayMode);
|
||||
PlayMode.ValueChanged += modeChanged;
|
||||
PlayMode.TriggerChange();
|
||||
Ruleset.BindTo(osu.Ruleset);
|
||||
Ruleset.ValueChanged += rulesetChanged;
|
||||
Ruleset.TriggerChange();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
|
@ -27,13 +27,15 @@ namespace osu.Game.Overlays.Options
|
||||
|
||||
var modes = new List<Drawable>();
|
||||
|
||||
foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
|
||||
foreach (var ruleset in RulesetCollection.AllRulesets)
|
||||
{
|
||||
modes.Add(new TextAwesome
|
||||
{
|
||||
Icon = RulesetCollection.GetRuleset(m).Icon,
|
||||
Icon = ruleset.Icon,
|
||||
Colour = Color4.Gray,
|
||||
TextSize = 20
|
||||
});
|
||||
}
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
public const float TOOLTIP_HEIGHT = 30;
|
||||
|
||||
public Action OnHome;
|
||||
public Action<PlayMode> OnPlayModeChange;
|
||||
public Action<Ruleset> OnRulesetChange;
|
||||
|
||||
private readonly ToolbarModeSelector modeSelector;
|
||||
private readonly ToolbarUserArea userArea;
|
||||
@ -55,9 +55,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
},
|
||||
modeSelector = new ToolbarModeSelector
|
||||
{
|
||||
OnPlayModeChange = mode =>
|
||||
OnRulesetChange = mode =>
|
||||
{
|
||||
OnPlayModeChange?.Invoke(mode);
|
||||
OnRulesetChange?.Invoke(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);
|
||||
public void SetGameMode(Ruleset ruleset) => modeSelector.SetGameMode(ruleset);
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
|
@ -9,16 +9,16 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarModeButton : ToolbarButton
|
||||
{
|
||||
private PlayMode mode;
|
||||
public PlayMode Mode
|
||||
private Ruleset ruleset;
|
||||
public Ruleset Ruleset
|
||||
{
|
||||
get { return mode; }
|
||||
get { return ruleset; }
|
||||
set
|
||||
{
|
||||
mode = value;
|
||||
TooltipMain = Ruleset.GetRuleset(mode).Description;
|
||||
TooltipSub = $"Play some {Ruleset.GetRuleset(mode).Description}";
|
||||
Icon = Ruleset.GetRuleset(mode).Icon;
|
||||
ruleset = value;
|
||||
TooltipMain = ruleset.Description;
|
||||
TooltipSub = $"Play some {ruleset.Description}";
|
||||
Icon = ruleset.Icon;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private readonly Drawable modeButtonLine;
|
||||
private ToolbarModeButton activeButton;
|
||||
|
||||
public Action<PlayMode> OnPlayModeChange;
|
||||
public Action<Ruleset> OnRulesetChange;
|
||||
|
||||
public ToolbarModeSelector()
|
||||
{
|
||||
@ -63,15 +63,15 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
};
|
||||
|
||||
foreach (PlayMode m in Ruleset.PlayModes)
|
||||
foreach (var ruleset in RulesetCollection.AllRulesets)
|
||||
{
|
||||
modeButtons.Add(new ToolbarModeButton
|
||||
{
|
||||
Mode = m,
|
||||
Ruleset = ruleset,
|
||||
Action = delegate
|
||||
{
|
||||
SetGameMode(m);
|
||||
OnPlayModeChange?.Invoke(m);
|
||||
SetGameMode(ruleset);
|
||||
OnRulesetChange?.Invoke(ruleset);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -84,11 +84,11 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Size = new Vector2(modeButtons.DrawSize.X, 1);
|
||||
}
|
||||
|
||||
public void SetGameMode(PlayMode mode)
|
||||
public void SetGameMode(Ruleset ruleset)
|
||||
{
|
||||
foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>())
|
||||
{
|
||||
bool isActive = m.Mode == mode;
|
||||
bool isActive = m.Ruleset == ruleset;
|
||||
m.Active = isActive;
|
||||
if (isActive)
|
||||
activeButton = m;
|
||||
|
@ -63,13 +63,6 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config)
|
||||
{
|
||||
if (Beatmap.Beatmap.BeatmapInfo?.Mode > (int)PlayMode.Taiko)
|
||||
{
|
||||
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
||||
Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
dimLevel = config.GetBindable<int>(OsuConfig.DimLevel);
|
||||
mouseWheelDisabled = config.GetBindable<bool>(OsuConfig.MouseDisableWheel);
|
||||
|
||||
@ -109,7 +102,7 @@ namespace osu.Game.Screens.Play
|
||||
sourceClock.Reset();
|
||||
});
|
||||
|
||||
ruleset = RulesetCollection.GetRuleset(Beatmap.PlayMode);
|
||||
ruleset = Beatmap.BeatmapInfo.Ruleset;
|
||||
HitRenderer = ruleset.CreateHitRendererWith(Beatmap);
|
||||
|
||||
scoreProcessor = HitRenderer.CreateScoreProcessor();
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select
|
||||
Group = group,
|
||||
Sort = sort,
|
||||
SearchText = searchTextBox.Text,
|
||||
Mode = playMode
|
||||
Ruleset = ruleset
|
||||
};
|
||||
|
||||
public Action Exit;
|
||||
@ -163,16 +163,17 @@ namespace osu.Game.Screens.Select
|
||||
searchTextBox.HoldFocus = true;
|
||||
}
|
||||
|
||||
private readonly Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
||||
private readonly Bindable<Ruleset> ruleset = new Bindable<Ruleset>();
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls:true)]
|
||||
private void load(OsuColour colours, OsuGame osu)
|
||||
{
|
||||
sortTabs.AccentColour = colours.GreenLight;
|
||||
|
||||
if (osu != null) playMode.BindTo(osu.PlayMode);
|
||||
playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria());
|
||||
playMode.TriggerChange();
|
||||
if (osu != null)
|
||||
ruleset.BindTo(osu.Ruleset);
|
||||
ruleset.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria());
|
||||
ruleset.TriggerChange();
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Screens.Select
|
||||
public GroupMode Group;
|
||||
public SortMode Sort;
|
||||
public string SearchText;
|
||||
public PlayMode Mode;
|
||||
public Ruleset Ruleset;
|
||||
|
||||
public void Filter(List<BeatmapGroup> groups)
|
||||
{
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
var set = g.BeatmapSet;
|
||||
|
||||
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == (int)Mode);
|
||||
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Ruleset == Ruleset);
|
||||
|
||||
bool match = hasCurrentMode;
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen
|
||||
{
|
||||
private readonly Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
||||
private readonly Bindable<Ruleset> ruleset = new Bindable<Ruleset>();
|
||||
private BeatmapDatabase database;
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
||||
@ -170,8 +170,8 @@ namespace osu.Game.Screens.Select
|
||||
if (database == null)
|
||||
database = beatmaps;
|
||||
|
||||
playMode.ValueChanged += val => { if (Beatmap != null) Beatmap.PreferredPlayMode = val; };
|
||||
if (osu != null) playMode.BindTo(osu.PlayMode);
|
||||
if (osu != null)
|
||||
ruleset.BindTo(osu.Ruleset);
|
||||
|
||||
database.BeatmapSetAdded += onBeatmapSetAdded;
|
||||
database.BeatmapSetRemoved += onBeatmapSetRemoved;
|
||||
@ -200,7 +200,6 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
if (Beatmap == null) return;
|
||||
|
||||
Beatmap.PreferredPlayMode = playMode.Value;
|
||||
OnSelected();
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,6 @@
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
|
||||
<Compile Include="Screens\Play\Player.cs" />
|
||||
<Compile Include="Screens\Charts\ChartListing.cs" />
|
||||
<Compile Include="Modes\PlayMode.cs" />
|
||||
<Compile Include="Modes\Ruleset.cs" />
|
||||
<Compile Include="Screens\Ranking\Results.cs" />
|
||||
<Compile Include="Screens\Direct\OnlineListing.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user