public void GetSelfEquipmentIds(List <EquipmentIdx> ids) { ids.Clear(); foreach (ItemInventory item in _equippedInventory.itemList) { EquipmentIdx equipmentIdx = new EquipmentIdx(); equipmentIdx._id = item.ItemID; equipmentIdx._evolutionLevel = 0; ids.Add(equipmentIdx); } }
void UpdateEquipments(GameObject model, EnumRole roleID, bool useFancyGear) { List <GameObject> equipInstances = new List <GameObject>(); InitInformation initialInfo = DataManager.Instance._initInformation; List <EquipmentIdx> equipmentListWithLevel = new List <EquipmentIdx>(); if (_playerInfos.ContainsKey(roleID) && _playerInfos[roleID] != null) { PlayerInfo playerInfo = _playerInfos[roleID]; playerInfo.GetSelfEquipmentIds(equipmentListWithLevel); } else { List <string> equipmentList = roleID == EnumRole.Mage ? initialInfo._loginEquipment_mage : initialInfo._loginEquipment_warrior; foreach (string name in equipmentList) { EquipmentIdx eIdx = new EquipmentIdx(); eIdx._id = name; eIdx._evolutionLevel = 0; equipmentListWithLevel.Add(eIdx); } } PlayerInfo.GetOtherEquipmentInstanceWithIds(equipInstances, equipmentListWithLevel); List <FCEquipmentsBase> equipments = new List <FCEquipmentsBase>(); // get equipment data array foreach (GameObject g in equipInstances) { FCEquipmentsBase[] es = g.GetComponentsInChildren <FCEquipmentsBase>(); equipments.AddRange(es); // destroy ai game object GameObject.Destroy(g); } // equip models. AvatarController avatar = model.GetComponent <AvatarController>(); avatar.RemoveWeapons(); foreach (FCEquipmentsBase eeb in equipments) { EquipmentAssembler.Singleton.Assemble(eeb, avatar); } model.SetActive(false); model.SetActive(true); }
public static void AddEquip(List <EquipmentIdx> list, string equipId) { if (equipId == null) { return; } if (equipId.Length < 2) { return; } EquipmentIdx eIdx = new EquipmentIdx(); eIdx._id = equipId; eIdx._evolutionLevel = 0; list.Add(eIdx); }