public BattlePlayerData(MapPlayerData mapPlayerData, BattlePlayer owner) : base(null, null) { Name = mapPlayerData.Name; Level = mapPlayerData.Level; HP = mapPlayerData.HP; MaxHP = mapPlayerData.MaxHP; MP = mapPlayerData.MP; MaxMP = mapPlayerData.MaxMP; HeadIcon = mapPlayerData.HeadIcon; MapSkillID = mapPlayerData.MapSkillID; BattleSkillID = mapPlayerData.BattleSkillID; UsingCharacter = mapPlayerData.UsingCharacter; Food = mapPlayerData.Food; MaxFood = mapPlayerData.MaxFood; Gold = mapPlayerData.Gold; SkillId = mapPlayerData.BattleSkillID; ClassData = mapPlayerData.ClassData; //玩家的行动值初始 AP = MaxAP = 0; CardList.Clear(); EquipList.Capacity = (mapPlayerData.EquipList.Count); for (int i = 0; i < mapPlayerData.EquipList.Count; i++) { List <int> actions = mapPlayerData.EquipList[i].Data.ActionTypes; for (int j = 0; j < actions.Count; j++) { if (actions[i] == (int)BattleActionType.AddEquipment) { EquipList.Add(new BattleEquipData(mapPlayerData.EquipList[j].Data.ActionParams[0], owner)); break; } } } CardList.Capacity = mapPlayerData.CardList.Count; for (int i = 0; i < mapPlayerData.CardList.Count; i++) { CardList.Add(new BattleCardData(mapPlayerData.CardList[i].CardId, owner)); } BuffList.Capacity = mapPlayerData.BuffList.Count; for (int i = 0; i < mapPlayerData.BuffList.Count; i++) { BuffList.Add(new BattleBuffData(mapPlayerData.BuffList[i].Data.ActionParams[0], -1, 0, new BattleCardData(mapPlayerData.BuffList[i].CardId, owner), owner, owner)); } CurrentCardList.Capacity = CardList.Count; for (int i = 0; i < CardList.Count; i++) { CurrentCardList.Add(new BattleCardData(CardList[i].CardId, owner)); } }
public MapPlayer(Player player) { m_Player = player; LoadedModel = false; if (m_Player is MyPlayer) { m_Data = new MapPlayerData(m_Player.Data, (m_Player as MyPlayer).DetailData); } else { m_Data = new MapPlayerData(m_Player.Data, null); } }