1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:02:55 +08:00

Update skin editor toolbox design to suck less

This commit is contained in:
Dean Herbert 2022-03-15 17:19:20 +09:00
parent 7e8aa77b2b
commit fdb411c0f3

View File

@ -6,16 +6,15 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Edit;
@ -23,7 +22,6 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Skinning.Editor
{
@ -33,8 +31,6 @@ namespace osu.Game.Skinning.Editor
public Action<Type> RequestPlacement;
private const float component_display_scale = 0.8f;
[Cached]
private ScoreProcessor scoreProcessor = new ScoreProcessor(new DummyRuleset())
{
@ -62,7 +58,7 @@ namespace osu.Game.Skinning.Editor
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(20)
Spacing = new Vector2(2)
};
var skinnableTypes = typeof(OsuGame).Assembly.GetTypes()
@ -120,39 +116,36 @@ namespace osu.Game.Skinning.Editor
Enabled.Value = true;
RelativeSizeAxes = Axes.X;
Height = 70;
Height = 60;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OverlayColourProvider colourProvider, OsuColour colours)
{
BackgroundColour = colours.Gray3;
Content.EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Radius = 2,
Offset = new Vector2(0, 1),
Colour = Color4.Black.Opacity(0.5f)
};
BackgroundColour = colourProvider.Background3;
AddRange(new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(10) { Bottom = 20 },
Masking = true,
Child = innerContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Child = component
},
},
new OsuSpriteText
{
Text = component.GetType().Name,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Margin = new MarginPadding(5),
},
innerContainer = new Container
{
Y = 10,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(component_display_scale),
Masking = true,
Child = component
}
});
// adjust provided component to fit / display in a known state.
@ -160,14 +153,17 @@ namespace osu.Game.Skinning.Editor
component.Origin = Anchor.Centre;
}
protected override void LoadComplete()
protected override void Update()
{
base.LoadComplete();
base.Update();
if (component.RelativeSizeAxes != Axes.None)
if (component.DrawSize != Vector2.Zero)
{
innerContainer.AutoSizeAxes = Axes.None;
innerContainer.Height = 100;
float bestScale = Math.Min(
innerContainer.DrawWidth / component.DrawWidth,
innerContainer.DrawHeight / component.DrawHeight);
innerContainer.Scale = new Vector2(bestScale);
}
}