using System.Collections.Generic; using Fantasy; using Fantasy.Entitas; namespace NBF { /// /// 地图房间 /// public class MapRoom : Entity { /// /// 是否本地房间 /// public bool IsLocalRoom; /// /// 房间序号id /// public int RoomId; /// /// 房间代码 /// public string Code = string.Empty; /// /// 房间玩家 /// public Dictionary Units = new Dictionary(); /// /// 房主 /// public long Owner; /// /// 创建时间 /// public long CreateTime; /// /// 房间地图 /// public int Map; public void AddUnit(MapUnitInfo unit) { var player = Create(Game.Main, unit.Id, true, true); Units[unit.Id] = player; player.InitPlayer(unit); } public void RemoveUnit(long id) { if (Units.Remove(id, out var player)) { player.Dispose(); } } } }