|
@@ -1,5 +1,5 @@
|
|
|
using System;
|
|
using System;
|
|
|
-using System.Threading;
|
|
|
|
|
|
|
+using System.ComponentModel;
|
|
|
|
|
|
|
|
namespace ET
|
|
namespace ET
|
|
|
{
|
|
{
|
|
@@ -9,9 +9,9 @@ namespace ET
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public abstract class Singleton<T>: ISingleton where T: Singleton<T>, new()
|
|
|
|
|
|
|
+ public abstract class Singleton<T>: ISingleton, ISupportInitialize where T: Singleton<T>, new()
|
|
|
{
|
|
{
|
|
|
- protected bool isDisposed;
|
|
|
|
|
|
|
+ private bool isDisposed;
|
|
|
|
|
|
|
|
[StaticField]
|
|
[StaticField]
|
|
|
private static T instance;
|
|
private static T instance;
|
|
@@ -54,56 +54,13 @@ namespace ET
|
|
|
|
|
|
|
|
this.Destroy();
|
|
this.Destroy();
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public abstract class SingletonReload<T>: ISingleton, ISingletonLoad where T: SingletonReload<T>, new()
|
|
|
|
|
- {
|
|
|
|
|
- private bool isDisposed;
|
|
|
|
|
-
|
|
|
|
|
- [StaticField]
|
|
|
|
|
- private static T instance;
|
|
|
|
|
-
|
|
|
|
|
- public static T Instance
|
|
|
|
|
- {
|
|
|
|
|
- get
|
|
|
|
|
- {
|
|
|
|
|
- return instance;
|
|
|
|
|
- }
|
|
|
|
|
- private set
|
|
|
|
|
- {
|
|
|
|
|
- instance = value;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- public virtual void Register()
|
|
|
|
|
|
|
+ public virtual void BeginInit()
|
|
|
{
|
|
{
|
|
|
- Instance = (T)this;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public bool IsDisposed()
|
|
|
|
|
|
|
+ public virtual void EndInit()
|
|
|
{
|
|
{
|
|
|
- return this.isDisposed;
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- protected virtual void Destroy()
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- void IDisposable.Dispose()
|
|
|
|
|
- {
|
|
|
|
|
- if (this.isDisposed)
|
|
|
|
|
- {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- this.isDisposed = true;
|
|
|
|
|
-
|
|
|
|
|
- Instance = null;
|
|
|
|
|
-
|
|
|
|
|
- this.Destroy();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public abstract void Load();
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|