37 lines
1.2 KiB
C#
Executable File
37 lines
1.2 KiB
C#
Executable File
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 AutoBattleIdleComponent autoBattleIdle);
|
|
return autoBattleIdle;
|
|
}
|
|
public static void Remove(this BattleIdleMap self, long leaderId)
|
|
{
|
|
if (self.dic.TryGetValue(leaderId, out AutoBattleIdleComponent autoBattleIdle))
|
|
{
|
|
autoBattleIdle.Dispose();
|
|
}
|
|
self.dic.Remove(leaderId);
|
|
}
|
|
|
|
}
|
|
}
|