6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) + game logic (GameFix/GameDAL/ServerData) + network layer (NetWorkMessage) + data layer (ObjectModel) + utilities (MrWu/Core/Config/CloudAPI/dll) + adapters (zyxAdapter/base) .NET 8.0 C# solution, 16 projects, 958 source files
35 lines
787 B
C#
35 lines
787 B
C#
using System;
|
|
|
|
namespace Server.Core
|
|
{
|
|
public abstract class SingleInstance
|
|
{
|
|
}
|
|
|
|
public abstract class SingleInstance<T> : SingleInstance where T : SingleInstance,new()
|
|
{
|
|
private static T _instance;
|
|
|
|
private static readonly Object instaceLock = new Object();
|
|
|
|
public static T Instance
|
|
{
|
|
get
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
lock (instaceLock)
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
_instance = new T();
|
|
}
|
|
}
|
|
}
|
|
|
|
return _instance;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |