1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-18 06:27:18 +08:00

Show changelog for current build when clicking on settings footer (#4884)

Show changelog for current build when clicking on settings footer

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-06-12 18:41:11 +09:00 committed by GitHub
commit 73e561bf10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 10 deletions

View File

@ -120,7 +120,7 @@ namespace osu.Desktop.Overlays
Activated = delegate
{
changelog.ShowBuild("lazer", version);
changelog.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
return true;
};
}

View File

@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Online
{
Version = "2018.712.0",
DisplayVersion = "2018.712.0",
UpdateStream = new APIUpdateStream { Name = "lazer" },
UpdateStream = new APIUpdateStream { Name = OsuGameBase.CLIENT_STREAM_NAME },
ChangelogEntries = new List<APIChangelogEntry>
{
new APIChangelogEntry

View File

@ -1,20 +1,29 @@
// 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 System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
namespace osu.Game.Tests.Visual.Settings
{
[TestFixture]
public class TestSceneSettings : OsuTestScene
public class TestSceneSettingsPanel : OsuTestScene
{
private readonly SettingsPanel settings;
private readonly DialogOverlay dialogOverlay;
public TestSceneSettings()
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(SettingsFooter),
typeof(SettingsOverlay),
};
public TestSceneSettingsPanel()
{
settings = new SettingsOverlay
{

View File

@ -45,7 +45,7 @@ namespace osu.Game.Online.API.Requests.Responses
case "cuttingedge":
return new Color4(238, 170, 0, 255);
case "lazer":
case OsuGameBase.CLIENT_STREAM_NAME:
return new Color4(237, 18, 33, 255);
case "web":

View File

@ -45,6 +45,8 @@ namespace osu.Game
/// </summary>
public class OsuGameBase : Framework.Game, ICanAcceptFiles
{
public const string CLIENT_STREAM_NAME = "lazer";
protected OsuConfigManager LocalConfig;
protected BeatmapManager BeatmapManager;

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
@ -58,15 +59,49 @@ namespace osu.Game.Overlays.Settings
Text = game.Name,
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
},
new OsuSpriteText
new BuildDisplay(game.Version, DebugUtils.IsDebug)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Font = OsuFont.GetFont(size: 14),
Text = game.Version,
Colour = DebugUtils.IsDebug ? colours.Red : Color4.White,
},
}
};
}
private class BuildDisplay : OsuAnimatedButton
{
private readonly string version;
private readonly bool isDebug;
[Resolved]
private OsuColour colours { get; set; }
public BuildDisplay(string version, bool isDebug)
{
this.version = version;
this.isDebug = isDebug;
Content.RelativeSizeAxes = Axes.Y;
Content.AutoSizeAxes = AutoSizeAxes = Axes.X;
Height = 20;
}
[BackgroundDependencyLoader(true)]
private void load(ChangelogOverlay changelog)
{
if (!isDebug)
Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
Add(new OsuSpriteText
{
Font = OsuFont.GetFont(size: 16),
Text = version,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Padding = new MarginPadding(5),
Colour = isDebug ? colours.Red : Color4.White,
});
}
}
}
}