2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-03-06 16:20:19 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using osu.Framework.Allocation;
|
2019-06-20 11:48:45 +08:00
|
|
|
|
using osu.Framework.Development;
|
2017-03-06 16:20:19 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics;
|
2017-08-03 13:36:21 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2017-03-06 16:20:19 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-06-03 12:38:06 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2017-07-26 12:22:46 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-05-15 09:55:29 +08:00
|
|
|
|
namespace osu.Game.Overlays.Settings
|
2017-03-06 16:20:19 +08:00
|
|
|
|
{
|
2017-05-15 09:55:29 +08:00
|
|
|
|
public class SettingsFooter : FillFlowContainer
|
2017-03-06 16:20:19 +08:00
|
|
|
|
{
|
2019-06-02 21:17:03 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2022-01-15 08:06:39 +08:00
|
|
|
|
private void load(OsuGameBase game, RulesetStore rulesets)
|
2017-03-06 16:20:19 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Direction = FillDirection.Vertical;
|
2021-07-24 10:04:12 +08:00
|
|
|
|
Padding = new MarginPadding { Top = 20, Bottom = 30, Horizontal = SettingsPanel.CONTENT_MARGINS };
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-03-06 16:20:19 +08:00
|
|
|
|
var modes = new List<Drawable>();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-10-16 16:02:31 +08:00
|
|
|
|
foreach (var ruleset in rulesets.AvailableRulesets)
|
2017-04-15 04:22:41 +08:00
|
|
|
|
{
|
2017-08-03 13:36:21 +08:00
|
|
|
|
var icon = new ConstrainedIconContainer
|
2017-03-06 16:20:19 +08:00
|
|
|
|
{
|
2021-07-24 10:04:12 +08:00
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2017-08-03 13:36:21 +08:00
|
|
|
|
Icon = ruleset.CreateInstance().CreateIcon(),
|
2017-03-06 16:20:19 +08:00
|
|
|
|
Colour = Color4.Gray,
|
2017-08-03 13:36:21 +08:00
|
|
|
|
Size = new Vector2(20),
|
|
|
|
|
};
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-08-03 13:36:21 +08:00
|
|
|
|
modes.Add(icon);
|
2017-04-15 04:22:41 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-03-06 16:20:19 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Direction = FillDirection.Full,
|
2021-07-24 10:04:12 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-03-06 16:20:19 +08:00
|
|
|
|
Children = modes,
|
|
|
|
|
Spacing = new Vector2(5),
|
|
|
|
|
Padding = new MarginPadding { Bottom = 10 },
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Text = game.Name,
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
|
2017-03-06 16:20:19 +08:00
|
|
|
|
},
|
2019-06-20 11:48:45 +08:00
|
|
|
|
new BuildDisplay(game.Version, DebugUtils.IsDebugBuild)
|
2017-03-06 16:20:19 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-06-03 12:38:06 +08:00
|
|
|
|
}
|
2017-03-06 16:20:19 +08:00
|
|
|
|
};
|
2019-05-31 23:43:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-03 12:38:06 +08:00
|
|
|
|
private class BuildDisplay : OsuAnimatedButton
|
2019-05-31 23:43:58 +08:00
|
|
|
|
{
|
2019-06-03 12:38:06 +08:00
|
|
|
|
private readonly string version;
|
|
|
|
|
private readonly bool isDebug;
|
|
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuColour colours { get; set; }
|
|
|
|
|
|
|
|
|
|
public BuildDisplay(string version, bool isDebug)
|
2019-06-01 14:46:38 +08:00
|
|
|
|
{
|
2019-06-03 12:38:06 +08:00
|
|
|
|
this.version = version;
|
|
|
|
|
this.isDebug = isDebug;
|
|
|
|
|
|
|
|
|
|
Content.RelativeSizeAxes = Axes.Y;
|
|
|
|
|
Content.AutoSizeAxes = AutoSizeAxes = Axes.X;
|
|
|
|
|
Height = 20;
|
2019-06-01 14:46:38 +08:00
|
|
|
|
}
|
2019-06-02 18:40:18 +08:00
|
|
|
|
|
2019-06-03 12:38:06 +08:00
|
|
|
|
[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,
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-03-06 16:20:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-05 19:21:19 +08:00
|
|
|
|
}
|