yuanshen/Yuanshen.Gameserver/Database/PlayerSessionRegistry.cs
wisedev fc2ac1050f First working version of the server
KCP gameserver with packet dispatch, scene streaming, combat, gacha and the
shop, plus a small HTTP server for the login flow and the wish history page.

Game data under assets is pulled out of the client instead of being typed by
hand. The excel tables come from the packed bin container and the spawn points
from the compiled scene scripts.
2026-09-04 02:10:50 +03:00

16 lines
531 B
C#

using System.Collections.Concurrent;
namespace Yuanshen.Gameserver.Database;
internal sealed class PlayerSessionRegistry
{
private readonly ConcurrentDictionary<uint, long> _owners = new();
public void Acquire(uint uid, long sessionId) => _owners[uid] = sessionId;
public bool IsOwner(uint uid, long sessionId)
=> _owners.TryGetValue(uid, out long owner) && owner == sessionId;
public void Release(uint uid, long sessionId)
=> _owners.TryRemove(new KeyValuePair<uint, long>(uid, sessionId));
}