void OnWorldBossGetBattleInfoHandler(C2G.WorldBossGetBattleInfo packet, C2G.WorldBossGetBattleInfoAck ack) { TeamData team_data = new TeamData(ack.team_data.team_type, null); List <Creature> Creatures = new List <Creature>(); for (int i = 0; i < ack.creatures.Count; ++i) { List <pd_EquipData> equips = ack.equips.FindAll(e => e.creature_idx == ack.creatures[i].creature_idx); pd_EquipData weapon = equips.Find(e => EquipInfoManager.Instance.GetInfoByIdn(e.equip_idn).CategoryInfo.EquipType == SharedData.eEquipType.weapon); pd_EquipData armor = equips.Find(e => EquipInfoManager.Instance.GetInfoByIdn(e.equip_idn).CategoryInfo.EquipType == SharedData.eEquipType.armor); List <Rune> runes = ack.runes.FindAll(r => r.creature_idx == ack.creatures[i].creature_idx).Select(e => new Rune(e)).ToList(); Creatures.Add(new Creature(ack.creatures[i], weapon, armor, runes)); } team_data.SetCreatures(ack.team_data.creature_infos.Select(c => new TeamCreature(Creatures.Find(lc => lc.Idx == c.team_creature_idx), c.auto_skill_index)).ToList(), false); if (ack.team_data.leader_creature_idx > 0) { Creature leader_creature = Creatures.Find(c => c.Idx == ack.team_data.leader_creature_idx); if (leader_creature != null) { team_data.SetLeaderCreature(leader_creature, ack.team_data.use_leader_skill_type); } } Popup.Instance.Show(ePopupMode.WorldBossPlayerInfo, m_WorldBossInfo, team_data); }
public void UpdateEquip(Creature creature, pd_EquipData equip_data) { Equip equip = null; if (creature.Weapon.EquipIdx == equip_data.equip_idx) { equip = creature.Weapon; } else if (creature.Armor.EquipIdx == equip_data.equip_idx) { equip = creature.Armor; } else { throw new Exception("invalid equip"); } equip.Set(equip_data); creature.CalculateStat(); IsSorted = false; SetUpdateNotify(); Save(); EquipManager.Instance.Save(); }
void SetInternal(pd_EquipData data) { Info = EquipInfoManager.Instance.GetInfoByIdn(data.equip_idn); EquipIdx = data.equip_idx; CreatureIdx = data.creature_idx; if (Stuffs != null) { Stuffs.Clear(); } else { Stuffs = new List <Item>(); } if (Info.Enchants.Count > 0) { EnchantInfo = Info.Enchants[data.equip_enchant]; foreach (StuffInfo stuff_info in EnchantInfo.Stuffs) { Stuffs.Add(ItemManager.Instance.GetOrCreateItem(stuff_info)); } } }
public pd_EquipData CreateSaveData() { pd_EquipData data = new pd_EquipData(); data.equip_idx = EquipIdx; data.creature_idx = CreatureIdx; data.equip_idn = Info.IDN; data.equip_level = (short)Info.Grade; data.equip_enchant = EnchantLevel; return(data); }
public PVPBattleInfo(pd_PvpPlayerInfo enemy_info, C2G.PvpGetBattleInfoAck ack) { this.enemy_info = enemy_info; for (int i = 0; i < ack.creatures.Count; ++i) { List <pd_EquipData> equips = ack.equips.FindAll(e => e.creature_idx == ack.creatures[i].creature_idx); pd_EquipData weapon = equips.Find(e => EquipInfoManager.Instance.GetInfoByIdn(e.equip_idn).CategoryInfo.EquipType == SharedData.eEquipType.weapon); pd_EquipData armor = equips.Find(e => EquipInfoManager.Instance.GetInfoByIdn(e.equip_idn).CategoryInfo.EquipType == SharedData.eEquipType.armor); List <Rune> runes = ack.runes.FindAll(r => r.creature_idx == ack.creatures[i].creature_idx).Select(e => new Rune(e)).ToList(); Creatures.Add(new Creature(ack.creatures[i], weapon, armor, runes)); } this.enemy_team_data = new TeamData(ack.team_data.team_type, null); enemy_team_data.SetCreatures(ack.team_data.creature_infos.Select(c => new TeamCreature(Creatures.Find(lc => lc.Idx == c.team_creature_idx), c.auto_skill_index)).ToList(), false); if (ack.team_data.leader_creature_idx > 0) { Creature leader_creature = Creatures.Find(c => c.Idx == ack.team_data.leader_creature_idx); if (leader_creature != null) { enemy_team_data.SetLeaderCreature(leader_creature, ack.team_data.use_leader_skill_type); } } }
void SetInternal(pd_CreatureData data, pd_EquipData weapon, pd_EquipData armor, List <Rune> runes) //设置Creature对象的信息 { this.Info = CreatureInfoManager.Instance.GetInfoByIdn(data.creature_idn); Idx = data.creature_idx; SkinName = Info.GetSkinName(data.skin_index); Grade = data.creature_grade; Level = data.creature_level; Enchant = data.creature_enchant; EnchantPoint = data.creature_enchant_point; Exp = data.creature_exp; IsLock = data.is_lock; Skills = new List <Skill>(); for (short i = 0; i < Info.Skills.Count; ++i) { SkillInfo skillInfo = Info.Skills[i]; short skill_level = Level; if (i > 0) { if (i - 1 < data.skill_level.Count) { skill_level = data.skill_level[i - 1]; } else { skill_level = 1; } } Skills.Add(new Skill(i, this, skillInfo, skill_level)); } if (Info.TeamSkill != null) { TeamSkill = new Skill(-1, this, Info.TeamSkill, Level); } if (weapon == null) { Weapon = EquipManager.Instance.GetEquipByIdx(data.equip_idx[0]); } else { Weapon = new Equip(weapon); } if (armor == null) { Armor = EquipManager.Instance.GetEquipByIdx(data.equip_idx[1]); } else { Armor = new Equip(armor); } if (runes != null) { Runes = runes; } else { Runes = RuneManager.Instance.GetRunesByCreatureIdx(this.Idx); } CalculateStat(); }
public Creature(pd_CreatureData data, pd_EquipData weapon = null, pd_EquipData armor = null, List <Rune> runes = null) { SetInternal(data, weapon, armor, runes); }
public void Set(pd_EquipData data) { SetInternal(data); }
public Equip(pd_EquipData data) { SetInternal(data); }