mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 16:43:20 +08:00
Merge pull request #5879 from peppy/add-legacy-default
Add "osu!classic" as a bundled skin choice
This commit is contained in:
commit
03ce8da5dd
@ -60,7 +60,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.823.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.830.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.828.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.830.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
// UI/selection defaults
|
// UI/selection defaults
|
||||||
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
|
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
|
||||||
Set(OsuSetting.Skin, 0, 0, int.MaxValue);
|
Set(OsuSetting.Skin, 0, -1, int.MaxValue);
|
||||||
|
|
||||||
Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details);
|
Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details);
|
||||||
|
|
||||||
|
@ -182,7 +182,26 @@ namespace osu.Game
|
|||||||
// bind config int to database SkinInfo
|
// bind config int to database SkinInfo
|
||||||
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
|
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
|
||||||
SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
|
SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
|
||||||
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
|
configSkin.ValueChanged += skinId =>
|
||||||
|
{
|
||||||
|
var skinInfo = SkinManager.Query(s => s.ID == skinId.NewValue);
|
||||||
|
|
||||||
|
if (skinInfo == null)
|
||||||
|
{
|
||||||
|
switch (skinId.NewValue)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
skinInfo = DefaultLegacySkin.Info;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
skinInfo = SkinInfo.Default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SkinManager.CurrentSkinInfo.Value = skinInfo;
|
||||||
|
};
|
||||||
configSkin.TriggerChange();
|
configSkin.TriggerChange();
|
||||||
|
|
||||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
runMigrations();
|
runMigrations();
|
||||||
|
|
||||||
dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio));
|
dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy")));
|
||||||
dependencies.CacheAs<ISkinSource>(SkinManager);
|
dependencies.CacheAs<ISkinSource>(SkinManager);
|
||||||
|
|
||||||
API = new APIAccess(LocalConfig);
|
API = new APIAccess(LocalConfig);
|
||||||
|
23
osu.Game/Skinning/DefaultLegacySkin.cs
Normal file
23
osu.Game/Skinning/DefaultLegacySkin.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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.Audio;
|
||||||
|
using osu.Framework.IO.Stores;
|
||||||
|
|
||||||
|
namespace osu.Game.Skinning
|
||||||
|
{
|
||||||
|
public class DefaultLegacySkin : LegacySkin
|
||||||
|
{
|
||||||
|
public DefaultLegacySkin(IResourceStore<byte[]> storage, AudioManager audioManager)
|
||||||
|
: base(Info, storage, audioManager, string.Empty)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SkinInfo Info { get; } = new SkinInfo
|
||||||
|
{
|
||||||
|
ID = -1, // this is temporary until database storage is decided upon.
|
||||||
|
Name = "osu!classic",
|
||||||
|
Creator = "team osu!"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -248,6 +248,9 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
private string getPathForFile(string filename)
|
private string getPathForFile(string filename)
|
||||||
{
|
{
|
||||||
|
if (source.Files == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
bool hasExtension = filename.Contains('.');
|
bool hasExtension = filename.Contains('.');
|
||||||
|
|
||||||
var file = source.Files.Find(f =>
|
var file = source.Files.Find(f =>
|
||||||
|
@ -26,7 +26,11 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public string FullName => $"\"{Name}\" by {Creator}";
|
public string FullName => $"\"{Name}\" by {Creator}";
|
||||||
|
|
||||||
public static SkinInfo Default { get; } = new SkinInfo { Name = "osu!lazer", Creator = "team osu!" };
|
public static SkinInfo Default { get; } = new SkinInfo
|
||||||
|
{
|
||||||
|
Name = "osu!lazer",
|
||||||
|
Creator = "team osu!"
|
||||||
|
};
|
||||||
|
|
||||||
public bool Equals(SkinInfo other) => other != null && ID == other.ID;
|
public bool Equals(SkinInfo other) => other != null && ID == other.ID;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ using osu.Framework.Audio.Sample;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -25,6 +26,8 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
private readonly AudioManager audio;
|
private readonly AudioManager audio;
|
||||||
|
|
||||||
|
private readonly IResourceStore<byte[]> legacyDefaultResources;
|
||||||
|
|
||||||
public readonly Bindable<Skin> CurrentSkin = new Bindable<Skin>(new DefaultSkin());
|
public readonly Bindable<Skin> CurrentSkin = new Bindable<Skin>(new DefaultSkin());
|
||||||
public readonly Bindable<SkinInfo> CurrentSkinInfo = new Bindable<SkinInfo>(SkinInfo.Default) { Default = SkinInfo.Default };
|
public readonly Bindable<SkinInfo> CurrentSkinInfo = new Bindable<SkinInfo>(SkinInfo.Default) { Default = SkinInfo.Default };
|
||||||
|
|
||||||
@ -34,10 +37,11 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
protected override string ImportFromStablePath => "Skins";
|
protected override string ImportFromStablePath => "Skins";
|
||||||
|
|
||||||
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio)
|
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio, IResourceStore<byte[]> legacyDefaultResources)
|
||||||
: base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost)
|
: base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost)
|
||||||
{
|
{
|
||||||
this.audio = audio;
|
this.audio = audio;
|
||||||
|
this.legacyDefaultResources = legacyDefaultResources;
|
||||||
|
|
||||||
ItemRemoved += removedInfo =>
|
ItemRemoved += removedInfo =>
|
||||||
{
|
{
|
||||||
@ -66,6 +70,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
var userSkins = GetAllUserSkins();
|
var userSkins = GetAllUserSkins();
|
||||||
userSkins.Insert(0, SkinInfo.Default);
|
userSkins.Insert(0, SkinInfo.Default);
|
||||||
|
userSkins.Insert(1, DefaultLegacySkin.Info);
|
||||||
return userSkins;
|
return userSkins;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +96,7 @@ namespace osu.Game.Skinning
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
model.Name = model.Name.Replace(".osk", "");
|
model.Name = model.Name.Replace(".osk", "");
|
||||||
model.Creator = "Unknown";
|
model.Creator = model.Creator ?? "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +110,9 @@ namespace osu.Game.Skinning
|
|||||||
if (skinInfo == SkinInfo.Default)
|
if (skinInfo == SkinInfo.Default)
|
||||||
return new DefaultSkin();
|
return new DefaultSkin();
|
||||||
|
|
||||||
|
if (skinInfo == DefaultLegacySkin.Info)
|
||||||
|
return new DefaultLegacySkin(legacyDefaultResources, audio);
|
||||||
|
|
||||||
return new LegacySkin(skinInfo, Files.Store, audio);
|
return new LegacySkin(skinInfo, Files.Store, audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.823.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.830.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.828.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.830.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -117,9 +117,9 @@
|
|||||||
<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.Game.Resources" Version="2019.823.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.830.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.828.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.830.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.828.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.830.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.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" />
|
||||||
|
Loading…
Reference in New Issue
Block a user