mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
Merge branch 'master' into beatmap-mod-selector
This commit is contained in:
11
osu.Game/Configuration/BackgroundSource.cs
Normal file
11
osu.Game/Configuration/BackgroundSource.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Configuration
|
||||||
|
{
|
||||||
|
public enum BackgroundSource
|
||||||
|
{
|
||||||
|
Skin,
|
||||||
|
Beatmap
|
||||||
|
}
|
||||||
|
}
|
@ -117,6 +117,8 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
|
Set(OsuSetting.UIHoldActivationDelay, 200f, 0f, 500f, 50f);
|
||||||
|
|
||||||
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
||||||
|
|
||||||
|
Set(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsuConfigManager(Storage storage)
|
public OsuConfigManager(Storage storage)
|
||||||
@ -186,6 +188,7 @@ namespace osu.Game.Configuration
|
|||||||
UIScale,
|
UIScale,
|
||||||
IntroSequence,
|
IntroSequence,
|
||||||
UIHoldActivationDelay,
|
UIHoldActivationDelay,
|
||||||
HitLighting
|
HitLighting,
|
||||||
|
MenuBackgroundSource
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
osu.Game/Graphics/Backgrounds/BeatmapBackground.cs
Normal file
28
osu.Game/Graphics/Backgrounds/BeatmapBackground.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.Backgrounds
|
||||||
|
{
|
||||||
|
public class BeatmapBackground : Background
|
||||||
|
{
|
||||||
|
public readonly WorkingBeatmap Beatmap;
|
||||||
|
|
||||||
|
private readonly string fallbackTextureName;
|
||||||
|
|
||||||
|
public BeatmapBackground(WorkingBeatmap beatmap, string fallbackTextureName = @"Backgrounds/bg1")
|
||||||
|
{
|
||||||
|
Beatmap = beatmap;
|
||||||
|
this.fallbackTextureName = fallbackTextureName;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
Sprite.Texture = Beatmap?.Background ?? textures.Get(fallbackTextureName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
|
|||||||
Bindable = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
Bindable = config.GetBindable<IntroSequence>(OsuSetting.IntroSequence),
|
||||||
Items = Enum.GetValues(typeof(IntroSequence)).Cast<IntroSequence>()
|
Items = Enum.GetValues(typeof(IntroSequence)).Cast<IntroSequence>()
|
||||||
},
|
},
|
||||||
|
new SettingsDropdown<BackgroundSource>
|
||||||
|
{
|
||||||
|
LabelText = "Background source",
|
||||||
|
Bindable = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource),
|
||||||
|
Items = Enum.GetValues(typeof(BackgroundSource)).Cast<BackgroundSource>()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ using System.Threading;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
@ -107,22 +106,6 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap;
|
return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class BeatmapBackground : Background
|
|
||||||
{
|
|
||||||
public readonly WorkingBeatmap Beatmap;
|
|
||||||
|
|
||||||
public BeatmapBackground(WorkingBeatmap beatmap)
|
|
||||||
{
|
|
||||||
Beatmap = beatmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
Sprite.Texture = Beatmap?.Background ?? textures.Get(@"Backgrounds/bg1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DimmableBackground : UserDimContainer
|
public class DimmableBackground : UserDimContainer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -6,6 +6,8 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -24,6 +26,10 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
private Bindable<User> user;
|
private Bindable<User> user;
|
||||||
private Bindable<Skin> skin;
|
private Bindable<Skin> skin;
|
||||||
|
private Bindable<BackgroundSource> mode;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
|
|
||||||
public BackgroundScreenDefault(bool animateOnEnter = true)
|
public BackgroundScreenDefault(bool animateOnEnter = true)
|
||||||
: base(animateOnEnter)
|
: base(animateOnEnter)
|
||||||
@ -31,13 +37,16 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api, SkinManager skinManager)
|
private void load(IAPIProvider api, SkinManager skinManager, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
user = api.LocalUser.GetBoundCopy();
|
user = api.LocalUser.GetBoundCopy();
|
||||||
skin = skinManager.CurrentSkin.GetBoundCopy();
|
skin = skinManager.CurrentSkin.GetBoundCopy();
|
||||||
|
mode = config.GetBindable<BackgroundSource>(OsuSetting.MenuBackgroundSource);
|
||||||
|
|
||||||
user.ValueChanged += _ => Next();
|
user.ValueChanged += _ => Next();
|
||||||
skin.ValueChanged += _ => Next();
|
skin.ValueChanged += _ => Next();
|
||||||
|
mode.ValueChanged += _ => Next();
|
||||||
|
beatmap.ValueChanged += _ => Next();
|
||||||
|
|
||||||
currentDisplay = RNG.Next(0, background_count);
|
currentDisplay = RNG.Next(0, background_count);
|
||||||
|
|
||||||
@ -66,7 +75,18 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
Background newBackground;
|
Background newBackground;
|
||||||
|
|
||||||
if (user.Value?.IsSupporter ?? false)
|
if (user.Value?.IsSupporter ?? false)
|
||||||
newBackground = new SkinnedBackground(skin.Value, backgroundName);
|
{
|
||||||
|
switch (mode.Value)
|
||||||
|
{
|
||||||
|
case BackgroundSource.Beatmap:
|
||||||
|
newBackground = new BeatmapBackground(beatmap.Value, backgroundName);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
newBackground = new SkinnedBackground(skin.Value, backgroundName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
newBackground = new Background(backgroundName);
|
newBackground = new Background(backgroundName);
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -170,8 +169,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
track.Start();
|
track.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.ValueChanged += beatmap_ValueChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool exitConfirmed;
|
private bool exitConfirmed;
|
||||||
@ -220,14 +217,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
seq.OnAbort(_ => buttons.SetOsuLogo(null));
|
seq.OnAbort(_ => buttons.SetOsuLogo(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmap_ValueChanged(ValueChangedEvent<WorkingBeatmap> e)
|
|
||||||
{
|
|
||||||
if (!this.IsCurrentScreen())
|
|
||||||
return;
|
|
||||||
|
|
||||||
((BackgroundScreenDefault)Background).Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
public override void OnSuspending(IScreen next)
|
||||||
{
|
{
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
|
Reference in New Issue
Block a user