1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +08:00

Update home button

This commit is contained in:
Dean Herbert 2020-09-03 16:28:53 +09:00
parent 942276d88f
commit 98c5a04a09
3 changed files with 19 additions and 13 deletions

View File

@ -35,6 +35,15 @@ namespace osu.Game.Overlays.Toolbar
IconContainer.Show();
}
[Resolved]
private TextureStore textures { get; set; }
public void SetIcon(string texture) =>
SetIcon(new Sprite
{
Texture = textures.Get(texture),
});
public string Text
{
get => DrawableText.Text;

View File

@ -1,6 +1,7 @@
// 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.Allocation;
using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar
@ -9,11 +10,16 @@ namespace osu.Game.Overlays.Toolbar
{
public ToolbarHomeButton()
{
// todo: icon
TooltipMain = "Home";
TooltipSub = "Return to the main menu";
Width *= 1.4f;
Hotkey = GlobalAction.Home;
}
[BackgroundDependencyLoader]
private void load()
{
TooltipMain = "Home";
TooltipSub = "Return to the main menu";
SetIcon("Icons/Hexacons/home");
}
}
}

View File

@ -1,14 +1,11 @@
// 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.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Toolbar
@ -21,9 +18,6 @@ namespace osu.Game.Overlays.Toolbar
private readonly Bindable<Visibility> overlayState = new Bindable<Visibility>();
[Resolved]
private TextureStore textures { get; set; }
public OverlayContainer StateContainer
{
get => stateContainer;
@ -43,10 +37,7 @@ namespace osu.Game.Overlays.Toolbar
{
TooltipMain = named.Title;
TooltipSub = named.Description;
SetIcon(new Sprite
{
Texture = textures.Get(named.IconTexture),
});
SetIcon(named.IconTexture);
}
}
}