mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:12:54 +08:00
Use interface in place of SkinnableTargetContainer
This commit is contained in:
parent
0959e7156a
commit
3ea469813c
@ -1,7 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Extensions;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -20,6 +25,12 @@ namespace osu.Game.Skinning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IBindableList<ISkinnableDrawable> Components { get; }
|
IBindableList<ISkinnableDrawable> Components { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serialise all children as <see cref="SkinnableInfo"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The serialised content.</returns>
|
||||||
|
IEnumerable<SkinnableInfo> CreateSkinnableInfo() => Components.Select(d => ((Drawable)d).CreateSkinnableInfo());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reload this target from the current skin.
|
/// Reload this target from the current skin.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Skinning
|
|||||||
/// Remove all stored customisations for the provided target.
|
/// Remove all stored customisations for the provided target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="targetContainer">The target container to reset.</param>
|
/// <param name="targetContainer">The target container to reset.</param>
|
||||||
public void ResetDrawableTarget(SkinnableTargetContainer targetContainer)
|
public void ResetDrawableTarget(ISkinnableTarget targetContainer)
|
||||||
{
|
{
|
||||||
DrawableComponentInfo.Remove(targetContainer.Target);
|
DrawableComponentInfo.Remove(targetContainer.Target);
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ namespace osu.Game.Skinning
|
|||||||
/// Update serialised information for the provided target.
|
/// Update serialised information for the provided target.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="targetContainer">The target container to serialise to this skin.</param>
|
/// <param name="targetContainer">The target container to serialise to this skin.</param>
|
||||||
public void UpdateDrawableTarget(SkinnableTargetContainer targetContainer)
|
public void UpdateDrawableTarget(ISkinnableTarget targetContainer)
|
||||||
{
|
{
|
||||||
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray();
|
DrawableComponentInfo[targetContainer.Target] = targetContainer.CreateSkinnableInfo().ToArray();
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Extensions;
|
|
||||||
using osu.Game.Screens.Play.HUD;
|
|
||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
@ -64,12 +61,6 @@ namespace osu.Game.Skinning
|
|||||||
components.Add(component);
|
components.Add(component);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serialise all children as <see cref="SkinnableInfo"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The serialised content.</returns>
|
|
||||||
public IEnumerable<SkinnableInfo> CreateSkinnableInfo() => components.Select(d => ((Drawable)d).CreateSkinnableInfo());
|
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
{
|
{
|
||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
Loading…
Reference in New Issue
Block a user