public int Query(FightAttribute _type) { if (!attributeDict.ContainsKey(_type)) { WDebug.Log(string.Format("FightAttribute {0} is not exist!", _type)); return(0); } return(attributeDict[_type].value); }
public void Add(FightAttribute _type, int _value) { if (!attributeDict.ContainsKey(_type)) { WDebug.Log(string.Format("FightAttribute {0} is not exist!", _type)); return; } attributeDict[_type].value += _value; if (AttributeChangeEvent != null) { AttributeChangeEvent(_type, attributeDict[_type].value); } }
//数据转换 public static PetItemDataModel PetItem2DataModel(BagItemDataModel pet, PetItemDataModel petData = null) { if (string.IsNullOrEmpty(StrSoul)) { StrSoul = GameUtils.GetDictionaryText(626); } int[] StateString = { 611, 603, 600, 602, 601 }; int[] AttrIndex = { 5, 6, 7, 8, 10, 11, 13 }; if (null == petData) { petData = new PetItemDataModel(); } var tablePet = Table.GetPet(pet.ItemId); if (null == tablePet) { return(null); } petData.Name = tablePet.Name; petData.PetId = pet.ItemId; petData.ItemId = pet.ItemId; petData.Type = tablePet.Type; petData.BagItemIndex = pet.Index; petData.Level = pet.Exdata[PetItemExtDataIdx.Level]; petData.StarLevel = tablePet.Ladder; //pet.Exdata[PetItemExtDataIdx.StarLevel]; petData.State = pet.Exdata[PetItemExtDataIdx.State]; petData.PieceNum = pet.Exdata[PetItemExtDataIdx.FragmentNum]; petData.MaxNum = tablePet.NeedItemCount; var stateIdx = petData.State; var state = (PetStateType)stateIdx; var str = ""; if (PetStateType.Piece == state) { var tableItem = Table.GetItemBase(tablePet.NeedItemId); //petData.StarLevel = 0; petData.MaxNum = tableItem.Exdata[1]; // if (petData.PieceNum >= petData.MaxNum) // { // str = GameUtils.GetDictionaryText(StateString[stateIdx]); // } } else { if (PetStateType.Idle == state) { } else if (PetStateType.Mission == state) { /* * string missionName = ""; * { * var __list11 = CityManager.Instance.PetMissionDataList; * var __listCount11 = __list11.Count; * for (int __i11 = 0; __i11 < __listCount11; ++__i11) * { * var mission = __list11[__i11]; * { * { * // foreach(var missionPet in mission.PetList) * var __enumerator13 = (mission.PetList).GetEnumerator(); * while (__enumerator13.MoveNext()) * { * var missionPet = __enumerator13.Current; * { * if (missionPet == petData.PetId) * { * missionName = mission.Name; * break; * } * } * } * } * * if (!string.IsNullOrEmpty(missionName)) * break; * } * } * } * str = string.Format("{0}{1}", GameUtils.GetDictionaryText(300127),missionName); * */ str = GameUtils.GetDictionaryText(300127); } else if (PetStateType.Building == state) { var find = false; { var __list12 = Instance.BuildingDataList; var __listCount12 = __list12.Count; for (var __i12 = 0; __i12 < __listCount12; ++__i12) { var tempBuilding = __list12[__i12]; { { // foreach(var tempPet in tempBuilding.PetList) var __enumerator14 = (tempBuilding.PetList).GetEnumerator(); while (__enumerator14.MoveNext()) { var tempPet = __enumerator14.Current; { if (tempPet == pet.ItemId) { var tableBuilding = Table.GetBuilding(tempBuilding.TypeId); str = string.Format(GameUtils.GetDictionaryText(StateString[stateIdx]), tableBuilding.Name); find = true; break; } } } } if (find) { break; } } } } } //可进阶或者合成的 if (tablePet.NeedItemCount > 0 && petData.PieceNum >= petData.MaxNum) { if (PetStateType.Piece == state) { //可进阶 } //str = GameUtils.GetDictionaryText(612); } } petData.Desc = str; var myRecord = new PetSkillRecord(); //技能 var templist = new List <int>(); var PetItemDataModelMaxSkill1 = PetItemDataModel.MaxSkill; for (var i = 0; i < PetItemDataModelMaxSkill1; i++) { petData.Skill.Skills[i].SkillId = tablePet.Skill[i]; petData.Skill.Skills[i].UnLockLevel = tablePet.ActiveLadder[i]; var active = petData.StarLevel >= petData.Skill.Skills[i].UnLockLevel; petData.Skill.Skills[i].Active = active; if (active) { petData.Skill.Skills[i].Col = MColor.white; } else { petData.Skill.Skills[i].Col = MColor.grey; } } //特殊技能 int[] SkillLevelLimit = { tablePet.Speciality[0], tablePet.Speciality[1], tablePet.Speciality[2] }; const int PetItemDataModelMaxSkill2 = PetItemDataModel.MaxSkill; for (var i = 0; i < PetItemDataModelMaxSkill2; i++) { petData.Skill.SpecialSkills[i].UnLockLevel = SkillLevelLimit[i]; if (petData.Level < SkillLevelLimit[i]) { petData.Skill.SpecialSkills[i].Name = "[ff0000]" + string.Format(GameUtils.GetDictionaryText(300204), SkillLevelLimit[i]) + "[-]"; ; petData.Skill.SpecialSkills[i].Desc = ""; petData.Skill.SpecialSkills[i].Col = MColor.white; petData.Skill.SpecialSkills[i].Active = false; } else { petData.Skill.SpecialSkills[i].Col = new Color(0, 1, 1); petData.Skill.SpecialSkills[i].SkillId = pet.Exdata[PetItemExtDataIdx.SpecialSkill_Begin + i]; var tableSkill = Table.GetPetSkill(petData.Skill.SpecialSkills[i].SkillId); if (null == tableSkill) { petData.Skill.SpecialSkills[i].Name = ""; petData.Skill.SpecialSkills[i].Desc = ""; petData.Skill.SpecialSkills[i].Active = false; } else { petData.Skill.SpecialSkills[i].Name = tableSkill.Name; petData.Skill.SpecialSkills[i].Desc = tableSkill.Desc; petData.Skill.SpecialSkills[i].Active = true; } } } /* * if (PetStateType.Idle == state) * { * petData.ShowCheck = true; * petData.ShowMask = false; * } * else * { * petData.ShowCheck = false; * petData.ShowMask = true; * } */ petData.Attributes[0].Type = 1001; petData.Attributes[0].Value = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.PhyPowerMin, petData.Level); petData.Attributes[0].ValueEx = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.PhyPowerMax, petData.Level); petData.Attributes[1].Type = 1002; petData.Attributes[1].Value = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.MagPowerMin, petData.Level); petData.Attributes[1].ValueEx = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.MagPowerMax, petData.Level); petData.Attributes[2].Type = 10; petData.Attributes[2].Value = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.PhyArmor, petData.Level); petData.Attributes[3].Type = 11; petData.Attributes[3].Value = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.MagArmor, petData.Level); petData.Attributes[4].Type = 13; petData.Attributes[4].Value = FightAttribute.GetPetAttribut(petData.PetId, eAttributeType.HpMax, petData.Level); var Ref = new Dictionary <eAttributeType, int>(); petData.FightPoint = FightAttribute.CalculatePetFightPower(tablePet, petData.Level, Ref); return(petData); }