using Gameplay.Character; using Gameplay.Unit.Data; namespace Gameplay.Unit { public static class GameUnitEx { public static string GetUnitDesc(this GameUnit unit) { var isSelf = unit.commonData.troopId == ETroopsId.Self; switch (unit.gameunitType) { case EGameUnitType.Character: if (isSelf) { return "我方角色:" + unit.GetID(); } return "敌方角色:" + unit.GetID(); case EGameUnitType.Summon: if (isSelf) { return "我方召唤物:" + unit.GetID(); } return "敌方召唤物:" + unit.GetID(); case EGameUnitType.Vehicle: if (isSelf) { return "我方载具:" + unit.GetID(); } return "敌方载具:" + unit.GetID(); case EGameUnitType.Player: if (isSelf) { return "我方玩家:" + unit.GetID(); } return "敌方玩家:" + unit.GetID(); default: DebugUtil.LogError($"未知类型:{unit.gameunitType} Id:{unit.GetID()}"); return "未知类型:" + unit.gameunitType + "Id:" + unit.GetID(); } DebugUtil.LogError($"错误类型:{unit.gameunitType} Id:{unit.GetID()}"); return "错误类型:" + unit.gameunitType + "Id:" + unit.GetID(); } } }