CTT/Server/Hotfix/Game/System/User/UnitComponentSystem.cs

54 lines
1.3 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using ET.EventType;
using System;
using System.Collections.Generic;
using System.Text;
namespace ET
{
public class UnitComponentAeakeSystem : AwakeSystem<UnitComponent>
{
public override void Awake(UnitComponent self)
{
self.Awake();
}
}
public class UnitComponentDestroySystem : DestroySystem<UnitComponent>
{
public override void Destroy(UnitComponent self)
{
self.idUnits.Clear();
}
}
public static class UnitComponentSystem
{
public static void Awake(this UnitComponent self)
{
}
public static void Add(this UnitComponent self, Unit unit)
{
self.idUnits[unit.Id] = unit;
}
public static Unit Get(this UnitComponent self, long id)
{
self.idUnits.TryGetValue(id, out Unit unit);
return unit;
}
public static void Remove(this UnitComponent self, long id)
{
self.idUnits.Remove(id);
}
public static void RemoveNoDispose(this UnitComponent self, long id)
{
self.idUnits.Remove(id);
}
public static IEnumerable<Unit> GetAll(this UnitComponent self)
{
return self.idUnits.Values;
}
}
}