mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Show a message when attempting to customisse a screen which doesn't support it
This commit is contained in:
parent
6d587dc392
commit
f55407f871
@ -87,9 +87,9 @@ namespace osu.Game.Screens
|
|||||||
private static Color4 getColourFor(object type)
|
private static Color4 getColourFor(object type)
|
||||||
{
|
{
|
||||||
int hash = type.GetHashCode();
|
int hash = type.GetHashCode();
|
||||||
byte r = (byte)Math.Clamp(((hash & 0xFF0000) >> 16) * 0.8f, 20, 255);
|
byte r = (byte)Math.Clamp(((hash & 0xFF0000) >> 16) * 2, 128, 255);
|
||||||
byte g = (byte)Math.Clamp(((hash & 0x00FF00) >> 8) * 0.8f, 20, 255);
|
byte g = (byte)Math.Clamp(((hash & 0x00FF00) >> 8) * 2, 128, 255);
|
||||||
byte b = (byte)Math.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
|
byte b = (byte)Math.Clamp((hash & 0x0000FF) * 2, 128, 255);
|
||||||
return new Color4(r, g, b, 255);
|
return new Color4(r, g, b, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,10 +109,10 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
private readonly Container boxContainer;
|
private readonly Container boxContainer;
|
||||||
|
|
||||||
public UnderConstructionMessage(string name)
|
public UnderConstructionMessage(string name, string description = "is not yet ready for use!")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Size = new Vector2(0.3f);
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
CornerRadius = 20,
|
CornerRadius = 20,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
RelativeSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -133,15 +133,15 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
|
||||||
Colour = colour,
|
Colour = colour.Darken(0.8f),
|
||||||
Alpha = 0.2f,
|
Alpha = 0.8f,
|
||||||
Blending = BlendingParameters.Additive,
|
|
||||||
},
|
},
|
||||||
TextContainer = new FillFlowContainer
|
TextContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
Padding = new MarginPadding(20),
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -157,14 +157,14 @@ namespace osu.Game.Screens
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = name,
|
Text = name,
|
||||||
Colour = colour.Lighten(0.8f),
|
Colour = colour,
|
||||||
Font = OsuFont.GetFont(size: 36),
|
Font = OsuFont.GetFont(size: 36),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = "is not yet ready for use!",
|
Text = description,
|
||||||
Font = OsuFont.GetFont(size: 20),
|
Font = OsuFont.GetFont(size: 20),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
|
@ -7,8 +7,10 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
@ -36,7 +38,17 @@ namespace osu.Game.Skinning.Editor
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
// track each target container on the current screen.
|
// track each target container on the current screen.
|
||||||
foreach (var targetContainer in target.ChildrenOfType<SkinnableElementTargetContainer>())
|
var targetContainers = target.ChildrenOfType<SkinnableElementTargetContainer>().ToArray();
|
||||||
|
|
||||||
|
if (targetContainers.Length == 0)
|
||||||
|
{
|
||||||
|
var targetScreen = target.ChildrenOfType<Screen>().LastOrDefault()?.GetType().Name ?? "this screen";
|
||||||
|
|
||||||
|
AddInternal(new ScreenWhiteBox.UnderConstructionMessage(targetScreen, "doesn't support skin customisation just yet."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var targetContainer in targetContainers)
|
||||||
{
|
{
|
||||||
var bindableList = new BindableList<ISkinnableComponent> { BindTarget = targetContainer.Components };
|
var bindableList = new BindableList<ISkinnableComponent> { BindTarget = targetContainer.Components };
|
||||||
bindableList.BindCollectionChanged(componentsChanged, true);
|
bindableList.BindCollectionChanged(componentsChanged, true);
|
||||||
|
@ -62,46 +62,68 @@ namespace osu.Game.Skinning.Editor
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X
|
RelativeSizeAxes = Axes.X
|
||||||
},
|
},
|
||||||
new SkinBlueprintContainer(targetScreen),
|
new GridContainer
|
||||||
new SkinComponentToolbox(600)
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.CentreLeft,
|
ColumnDimensions = new[]
|
||||||
RequestPlacement = placeComponent
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Spacing = new Vector2(5),
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
{
|
||||||
Top = 10,
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
Left = 10,
|
new Dimension()
|
||||||
},
|
},
|
||||||
Margin = new MarginPadding
|
Content = new[]
|
||||||
{
|
{
|
||||||
Right = 10,
|
new Drawable[]
|
||||||
Bottom = 10,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new TriangleButton
|
|
||||||
{
|
{
|
||||||
Text = "Save Changes",
|
new SkinComponentToolbox(600)
|
||||||
Width = 140,
|
{
|
||||||
Action = save,
|
Anchor = Anchor.CentreLeft,
|
||||||
},
|
Origin = Anchor.CentreLeft,
|
||||||
new DangerousTriangleButton
|
RequestPlacement = placeComponent
|
||||||
{
|
},
|
||||||
Text = "Revert to default",
|
new Container
|
||||||
Width = 140,
|
{
|
||||||
Action = revert,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SkinBlueprintContainer(targetScreen),
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
Spacing = new Vector2(5),
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = 10,
|
||||||
|
Left = 10,
|
||||||
|
},
|
||||||
|
Margin = new MarginPadding
|
||||||
|
{
|
||||||
|
Right = 10,
|
||||||
|
Bottom = 10,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new TriangleButton
|
||||||
|
{
|
||||||
|
Text = "Save Changes",
|
||||||
|
Width = 140,
|
||||||
|
Action = save,
|
||||||
|
},
|
||||||
|
new DangerousTriangleButton
|
||||||
|
{
|
||||||
|
Text = "Revert to default",
|
||||||
|
Width = 140,
|
||||||
|
Action = revert,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user