1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 09:49:53 +08:00

Compare commits

...

19 Commits

40 changed files with 185 additions and 136 deletions
+56 -11
View File
@@ -11,25 +11,70 @@ We are accepting bug reports (please report with as much detail as possible). Fe
# Requirements
- A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed.
- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio Code](https://code.visualstudio.com/) (with the C# plugin installed) or [Jetbrains Rider](https://www.jetbrains.com/rider/) (commercial).
- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio 2017+](https://visualstudio.microsoft.com/vs/), [Jetbrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/).
# Building and running
# Running osu!
If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled (download and run the install executable for your platform).
## Releases
Clone the repository including submodules
If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled.
`git clone --recurse-submodules https://github.com/ppy/osu`
- Windows (x64) users should download and run `install.exe`.
- macOS users (10.12 "Sierra" and higher) should download and run `osu.app.zip`.
- iOS users can join the [TestFlight beta program](https://t.co/xQJmHkfC18).
Build and run
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included)
- From command line using `dotnet run --project osu.Desktop`. When building for non-development purposes, add `-c Release` to gain higher performance.
- To run with code analysis, instead use `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice.
## Downloading the source code
Note: If you run from command line under linux, you will need to prefix the output folder to your `LD_LIBRARY_PATH`. See `.vscode/launch.json` for an example
Clone the repository **including submodules**:
If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build.
```shell
git clone --recurse-submodules https://github.com/ppy/osu
cd osu
```
> If you forgot the `--recurse-submodules` option, run this command inside the `osu` directory:
>
> `git submodule update --init --recursive`
To update the source code to the latest commit, run the following command inside the `osu` directory:
```shell
git pull --recurse-submodules
```
## Building
Build configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `VisualTests` project/configuration. More information on this provided below.
> Visual Studio Code users must run the `Restore` task before any build attempt.
You can also build and run osu! from the command-line with a single command:
```shell
dotnet run --project osu.Desktop
```
If you are not interested in debugging osu!, you can add `-c Release` to gain performance. In this case, you must replace `Debug` with `Release` in any commands mentioned in this document.
If the build fails, try to restore nuget packages with `dotnet restore`.
### A note for Linux users
On Linux, the environment variable `LD_LIBRARY_PATH` must point to the build directory, located at `osu.Desktop/bin/Debug/$NETCORE_VERSION`.
`$NETCORE_VERSION` is the version of .NET Core SDK. You can have it with `grep TargetFramework osu.Desktop/osu.Desktop.csproj | sed -r 's/.*>(.*)<\/.*/\1/'`.
For example, you can run osu! with the following command:
```shell
LD_LIBRARY_PATH="$(pwd)/osu.Desktop/bin/Debug/netcoreapp2.2" dotnet run --project osu.Desktop
```
## Code analysis
Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternative, you can install resharper or use rider to get inline support in your IDE of choice.
# Contributing
@@ -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
+2 -5
View File
@@ -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.
-19
View File
@@ -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
View File
@@ -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;
+8 -5
View File
@@ -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();
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+2 -1
View File
@@ -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;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace osu.Game.Screens.Edit
}
[BackgroundDependencyLoader]
private void load(IBindableBeatmap beatmap)
private void load(IBindable<WorkingBeatmap> beatmap)
{
Beatmap.BindTo(beatmap);
}
+2 -6
View File
@@ -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();
+2 -3
View File
@@ -3,7 +3,6 @@
using osuTK;
using osuTK.Graphics;
using osuTK.Graphics.ES30;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Batches;
@@ -75,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);
@@ -150,7 +149,7 @@ namespace osu.Game.Screens.Menu
private class VisualiserSharedData
{
public readonly LinearBatch<TexturedVertex2D> VertexBatch = new LinearBatch<TexturedVertex2D>(100 * 4, 10, PrimitiveType.Quads);
public readonly QuadBatch<TexturedVertex2D> VertexBatch = new QuadBatch<TexturedVertex2D>(100, 10);
}
private class VisualisationDrawNode : DrawNode
+1 -1
View File
@@ -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)
-2
View File
@@ -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),
};
}
}
+50 -14
View File
@@ -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;
}
+2
View File
@@ -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;
+2 -2
View File
@@ -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)
};
}
}
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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" />
+2
View File
@@ -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>