Skip to content

Commit 576acaa

Browse files
committed
Merge upstream master into external-deploy
1 parent fe35c02 commit 576acaa

34 files changed

+322
-200
lines changed

.gitmodules

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "osu-framework"]
2-
path = osu-framework
3-
url = https://github.com/ppy/osu-framework
41
[submodule "osu-resources"]
52
path = osu-resources
6-
url = https://github.com/ppy/osu-resources
3+
url = https://github.com/ppy/osu-resources

osu-framework

Lines changed: 0 additions & 1 deletion
This file was deleted.

osu.Desktop/Overlays/VersionManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using System.Diagnostics;
55
using osu.Framework.Allocation;
6-
using osu.Framework.Development;
76
using osu.Framework.Graphics;
87
using osu.Framework.Graphics.Containers;
98
using osu.Framework.Graphics.Sprites;
@@ -14,6 +13,7 @@
1413
using osu.Game.Graphics.Sprites;
1514
using osu.Game.Overlays;
1615
using osu.Game.Overlays.Notifications;
16+
using osu.Game.Utils;
1717
using OpenTK;
1818
using OpenTK.Graphics;
1919

osu.Desktop/osu.Desktop.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<StartupObject>osu.Desktop.Program</StartupObject>
2121
</PropertyGroup>
2222
<ItemGroup Label="Project References">
23-
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj" />
2423
<ProjectReference Include="..\osu.Game\osu.Game.csproj" />
2524
<ProjectReference Include="..\osu.Game.Rulesets.Osu\osu.Game.Rulesets.Osu.csproj" />
2625
<ProjectReference Include="..\osu.Game.Rulesets.Catch\osu.Game.Rulesets.Catch.csproj" />

osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,34 @@
77
using osu.Framework.Graphics;
88
using osu.Game.Rulesets.Mods;
99
using osu.Game.Rulesets.Objects.Drawables;
10+
using osu.Game.Rulesets.Osu.Objects.Drawables;
1011
using osu.Game.Rulesets.Objects.Types;
1112
using osu.Game.Rulesets.Osu.Objects;
12-
using osu.Game.Rulesets.Osu.Objects.Drawables;
1313

1414
namespace osu.Game.Rulesets.Osu.Mods
1515
{
16-
public class OsuModHidden : ModHidden, IApplicableToDrawableHitObjects
16+
public class OsuModHidden : ModHidden
1717
{
1818
public override string Description => @"Play with no approach circles and fading circles/sliders.";
1919
public override double ScoreMultiplier => 1.06;
20-
2120
private const double fade_in_duration_multiplier = 0.4;
2221
private const double fade_out_duration_multiplier = 0.3;
2322

24-
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
23+
public override void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
2524
{
25+
void adjustFadeIn(OsuHitObject h) => h.TimeFadein = h.TimePreempt * fade_in_duration_multiplier;
26+
2627
foreach (var d in drawables.OfType<DrawableOsuHitObject>())
2728
{
28-
d.ApplyCustomUpdateState += ApplyHiddenState;
29-
30-
d.HitObject.TimeFadein = d.HitObject.TimePreempt * fade_in_duration_multiplier;
29+
adjustFadeIn(d.HitObject);
3130
foreach (var h in d.HitObject.NestedHitObjects.OfType<OsuHitObject>())
32-
h.TimeFadein = h.TimePreempt * fade_in_duration_multiplier;
31+
adjustFadeIn(h);
3332
}
33+
34+
base.ApplyToDrawableHitObjects(drawables);
3435
}
3536

36-
protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
37+
protected override void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
3738
{
3839
if (!(drawable is DrawableOsuHitObject d))
3940
return;

osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ public void TestImportWhenFileOpen()
264264

265265
private string createTemporaryBeatmap()
266266
{
267-
var temp = new FileInfo(osz_path).CopyTo(Path.GetTempFileName(), true).FullName;
267+
var temp = Path.GetTempFileName() + ".osz";
268+
File.Copy(osz_path, temp, true);
268269
Assert.IsTrue(File.Exists(temp));
269270
return temp;
270271
}
@@ -344,12 +345,12 @@ private void ensureLoaded(OsuGameBase osu, int timeout = 60000)
344345

345346
private void waitForOrAssert(Func<bool> result, string failureMessage, int timeout = 60000)
346347
{
347-
Action waitAction = () =>
348+
Task task = Task.Run(() =>
348349
{
349350
while (!result()) Thread.Sleep(200);
350-
};
351+
});
351352

352-
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), failureMessage);
353+
Assert.IsTrue(task.Wait(timeout), failureMessage);
353354
}
354355
}
355356
}

osu.Game/Configuration/OsuConfigManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ protected override void InitialiseDefaults()
8282

8383
Set(OsuSetting.SpeedChangeVisualisation, SpeedChangeVisualisationMethod.Sequential);
8484

85+
Set(OsuSetting.IncreaseFirstObjectVisibility, true);
86+
8587
// Update
8688
Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
8789

@@ -144,6 +146,7 @@ public enum OsuSetting
144146
ScreenshotCaptureMenuCursor,
145147
SongSelectRightMouseScroll,
146148
BeatmapSkins,
147-
BeatmapHitsounds
149+
BeatmapHitsounds,
150+
IncreaseFirstObjectVisibility
148151
}
149152
}

osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using osu.Framework.Input;
99
using OpenTK;
1010
using osu.Framework.Configuration;
11+
using osu.Game.Overlays;
1112

1213
namespace osu.Game.Graphics.Containers
1314
{
@@ -16,13 +17,13 @@ public class OsuFocusedOverlayContainer : FocusedOverlayContainer
1617
private SampleChannel samplePopIn;
1718
private SampleChannel samplePopOut;
1819

19-
private readonly BindableBool allowOpeningOverlays = new BindableBool(true);
20+
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
2021

2122
[BackgroundDependencyLoader(true)]
2223
private void load(OsuGame osuGame, AudioManager audio)
2324
{
2425
if (osuGame != null)
25-
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
26+
OverlayActivationMode.BindTo(osuGame.OverlayActivationMode);
2627

2728
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
2829
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
@@ -52,20 +53,18 @@ protected override bool OnClick(InputState state)
5253

5354
private void onStateChanged(Visibility visibility)
5455
{
55-
if (allowOpeningOverlays)
56+
switch (visibility)
5657
{
57-
switch (visibility)
58-
{
59-
case Visibility.Visible:
58+
case Visibility.Visible:
59+
if (OverlayActivationMode != OverlayActivation.Disabled)
6060
samplePopIn?.Play();
61-
break;
62-
case Visibility.Hidden:
63-
samplePopOut?.Play();
64-
break;
65-
}
61+
else
62+
State = Visibility.Hidden;
63+
break;
64+
case Visibility.Hidden:
65+
samplePopOut?.Play();
66+
break;
6667
}
67-
else
68-
State = Visibility.Hidden;
6968
}
7069
}
7170
}

osu.Game/OsuGame.cs

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ private Intro intro
7777

7878
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
7979

80-
public readonly BindableBool HideOverlaysOnEnter = new BindableBool();
81-
public readonly BindableBool AllowOpeningOverlays = new BindableBool(true);
80+
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
8281

8382
private OsuScreen screenStack;
8483

@@ -94,6 +93,8 @@ private Intro intro
9493

9594
private SettingsOverlay settings;
9695

96+
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
97+
9798
// todo: move this to SongSelect once Screen has the ability to unsuspend.
9899
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
99100

@@ -106,6 +107,17 @@ public OsuGame(string[] args = null)
106107

107108
public void ToggleDirect() => direct.ToggleVisibility();
108109

110+
/// <summary>
111+
/// Close all game-wide overlays.
112+
/// </summary>
113+
/// <param name="toolbar">Whether the toolbar should also be hidden.</param>
114+
public void CloseAllOverlays(bool toolbar = true)
115+
{
116+
foreach (var o in overlays)
117+
o.State = Visibility.Hidden;
118+
if (toolbar) Toolbar.State = Visibility.Hidden;
119+
}
120+
109121
private DependencyContainer dependencies;
110122

111123
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) =>
@@ -251,7 +263,7 @@ protected override void LoadComplete()
251263
Depth = -5,
252264
OnHome = delegate
253265
{
254-
hideAllOverlays();
266+
CloseAllOverlays(false);
255267
intro?.ChildScreen?.MakeCurrent();
256268
},
257269
}, overlayContent.Add);
@@ -308,6 +320,8 @@ protected override void LoadComplete()
308320

309321
// ensure only one of these overlays are open at once.
310322
var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct };
323+
overlays.AddRange(singleDisplayOverlays);
324+
311325
foreach (var overlay in singleDisplayOverlays)
312326
{
313327
overlay.StateChanged += state =>
@@ -323,6 +337,8 @@ protected override void LoadComplete()
323337
}
324338

325339
var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications };
340+
overlays.AddRange(singleDisplaySideOverlays);
341+
326342
foreach (var overlay in singleDisplaySideOverlays)
327343
{
328344
overlay.StateChanged += state =>
@@ -339,6 +355,8 @@ protected override void LoadComplete()
339355

340356
// eventually informational overlays should be displayed in a stack, but for now let's only allow one to stay open at a time.
341357
var informationalOverlays = new OverlayContainer[] { beatmapSetOverlay, userProfile };
358+
overlays.AddRange(informationalOverlays);
359+
342360
foreach (var overlay in informationalOverlays)
343361
{
344362
overlay.StateChanged += state =>
@@ -353,6 +371,11 @@ protected override void LoadComplete()
353371
};
354372
}
355373

374+
OverlayActivationMode.ValueChanged += v =>
375+
{
376+
if (v != OverlayActivation.All) CloseAllOverlays();
377+
};
378+
356379
void updateScreenOffset()
357380
{
358381
float offset = 0;
@@ -367,21 +390,6 @@ void updateScreenOffset()
367390

368391
settings.StateChanged += _ => updateScreenOffset();
369392
notifications.StateChanged += _ => updateScreenOffset();
370-
371-
notifications.Enabled.BindTo(AllowOpeningOverlays);
372-
373-
HideOverlaysOnEnter.ValueChanged += hide =>
374-
{
375-
//central game screen change logic.
376-
if (hide)
377-
{
378-
hideAllOverlays();
379-
musicController.State = Visibility.Hidden;
380-
Toolbar.State = Visibility.Hidden;
381-
}
382-
else
383-
Toolbar.State = Visibility.Visible;
384-
};
385393
}
386394

387395
private void forwardLoggedErrorsToNotifications()
@@ -498,16 +506,6 @@ protected override void OnActivated()
498506
private OsuScreen currentScreen;
499507
private FrameworkConfigManager frameworkConfig;
500508

501-
private void hideAllOverlays()
502-
{
503-
settings.State = Visibility.Hidden;
504-
chat.State = Visibility.Hidden;
505-
direct.State = Visibility.Hidden;
506-
social.State = Visibility.Hidden;
507-
userProfile.State = Visibility.Hidden;
508-
notifications.State = Visibility.Hidden;
509-
}
510-
511509
protected override bool OnExiting()
512510
{
513511
if (screenStack.ChildScreen == null) return false;

osu.Game/OsuGameBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using osu.Framework.Allocation;
1111
using osu.Framework.Audio;
1212
using osu.Framework.Configuration;
13-
using osu.Framework.Development;
1413
using osu.Framework.Graphics;
1514
using osu.Framework.Graphics.Containers;
1615
using osu.Framework.IO.Stores;
@@ -31,6 +30,7 @@
3130
using osu.Game.Rulesets;
3231
using osu.Game.Rulesets.Scoring;
3332
using osu.Game.Skinning;
33+
using DebugUtils = osu.Game.Utils.DebugUtils;
3434

3535
namespace osu.Game
3636
{
@@ -59,8 +59,6 @@ public class OsuGameBase : Framework.Game, ICanAcceptFiles
5959

6060
protected MenuCursorContainer MenuCursorContainer;
6161

62-
protected override string MainResourceFile => @"osu.Game.Resources.dll";
63-
6462
private Container content;
6563

6664
protected override Container<Drawable> Content => content;
@@ -100,6 +98,8 @@ protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnl
10098
[BackgroundDependencyLoader]
10199
private void load()
102100
{
101+
Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll"));
102+
103103
dependencies.Cache(contextFactory = new DatabaseContextFactory(Host));
104104

105105
dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures"))));

0 commit comments

Comments
 (0)