1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Remove unused interface class for simplicity

This commit is contained in:
Dean Herbert 2021-05-10 15:31:14 +09:00
parent 95a8f21ab2
commit 95a497e9df
3 changed files with 6 additions and 34 deletions

View File

@ -47,7 +47,7 @@ namespace osu.Game.Extensions
public static SkinnableInfo CreateSerialisedInformation(this Drawable component) => new SkinnableInfo(component);
public static void ApplySerialisedInformation(this Drawable component, ISkinnableInfo info)
public static void ApplySerialisedInformation(this Drawable component, SkinnableInfo info)
{
// todo: can probably make this better via deserialisation directly using a common interface.
component.Position = info.Position;

View File

@ -1,26 +0,0 @@
// 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 System;
using osu.Framework.Graphics;
using osu.Game.IO.Serialization;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Screens.Play.HUD
{
public interface ISkinnableInfo : IJsonSerializable
{
public Type Type { get; set; }
public SkinnableTarget? Target { get; set; }
public Vector2 Position { get; set; }
public float Rotation { get; set; }
public Vector2 Scale { get; set; }
public Anchor Anchor { get; set; }
}
}

View File

@ -6,6 +6,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using osu.Framework.Graphics;
using osu.Game.Extensions;
using osu.Game.IO.Serialization;
using osu.Game.Skinning;
using osuTK;
@ -15,7 +16,7 @@ namespace osu.Game.Screens.Play.HUD
/// Serialised information governing custom changes to an <see cref="ISkinnableComponent"/>.
/// </summary>
[Serializable]
public class SkinnableInfo : ISkinnableInfo
public class SkinnableInfo : IJsonSerializable
{
public SkinnableInfo()
{
@ -47,14 +48,11 @@ namespace osu.Game.Screens.Play.HUD
public Vector2 Scale { get; set; }
public Anchor Anchor { get; set; }
}
public static class SkinnableInfoExtensions
{
public static Drawable CreateInstance(this ISkinnableInfo info)
public Drawable CreateInstance()
{
Drawable d = (Drawable)Activator.CreateInstance(info.Type);
d.ApplySerialisedInformation(info);
Drawable d = (Drawable)Activator.CreateInstance(Type);
d.ApplySerialisedInformation(this);
return d;
}
}