void SelectEquip(eEquipType type) { if (type == eEquipType.Weapon) { SelectWeapon(); } }
public void RemoveEquip(eEquipType type) { if (m_equipList == null) { return; } object val = null; if (m_equipList.TryGetValue((int)type, out val)) { if (type == eEquipType.HandLeftAndRight) { int[] hid = (int[])val; EntityManager.Inst.RemoveEntity(hid[0]); EntityManager.Inst.RemoveEntity(hid[1]); m_equipList.Remove((int)type); } else { int hid = (int)val; EntityManager.Inst.RemoveEntity(hid); m_equipList.Remove((int)type); } } }
public void WearEquipment(eEquipType equiptype, double value) { switch (equiptype) { case eEquipType.Attack: mATK += value; break; case eEquipType.Defend: mDEF += value; break; case eEquipType.Heal: mHEAL += value; break; default: Debug.LogError("Wrong EquipType : " + equiptype); break; } }
public void AddEquip(eEquipType type, int resId) { if (m_equipList == null) { m_equipList = new Dictionary <int, object>(); } // 如果该部位有装备,相同资源不处理,不同的先移除 object val = null; if (m_equipList.TryGetValue((int)type, out val)) { if (type == eEquipType.HandLeftAndRight) { int[] hid = (int[])val; Entity ent = EntityManager.Inst.GetEnity(hid[0]); if (ent.GetResource().m_resInfo.nResID == resId) { return; } EntityManager.Inst.RemoveEntity(hid[0]); EntityManager.Inst.RemoveEntity(hid[1]); m_equipList.Remove((int)type); } else { int hid = (int)val; Entity ent = EntityManager.Inst.GetEnity(hid); if (ent == null || ent.GetResource() == null || ent.GetResource().m_resInfo.nResID == resId) { return; } EntityManager.Inst.RemoveEntity(hid); m_equipList.Remove((int)type); } } if (type == eEquipType.HandLeftAndRight) { int[] hid = new int[2]; hid[0] = CreatEquip(resId, HAND_RIGHT); hid[1] = CreatEquip(resId, HAND_LEFT); m_equipList[(int)type] = hid; } else { if (type == eEquipType.HandRight) { m_equipList[(int)type] = CreatEquip(resId, HAND_RIGHT); } else if (type == eEquipType.Back) { m_equipList[(int)type] = CreatEquip(resId, BACK); } } }
public StatInfo AddStats(eEquipType type, eAttackType attack_type, int equip_grade, int enchant, StatInfo stat_info) { EquipStat stat = null; switch (type) { case eEquipType.weapon: stat = StatInfo.Weapons.Find(e => e.Grade == equip_grade && e.Enchant == enchant); if (stat == null) { throw new System.Exception(string.Format("Can't Find Weapon Stat Info : grade({0}), enchant({1})", equip_grade, enchant)); } stat_info.AddValue(eStatType.PhysicAttack, stat.Value); stat_info.AddValue(eStatType.MagicAttack, stat.Value); stat_info.AddValue(eStatType.Heal, stat.Value); break; case eEquipType.armor: stat = StatInfo.Armors.Find(e => e.Grade == equip_grade && e.Enchant == enchant); if (stat == null) { throw new System.Exception(string.Format("Can't Find Armor Stat Info : grade({0}), enchant({1})", equip_grade, enchant)); } switch (attack_type) { case eAttackType.physic: stat_info.AddValue(eStatType.PhysicDefense, stat.Value); stat_info.AddValue(eStatType.MagicDefense, (int)(stat.Value * stat.DefenseRate)); break; case eAttackType.magic: stat_info.AddValue(eStatType.MagicDefense, stat.Value); stat_info.AddValue(eStatType.PhysicDefense, (int)(stat.Value * stat.DefenseRate)); break; case eAttackType.heal: stat_info.AddValue(eStatType.PhysicDefense, (int)(stat.Value * stat.DefenseRate)); stat_info.AddValue(eStatType.MagicDefense, (int)(stat.Value * stat.DefenseRate)); break; } break; } return(stat_info); }
public EquipStatInfo(XmlNode node) { Weapons = new List <EquipStat>(); Armors = new List <EquipStat>(); foreach (XmlNode equip_type_node in node.ChildNodes) { eEquipType equip_type = (eEquipType)Enum.Parse(typeof(eEquipType), equip_type_node.Attributes["type"].Value); List <EquipStat> current = null; if (equip_type == eEquipType.weapon) { current = Weapons; } else if (equip_type == eEquipType.armor) { current = Armors; } foreach (XmlNode data in equip_type_node.ChildNodes) { current.Add(new EquipStat(data)); } } }
public CategoryInfo(XmlNode node) { Name = node.Attributes["category"].Value; AttackType = (eAttackType)Enum.Parse(typeof(eAttackType), node.Attributes["type"].Value); EquipType = (eEquipType)Enum.Parse(typeof(eEquipType), node.Attributes["equip_type"].Value); }
public void ApplyEquipItem(int playerID, eEquipType equiptype, int equipID) { PlayerController.Instance.EquipItem(playerID, equipID, equiptype, mEquipData[equipID].Value); }
public void EquipItem(int playerID, int equipID, eEquipType equiptype, double value) { mPlayerSpawnedList[playerID].WearEquipment(equiptype, value); }
public int RefreshEquipedDataModel(int index, Dictionary <int, int> attributes, eEquipType equipType, bool isBothHands = false) { var equipData = PlayerDataManager.Instance.PlayerDataModel.EquipList[(int)equipType]; var equipAttr = DataModel.EquipAttrChanges[index]; if (equipData.ItemId == -1) { equipAttr.IsShow = 0; return(index); } var tbItemBase = Table.GetItemBase(equipData.ItemId); equipAttr.IsShow = 1; var canEquip = PlayerDataManager.Instance.CheckItemEquip(nowItem.ItemId); var color = GameUtils.GetTableColorString(tbItemBase.Quality); var level = equipData.Exdata[0]; var levelStr = ""; if (level > 0) { levelStr = string.Format("+{0}", level); } if (equipType == eEquipType.RingL) { equipAttr.EquipName = string.Format(GameUtils.GetDictionaryText(230001), color, tbItemBase.Name, levelStr); } else if (equipType == eEquipType.RingR) { equipAttr.EquipName = string.Format(GameUtils.GetDictionaryText(230002), color, tbItemBase.Name, levelStr); } else { equipAttr.EquipName = string.Format(GameUtils.GetDictionaryText(230000), color, tbItemBase.Name, levelStr); } equipAttr.AttrChanges.Clear(); equipAttr.IsSame = 0; List <AttributeBaseDataModel> newOrderAttrChg = null; var fightPoint = 0; if (!(isBothHands && equipType == eEquipType.WeaponScend)) { newOrderAttrChg = StatisticEquipAttribute(attributes, equipData); if (PlayerDataManager.Instance.CheckItemEquip(equipData.ItemId) == eEquipLimit.OK || canEquip == eEquipLimit.Attribute) { fightPoint = PlayerDataManager.Instance.GetBagItemFightPoint(equipData, mCharacterLevel); } } if (isBothHands && equipType == eEquipType.WeaponScend) { DataModel.EquipAttrChanges[0].CanReplace = false; } if (isBothHands && equipType == eEquipType.WeaponMain) { var equipData12 = PlayerDataManager.Instance.PlayerDataModel.EquipList[(int)eEquipType.WeaponScend]; newOrderAttrChg = StatisticEquipAttribute(attributes, equipData, equipData12); if (PlayerDataManager.Instance.CheckItemEquip(equipData.ItemId) == eEquipLimit.OK || canEquip == eEquipLimit.Attribute) { fightPoint = PlayerDataManager.Instance.GetBagItemFightPoint(equipData, mCharacterLevel); } if (PlayerDataManager.Instance.CheckItemEquip(equipData12.ItemId) == eEquipLimit.OK || canEquip == eEquipLimit.Attribute) { fightPoint += PlayerDataManager.Instance.GetBagItemFightPoint(equipData12, mCharacterLevel); } } if (newOrderAttrChg != null) { equipAttr.AttrChanges = new ObservableCollection <AttributeBaseDataModel>(newOrderAttrChg); equipAttr.IsSame = equipAttr.AttrChanges.Count == 0 ? 1 : 0; } var lookPoint = DataModel.look.FightPoint; equipAttr.IsUp = fightPoint > lookPoint ? 1 : 0; equipAttr.FightPoint = Math.Abs(fightPoint - lookPoint); //套装 var tbEquip = Table.GetEquipBase(tbItemBase.Exdata[0]); equipAttr.SuitId = tbEquip.TieId; var indexList = new List <int>(); if (tbEquip.TieId != -1) { var nNowTieCount = 0; PlayerDataManager.Instance.ForeachEquip(item => { var ItemId = item.ItemId; if (ItemId == -1) { return; } var tbTieItem = Table.GetItemBase(ItemId); if (tbTieItem == null) { return; } var tbTieEquip = Table.GetEquipBase(tbTieItem.Exdata[0]); if (tbTieEquip == null) { return; } if (tbEquip.TieId == tbTieEquip.TieId) { if (!indexList.Contains(tbTieEquip.TieIndex)) { nNowTieCount++; indexList.Add(tbTieEquip.TieIndex); } } }); equipAttr.SuitCount = nNowTieCount; } index++; return(index); }