Update EcsDebug.cs

This commit is contained in:
DCFApixels 2025-03-21 14:32:21 +08:00
parent a7aa1cd4cb
commit 940e51d77a

View File

@ -228,7 +228,7 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
#region Constructors #region Static Constructor
static DebugService() static DebugService()
{ {
Set(new DefaultDebugService()); Set(new DefaultDebugService());
@ -262,15 +262,17 @@ namespace DCFApixels.DragonECS
{ {
service.OnNewProfilerMark(record.Value, record.Key); service.OnNewProfilerMark(record.Value, record.Key);
} }
service.OnServiceSetup(oldService); oldService.OnDisableBaseService(service);
service.OnEnableBaseService(oldService);
OnServiceChanged(service); OnServiceChanged(service);
} }
} }
} }
#endregion #endregion
#region OnServiceSetup/CreateThreadInstance #region OnEnable/OnDisable/CreateThreadInstance
protected virtual void OnServiceSetup(DebugService oldService) { } protected virtual void OnEnableBaseService(DebugService prevService) { }
protected virtual void OnDisableBaseService(DebugService nextService) { }
protected abstract DebugService CreateThreadInstance(); protected abstract DebugService CreateThreadInstance();
#endregion #endregion
@ -349,9 +351,11 @@ namespace DCFApixels.DragonECS
} }
#endregion #endregion
public static OnServiceChangedHandler OnServiceChanged = delegate { }; #region Events
public static event OnServiceChangedHandler OnServiceChanged = delegate { };
public delegate void OnServiceChangedHandler(DebugService service); public delegate void OnServiceChangedHandler(DebugService service);
#endregion
} }
public static class DebugServiceExtensions public static class DebugServiceExtensions
{ {