示例#1
0
    public void OnSelect(string selectedName)
    {
        myName = selectedName;
        if (decider == 1)
        {
            type = 4;
            HPpotRegen temp = Item.CallHPRegen(selectedName);

            HPDisplay.transform.Find("Name").GetComponent <Text>().text  = temp.name;
            HPDisplay.transform.Find("Dura").GetComponent <Text>().text  = temp.duration.ToString();
            HPDisplay.transform.Find("Resto").GetComponent <Text>().text = temp.regen.ToString();
        }
        else if (decider == 2)
        {
            type = 5;
            MPpotRegen temp1 = Item.CallMPRegen(selectedName);

            ManaDisplay.transform.Find("Name").GetComponent <Text>().text  = temp1.name;
            ManaDisplay.transform.Find("Dura").GetComponent <Text>().text  = temp1.duration.ToString();
            ManaDisplay.transform.Find("Resto").GetComponent <Text>().text = temp1.regen.ToString();
        }
        else if (decider == 3)
        {
            type = 6;
            HPpotRegen temp2 = Item.CallHPRegen(selectedName);

            HPDisplay.transform.Find("Name").GetComponent <Text>().text  = temp2.name;
            HPDisplay.transform.Find("Dura").GetComponent <Text>().text  = temp2.duration.ToString();
            HPDisplay.transform.Find("Resto").GetComponent <Text>().text = temp2.regen.ToString();
        }
        else if (decider == 4)
        {
            type = 7;
            MPpotRegen temp3 = Item.CallMPRegen(selectedName);

            ManaDisplay.transform.Find("Name").GetComponent <Text>().text  = temp3.name;
            ManaDisplay.transform.Find("Dura").GetComponent <Text>().text  = temp3.duration.ToString();
            ManaDisplay.transform.Find("Resto").GetComponent <Text>().text = temp3.regen.ToString();
        }
    }
示例#2
0
    //function to call then user click on inventory slot
    public void Selected(int slotNumber)
    {
        slotSelected = slotNumber;

        int x = tipeItem[slotNumber];

        if (x == 0 || x == 1 || x == 2)
        {
            HPPotionDescription.SetActive(false);
            MPPotionDescription.SetActive(false);
            WeaponDescription.SetActive(true);
            GlyphDescription.SetActive(false);
            SpecialDescription.SetActive(false);

            string weaponName = PlayerPrefs.GetString("itemNameInvenSlot" + slotNumber);

            WeaponDescription.transform.Find("Name").GetComponent <Text>().text         = weaponName;
            WeaponDescription.transform.Find("RegenHP").GetComponent <Text>().text      = "+" + PlayerPrefs.GetInt(weaponName + "regenHP").ToString();
            WeaponDescription.transform.Find("RegenMP").GetComponent <Text>().text      = "+" + PlayerPrefs.GetInt(weaponName + "regenMP").ToString();
            WeaponDescription.transform.Find("MaxHP").GetComponent <Text>().text        = "+" + PlayerPrefs.GetInt(weaponName + "maxHP").ToString();
            WeaponDescription.transform.Find("MaxMP").GetComponent <Text>().text        = "+" + PlayerPrefs.GetInt(weaponName + "maxMP").ToString();
            WeaponDescription.transform.Find("Strength").GetComponent <Text>().text     = "+" + PlayerPrefs.GetInt(weaponName + "strength").ToString();
            WeaponDescription.transform.Find("Defence").GetComponent <Text>().text      = "+" + PlayerPrefs.GetInt(weaponName + "def").ToString();
            WeaponDescription.transform.Find("Stamina").GetComponent <Text>().text      = "+" + PlayerPrefs.GetInt(weaponName + "stamina").ToString();
            WeaponDescription.transform.Find("Agility").GetComponent <Text>().text      = "+" + PlayerPrefs.GetInt(weaponName + "agility").ToString();
            WeaponDescription.transform.Find("Vitality").GetComponent <Text>().text     = "+" + PlayerPrefs.GetInt(weaponName + "vitality").ToString();
            WeaponDescription.transform.Find("Intelligence").GetComponent <Text>().text = "+" + PlayerPrefs.GetInt(weaponName + "intelligence").ToString();
            WeaponDescription.transform.Find("Attack").GetComponent <Text>().text       = PlayerPrefs.GetInt(weaponName + "attack").ToString();
            WeaponDescription.transform.Find("Description").GetComponent <Text>().text  = PlayerPrefs.GetString(weaponName + "desc");
        }
        else if (x == 3)
        {
            HPPotionDescription.SetActive(false);
            MPPotionDescription.SetActive(false);
            WeaponDescription.SetActive(false);
            GlyphDescription.SetActive(true);
            SpecialDescription.SetActive(false);

            Glyph temp = Item.CallGlyph(namaItem[slotNumber]);

            GlyphDescription.transform.Find("Name").GetComponent <Text>().text         = temp.name;
            GlyphDescription.transform.Find("RegenHP").GetComponent <Text>().text      = temp.bonusRegenHP.ToString();
            GlyphDescription.transform.Find("RegenMP").GetComponent <Text>().text      = temp.bonusRegenMana.ToString();
            GlyphDescription.transform.Find("MaxHP").GetComponent <Text>().text        = temp.bonusMaxHP.ToString();
            GlyphDescription.transform.Find("MaxMP").GetComponent <Text>().text        = temp.bonusMaxMana.ToString();
            GlyphDescription.transform.Find("Strength").GetComponent <Text>().text     = temp.bonusStrength.ToString();
            GlyphDescription.transform.Find("Defence").GetComponent <Text>().text      = temp.bonusDef.ToString();
            GlyphDescription.transform.Find("Stamina").GetComponent <Text>().text      = temp.bonusStamina.ToString();
            GlyphDescription.transform.Find("Agility").GetComponent <Text>().text      = temp.bonusAgility.ToString();
            GlyphDescription.transform.Find("Vitality").GetComponent <Text>().text     = temp.bonusVitality.ToString();
            GlyphDescription.transform.Find("Intelligence").GetComponent <Text>().text = temp.bonusIntelligence.ToString();
        }
        else if (x == 4 || x == 6)
        {
            HPPotionDescription.SetActive(true);
            MPPotionDescription.SetActive(false);
            WeaponDescription.SetActive(false);
            GlyphDescription.SetActive(false);
            SpecialDescription.SetActive(false);

            if (x == 4)
            {
                HPpotRegen temp = Item.CallHPRegen(namaItem[slotNumber]);

                HPPotionDescription.transform.Find("Name").GetComponent <Text>().text  = temp.name;
                HPPotionDescription.transform.Find("Dura").GetComponent <Text>().text  = temp.duration.ToString();
                HPPotionDescription.transform.Find("Resto").GetComponent <Text>().text = temp.regen.ToString();
            }
            else if (x == 6)
            {
                HPpotInstant temp = Item.CallHPInstant(namaItem[slotNumber]);

                HPPotionDescription.transform.Find("Name").GetComponent <Text>().text  = temp.name;
                HPPotionDescription.transform.Find("Dura").GetComponent <Text>().text  = "Instant";
                HPPotionDescription.transform.Find("Resto").GetComponent <Text>().text = temp.regen.ToString();
            }
        }
        else if (x == 5 || x == 7)
        {
            HPPotionDescription.SetActive(false);
            MPPotionDescription.SetActive(true);
            WeaponDescription.SetActive(false);
            GlyphDescription.SetActive(false);
            SpecialDescription.SetActive(false);

            if (x == 5)
            {
                MPpotRegen temp = Item.CallMPRegen(namaItem[slotNumber]);

                MPPotionDescription.transform.Find("Name").GetComponent <Text>().text  = temp.name;
                MPPotionDescription.transform.Find("Dura").GetComponent <Text>().text  = temp.duration.ToString();
                MPPotionDescription.transform.Find("Resto").GetComponent <Text>().text = temp.regen.ToString();
            }
            else if (x == 7)
            {
                MPpotInstant temp = Item.CallMPInstant(namaItem[slotNumber]);

                MPPotionDescription.transform.Find("Name").GetComponent <Text>().text  = temp.name;
                MPPotionDescription.transform.Find("Dura").GetComponent <Text>().text  = "Instant";
                MPPotionDescription.transform.Find("Resto").GetComponent <Text>().text = temp.regen.ToString();
            }
        }
        else if (x == 8)
        {
            HPPotionDescription.SetActive(false);
            MPPotionDescription.SetActive(false);
            WeaponDescription.SetActive(false);
            GlyphDescription.SetActive(false);
            SpecialDescription.SetActive(true);
        }
        else if (x == 9)
        {
            HPPotionDescription.SetActive(false);
            MPPotionDescription.SetActive(false);
            WeaponDescription.SetActive(false);
            GlyphDescription.SetActive(false);
            SpecialDescription.SetActive(false);
        }
    }