//##### CUSTOM ##### //武器カスタム設定 public void SetWeaponCustom(int type, int level = 1) { wepLvCtrl = GetComponent <WeaponLevelController>(); if (wepLvCtrl != null) { WaitReadyAction(() => wepLvCtrl.Init(type, level)); } }
//カスタム可能チェック private bool IsEnabledCustom(int weaponNo) { string prefabName = Common.Weapon.GetWeaponName(weaponNo, true); GameObject weapon = Resources.Load <GameObject>(Common.Func.GetResourceWeapon(prefabName)); if (weapon == null) { return(false); } WeaponLevelController weaponLevelCtrl = weapon.GetComponent <WeaponLevelController>(); if (weaponLevelCtrl == null) { return(false); } return(true); }
//改造武器リスト表示 private void DispWeaponCustomList() { DispListClear(); WeaponCustomList.gameObject.SetActive(true); //リストクリア foreach (Transform child in weaponCustomContent) { Destroy(child.gameObject); } //武器リスト Dictionary <int, string[]> weaponList; int[] partsNoArray = new int[] { Common.CO.PARTS_LEFT_HAND_NO, Common.CO.PARTS_LEFT_HAND_DASH_NO, Common.CO.PARTS_SHOULDER_NO, Common.CO.PARTS_SHOULDER_DASH_NO, Common.CO.PARTS_SUB_NO, Common.CO.PARTS_EXTRA_NO, }; foreach (int partsNo in partsNoArray) { weaponList = Common.Weapon.GetWeaponList(partsNo); foreach (int weaponNo in weaponList.Keys) { string[] weaponInfo = weaponList[weaponNo]; //OPENチェック if (!WeaponStore.Instance.IsEnabledEquip(weaponNo, true, weaponInfo)) { continue; } //カスタム可能チェック string prefabName = weaponInfo[Common.Weapon.DETAIL_PREFAB_NAME_NO]; GameObject weapon = (GameObject)Resources.Load(Common.Func.GetResourceWeapon(prefabName)); if (weapon == null) { continue; } WeaponLevelController weaponLevelCtrl = weapon.GetComponent <WeaponLevelController>(); if (weaponLevelCtrl == null) { continue; } //現在の強化状態 int nowCustomType = UserManager.GetWeaponCustomType(weaponNo); Sprite customIcon = Common.Func.GetCustomIcon(nowCustomType); GameObject row = (GameObject)Instantiate(storeCustomObj); Transform rowTran = row.transform; if (customIcon != null) { Transform customIconTran = rowTran.FindChild("NameArea/CustomIcon"); Image imgObj = customIconTran.GetComponent <Image>(); imgObj.sprite = customIcon; imgObj.preserveAspect = true; customIconTran.gameObject.SetActive(true); } rowTran.FindChild("NameArea/WeaponName").GetComponent <Text>().text = Common.Weapon.GetWeaponName(weaponNo); rowTran.FindChild("TypeName").GetComponent <Text>().text = Common.Weapon.GetWeaponTypeName(weaponNo); rowTran.FindChild("Description").GetComponent <Text>().text = weaponInfo[Common.Weapon.DETAIL_DESCRIPTION_NO]; rowTran.FindChild("NeedPoint").GetComponent <Text>().text = needWeaopnCustomPoint.ToString(); int param = weaponNo; rowTran.GetComponent <Button>().onClick.AddListener(() => WeaponCustom(param)); rowTran.SetParent(weaponCustomContent, false); } } //フィルター WeaponBuyListFilter(selectedCustomPartsNo); //Tagセット SetWeaponBuyTag(); }