mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] GameTickWacher
[+] GameTickWacher
This commit is contained in:
27
Assets/GameScripts/HotFix/GameBase/Singleton/Singleton.cs
Normal file
27
Assets/GameScripts/HotFix/GameBase/Singleton/Singleton.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using TEngine;
|
||||
|
||||
namespace GameBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用单例。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">泛型T。</typeparam>
|
||||
public class Singleton<T> where T : new()
|
||||
{
|
||||
private static T _instance;
|
||||
|
||||
public static T Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null == _instance)
|
||||
{
|
||||
_instance = new T();
|
||||
Log.Assert(_instance != null);
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b68a449df312429cbb27873984ec238e
|
||||
timeCreated: 1681214042
|
Reference in New Issue
Block a user