水电费

This commit is contained in:
bob
2025-07-16 17:47:53 +08:00
parent 7cccd2a81c
commit 3bd1ffbb75
75 changed files with 2148 additions and 1265 deletions

View File

@@ -0,0 +1,50 @@
using Fantasy.Entitas.Interface;
using Fantasy.Gate;
namespace System.Gate.System;
public sealed class GameAccountManageComponentDestroySystem : DestroySystem<GameAccountManageComponent>
{
protected override void Destroy(GameAccountManageComponent self)
{
foreach (var (_, gameAccount) in self.Accounts)
{
gameAccount.Dispose();
}
self.Accounts.Clear();
}
}
public static class GameAccountManageComponentSystem
{
public static void Add(this GameAccountManageComponent self, GameAccount account)
{
self.Accounts.Add(account.Id, account);
}
public static GameAccount? Get(this GameAccountManageComponent self, long accountId)
{
return self.Accounts.GetValueOrDefault(accountId);
}
public static bool TryGet(this GameAccountManageComponent self, long accountId, out GameAccount? account)
{
return self.Accounts.TryGetValue(accountId, out account);
}
public static void Remove(this GameAccountManageComponent self, long accountId, bool isDispose = true)
{
if (!self.Accounts.Remove(accountId, out var account))
{
return;
}
if (!isDispose)
{
return;
}
account.Dispose();
}
}