void Initial() { picture.sprite = DB_EquipmentInventory.GetItemSrpite(equipment.data.itemPath); atk.text = equipment.data.attack.ToString(); def.text = equipment.data.defense.ToString(); hp.text = equipment.data.health.ToString(); unlock_btn.gameObject.SetActive(!equipment.isAvaiable); equip_btn.gameObject.SetActive(equipment.isAvaiable); unlockCost_text.transform.parent.gameObject.SetActive(!equipment.isAvaiable); repair_btn.gameObject.SetActive(equipment.isAvaiable); repair_btn.interactable = equipment.cur_durability < equipment.data.durability; equip_btn.interactable = !equipment.isEquip; float fill_durability = ((float)equipment.cur_durability / (float)equipment.data.durability); durability_img.fillAmount = fill_durability; durability_img.color = durability_color.Evaluate(fill_durability); int cost = (int)equipment.data.fullRepairCost - (int)(equipment.data.fullRepairCost * fill_durability); if (equipment.cur_durability <= 0) { cost = cost * 2; } repairCost = cost; repairCost_text.text = "-" + repairCost.ToString(); unlockCost = equipment.data.unlockCost; unlockCost_text.text = unlockCost.ToString(); }
// Start is called before the first frame update public void Initial(LootDropData data) { picture.sprite = data.GetData().Equals(typeof(EquipmentData)) ? DB_EquipmentInventory.GetItemSrpite(data.GetData().itemPath) : DB_Resources.GetItemSrpite(data.GetData().itemPath); amount.text = data.GetFixDrop().ToString(); }
public void SwitchEquip(EquipmentInv data) { int lastID = -1; if (data.data.GetType() == typeof(WeaponBase)) { player.SwitchWeapon(data, out int lasItemID, out bool isSuccess); if (isSuccess) { lastID = lasItemID; equipedWeapon.sprite = DB_EquipmentInventory.GetItemSrpite(data.data.itemPath); } } else if (data.data.GetType() == typeof(ArmorBase)) { player.SwitchArmor(data, out int lasItemID, out bool isSuccess); if (isSuccess) { equipedArmor.sprite = DB_EquipmentInventory.GetItemSrpite(data.data.itemPath); lastID = lasItemID; } } else if (data.data.GetType() == typeof(AccecoriesBase)) { player.SwitchAcc(data, out int lasItemID, out bool isSuccess); if (isSuccess) { equipedAcc.sprite = DB_EquipmentInventory.GetItemSrpite(data.data.itemPath); lastID = lasItemID; } } if (lastID != -1) { DB_EquipmentInventory.UpdateEquip(lastID, false); GetLastEquip(lastID).ReInitial(); } DB_EquipmentInventory.UpdateEquip(data.id, true); UpdateStatusValue(); }
void SetItemView() { int[] eqStatus = player.GetEqStatus(); if (eqStatus[0] != -1) { equipedWeapon.sprite = DB_EquipmentInventory.GetItemSrpite( DB_EquipmentInventory.GetItem(eqStatus[0]).data.itemPath ); } if (eqStatus[1] != -1) { equipedArmor.sprite = DB_EquipmentInventory.GetItemSrpite( DB_EquipmentInventory.GetItem(eqStatus[1]).data.itemPath ); } if (eqStatus[2] != -1) { equipedAcc.sprite = DB_EquipmentInventory.GetItemSrpite( DB_EquipmentInventory.GetItem(eqStatus[2]).data.itemPath ); } }