refactoring to support c# 7.3

This commit is contained in:
Mikhail 2023-06-12 20:46:51 +08:00
parent e5d6391630
commit b0c0014faf
2 changed files with 16 additions and 8 deletions

View File

@ -55,7 +55,15 @@ namespace DCFApixels.DragonECS
public abstract class DebugService public abstract class DebugService
{ {
private static DebugService _instance; private static DebugService _instance;
public static DebugService Instance => _instance ??= new DefaultDebugService(); public static DebugService Instance
{
get
{
if (_instance == null)
_instance = new DefaultDebugService();
return _instance;
}
}
public static void Set<T>() where T : DebugService, new() => Set(new T()); public static void Set<T>() where T : DebugService, new() => Set(new T());
public static void Set(DebugService service) public static void Set(DebugService service)

View File

@ -9,11 +9,11 @@ namespace DCFApixels.DragonECS
public interface IEcsPool public interface IEcsPool
{ {
#region Properties #region Properties
public int ComponentID { get; } int ComponentID { get; }
public Type ComponentType { get; } Type ComponentType { get; }
public EcsWorld World { get; } EcsWorld World { get; }
public int Count { get; } int Count { get; }
public int Capacity { get; } int Capacity { get; }
#endregion #endregion
#region Methods #region Methods
@ -127,7 +127,7 @@ namespace DCFApixels.DragonECS
#region Reset/Copy interfaces #region Reset/Copy interfaces
public interface IEcsComponentReset<T> public interface IEcsComponentReset<T>
{ {
public void Reset(ref T component); void Reset(ref T component);
} }
public static class EcsComponentResetHandler<T> public static class EcsComponentResetHandler<T>
{ {
@ -163,7 +163,7 @@ namespace DCFApixels.DragonECS
public interface IEcsComponentCopy<T> public interface IEcsComponentCopy<T>
{ {
public void Copy(ref T from, ref T to); void Copy(ref T from, ref T to);
} }
public static class EcsComponentCopyHandler<T> public static class EcsComponentCopyHandler<T>
{ {