mirror of https://github.com/ppy/osu
Update home button
This commit is contained in:
parent
942276d88f
commit
98c5a04a09
|
@ -35,6 +35,15 @@ public void SetIcon(Drawable icon)
|
|||
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;
|
||||
|
|
|
@ -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 @@ public class ToolbarHomeButton : ToolbarButton
|
|||
{
|
||||
public ToolbarHomeButton()
|
||||
{
|
||||
// todo: icon
|
||||
Width *= 1.4f;
|
||||
Hotkey = GlobalAction.Home;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
TooltipMain = "Home";
|
||||
TooltipSub = "Return to the main menu";
|
||||
|
||||
Hotkey = GlobalAction.Home;
|
||||
SetIcon("Icons/Hexacons/home");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public class ToolbarOverlayToggleButton : ToolbarButton
|
|||
|
||||
private readonly Bindable<Visibility> overlayState = new Bindable<Visibility>();
|
||||
|
||||
[Resolved]
|
||||
private TextureStore textures { get; set; }
|
||||
|
||||
public OverlayContainer StateContainer
|
||||
{
|
||||
get => stateContainer;
|
||||
|
@ -43,10 +37,7 @@ public OverlayContainer StateContainer
|
|||
{
|
||||
TooltipMain = named.Title;
|
||||
TooltipSub = named.Description;
|
||||
SetIcon(new Sprite
|
||||
{
|
||||
Texture = textures.Get(named.IconTexture),
|
||||
});
|
||||
SetIcon(named.IconTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue