mirror of
https://github.com/ppy/osu.git
synced 2026-05-14 15:43:18 +08:00
Compare commits
4 Commits
@@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config, IBindableBeatmap beatmap)
|
||||
private void load(OsuConfigManager config, IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
InternalChild = expandTarget = new Container
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IAdjustableClock adjustableClock, IBindableBeatmap beatmap)
|
||||
private void load(IAdjustableClock adjustableClock, IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
this.adjustableClock = adjustableClock;
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new[] { new TestRoomLeaderboardPageInfo(Score, Beatmap, room) };
|
||||
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new[] { new TestRoomLeaderboardPageInfo(Score, Beatmap.Value, room) };
|
||||
}
|
||||
|
||||
private class TestRoomLeaderboardPageInfo : RoomLeaderboardPageInfo
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="Bindable{WorkingBeatmap}"/> for the <see cref="OsuGame"/> beatmap.
|
||||
/// This should be used sparingly in-favour of <see cref="IBindableBeatmap"/>.
|
||||
/// This should be used sparingly in-favour of <see cref="IBindable<WorkingBeatmap>"/>.
|
||||
/// </summary>
|
||||
public abstract class BindableBeatmap : NonNullableBindable<WorkingBeatmap>, IBindableBeatmap
|
||||
public abstract class BindableBeatmap : NonNullableBindable<WorkingBeatmap>
|
||||
{
|
||||
private AudioManager audioManager;
|
||||
private WorkingBeatmap lastBeatmap;
|
||||
@@ -62,9 +62,6 @@ namespace osu.Game.Beatmaps
|
||||
lastBeatmap = beatmap;
|
||||
}
|
||||
|
||||
[NotNull]
|
||||
IBindableBeatmap IBindableBeatmap.GetBoundCopy() => GetBoundCopy();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a new <see cref="BindableBeatmap"/> instance weakly bound to this <see cref="BindableBeatmap"/>.
|
||||
/// If you are further binding to events of the retrieved <see cref="BindableBeatmap"/>, ensure a local reference is held.
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
/// <summary>
|
||||
/// Read-only interface for the <see cref="OsuGame"/> beatmap.
|
||||
/// </summary>
|
||||
public interface IBindableBeatmap : IBindable<WorkingBeatmap>
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieve a new <see cref="IBindableBeatmap"/> instance weakly bound to this <see cref="IBindableBeatmap"/>.
|
||||
/// If you are further binding to events of the retrieved <see cref="IBindableBeatmap"/>, ensure a local reference is held.
|
||||
/// </summary>
|
||||
IBindableBeatmap GetBoundCopy();
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace osu.Game.Graphics.Containers
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
}
|
||||
|
||||
+2
-35
@@ -102,7 +102,7 @@ namespace osu.Game
|
||||
private OnScreenDisplay onscreenDisplay;
|
||||
|
||||
private Bindable<int> configRuleset;
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
private readonly LeasableBindable<RulesetInfo> ruleset = new LeasableBindable<RulesetInfo>(new Bindable<RulesetInfo>());
|
||||
|
||||
private Bindable<int> configSkin;
|
||||
|
||||
@@ -172,6 +172,7 @@ namespace osu.Game
|
||||
|
||||
dependencies.CacheAs(ruleset);
|
||||
dependencies.CacheAs<IBindable<RulesetInfo>>(ruleset);
|
||||
dependencies.CacheAs<IMutableBindable<RulesetInfo>>(ruleset);
|
||||
|
||||
// bind config int to database RulesetInfo
|
||||
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
|
||||
@@ -688,44 +689,10 @@ namespace osu.Game
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
// we only want to apply these restrictions when we are inside a screen stack.
|
||||
// the use case for not applying is in visual/unit tests.
|
||||
bool applyBeatmapRulesetRestrictions = !currentScreen?.AllowBeatmapRulesetChange ?? false;
|
||||
|
||||
ruleset.Disabled = applyBeatmapRulesetRestrictions;
|
||||
Beatmap.Disabled = applyBeatmapRulesetRestrictions;
|
||||
|
||||
screenContainer.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||
|
||||
MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets <see cref="Beatmap"/> while ignoring any beatmap.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The beatmap to set.</param>
|
||||
public void ForcefullySetBeatmap(WorkingBeatmap beatmap)
|
||||
{
|
||||
var beatmapDisabled = Beatmap.Disabled;
|
||||
|
||||
Beatmap.Disabled = false;
|
||||
Beatmap.Value = beatmap;
|
||||
Beatmap.Disabled = beatmapDisabled;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets <see cref="Ruleset"/> while ignoring any ruleset restrictions.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The beatmap to set.</param>
|
||||
public void ForcefullySetRuleset(RulesetInfo ruleset)
|
||||
{
|
||||
var rulesetDisabled = this.ruleset.Disabled;
|
||||
|
||||
this.ruleset.Disabled = false;
|
||||
this.ruleset.Value = ruleset;
|
||||
this.ruleset.Disabled = rulesetDisabled;
|
||||
}
|
||||
|
||||
protected virtual void ScreenChanged(OsuScreen current, Screen newScreen)
|
||||
{
|
||||
currentScreen = (OsuScreen)newScreen;
|
||||
|
||||
@@ -69,8 +69,9 @@ namespace osu.Game
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private OsuBindableBeatmap beatmap;
|
||||
protected BindableBeatmap Beatmap => beatmap;
|
||||
private LeasableBindable<WorkingBeatmap> beatmap;
|
||||
|
||||
protected IMutableBindable<WorkingBeatmap> Beatmap => beatmap;
|
||||
|
||||
private Bindable<bool> fpsDisplayVisible;
|
||||
|
||||
@@ -155,7 +156,6 @@ namespace osu.Game
|
||||
dependencies.CacheAs<IAPIProvider>(API);
|
||||
|
||||
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
||||
beatmap = new OsuBindableBeatmap(defaultBeatmap, Audio);
|
||||
|
||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
||||
@@ -174,8 +174,11 @@ namespace osu.Game
|
||||
// this adds a global reduction of track volume for the time being.
|
||||
Audio.Track.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8));
|
||||
|
||||
dependencies.CacheAs<BindableBeatmap>(beatmap);
|
||||
dependencies.CacheAs<IBindableBeatmap>(beatmap);
|
||||
beatmap = new LeasableBindable<WorkingBeatmap>(new OsuBindableBeatmap(defaultBeatmap, Audio));
|
||||
|
||||
dependencies.CacheAs<IBindable<WorkingBeatmap>>(beatmap);
|
||||
dependencies.CacheAs<IMutableBindable<WorkingBeatmap>>(beatmap);
|
||||
dependencies.CacheAs(beatmap);
|
||||
|
||||
FileStore.Cleanup();
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Music
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapManager beatmaps, IBindableBeatmap beatmap)
|
||||
private void load(BeatmapManager beatmaps, IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
beatmaps.GetAllUsableBeatmapSets().ForEach(b => addBeatmapSet(b, false, false));
|
||||
beatmaps.ItemAdded += addBeatmapSet;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Music
|
||||
private PlaylistList list;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, BindableBeatmap beatmap, BeatmapManager beatmaps)
|
||||
private void load(OsuColour colours, IMutableBindable<WorkingBeatmap> beatmap, BeatmapManager beatmaps)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
this.beatmaps = beatmaps;
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours)
|
||||
private void load(IMutableBindable<WorkingBeatmap> beatmap, BeatmapManager beatmaps, OsuColour colours)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
this.beatmaps = beatmaps;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets, Bindable<RulesetInfo> parentRuleset)
|
||||
private void load(RulesetStore rulesets, IMutableBindable<RulesetInfo> parentRuleset)
|
||||
{
|
||||
this.rulesets = rulesets;
|
||||
foreach (var r in rulesets.AvailableRulesets)
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, IFrameBasedClock framedClock)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, IFrameBasedClock framedClock)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, IAdjustableClock clock)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, IAdjustableClock clock)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.UI
|
||||
private WorkingBeatmap beatmap;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
this.beatmap = beatmap.Value;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace osu.Game.Screens.Edit.Components
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, OsuColour colours)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
background.Colour = colours.Gray1;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
private WaveformGraph waveform;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, IAdjustableClock adjustableClock, OsuColour colours)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, IAdjustableClock adjustableClock, OsuColour colours)
|
||||
{
|
||||
this.adjustableClock = adjustableClock;
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ namespace osu.Game.Screens.Edit
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||
|
||||
protected override bool HideOverlaysOnEnter => true;
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
protected override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
private Box bottomBackground;
|
||||
private Container screenContainer;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
public bool DidLoadMenu;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private MainMenu mainMenu;
|
||||
private SampleChannel welcome;
|
||||
private SampleChannel seeya;
|
||||
@@ -47,10 +45,8 @@ namespace osu.Game.Screens.Menu
|
||||
private WorkingBeatmap introBeatmap;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
|
||||
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||
|
||||
@@ -95,7 +91,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
if (!resuming)
|
||||
{
|
||||
beatmap.Value = introBeatmap;
|
||||
Beatmap.Value = introBeatmap;
|
||||
|
||||
if (menuVoice)
|
||||
welcome.Play();
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders, IBindableBeatmap beatmap)
|
||||
private void load(ShaderManager shaders, IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, OsuColour colours)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, OsuColour colours)
|
||||
{
|
||||
this.beatmap.BindTo(beatmap);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
private readonly Room room;
|
||||
|
||||
[Resolved]
|
||||
private IBindableBeatmap gameBeatmap { get; set; }
|
||||
private IBindable<WorkingBeatmap> gameBeatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
|
||||
@@ -20,7 +20,8 @@ namespace osu.Game.Screens.Multi.Match
|
||||
{
|
||||
public class MatchSubScreen : MultiplayerSubScreen
|
||||
{
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
protected override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
public override string Title => room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||
public override string ShortTitle => "room";
|
||||
|
||||
@@ -108,7 +109,10 @@ namespace osu.Game.Screens.Multi.Match
|
||||
},
|
||||
};
|
||||
|
||||
header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect { Selected = addPlaylistItem });
|
||||
header.OnRequestSelectBeatmap = () =>
|
||||
{
|
||||
Push(new MatchSongSelect { Selected = addPlaylistItem });
|
||||
};
|
||||
header.Tabs.Current.ValueChanged += t =>
|
||||
{
|
||||
const float fade_duration = 500;
|
||||
@@ -154,7 +158,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
// Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info
|
||||
var localBeatmap = beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == beatmap.OnlineBeatmapID);
|
||||
|
||||
game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
||||
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
||||
}
|
||||
|
||||
private void setRuleset(RulesetInfo ruleset)
|
||||
@@ -162,7 +166,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
if (ruleset == null)
|
||||
return;
|
||||
|
||||
game?.ForcefullySetRuleset(ruleset);
|
||||
Ruleset.Value = ruleset;
|
||||
}
|
||||
|
||||
private void beatmapAdded(BeatmapSetInfo model, bool existing, bool silent) => Schedule(() =>
|
||||
@@ -177,7 +181,7 @@ namespace osu.Game.Screens.Multi.Match
|
||||
var localBeatmap = beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == bindings.CurrentBeatmap.Value.OnlineBeatmapID);
|
||||
|
||||
if (localBeatmap != null)
|
||||
game?.ForcefullySetBeatmap(beatmapManager.GetWorkingBeatmap(localBeatmap));
|
||||
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
||||
});
|
||||
|
||||
private void addPlaylistItem(PlaylistItem item)
|
||||
|
||||
@@ -28,8 +28,6 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
private readonly MultiplayerWaveContainer waves;
|
||||
|
||||
public override bool AllowBeatmapRulesetChange => currentSubScreen?.AllowBeatmapRulesetChange ?? base.AllowBeatmapRulesetChange;
|
||||
|
||||
private readonly OsuButton createButton;
|
||||
private readonly LoungeSubScreen loungeSubScreen;
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace osu.Game.Screens.Multi.Ranking
|
||||
|
||||
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new IResultPageInfo[]
|
||||
{
|
||||
new ScoreOverviewPageInfo(Score, Beatmap),
|
||||
new LocalLeaderboardPageInfo(Score, Beatmap),
|
||||
new RoomLeaderboardPageInfo(Score, Beatmap, room),
|
||||
new ScoreOverviewPageInfo(Score, Beatmap.Value),
|
||||
new LocalLeaderboardPageInfo(Score, Beatmap.Value),
|
||||
new RoomLeaderboardPageInfo(Score, Beatmap.Value, room),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,28 +65,54 @@ namespace osu.Game.Screens
|
||||
|
||||
private OsuLogo logo;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
|
||||
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
|
||||
/// </summary>
|
||||
public virtual bool AllowBeatmapRulesetChange => true;
|
||||
|
||||
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
protected virtual float BackgroundParallaxAmount => 1;
|
||||
|
||||
private ParallaxContainer backgroundParallaxContainer;
|
||||
|
||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
protected IMutableBindable<WorkingBeatmap> Beatmap;
|
||||
|
||||
protected IMutableBindable<RulesetInfo> Ruleset;
|
||||
|
||||
/// <summary>
|
||||
/// Disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children).
|
||||
/// </summary>
|
||||
protected virtual bool DisallowExternalBeatmapRulesetChanges => false;
|
||||
|
||||
private SampleChannel sampleExit;
|
||||
private bool leaseOwner;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
if (DisallowExternalBeatmapRulesetChanges)
|
||||
{
|
||||
Beatmap = dependencies.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
|
||||
if (Beatmap == null)
|
||||
{
|
||||
leaseOwner = true;
|
||||
dependencies.Cache(Beatmap = dependencies.Get<LeasableBindable<WorkingBeatmap>>().BeginLease(true));
|
||||
}
|
||||
|
||||
Ruleset = dependencies.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
|
||||
if (Ruleset == null)
|
||||
{
|
||||
leaseOwner = true;
|
||||
dependencies.Cache(Ruleset = dependencies.Get<LeasableBindable<RulesetInfo>>().BeginLease(true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Beatmap = dependencies.Get<LeasableBindable<WorkingBeatmap>>().GetBoundCopy();
|
||||
Ruleset = dependencies.Get<LeasableBindable<RulesetInfo>>().GetBoundCopy();
|
||||
}
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BindableBeatmap beatmap, OsuGame osu, AudioManager audio, Bindable<RulesetInfo> ruleset)
|
||||
private void load(OsuGame osu, AudioManager audio)
|
||||
{
|
||||
Beatmap.BindTo(beatmap);
|
||||
Ruleset.BindTo(ruleset);
|
||||
|
||||
if (osu != null)
|
||||
{
|
||||
OverlayActivationMode.BindTo(osu.OverlayActivationMode);
|
||||
@@ -191,7 +217,17 @@ namespace osu.Game.Screens
|
||||
if (base.OnExiting(next))
|
||||
return true;
|
||||
|
||||
Beatmap.UnbindAll();
|
||||
if (leaseOwner)
|
||||
{
|
||||
((LeasedBindable<WorkingBeatmap>)Beatmap).Return();
|
||||
((LeasedBindable<RulesetInfo>)Ruleset).Return();
|
||||
}
|
||||
else
|
||||
{
|
||||
Beatmap.UnbindAll();
|
||||
Ruleset.UnbindAll();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play
|
||||
private bool hideOverlays;
|
||||
protected override bool HideOverlaysOnEnter => hideOverlays;
|
||||
|
||||
protected override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
private Task loadTask;
|
||||
|
||||
public PlayerLoader(Func<Player> createPlayer)
|
||||
|
||||
@@ -17,8 +17,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
|
||||
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
protected const float BACKGROUND_FADE_DURATION = 800;
|
||||
|
||||
protected float BackgroundOpacity => 1 - (float)DimLevel;
|
||||
|
||||
@@ -17,8 +17,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override IEnumerable<IResultPageInfo> CreateResultPages() => new IResultPageInfo[]
|
||||
{
|
||||
new ScoreOverviewPageInfo(Score, Beatmap),
|
||||
new LocalLeaderboardPageInfo(Score, Beatmap)
|
||||
new ScoreOverviewPageInfo(Score, Beatmap.Value),
|
||||
new LocalLeaderboardPageInfo(Score, Beatmap.Value)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
private ResultModeTabControl modeChangeButtons;
|
||||
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
protected override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
protected readonly ScoreInfo Score;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using Humanizer;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Multi;
|
||||
|
||||
@@ -33,5 +34,21 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnExiting(Screen next)
|
||||
{
|
||||
Beatmap.Disabled = true;
|
||||
Ruleset.Disabled = true;
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
|
||||
Beatmap.Disabled = false;
|
||||
Ruleset.Disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Animations;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
@@ -63,7 +64,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, TextureStore textureStore)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
|
||||
{
|
||||
var basePath = Animation.Path.ToLowerInvariant();
|
||||
for (var frame = 0; frame < Animation.FrameCount; frame++)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using System.IO;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
@@ -28,7 +29,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
||||
{
|
||||
// Try first with the full name, then attempt with no path
|
||||
channel = beatmap.Value.Skin.GetSample(sample.Path) ?? beatmap.Value.Skin.GetSample(Path.ChangeExtension(sample.Path, null));
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
@@ -62,7 +63,7 @@ namespace osu.Game.Storyboards.Drawables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IBindableBeatmap beatmap, TextureStore textureStore)
|
||||
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
|
||||
{
|
||||
var spritePath = Sprite.Path.ToLowerInvariant();
|
||||
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual
|
||||
beatmap.Default = new DummyWorkingBeatmap(Dependencies.Get<OsuGameBase>());
|
||||
|
||||
Dependencies.CacheAs<BindableBeatmap>(beatmap);
|
||||
Dependencies.CacheAs<IBindableBeatmap>(beatmap);
|
||||
Dependencies.CacheAs<IBindable<WorkingBeatmap>>(beatmap);
|
||||
|
||||
Dependencies.CacheAs(Ruleset);
|
||||
Dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.117.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="0.0.8033" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ParameterHidesMember/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ParameterOnlyUsedForPreconditionCheck_002EGlobal/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ParameterOnlyUsedForPreconditionCheck_002ELocal/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleInterfaceMemberAmbiguity/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleMultipleEnumeration/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PrivateVariableCanBeMadeReadonly/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PublicConstructorInAbstractClass/@EntryIndexedValue">WARNING</s:String>
|
||||
@@ -203,6 +204,7 @@
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HID/@EntryIndexedValue">HID</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HUD/@EntryIndexedValue">HUD</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IL/@EntryIndexedValue">IL</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPC/@EntryIndexedValue">IPC</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String>
|
||||
|
||||
Reference in New Issue
Block a user