mirror of
https://github.com/osukey/osukey.git
synced 2025-06-10 05:48:05 +09:00
Merge pull request #17273 from peppy/skin-editor-scene-library
Add a basic scene library to skin editor
This commit is contained in:
commit
36c97e5a8d
@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("reload skin editor", () =>
|
AddStep("reload skin editor", () =>
|
||||||
{
|
{
|
||||||
skinEditor?.Expire();
|
skinEditor?.Expire();
|
||||||
Player.ScaleTo(SkinEditorOverlay.VISIBLE_TARGET_SCALE);
|
Player.ScaleTo(0.8f);
|
||||||
LoadComponentAsync(skinEditor = new SkinEditor(Player), Add);
|
LoadComponentAsync(skinEditor = new SkinEditor(Player), Add);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -235,6 +236,10 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
new SkinnableTargetContainer(SkinnableTarget.SongSelect)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ShowFooter)
|
if (ShowFooter)
|
||||||
|
@ -70,6 +70,14 @@ namespace osu.Game.Skinning
|
|||||||
case SkinnableTargetComponent target:
|
case SkinnableTargetComponent target:
|
||||||
switch (target.Target)
|
switch (target.Target)
|
||||||
{
|
{
|
||||||
|
case SkinnableTarget.SongSelect:
|
||||||
|
var songSelectComponents = new SkinnableTargetComponentsContainer(container =>
|
||||||
|
{
|
||||||
|
// do stuff when we need to.
|
||||||
|
});
|
||||||
|
|
||||||
|
return songSelectComponents;
|
||||||
|
|
||||||
case SkinnableTarget.MainHUDComponents:
|
case SkinnableTarget.MainHUDComponents:
|
||||||
var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
|
var skinnableTargetWrapper = new SkinnableTargetComponentsContainer(container =>
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Screens.Edit.Components.Menus;
|
using osu.Game.Screens.Edit.Components.Menus;
|
||||||
|
|
||||||
@ -42,6 +43,9 @@ namespace osu.Game.Skinning.Editor
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; }
|
private OsuColour colours { get; set; }
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
private bool hasBegunMutating;
|
private bool hasBegunMutating;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
@ -62,6 +66,8 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
const float menu_height = 40;
|
||||||
|
|
||||||
InternalChild = new OsuContextMenuContainer
|
InternalChild = new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -69,10 +75,10 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Name = "Top bar",
|
Name = "Menu container",
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Depth = float.MinValue,
|
Depth = float.MinValue,
|
||||||
Height = 40,
|
Height = menu_height,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new EditorMenuBar
|
new EditorMenuBar
|
||||||
@ -105,6 +111,12 @@ namespace osu.Game.Skinning.Editor
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
new SkinEditorSceneLibrary
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Y = menu_height,
|
||||||
|
},
|
||||||
|
|
||||||
new GridContainer
|
new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -173,7 +185,10 @@ namespace osu.Game.Skinning.Editor
|
|||||||
{
|
{
|
||||||
content.Children = new Drawable[]
|
content.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SkinBlueprintContainer(targetScreen),
|
new SkinBlueprintContainer(targetScreen)
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding { Top = 100 },
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Skinning.Editor
|
|||||||
|
|
||||||
if (skinEditor.State.Value == Visibility.Visible)
|
if (skinEditor.State.Value == Visibility.Visible)
|
||||||
{
|
{
|
||||||
scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.1f, 0.8f - toolbar_padding_requirement, 0.7f), true);
|
scalingContainer.SetCustomRect(new RectangleF(toolbar_padding_requirement, 0.2f, 0.8f - toolbar_padding_requirement, 0.7f), true);
|
||||||
|
|
||||||
game?.Toolbar.Hide();
|
game?.Toolbar.Hide();
|
||||||
game?.CloseAllOverlays();
|
game?.CloseAllOverlays();
|
||||||
|
123
osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs
Normal file
123
osu.Game/Skinning/Editor/SkinEditorSceneLibrary.cs
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
// 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 JetBrains.Annotations;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Screens.Select;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Skinning.Editor
|
||||||
|
{
|
||||||
|
public class SkinEditorSceneLibrary : CompositeDrawable
|
||||||
|
{
|
||||||
|
public const float BUTTON_HEIGHT = 40;
|
||||||
|
|
||||||
|
private const float padding = 10;
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
|
public SkinEditorSceneLibrary()
|
||||||
|
{
|
||||||
|
Height = BUTTON_HEIGHT + padding * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider overlayColourProvider)
|
||||||
|
{
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = overlayColourProvider.Background6,
|
||||||
|
},
|
||||||
|
new OsuScrollContainer(Direction.Horizontal)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Name = "Scene library",
|
||||||
|
AutoSizeAxes = Axes.X,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Spacing = new Vector2(padding),
|
||||||
|
Padding = new MarginPadding(padding),
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "Scene library",
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Margin = new MarginPadding(10),
|
||||||
|
},
|
||||||
|
new SceneButton
|
||||||
|
{
|
||||||
|
Text = "Song Select",
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Action = () => game?.PerformFromScreen(screen =>
|
||||||
|
{
|
||||||
|
if (screen is SongSelect)
|
||||||
|
return;
|
||||||
|
|
||||||
|
screen.Push(new PlaySongSelect());
|
||||||
|
}, new[] { typeof(SongSelect) })
|
||||||
|
},
|
||||||
|
new SceneButton
|
||||||
|
{
|
||||||
|
Text = "Gameplay",
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Action = () => game?.PerformFromScreen(screen =>
|
||||||
|
{
|
||||||
|
if (screen is Player)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var replayGeneratingMod = ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||||
|
if (replayGeneratingMod != null)
|
||||||
|
screen.Push(new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateReplayScore(beatmap, mods)));
|
||||||
|
}, new[] { typeof(Player), typeof(SongSelect) })
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SceneButton : OsuButton
|
||||||
|
{
|
||||||
|
public SceneButton()
|
||||||
|
{
|
||||||
|
Width = 100;
|
||||||
|
Height = BUTTON_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours)
|
||||||
|
{
|
||||||
|
BackgroundColour = overlayColourProvider?.Background3 ?? colours.Blue3;
|
||||||
|
Content.CornerRadius = 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
public enum SkinnableTarget
|
public enum SkinnableTarget
|
||||||
{
|
{
|
||||||
MainHUDComponents
|
MainHUDComponents,
|
||||||
|
SongSelect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user