37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
public static class BattleIdleMapSystem
|
|||
|
{
|
|||
|
|
|||
|
public static void Create(this BattleIdleMap self, long leaderId, int sceneId)
|
|||
|
{
|
|||
|
Team team = TeamComponent.Instance.Get(leaderId);
|
|||
|
if (team == null)
|
|||
|
{
|
|||
|
Log.Error($"team is null where id is {leaderId}");
|
|||
|
return;
|
|||
|
}
|
|||
|
AutoBattleIdleComponent autoBattleIdle = EntityFactory.CreateWithParent<AutoBattleIdleComponent, Team>(self, team);
|
|||
|
autoBattleIdle.Init(sceneId);
|
|||
|
self.dic[leaderId] = autoBattleIdle;
|
|||
|
}
|
|||
|
public static AutoBattleIdleComponent Get(this BattleIdleMap self, long leaderId)
|
|||
|
{
|
|||
|
self.dic.TryGetValue(leaderId, out var autoBattleIdle);
|
|||
|
return autoBattleIdle;
|
|||
|
}
|
|||
|
public static void Remove(this BattleIdleMap self, long leaderId)
|
|||
|
{
|
|||
|
if (self.dic.TryGetValue(leaderId, out var autoBattleIdle))
|
|||
|
{
|
|||
|
autoBattleIdle.Dispose();
|
|||
|
}
|
|||
|
self.dic.Remove(leaderId);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|