Initial commit: Client Doc docs Server Tools

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ud18010
2026-07-10 10:24:29 +08:00
co-authored by Cursor
commit 7e35d8da31
3374 changed files with 680813 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
using System;
using XWorld.Framework;
namespace XWorld.Server.Host
{
public sealed class LoadedGameModule
{
public string GameId { get; }
public int Version { get; }
public Func<IGameServerRoom> CreateRoom { get; private set; }
private GameModuleAlc _alc; // 强引用;Unload 时置空
internal LoadedGameModule(string gameId, int version, GameModuleAlc alc, Func<IGameServerRoom> factory)
{
GameId = gameId; Version = version; _alc = alc; CreateRoom = factory;
}
// 卸载并返回 ALC 弱引用,便于上层做 GC 内存回收断言
public WeakReference Unload()
{
var alc = _alc;
_alc = null;
// 切断工厂闭包对 entryType→Assembly→ALC 的引用链;卸载后再调用即抛错
CreateRoom = () => throw new ObjectDisposedException($"GameModule {GameId}@{Version} 已卸载");
var weak = new WeakReference(alc);
alc.Unload();
return weak;
}
}
}