Merge branch 'master' into dimmed-load-input-blocking

This commit is contained in:
Dan Balasescu 2019-11-25 13:49:10 +09:00 committed by GitHub
commit dd7e4b2340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 219 additions and 45 deletions

View File

@ -2,3 +2,4 @@ M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use obj
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead. M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead. M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead. T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
T:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.

View File

@ -11,12 +11,12 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Game.Skinning; using osu.Game.Skinning;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Rulesets.Catch.Tests namespace osu.Game.Rulesets.Catch.Tests
{ {
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Tests
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Blue Colour = Color4.Blue
}, },
new SpriteText new OsuSpriteText
{ {
Text = "custom" Text = "custom"
} }

View File

@ -16,6 +16,7 @@ using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Skinning; using osu.Game.Skinning;
@ -125,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
if (!enabled) return null; if (!enabled) return null;
return new SpriteText return new OsuSpriteText
{ {
Text = identifier, Text = identifier,
Font = OsuFont.Default.With(size: 30), Font = OsuFont.Default.With(size: 30),

View File

@ -0,0 +1,2 @@
[General]
Version: 2

View File

@ -0,0 +1,2 @@
[General]
Version: latest

View File

@ -59,5 +59,32 @@ namespace osu.Game.Tests.Skins
Assert.AreEqual("TestValue", config.ConfigDictionary["TestLookup"]); Assert.AreEqual("TestValue", config.ConfigDictionary["TestLookup"]);
} }
} }
[Test]
public void TestDecodeSpecifiedVersion()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-20.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.AreEqual(2.0m, decoder.Decode(stream).LegacyVersion);
}
[Test]
public void TestDecodeLatestVersion()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-latest.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.AreEqual(LegacySkinConfiguration.LATEST_VERSION, decoder.Decode(stream).LegacyVersion);
}
[Test]
public void TestDecodeNoVersion()
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin-empty.ini"))
using (var stream = new LineBufferedReader(resStream))
Assert.IsNull(decoder.Decode(stream).LegacyVersion);
}
} }
} }

View File

@ -116,6 +116,14 @@ namespace osu.Game.Tests.Skins
}); });
} }
[Test]
public void TestLegacyVersionLookup()
{
AddStep("Set source1 version 2.3", () => source1.Configuration.LegacyVersion = 2.3m);
AddStep("Set source2 version null", () => source2.Configuration.LegacyVersion = null);
AddAssert("Check legacy version lookup", () => requester.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value == 2.3m);
}
public enum LookupType public enum LookupType
{ {
Test Test

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets.Judgements;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Catch.Scoring; using osu.Game.Rulesets.Catch.Scoring;
using osu.Game.Rulesets.Mania.Scoring; using osu.Game.Rulesets.Mania.Scoring;
using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Osu.Scoring;
@ -85,9 +85,9 @@ namespace osu.Game.Tests.Visual.Gameplay
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {
new SpriteText { Text = $@"Great: {hitWindows?.WindowFor(HitResult.Great)}" }, new OsuSpriteText { Text = $@"Great: {hitWindows?.WindowFor(HitResult.Great)}" },
new SpriteText { Text = $@"Good: {hitWindows?.WindowFor(HitResult.Good)}" }, new OsuSpriteText { Text = $@"Good: {hitWindows?.WindowFor(HitResult.Good)}" },
new SpriteText { Text = $@"Meh: {hitWindows?.WindowFor(HitResult.Meh)}" }, new OsuSpriteText { Text = $@"Meh: {hitWindows?.WindowFor(HitResult.Meh)}" },
} }
}); });

View File

@ -42,6 +42,7 @@ namespace osu.Game.Tests.Visual.Online
typeof(BeatmapAvailability), typeof(BeatmapAvailability),
typeof(BeatmapRulesetSelector), typeof(BeatmapRulesetSelector),
typeof(BeatmapRulesetTabItem), typeof(BeatmapRulesetTabItem),
typeof(NotSupporterPlaceholder)
}; };
protected override bool UseOnlineAPI => true; protected override bool UseOnlineAPI => true;

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets; using osu.Game.Rulesets;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
@ -45,7 +46,7 @@ namespace osu.Game.Tests.Visual.Online
modSelector.SelectedMods.ItemsAdded += mods => modSelector.SelectedMods.ItemsAdded += mods =>
{ {
mods.ForEach(mod => selectedMods.Add(new SpriteText mods.ForEach(mod => selectedMods.Add(new OsuSpriteText
{ {
Text = mod.Acronym, Text = mod.Acronym,
})); }));

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Rankings; using osu.Game.Overlays.Rankings;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -45,7 +46,7 @@ namespace osu.Game.Tests.Visual.Online
Size = new Vector2(30, 20), Size = new Vector2(30, 20),
Country = countryA, Country = countryA,
}, },
text = new SpriteText text = new OsuSpriteText
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,

View File

@ -11,7 +11,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania;
using osu.Game.Users; using osu.Game.Users;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Taiko;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -94,11 +94,11 @@ namespace osu.Game.Tests.Visual.Online
AddRange(new Drawable[] AddRange(new Drawable[]
{ {
new SpriteText new OsuSpriteText
{ {
Text = $@"Username: {user.NewValue?.Username}" Text = $@"Username: {user.NewValue?.Username}"
}, },
new SpriteText new OsuSpriteText
{ {
Text = $@"RankedScore: {user.NewValue?.Statistics.RankedScore}" Text = $@"RankedScore: {user.NewValue?.Statistics.RankedScore}"
}, },

View File

@ -12,13 +12,13 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
@ -104,7 +104,7 @@ namespace osu.Game.Tournament
Colour = Color4.Red, Colour = Color4.Red,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new SpriteText new OsuSpriteText
{ {
Text = "Please make the window wider", Text = "Please make the window wider",
Font = OsuFont.Default.With(weight: "bold"), Font = OsuFont.Default.With(weight: "bold"),

View File

@ -150,7 +150,7 @@ namespace osu.Game.Online.API
private class DisplayableError private class DisplayableError
{ {
[JsonProperty("error")] [JsonProperty("error")]
public string ErrorMessage; public string ErrorMessage { get; set; }
} }
} }

View File

@ -0,0 +1,49 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
public class NotSupporterPlaceholder : Container
{
public NotSupporterPlaceholder()
{
LinkFlowContainer text;
AutoSizeAxes = Axes.Both;
Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = @"You need to be an osu!supporter to access the friend and country rankings!",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
},
text = new LinkFlowContainer(t => t.Font = t.Font.With(size: 12))
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
}
}
};
text.AddText("Click ");
text.AddLink("here", "/home/support");
text.AddText(" to see all the fancy features that you can get!");
}
}
}

View File

@ -26,17 +26,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>(); public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>(); private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(); private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(BeatmapLeaderboardScope.Global);
private readonly Bindable<User> user = new Bindable<User>(); private readonly Bindable<User> user = new Bindable<User>();
private readonly Box background; private readonly Box background;
private readonly ScoreTable scoreTable; private readonly ScoreTable scoreTable;
private readonly FillFlowContainer topScoresContainer; private readonly FillFlowContainer topScoresContainer;
private readonly DimmedLoadingLayer loading; private readonly DimmedLoadingLayer loading;
private readonly FillFlowContainer filterControls;
private readonly LeaderboardModSelector modSelector; private readonly LeaderboardModSelector modSelector;
private readonly NoScoresPlaceholder noScoresPlaceholder; private readonly NoScoresPlaceholder noScoresPlaceholder;
private readonly FillFlowContainer content; private readonly FillFlowContainer content;
private readonly NotSupporterPlaceholder notSupporterPlaceholder;
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
@ -93,21 +93,24 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Margin = new MarginPadding { Vertical = spacing }, Margin = new MarginPadding { Vertical = spacing },
Children = new Drawable[] Children = new Drawable[]
{ {
filterControls = new FillFlowContainer new FillFlowContainer
{ {
Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Y,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(0, spacing), Spacing = new Vector2(0, spacing),
Children = new Drawable[] Children = new Drawable[]
{ {
new LeaderboardScopeSelector new LeaderboardScopeSelector
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Current = { BindTarget = scope } Current = { BindTarget = scope }
}, },
modSelector = new LeaderboardModSelector modSelector = new LeaderboardModSelector
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Ruleset = { BindTarget = ruleset } Ruleset = { BindTarget = ruleset }
} }
} }
@ -127,6 +130,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
AlwaysPresent = true, AlwaysPresent = true,
Margin = new MarginPadding { Vertical = 10 } Margin = new MarginPadding { Vertical = 10 }
}, },
notSupporterPlaceholder = new NotSupporterPlaceholder
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Alpha = 0,
},
new FillFlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -204,9 +213,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void onUserChanged(ValueChangedEvent<User> user) private void onUserChanged(ValueChangedEvent<User> user)
{ {
scope.Value = BeatmapLeaderboardScope.Global; if (modSelector.SelectedMods.Any())
modSelector.DeselectAll(); modSelector.DeselectAll();
filterControls.FadeTo(api.IsLoggedIn && api.LocalUser.Value.IsSupporter ? 1 : 0); else
getScores();
modSelector.FadeTo(userIsSupporter ? 1 : 0);
} }
private void getScores() private void getScores()
@ -223,6 +235,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
return; return;
} }
if (scope.Value != BeatmapLeaderboardScope.Global && !userIsSupporter)
{
Scores = null;
notSupporterPlaceholder.Show();
loading.Hide();
return;
}
notSupporterPlaceholder.Hide();
content.Show(); content.Show();
loading.Show(); loading.Show();
@ -238,5 +260,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
api.Queue(getScoresRequest); api.Queue(getScoresRequest);
} }
private bool userIsSupporter => api.IsLoggedIn && api.LocalUser.Value.IsSupporter;
} }
} }

View File

@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Chat namespace osu.Game.Overlays.Chat
{ {
@ -202,7 +203,7 @@ namespace osu.Game.Overlays.Chat
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = lineHeight, Height = lineHeight,
}, },
text = new SpriteText text = new OsuSpriteText
{ {
Margin = new MarginPadding { Horizontal = 10 }, Margin = new MarginPadding { Horizontal = 10 },
Text = time.ToLocalTime().ToString("dd MMM yyyy"), Text = time.ToLocalTime().ToString("dd MMM yyyy"),

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osuTK; using osuTK;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
{ {
@ -48,7 +49,7 @@ namespace osu.Game.Overlays.Comments
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -101,7 +102,7 @@ namespace osu.Game.Overlays.Comments
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Size = new Vector2(10), Size = new Vector2(10),
}, },
new SpriteText new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
using osuTK; using osuTK;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using Humanizer; using Humanizer;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
{ {
@ -31,7 +32,7 @@ namespace osu.Game.Overlays.Comments
Icon = FontAwesome.Solid.Trash, Icon = FontAwesome.Solid.Trash,
Size = new Vector2(14), Size = new Vector2(14),
}, },
countText = new SpriteText countText = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
} }

View File

@ -14,6 +14,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using System.Linq; using System.Linq;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
@ -123,7 +124,7 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
}, },
new ParentUsername(comment), new ParentUsername(comment),
new SpriteText new OsuSpriteText
{ {
Alpha = comment.IsDeleted ? 1 : 0, Alpha = comment.IsDeleted ? 1 : 0,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
@ -145,7 +146,7 @@ namespace osu.Game.Overlays.Comments
Colour = OsuColour.Gray(0.7f), Colour = OsuColour.Gray(0.7f),
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -196,7 +197,7 @@ namespace osu.Game.Overlays.Comments
if (comment.EditedAt.HasValue) if (comment.EditedAt.HasValue)
{ {
info.Add(new SpriteText info.Add(new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -291,7 +292,7 @@ namespace osu.Game.Overlays.Comments
this.count = count; this.count = count;
Alpha = count == 0 ? 0 : 1; Alpha = count == 0 ? 0 : 1;
Child = text = new SpriteText Child = text = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
}; };
@ -324,7 +325,7 @@ namespace osu.Game.Overlays.Comments
Icon = FontAwesome.Solid.Reply, Icon = FontAwesome.Solid.Reply,
Size = new Vector2(14), Size = new Vector2(14),
}, },
new SpriteText new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true),
Text = parentComment?.User?.Username ?? parentComment?.LegacyName Text = parentComment?.User?.Username ?? parentComment?.LegacyName

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.UserInterface;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
@ -61,7 +62,7 @@ namespace osu.Game.Overlays.Comments
public TabButton(CommentsSortCriteria value) public TabButton(CommentsSortCriteria value)
{ {
Add(text = new SpriteText Add(text = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 14), Font = OsuFont.GetFont(size: 14),
Text = value.ToString() Text = value.ToString()

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Sprites;
using osuTK; using osuTK;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments
{ {
@ -32,7 +33,7 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(5, 0), Spacing = new Vector2(5, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -52,7 +53,7 @@ namespace osu.Game.Overlays.Comments
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.05f) Colour = OsuColour.Gray(0.05f)
}, },
counter = new SpriteText counter = new OsuSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Comments
} }
} }
}, },
sideNumber = new SpriteText sideNumber = new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,

View File

@ -167,7 +167,7 @@ namespace osu.Game.Overlays.Mods
Spacing = new Vector2(50f, 0f), Spacing = new Vector2(50f, 0f),
Margin = new MarginPadding Margin = new MarginPadding
{ {
Top = 6, Top = 20,
}, },
AlwaysPresent = true AlwaysPresent = true
}, },

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -63,7 +64,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new Drawable[] new Drawable[]
{ {
hoverIcon = new HoverIconContainer(), hoverIcon = new HoverIconContainer(),
header = new SpriteText header = new OsuSpriteText
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osuTK; using osuTK;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Rankings namespace osu.Game.Overlays.Rankings
{ {
@ -41,13 +42,13 @@ namespace osu.Game.Overlays.Rankings
Margin = new MarginPadding { Bottom = flag_margin }, Margin = new MarginPadding { Bottom = flag_margin },
Size = new Vector2(30, 20), Size = new Vector2(30, 20),
}, },
scopeText = new SpriteText scopeText = new OsuSpriteText
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light) Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light)
}, },
new SpriteText new OsuSpriteText
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,

View File

@ -224,7 +224,7 @@ namespace osu.Game.Rulesets.UI
Playfield.PostProcess(); Playfield.PostProcess();
foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>()) foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>())
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); mod.ApplyToDrawableHitObjects(Playfield.AllHitObjects);
} }
public override void RequestResume(Action continueResume) public override void RequestResume(Action continueResume)

View File

@ -20,6 +20,8 @@ namespace osu.Game.Skinning
new Color4(18, 124, 255, 255), new Color4(18, 124, 255, 255),
new Color4(242, 24, 57, 255), new Color4(242, 24, 57, 255),
}); });
Configuration.LegacyVersion = 2.0m;
} }
public static SkinInfo Info { get; } = new SkinInfo public static SkinInfo Info { get; } = new SkinInfo

View File

@ -26,6 +26,12 @@ namespace osu.Game.Skinning
[CanBeNull] [CanBeNull]
protected IResourceStore<SampleChannel> Samples; protected IResourceStore<SampleChannel> Samples;
public new LegacySkinConfiguration Configuration
{
get => base.Configuration as LegacySkinConfiguration;
set => base.Configuration = value;
}
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager) public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini") : this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
{ {
@ -42,7 +48,7 @@ namespace osu.Game.Skinning
Configuration = new LegacySkinDecoder().Decode(reader); Configuration = new LegacySkinDecoder().Decode(reader);
} }
else else
Configuration = new DefaultSkinConfiguration(); Configuration = new LegacySkinConfiguration { LegacyVersion = LegacySkinConfiguration.LATEST_VERSION };
if (storage != null) if (storage != null)
{ {
@ -74,6 +80,18 @@ namespace osu.Game.Skinning
case GlobalSkinColour colour: case GlobalSkinColour colour:
return SkinUtils.As<TValue>(getCustomColour(colour.ToString())); return SkinUtils.As<TValue>(getCustomColour(colour.ToString()));
case LegacySkinConfiguration.LegacySetting legacy:
switch (legacy)
{
case LegacySkinConfiguration.LegacySetting.Version:
if (Configuration.LegacyVersion is decimal version)
return SkinUtils.As<TValue>(new Bindable<decimal>(version));
break;
}
break;
case SkinCustomColourLookup customColour: case SkinCustomColourLookup customColour:
return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString())); return SkinUtils.As<TValue>(getCustomColour(customColour.Lookup.ToString()));

View File

@ -0,0 +1,20 @@
// 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.Skinning
{
public class LegacySkinConfiguration : DefaultSkinConfiguration
{
public const decimal LATEST_VERSION = 2.7m;
/// <summary>
/// Legacy version of this skin.
/// </summary>
public decimal? LegacyVersion { get; internal set; }
public enum LegacySetting
{
Version,
}
}
}

View File

@ -1,18 +1,19 @@
// 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.
using System.Globalization;
using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Formats;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
public class LegacySkinDecoder : LegacyDecoder<DefaultSkinConfiguration> public class LegacySkinDecoder : LegacyDecoder<LegacySkinConfiguration>
{ {
public LegacySkinDecoder() public LegacySkinDecoder()
: base(1) : base(1)
{ {
} }
protected override void ParseLine(DefaultSkinConfiguration skin, Section section, string line) protected override void ParseLine(LegacySkinConfiguration skin, Section section, string line)
{ {
if (section != Section.Colours) if (section != Section.Colours)
{ {
@ -32,6 +33,14 @@ namespace osu.Game.Skinning
case @"Author": case @"Author":
skin.SkinInfo.Creator = pair.Value; skin.SkinInfo.Creator = pair.Value;
return; return;
case @"Version":
if (pair.Value == "latest")
skin.LegacyVersion = LegacySkinConfiguration.LATEST_VERSION;
else if (decimal.TryParse(pair.Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var version))
skin.LegacyVersion = version;
return;
} }
break; break;