mirror of
https://github.com/ppy/osu.git
synced 2026-05-29 03:19:54 +08:00
Merge branch 'master' into upgrade-packages
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.329.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.419.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Text;
|
||||
using DiscordRPC;
|
||||
using DiscordRPC.Message;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
@@ -80,14 +79,20 @@ namespace osu.Desktop
|
||||
client.OnReady += onReady;
|
||||
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network, LogLevel.Error);
|
||||
|
||||
// A URI scheme is required to support game invitations, as well as informing Discord of the game executable path to support launching the game when a user clicks on join/spectate.
|
||||
// The library doesn't properly support URI registration when ran from an app bundle on macOS.
|
||||
if (!RuntimeInfo.IsApple)
|
||||
try
|
||||
{
|
||||
client.RegisterUriScheme();
|
||||
client.Subscribe(EventType.Join);
|
||||
client.OnJoin += onJoin;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// This is known to fail in at least the following sandboxed environments:
|
||||
// - macOS (when packaged as an app bundle)
|
||||
// - flatpak (see: https://github.com/flathub/sh.ppy.osu/issues/170)
|
||||
// There is currently no better way to do this offered by Discord, so the best we can do is simply ignore it for now.
|
||||
Logger.Log($"Failed to register Discord URI scheme: {ex}");
|
||||
}
|
||||
|
||||
client.Initialize();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ using osu.Game.IPC;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Performance;
|
||||
using osu.Game.Utils;
|
||||
using SDL2;
|
||||
using SDL;
|
||||
|
||||
namespace osu.Desktop
|
||||
{
|
||||
@@ -161,7 +161,7 @@ namespace osu.Desktop
|
||||
host.Window.Title = Name;
|
||||
}
|
||||
|
||||
protected override BatteryInfo CreateBatteryInfo() => new SDL2BatteryInfo();
|
||||
protected override BatteryInfo CreateBatteryInfo() => new SDL3BatteryInfo();
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
@@ -170,13 +170,14 @@ namespace osu.Desktop
|
||||
archiveImportIPCChannel?.Dispose();
|
||||
}
|
||||
|
||||
private class SDL2BatteryInfo : BatteryInfo
|
||||
private unsafe class SDL3BatteryInfo : BatteryInfo
|
||||
{
|
||||
public override double? ChargeLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
SDL.SDL_GetPowerInfo(out _, out int percentage);
|
||||
int percentage;
|
||||
SDL3.SDL_GetPowerInfo(null, &percentage);
|
||||
|
||||
if (percentage == -1)
|
||||
return null;
|
||||
@@ -185,7 +186,7 @@ namespace osu.Desktop
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnBattery => SDL.SDL_GetPowerInfo(out _, out _) == SDL.SDL_PowerState.SDL_POWERSTATE_ON_BATTERY;
|
||||
public override bool OnBattery => SDL3.SDL_GetPowerInfo(null, null) == SDL_PowerState.SDL_POWERSTATE_ON_BATTERY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-11
@@ -13,7 +13,7 @@ using osu.Framework.Platform;
|
||||
using osu.Game;
|
||||
using osu.Game.IPC;
|
||||
using osu.Game.Tournament;
|
||||
using SDL2;
|
||||
using SDL;
|
||||
using Squirrel;
|
||||
|
||||
namespace osu.Desktop
|
||||
@@ -52,16 +52,19 @@ namespace osu.Desktop
|
||||
// See https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/
|
||||
if (windowsVersion.Major < 6 || (windowsVersion.Major == 6 && windowsVersion.Minor <= 2))
|
||||
{
|
||||
// If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider
|
||||
// disabling it ourselves.
|
||||
// We could also better detect compatibility mode if required:
|
||||
// https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730
|
||||
SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR,
|
||||
"Your operating system is too old to run osu!",
|
||||
"This version of osu! requires at least Windows 8.1 to run.\n"
|
||||
+ "Please upgrade your operating system or consider using an older version of osu!.\n\n"
|
||||
+ "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!", IntPtr.Zero);
|
||||
return;
|
||||
unsafe
|
||||
{
|
||||
// If users running in compatibility mode becomes more of a common thing, we may want to provide better guidance or even consider
|
||||
// disabling it ourselves.
|
||||
// We could also better detect compatibility mode if required:
|
||||
// https://stackoverflow.com/questions/10744651/how-i-can-detect-if-my-application-is-running-under-compatibility-mode#comment58183249_10744730
|
||||
SDL3.SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR,
|
||||
"Your operating system is too old to run osu!"u8,
|
||||
"This version of osu! requires at least Windows 8.1 to run.\n"u8
|
||||
+ "Please upgrade your operating system or consider using an older version of osu!.\n\n"u8
|
||||
+ "If you are running a newer version of windows, please check you don't have \"Compatibility mode\" turned on for osu!"u8, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setupSquirrel();
|
||||
|
||||
@@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Catch
|
||||
: base(component)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string RulesetPrefix => "catch"; // todo: use CatchRuleset.SHORT_NAME;
|
||||
|
||||
protected override string ComponentName => Component.ToString().ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,6 @@ namespace osu.Game.Rulesets.Mania
|
||||
: base(component)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string RulesetPrefix => ManiaRuleset.SHORT_NAME;
|
||||
|
||||
protected override string ComponentName => Component.ToString().ToLowerInvariant();
|
||||
}
|
||||
|
||||
public enum ManiaSkinComponents
|
||||
|
||||
@@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Osu
|
||||
: base(component)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string RulesetPrefix => OsuRuleset.SHORT_NAME;
|
||||
|
||||
protected override string ComponentName => Component.ToString().ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,5 @@ namespace osu.Game.Rulesets.Taiko
|
||||
: base(component)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string RulesetPrefix => TaikoRuleset.SHORT_NAME;
|
||||
|
||||
protected override string ComponentName => Component.ToString().ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,6 +612,23 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("search text box unfocused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSearchBoxFocusToggleRespondsToExternalChanges()
|
||||
{
|
||||
AddStep("text search does not start active", () => configManager.SetValue(OsuSetting.ModSelectTextSearchStartsActive, false));
|
||||
createScreen();
|
||||
|
||||
AddUntilStep("search text box not focused", () => !modSelectOverlay.SearchTextBox.HasFocus);
|
||||
|
||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||
|
||||
AddStep("unfocus search text box externally", () => InputManager.ChangeFocus(null));
|
||||
|
||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTextSearchDoesNotBlockCustomisationPanelKeyboardInteractions()
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@ using System.Linq;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@@ -143,13 +145,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
FadeUnhovered();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
if (accentColour == default)
|
||||
AccentColour = colours.Blue;
|
||||
}
|
||||
|
||||
public OsuTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
@@ -196,10 +191,21 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
},
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
};
|
||||
}
|
||||
|
||||
private Sample selectSample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
if (accentColour == default)
|
||||
AccentColour = colours.Blue;
|
||||
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected override void OnActivated()
|
||||
{
|
||||
Text.Font = Text.Font.With(weight: FontWeight.Bold);
|
||||
@@ -211,6 +217,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
||||
FadeUnhovered();
|
||||
}
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ using System;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -53,6 +55,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
private Sample selectSample = null!;
|
||||
|
||||
public PageTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
@@ -78,12 +82,18 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
},
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
};
|
||||
|
||||
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected virtual LocalisableString CreateText() => (Value as Enum)?.GetLocalisableDescription() ?? Value.ToString();
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
@@ -112,6 +122,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override void OnActivated() => slideActive();
|
||||
|
||||
protected override void OnDeactivated() => slideInactive();
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -47,13 +49,15 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; }
|
||||
|
||||
private Sample selectSample = null!;
|
||||
|
||||
public TabItem(BeatmapCardSize value)
|
||||
: base(value)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
@@ -79,8 +83,10 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
Icon = getIconForCardSize(Value)
|
||||
}
|
||||
},
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
};
|
||||
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
private static IconUsage getIconForCardSize(BeatmapCardSize cardSize)
|
||||
@@ -111,6 +117,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
updateState();
|
||||
}
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
|
||||
protected override void OnDeactivated()
|
||||
{
|
||||
if (IsLoaded)
|
||||
|
||||
@@ -128,7 +128,11 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
base.OnClick(e);
|
||||
|
||||
// this tab item implementation is not managed by a TabControl,
|
||||
// therefore we have to manually update Active state and play select sound when this tab item is clicked.
|
||||
Active.Toggle();
|
||||
SelectSample.Play();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@@ -24,13 +26,15 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
|
||||
private OsuSpriteText text;
|
||||
|
||||
protected Sample SelectSample { get; private set; } = null!;
|
||||
|
||||
public FilterTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
AddRangeInternal(new Drawable[]
|
||||
@@ -40,10 +44,12 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular),
|
||||
Text = LabelFor(Value)
|
||||
},
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
});
|
||||
|
||||
Enabled.Value = true;
|
||||
|
||||
SelectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@@ -71,6 +77,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
|
||||
protected override void OnDeactivated() => UpdateState();
|
||||
|
||||
protected override void OnActivatedByUser() => SelectSample.Play();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the label text to be used for the supplied <paramref name="value"/>.
|
||||
/// </summary>
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
// propagate value to tab items first to enable only available rulesets.
|
||||
beatmapSet.Value = value;
|
||||
|
||||
SelectTab(TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value));
|
||||
Current.Value = TabContainer.TabItems.FirstOrDefault(t => t.Enabled.Value)?.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,8 +143,6 @@ namespace osu.Game.Overlays.Mods
|
||||
protected ShearedToggleButton? CustomisationButton { get; private set; }
|
||||
protected SelectAllModsButton? SelectAllModsButton { get; set; }
|
||||
|
||||
private bool textBoxShouldFocus;
|
||||
|
||||
private Sample? columnAppearSample;
|
||||
|
||||
private WorkingBeatmap? beatmap;
|
||||
@@ -542,7 +540,7 @@ namespace osu.Game.Overlays.Mods
|
||||
if (customisationVisible.Value)
|
||||
SearchTextBox.KillFocus();
|
||||
else
|
||||
setTextBoxFocus(textBoxShouldFocus);
|
||||
setTextBoxFocus(textSearchStartsActive.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -798,15 +796,13 @@ namespace osu.Game.Overlays.Mods
|
||||
return false;
|
||||
|
||||
// TODO: should probably eventually support typical platform search shortcuts (`Ctrl-F`, `/`)
|
||||
setTextBoxFocus(!textBoxShouldFocus);
|
||||
setTextBoxFocus(!SearchTextBox.HasFocus);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setTextBoxFocus(bool keepFocus)
|
||||
private void setTextBoxFocus(bool focus)
|
||||
{
|
||||
textBoxShouldFocus = keepFocus;
|
||||
|
||||
if (textBoxShouldFocus)
|
||||
if (focus)
|
||||
SearchTextBox.TakeFocus();
|
||||
else
|
||||
SearchTextBox.KillFocus();
|
||||
|
||||
@@ -11,6 +11,8 @@ using osuTK;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Localisation;
|
||||
@@ -65,6 +67,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
private readonly SpriteIcon icon;
|
||||
|
||||
private Sample selectSample = null!;
|
||||
|
||||
public PanelDisplayTabItem(OverlayPanelDisplayStyle value)
|
||||
: base(value)
|
||||
{
|
||||
@@ -78,14 +82,22 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit
|
||||
},
|
||||
new HoverClickSounds()
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected override void OnActivated() => updateState();
|
||||
|
||||
protected override void OnDeactivated() => updateState();
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
updateState();
|
||||
|
||||
@@ -10,6 +10,8 @@ using osu.Game.Rulesets;
|
||||
using osuTK.Graphics;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@@ -39,6 +41,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
public LocalisableString TooltipText => Value.Name;
|
||||
|
||||
private Sample selectSample = null!;
|
||||
|
||||
public OverlayRulesetTabItem(RulesetInfo value)
|
||||
: base(value)
|
||||
{
|
||||
@@ -59,12 +63,18 @@ namespace osu.Game.Overlays
|
||||
Icon = value.CreateInstance().CreateIcon(),
|
||||
},
|
||||
},
|
||||
new HoverClickSounds()
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
});
|
||||
|
||||
Enabled.Value = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@@ -90,6 +100,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override void OnDeactivated() => updateState();
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
AccentColour = Enabled.Value ? getActiveColour() : colourProvider.Foreground1;
|
||||
|
||||
@@ -11,6 +11,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
@@ -49,8 +51,10 @@ namespace osu.Game.Overlays
|
||||
Margin = new MarginPadding(PADDING);
|
||||
}
|
||||
|
||||
private Sample selectSample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider, OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider, OsuColour colours, AudioManager audio)
|
||||
{
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
@@ -87,9 +91,11 @@ namespace osu.Game.Overlays
|
||||
CollapsedSize = 2,
|
||||
Expanded = true
|
||||
},
|
||||
new HoverClickSounds()
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
});
|
||||
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
|
||||
SelectedItem.BindValueChanged(_ => updateState(), true);
|
||||
}
|
||||
|
||||
@@ -105,6 +111,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override void OnDeactivated() => updateState();
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
updateState();
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@@ -80,6 +82,8 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
private Sample selectSample = null!;
|
||||
|
||||
public OverlayTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
@@ -101,10 +105,16 @@ namespace osu.Game.Overlays
|
||||
ExpandedSize = 5f,
|
||||
CollapsedSize = 0
|
||||
},
|
||||
new HoverClickSounds(HoverSampleSet.TabSelect)
|
||||
new HoverSounds(HoverSampleSet.TabSelect)
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
base.OnHover(e);
|
||||
@@ -136,6 +146,8 @@ namespace osu.Game.Overlays
|
||||
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
||||
}
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
if (Active.Value)
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -24,8 +21,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
protected Drawable ModeButtonLine { get; private set; }
|
||||
|
||||
private readonly Dictionary<string, Sample> selectionSamples = new Dictionary<string, Sample>();
|
||||
|
||||
public ToolbarRulesetSelector()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
@@ -33,7 +28,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private void load()
|
||||
{
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
@@ -59,9 +54,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
foreach (var ruleset in Rulesets.AvailableRulesets)
|
||||
selectionSamples[ruleset.ShortName] = audio.Samples.Get($"UI/ruleset-select-{ruleset.ShortName}");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@@ -88,10 +80,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
if (SelectedTab != null)
|
||||
{
|
||||
ModeButtonLine.MoveToX(SelectedTab.DrawPosition.X, !hasInitialPosition ? 0 : 500, Easing.OutElasticQuarter);
|
||||
|
||||
if (hasInitialPosition)
|
||||
selectionSamples[SelectedTab.Value.ShortName]?.Play();
|
||||
|
||||
hasInitialPosition = true;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +109,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
RulesetInfo found = Rulesets.AvailableRulesets.ElementAtOrDefault(requested);
|
||||
if (found != null)
|
||||
Current.Value = found;
|
||||
SelectItem(found);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@@ -17,6 +19,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
private readonly RulesetButton ruleset;
|
||||
|
||||
private Sample? selectSample;
|
||||
|
||||
public ToolbarRulesetTabButton(RulesetInfo value)
|
||||
: base(value)
|
||||
{
|
||||
@@ -34,10 +38,18 @@ namespace osu.Game.Overlays.Toolbar
|
||||
ruleset.SetIcon(rInstance.CreateIcon());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
selectSample = audio.Samples.Get($@"UI/ruleset-select-{Value.ShortName}");
|
||||
}
|
||||
|
||||
protected override void OnActivated() => ruleset.Active = true;
|
||||
|
||||
protected override void OnDeactivated() => ruleset.Active = false;
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample?.Play();
|
||||
|
||||
private partial class RulesetButton : ToolbarButton
|
||||
{
|
||||
protected override HoverSounds CreateHoverSounds(HoverSampleSet sampleSet) => new HoverSounds();
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace osu.Game.Screens.Edit
|
||||
}
|
||||
}
|
||||
},
|
||||
new EditorScreenSwitcherControl
|
||||
screenSwitcher = new EditorScreenSwitcherControl
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
@@ -662,23 +662,23 @@ namespace osu.Game.Screens.Edit
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorComposeMode:
|
||||
Mode.Value = EditorScreenMode.Compose;
|
||||
screenSwitcher.SelectItem(EditorScreenMode.Compose);
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorDesignMode:
|
||||
Mode.Value = EditorScreenMode.Design;
|
||||
screenSwitcher.SelectItem(EditorScreenMode.Design);
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorTimingMode:
|
||||
Mode.Value = EditorScreenMode.Timing;
|
||||
screenSwitcher.SelectItem(EditorScreenMode.Timing);
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorSetupMode:
|
||||
Mode.Value = EditorScreenMode.SongSetup;
|
||||
screenSwitcher.SelectItem(EditorScreenMode.SongSetup);
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorVerifyMode:
|
||||
Mode.Value = EditorScreenMode.Verify;
|
||||
screenSwitcher.SelectItem(EditorScreenMode.Verify);
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorTestGameplay:
|
||||
@@ -959,6 +959,8 @@ namespace osu.Game.Screens.Edit
|
||||
[CanBeNull]
|
||||
private ScheduledDelegate playbackDisabledDebounce;
|
||||
|
||||
private EditorScreenSwitcherControl screenSwitcher;
|
||||
|
||||
private void updateSampleDisabledState()
|
||||
{
|
||||
bool shouldDisableSamples = clock.SeekingOrStopped.Value
|
||||
|
||||
@@ -30,6 +30,10 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
protected readonly FillFlowContainer<RowBackground> BackgroundFlow;
|
||||
|
||||
// We can avoid potentially thousands of objects being added to the input sub-tree since item selection is being handled by the BackgroundFlow
|
||||
// and no items in the underlying table are clickable.
|
||||
protected override bool ShouldBeConsideredForInput(Drawable child) => child == BackgroundFlow && base.ShouldBeConsideredForInput(child);
|
||||
|
||||
protected EditorTable()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@@ -78,14 +80,17 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||
},
|
||||
},
|
||||
},
|
||||
new HoverClickSounds(),
|
||||
new HoverSounds(HoverSampleSet.TabSelect),
|
||||
};
|
||||
}
|
||||
|
||||
private Sample selectSample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
selection.Colour = colours.Yellow;
|
||||
selectSample = audio.Samples.Get(@"UI/tabselect-select");
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
@@ -109,6 +114,8 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
|
||||
{
|
||||
selection.FadeOut(transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void OnActivatedByUser() => selectSample.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +390,15 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.QuickExit:
|
||||
if (this.IsCurrentScreen())
|
||||
{
|
||||
this.Exit();
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GlobalAction.Select:
|
||||
StatisticsPanel.ToggleVisibility();
|
||||
return true;
|
||||
|
||||
@@ -24,8 +24,5 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
Component = component;
|
||||
}
|
||||
|
||||
protected virtual string RulesetPrefix => string.Empty;
|
||||
protected virtual string ComponentName => Component.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,6 @@ namespace osu.Game.Skinning
|
||||
/// </summary>
|
||||
void Reload();
|
||||
|
||||
/// <summary>
|
||||
/// Reload this target from the provided skinnable information.
|
||||
/// </summary>
|
||||
void Reload(SerialisedDrawableInfo[] skinnableInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Add a new skinnable component to this target.
|
||||
/// </summary>
|
||||
|
||||
@@ -34,15 +34,15 @@ namespace osu.Game.Skinning
|
||||
|
||||
public float Rotation { get; set; }
|
||||
|
||||
public Vector2 Scale { get; set; }
|
||||
public Vector2 Scale { get; set; } = Vector2.One;
|
||||
|
||||
public float? Width { get; set; }
|
||||
|
||||
public float? Height { get; set; }
|
||||
|
||||
public Anchor Anchor { get; set; }
|
||||
public Anchor Anchor { get; set; } = Anchor.TopLeft;
|
||||
|
||||
public Anchor Origin { get; set; }
|
||||
public Anchor Origin { get; set; } = Anchor.TopLeft;
|
||||
|
||||
/// <inheritdoc cref="ISerialisableDrawable.UsesFixedAnchor"/>
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using osu.Framework.Bindables;
|
||||
@@ -44,20 +43,6 @@ namespace osu.Game.Skinning
|
||||
Lookup = lookup;
|
||||
}
|
||||
|
||||
public void Reload(SerialisedDrawableInfo[] skinnableInfo)
|
||||
{
|
||||
var drawables = new List<Drawable>();
|
||||
|
||||
foreach (var i in skinnableInfo)
|
||||
drawables.Add(i.CreateInstance());
|
||||
|
||||
Reload(new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = drawables,
|
||||
});
|
||||
}
|
||||
|
||||
public void Reload() => Reload(CurrentSkin.GetDrawableComponent(Lookup) as Container);
|
||||
|
||||
public void Reload(Container? componentsContainer)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="12.0.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.329.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.419.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.410.0" />
|
||||
<PackageReference Include="Sentry" Version="4.4.0" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
|
||||
+1
-1
@@ -23,6 +23,6 @@
|
||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.329.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.419.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user