2019-01-24 08:43:03 +00: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 09:19:50 +00:00
|
|
|
|
|
2017-03-06 08:20:19 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-06-20 03:48:45 +00:00
|
|
|
|
using osu.Framework.Development;
|
2017-03-06 08:20:19 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2022-06-29 09:56:15 +00:00
|
|
|
|
using osu.Framework.Logging;
|
2017-03-06 08:20:19 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2017-08-03 05:36:21 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2017-03-06 08:20:19 +00:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-06-03 04:38:06 +00:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2017-07-26 04:22:46 +00:00
|
|
|
|
using osu.Game.Rulesets;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-05-15 01:55:29 +00:00
|
|
|
|
namespace osu.Game.Overlays.Settings
|
2017-03-06 08:20:19 +00:00
|
|
|
|
{
|
2017-05-15 01:55:29 +00:00
|
|
|
|
public partial class SettingsFooter : FillFlowContainer
|
2017-03-06 08:20:19 +00:00
|
|
|
|
{
|
2019-06-02 13:17:03 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
2022-01-15 00:06:39 +00:00
|
|
|
|
private void load(OsuGameBase game, RulesetStore rulesets)
|
2017-03-06 08:20:19 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Direction = FillDirection.Vertical;
|
2021-07-24 02:04:12 +00:00
|
|
|
|
Padding = new MarginPadding { Top = 20, Bottom = 30, Horizontal = SettingsPanel.CONTENT_MARGINS };
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-06-29 10:37:02 +00:00
|
|
|
|
FillFlowContainer modes;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-03-06 08:20:19 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2022-06-29 10:37:02 +00:00
|
|
|
|
modes = new FillFlowContainer
|
2017-03-06 08:20:19 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Direction = FillDirection.Full,
|
2021-07-24 02:04:12 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-03-06 08:20:19 +00:00
|
|
|
|
Spacing = new Vector2(5),
|
|
|
|
|
Padding = new MarginPadding { Bottom = 10 },
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Text = game.Name,
|
2019-02-12 04:04:46 +00:00
|
|
|
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
|
2017-03-06 08:20:19 +00:00
|
|
|
|
},
|
2023-01-24 08:21:39 +00:00
|
|
|
|
new BuildDisplay(game.Version)
|
2017-03-06 08:20:19 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2019-06-03 04:38:06 +00:00
|
|
|
|
}
|
2017-03-06 08:20:19 +00:00
|
|
|
|
};
|
2022-06-29 10:37:02 +00:00
|
|
|
|
|
|
|
|
|
foreach (var ruleset in rulesets.AvailableRulesets)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var icon = new ConstrainedIconContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Icon = ruleset.CreateInstance().CreateIcon(),
|
|
|
|
|
Colour = Color4.Gray,
|
|
|
|
|
Size = new Vector2(20),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
modes.Add(icon);
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
Logger.Log($"Could not create ruleset icon for {ruleset.Name}. Please check for an update from the developer.", level: LogLevel.Error);
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-05-31 15:43:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-03 04:38:06 +00:00
|
|
|
|
private partial class BuildDisplay : OsuAnimatedButton
|
2019-05-31 15:43:58 +00:00
|
|
|
|
{
|
2019-06-03 04:38:06 +00:00
|
|
|
|
private readonly string version;
|
|
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
|
private OsuColour colours { get; set; } = null!;
|
|
|
|
|
|
2023-01-24 08:21:39 +00:00
|
|
|
|
public BuildDisplay(string version)
|
2019-06-01 06:46:38 +00:00
|
|
|
|
{
|
2019-06-03 04:38:06 +00:00
|
|
|
|
this.version = version;
|
|
|
|
|
|
|
|
|
|
Content.RelativeSizeAxes = Axes.Y;
|
|
|
|
|
Content.AutoSizeAxes = AutoSizeAxes = Axes.X;
|
|
|
|
|
Height = 20;
|
2019-06-01 06:46:38 +00:00
|
|
|
|
}
|
2019-06-02 10:40:18 +00:00
|
|
|
|
|
2023-06-23 15:59:36 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(ChangelogOverlay? changelog)
|
2019-06-03 04:38:06 +00:00
|
|
|
|
{
|
2023-01-24 08:21:39 +00:00
|
|
|
|
Action = () => changelog?.ShowBuild(OsuGameBase.CLIENT_STREAM_NAME, version);
|
2019-06-03 04:38:06 +00:00
|
|
|
|
|
|
|
|
|
Add(new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Font = OsuFont.GetFont(size: 16),
|
|
|
|
|
|
|
|
|
|
Text = version,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Padding = new MarginPadding(5),
|
2023-01-24 08:21:39 +00:00
|
|
|
|
Colour = DebugUtils.IsDebugBuild ? colours.Red : Color4.White,
|
2019-06-03 04:38:06 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
2017-03-06 08:20:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-05 11:21:19 +00:00
|
|
|
|
}
|