1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 13:33:03 +08:00

Merge remote-tracking branch 'upstream/master' into fix-texture-loader-stores

This commit is contained in:
Dean Herbert 2019-01-25 20:23:51 +09:00
commit 0b587baab8
19 changed files with 109 additions and 49 deletions

1
.gitattributes vendored
View File

@ -15,6 +15,7 @@ App.config text eol=crlf
*.cmd text eol=crlf *.cmd text eol=crlf
*.snippet text eol=crlf *.snippet text eol=crlf
*.manifest text eol=crlf *.manifest text eol=crlf
*.licenseheader text eol=crlf
# Check out with lf (UNIX) line endings # Check out with lf (UNIX) line endings
*.sh text eol=lf *.sh text eol=lf

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
@ -21,14 +22,26 @@ namespace osu.Game.Rulesets.Mania
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var config = (ManiaConfigManager)Config;
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsEnumDropdown<ManiaScrollingDirection> new SettingsEnumDropdown<ManiaScrollingDirection>
{ {
LabelText = "Scrolling direction", LabelText = "Scrolling direction",
Bindable = ((ManiaConfigManager)Config).GetBindable<ManiaScrollingDirection>(ManiaSetting.ScrollDirection) Bindable = config.GetBindable<ManiaScrollingDirection>(ManiaSetting.ScrollDirection)
} },
new SettingsSlider<double, TimeSlider>
{
LabelText = "Scroll speed",
Bindable = config.GetBindable<double>(ManiaSetting.ScrollTime)
},
}; };
} }
private class TimeSlider : OsuSliderBar<double>
{
public override string TooltipText => Current.Value.ToString("N0") + "ms";
}
} }
} }

View File

@ -27,6 +27,11 @@ namespace osu.Game.Input
private readonly BindableBool isIdle = new BindableBool(); private readonly BindableBool isIdle = new BindableBool();
/// <summary>
/// Whether the game can currently enter an idle state.
/// </summary>
protected virtual bool AllowIdle => true;
/// <summary> /// <summary>
/// Intstantiate a new <see cref="IdleTracker"/>. /// Intstantiate a new <see cref="IdleTracker"/>.
/// </summary> /// </summary>
@ -40,7 +45,7 @@ namespace osu.Game.Input
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
isIdle.Value = TimeSpentIdle > timeToIdle; isIdle.Value = TimeSpentIdle > timeToIdle && AllowIdle;
} }
public bool OnPressed(PlatformAction action) => updateLastInteractionTime(); public bool OnPressed(PlatformAction action) => updateLastInteractionTime();

View File

@ -221,9 +221,7 @@ namespace osu.Game
return; return;
} }
var databasedSet = beatmap.OnlineBeatmapSetID != null ? var databasedSet = beatmap.OnlineBeatmapSetID != null ? BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID) : BeatmapManager.QueryBeatmapSet(s => s.Hash == beatmap.Hash);
BeatmapManager.QueryBeatmapSet(s => s.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID) :
BeatmapManager.QueryBeatmapSet(s => s.Hash == beatmap.Hash);
if (databasedSet != null) if (databasedSet != null)
{ {
@ -369,7 +367,7 @@ namespace osu.Game
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue }, floatingOverlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue },
idleTracker = new IdleTracker(6000) idleTracker = new GameIdleTracker(6000)
}); });
loadComponentSingleFile(screenStack = new Loader(), d => loadComponentSingleFile(screenStack = new Loader(), d =>
@ -437,7 +435,7 @@ namespace osu.Game
Depth = -8, Depth = -8,
}, floatingOverlayContent.Add); }, floatingOverlayContent.Add);
dependencies.Cache(idleTracker); dependencies.CacheAs(idleTracker);
dependencies.Cache(settings); dependencies.Cache(settings);
dependencies.Cache(onscreenDisplay); dependencies.Cache(onscreenDisplay);
dependencies.Cache(social); dependencies.Cache(social);
@ -518,6 +516,24 @@ namespace osu.Game
notifications.StateChanged += _ => updateScreenOffset(); notifications.StateChanged += _ => updateScreenOffset();
} }
public class GameIdleTracker : IdleTracker
{
private InputManager inputManager;
public GameIdleTracker(int time)
: base(time)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
inputManager = GetContainingInputManager();
}
protected override bool AllowIdle => inputManager.FocusedDrawable == null;
}
private void forwardLoggedErrorsToNotifications() private void forwardLoggedErrorsToNotifications()
{ {
int recentLogCount = 0; int recentLogCount = 0;

View File

@ -22,16 +22,12 @@ using osu.Game.Graphics.Containers;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods.Sections; using osu.Game.Overlays.Mods.Sections;
using osu.Game.Screens;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
public class ModSelectOverlay : WaveOverlayContainer public class ModSelectOverlay : WaveOverlayContainer
{ {
/// <summary>
/// How much this container should overflow the sides of the screen to account for parallax shifting.
/// </summary>
private const float overflow_padding = 50;
private const float content_width = 0.8f; private const float content_width = 0.8f;
protected Color4 LowMultiplierColour, HighMultiplierColour; protected Color4 LowMultiplierColour, HighMultiplierColour;
@ -203,11 +199,7 @@ namespace osu.Game.Overlays.Mods
Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e"); Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e");
Height = 510; Height = 510;
Padding = new MarginPadding Padding = new MarginPadding { Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING };
{
Left = -overflow_padding,
Right = -overflow_padding
};
Children = new Drawable[] Children = new Drawable[]
{ {
@ -267,11 +259,7 @@ namespace osu.Game.Overlays.Mods
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Width = content_width, Width = content_width,
Padding = new MarginPadding Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
{
Left = overflow_padding,
Right = overflow_padding
},
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
@ -312,8 +300,7 @@ namespace osu.Game.Overlays.Mods
Padding = new MarginPadding Padding = new MarginPadding
{ {
Vertical = 10, Vertical = 10,
Left = overflow_padding, Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
Right = overflow_padding
}, },
Child = ModSectionsContainer = new FillFlowContainer<ModSection> Child = ModSectionsContainer = new FillFlowContainer<ModSection>
{ {
@ -361,8 +348,7 @@ namespace osu.Game.Overlays.Mods
Padding = new MarginPadding Padding = new MarginPadding
{ {
Vertical = 15, Vertical = 15,
Left = overflow_padding, Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
Right = overflow_padding
}, },
Children = new Drawable[] Children = new Drawable[]
{ {

View File

@ -161,7 +161,7 @@ namespace osu.Game.Overlays
if (configManager == null) throw new ArgumentNullException(nameof(configManager)); if (configManager == null) throw new ArgumentNullException(nameof(configManager));
if (!trackedConfigManagers.TryGetValue((source, configManager), out var existing)) if (!trackedConfigManagers.TryGetValue((source, configManager), out var existing))
throw new InvalidOperationException($"{nameof(configManager)} is not registered."); return;
existing.Unload(); existing.Unload();
existing.SettingChanged -= display; existing.SettingChanged -= display;

View File

@ -28,6 +28,11 @@ namespace osu.Game.Overlays.SearchableList
protected abstract T DefaultTab { get; } protected abstract T DefaultTab { get; }
protected virtual Drawable CreateSupplementaryControls() => null; protected virtual Drawable CreateSupplementaryControls() => null;
/// <summary>
/// The amount of padding added to content (does not affect background or tab control strip).
/// </summary>
protected virtual float ContentHorizontalPadding => SearchableListOverlay.WIDTH_PADDING;
protected SearchableListFilterControl() protected SearchableListFilterControl()
{ {
if (!typeof(T).IsEnum) if (!typeof(T).IsEnum)
@ -62,7 +67,11 @@ namespace osu.Game.Overlays.SearchableList
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Top = padding, Horizontal = SearchableListOverlay.WIDTH_PADDING }, Padding = new MarginPadding
{
Top = padding,
Horizontal = ContentHorizontalPadding
},
Children = new Drawable[] Children = new Drawable[]
{ {
Search = new FilterSearchTextBox Search = new FilterSearchTextBox

View File

@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private class SensitivitySlider : OsuSliderBar<double> private class SensitivitySlider : OsuSliderBar<double>
{ {
public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x"); public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : $"{base.TooltipText}x";
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace osu.Game.Screens.Multi
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -13,6 +13,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components
protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42"); protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42");
protected override PrimaryFilter DefaultTab => PrimaryFilter.Open; protected override PrimaryFilter DefaultTab => PrimaryFilter.Open;
protected override float ContentHorizontalPadding => base.ContentHorizontalPadding + OsuScreen.HORIZONTAL_OVERFLOW_PADDING;
public FilterControl() public FilterControl()
{ {
DisplayStyleControl.Hide(); DisplayStyleControl.Hide();

View File

@ -91,8 +91,8 @@ namespace osu.Game.Screens.Multi.Lounge
content.Padding = new MarginPadding content.Padding = new MarginPadding
{ {
Top = Filter.DrawHeight, Top = Filter.DrawHeight,
Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH, Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH + HORIZONTAL_OVERFLOW_PADDING,
Right = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING + HORIZONTAL_OVERFLOW_PADDING,
}; };
} }

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Multi.Match.Components
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -41,7 +41,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING }, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer

View File

@ -79,7 +79,11 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
new ScrollContainer new ScrollContainer
{ {
Padding = new MarginPadding { Vertical = 10 }, Padding = new MarginPadding
{
Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
Vertical = 10
},
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {
@ -210,6 +214,7 @@ namespace osu.Game.Screens.Multi.Match.Components
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20), Spacing = new Vector2(0, 20),
Margin = new MarginPadding { Vertical = 20 }, Margin = new MarginPadding { Vertical = 20 },
Padding = new MarginPadding { Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[] Children = new Drawable[]
{ {
ApplyButton = new CreateRoomButton ApplyButton = new CreateRoomButton

View File

@ -75,13 +75,23 @@ namespace osu.Game.Screens.Multi.Match
{ {
leaderboard = new MatchLeaderboard leaderboard = new MatchLeaderboard
{ {
Padding = new MarginPadding(10), Padding = new MarginPadding
{
Left = 10 + HORIZONTAL_OVERFLOW_PADDING,
Right = 10,
Vertical = 10,
},
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Room = room Room = room
}, },
new Container new Container
{ {
Padding = new MarginPadding(10), Padding = new MarginPadding
{
Left = 10,
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
Vertical = 10,
},
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = chat = new MatchChatDisplay(room) Child = chat = new MatchChatDisplay(room)
{ {
@ -108,7 +118,12 @@ namespace osu.Game.Screens.Multi.Match
}, },
}; };
header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect { Selected = addPlaylistItem }); header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect
{
Selected = addPlaylistItem,
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }
});
header.Tabs.Current.ValueChanged += t => header.Tabs.Current.ValueChanged += t =>
{ {
const float fade_duration = 500; const float fade_duration = 500;

View File

@ -48,6 +48,8 @@ namespace osu.Game.Screens.Multi
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };
Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING };
waves.AddRange(new Drawable[] waves.AddRange(new Drawable[]
{ {
new Container new Container
@ -86,7 +88,7 @@ namespace osu.Game.Screens.Multi
Margin = new MarginPadding Margin = new MarginPadding
{ {
Top = 10, Top = 10,
Right = 10, Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
}, },
Text = "Create room", Text = "Create room",
Action = () => loungeSubScreen.Push(new Room Action = () => loungeSubScreen.Push(new Room

View File

@ -23,6 +23,12 @@ namespace osu.Game.Screens
{ {
public abstract class OsuScreen : Screen, IKeyBindingHandler<GlobalAction>, IHasDescription public abstract class OsuScreen : Screen, IKeyBindingHandler<GlobalAction>, IHasDescription
{ {
/// <summary>
/// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen.
/// This allows for the game content to be pushed byt he options/notification overlays without causing black areas to appear.
/// </summary>
public const float HORIZONTAL_OVERFLOW_PADDING = 50;
public BackgroundScreen Background { get; private set; } public BackgroundScreen Background { get; private set; }
/// <summary> /// <summary>

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2019.122.0" /> <PackageReference Include="ppy.osu.Framework" Version="2019.125.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" /> <PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />

View File

@ -1,9 +1,9 @@
extensions: .cs extensions: .cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
extensions: .xml .config .xsd extensions: .xml .config .xsd
<!-- <!--
Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
See the LICENCE file in the repository root for full licence text. See the LICENCE file in the repository root for full licence text.
--> -->