mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Make settings section icons actual drawables.
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// 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 osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
@ -9,7 +10,12 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
public class GlobalKeyBindingsSection : SettingsSection
|
public class GlobalKeyBindingsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Globe;
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Globe
|
||||||
|
};
|
||||||
|
|
||||||
public override string Header => "Global";
|
public override string Header => "Global";
|
||||||
|
|
||||||
public GlobalKeyBindingsSection(GlobalActionContainer manager)
|
public GlobalKeyBindingsSection(GlobalActionContainer manager)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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 osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
@ -10,7 +11,12 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
public class RulesetBindingsSection : SettingsSection
|
public class RulesetBindingsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override IconUsage Icon => (ruleset.CreateInstance().CreateIcon() as SpriteIcon)?.Icon ?? OsuIcon.Hot;
|
public override Drawable CreateIcon() => ruleset?.CreateInstance()?.CreateIcon() ?? new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = OsuIcon.Hot
|
||||||
|
};
|
||||||
|
|
||||||
public override string Header => ruleset.Name;
|
public override string Header => ruleset.Name;
|
||||||
|
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
@ -13,9 +13,13 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
{
|
{
|
||||||
public override string Header => "Audio";
|
public override string Header => "Audio";
|
||||||
|
|
||||||
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "sound" });
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.VolumeUp
|
||||||
|
};
|
||||||
|
|
||||||
public override IconUsage Icon => FontAwesome.Solid.VolumeUp;
|
public override IEnumerable<string> FilterTerms => base.FilterTerms.Concat(new[] { "sound" });
|
||||||
|
|
||||||
public AudioSection()
|
public AudioSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class DebugSection : SettingsSection
|
public class DebugSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Debug";
|
public override string Header => "Debug";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Bug;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Bug
|
||||||
|
};
|
||||||
|
|
||||||
public DebugSection()
|
public DebugSection()
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class GameplaySection : SettingsSection
|
public class GameplaySection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Gameplay";
|
public override string Header => "Gameplay";
|
||||||
public override IconUsage Icon => FontAwesome.Regular.Circle;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Regular.Circle
|
||||||
|
};
|
||||||
|
|
||||||
public GameplaySection()
|
public GameplaySection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class GeneralSection : SettingsSection
|
public class GeneralSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "General";
|
public override string Header => "General";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Cog;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Cog
|
||||||
|
};
|
||||||
|
|
||||||
public GeneralSection()
|
public GeneralSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class GraphicsSection : SettingsSection
|
public class GraphicsSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Graphics";
|
public override string Header => "Graphics";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Laptop;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Laptop
|
||||||
|
};
|
||||||
|
|
||||||
public GraphicsSection()
|
public GraphicsSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class InputSection : SettingsSection
|
public class InputSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Input";
|
public override string Header => "Input";
|
||||||
public override IconUsage Icon => FontAwesome.Regular.Keyboard;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Keyboard
|
||||||
|
};
|
||||||
|
|
||||||
public InputSection(KeyBindingPanel keyConfig)
|
public InputSection(KeyBindingPanel keyConfig)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class MaintenanceSection : SettingsSection
|
public class MaintenanceSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Maintenance";
|
public override string Header => "Maintenance";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.Wrench;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.Wrench
|
||||||
|
};
|
||||||
|
|
||||||
public MaintenanceSection()
|
public MaintenanceSection()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,12 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
public class OnlineSection : SettingsSection
|
public class OnlineSection : SettingsSection
|
||||||
{
|
{
|
||||||
public override string Header => "Online";
|
public override string Header => "Online";
|
||||||
public override IconUsage Icon => FontAwesome.Solid.GlobeAsia;
|
|
||||||
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.GlobeAsia
|
||||||
|
};
|
||||||
|
|
||||||
public OnlineSection()
|
public OnlineSection()
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
|
|
||||||
public override string Header => "Skin";
|
public override string Header => "Skin";
|
||||||
|
|
||||||
public override IconUsage Icon => FontAwesome.Solid.PaintBrush;
|
public override Drawable CreateIcon() => new SpriteIcon
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Icon = FontAwesome.Solid.PaintBrush
|
||||||
|
};
|
||||||
|
|
||||||
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default };
|
private readonly Bindable<SkinInfo> dropdownBindable = new Bindable<SkinInfo> { Default = SkinInfo.Default };
|
||||||
private readonly Bindable<int> configBindable = new Bindable<int>();
|
private readonly Bindable<int> configBindable = new Bindable<int>();
|
||||||
|
@ -11,7 +11,6 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
@ -20,7 +19,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
protected FillFlowContainer FlowContent;
|
protected FillFlowContainer FlowContent;
|
||||||
protected override Container<Drawable> Content => FlowContent;
|
protected override Container<Drawable> Content => FlowContent;
|
||||||
|
|
||||||
public abstract IconUsage Icon { get; }
|
public abstract Drawable CreateIcon();
|
||||||
public abstract string Header { get; }
|
public abstract string Header { get; }
|
||||||
|
|
||||||
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
public IEnumerable<IFilterable> FilterableChildren => Children.OfType<IFilterable>();
|
||||||
|
@ -11,12 +11,13 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
public class SidebarButton : OsuButton
|
public class SidebarButton : OsuButton
|
||||||
{
|
{
|
||||||
private readonly SpriteIcon drawableIcon;
|
private readonly ConstrainedIconContainer iconContainer;
|
||||||
private readonly SpriteText headerText;
|
private readonly SpriteText headerText;
|
||||||
private readonly Box selectionIndicator;
|
private readonly Box selectionIndicator;
|
||||||
private readonly Container text;
|
private readonly Container text;
|
||||||
@ -30,7 +31,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
{
|
{
|
||||||
section = value;
|
section = value;
|
||||||
headerText.Text = value.Header;
|
headerText.Text = value.Header;
|
||||||
drawableIcon.Icon = value.Icon;
|
iconContainer.Icon = value.CreateIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
},
|
},
|
||||||
drawableIcon = new SpriteIcon
|
iconContainer = new ConstrainedIconContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Reference in New Issue
Block a user