Added shield items for all classes, finalised item display in inventory, v1.3.0
This commit is contained in:
@@ -51,7 +51,8 @@ namespace Assets.Scripts
|
||||
{
|
||||
slots[j].GetComponent<InventorySlot>().setItem(item);
|
||||
itemAdded = true;
|
||||
slots[j].GetComponent<RawImage>().color = Color.red;
|
||||
slots[j].GetComponent<RawImage>().color = item.rarityColor;
|
||||
slots[j].GetComponent<RawImage>().texture = item.image;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -80,15 +81,19 @@ namespace Assets.Scripts
|
||||
|
||||
private void checkInventoryColors()
|
||||
{
|
||||
Item item;
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
if (slots[i].GetComponent<InventorySlot>().getItem() != null)
|
||||
item = slots[i].GetComponent<InventorySlot>().getItem();
|
||||
if (item != null)
|
||||
{
|
||||
slots[i].GetComponent<RawImage>().color = Color.red;
|
||||
slots[i].GetComponent<RawImage>().color = item.rarityColor;
|
||||
slots[i].GetComponent<RawImage>().texture = item.image;
|
||||
}
|
||||
else
|
||||
{
|
||||
slots[i].GetComponent<RawImage>().color = Color.white;
|
||||
slots[i].GetComponent<RawImage>().texture = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,6 +101,7 @@ namespace Assets.Scripts
|
||||
private void checkEquipColors()
|
||||
{
|
||||
GameObject slot = head;
|
||||
Item item;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
switch (i)
|
||||
@@ -125,9 +131,11 @@ namespace Assets.Scripts
|
||||
slot = ring;
|
||||
break;
|
||||
}
|
||||
if (slot.GetComponent<InventorySlot>().getEquip() != null)
|
||||
item = slot.GetComponent<InventorySlot>().getEquip();
|
||||
if (item != null)
|
||||
{
|
||||
slot.GetComponent<RawImage>().color = Color.red;
|
||||
slot.GetComponent<RawImage>().color = item.rarityColor;
|
||||
slot.GetComponent<RawImage>().texture = item.image;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -150,9 +158,9 @@ namespace Assets.Scripts
|
||||
{
|
||||
switch (place)
|
||||
{
|
||||
case ItemPlace.SHIELD:
|
||||
case ItemPlace.LEFTHAND:
|
||||
return leftHand.GetComponent<InventorySlot>().getEquip();
|
||||
case ItemPlace.WEAPON:
|
||||
case ItemPlace.RIGHTHAND:
|
||||
return rightHand.GetComponent<InventorySlot>().getEquip();
|
||||
case ItemPlace.HELMET:
|
||||
return head.GetComponent<InventorySlot>().getEquip();
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Assets.Scripts
|
||||
private void Start()
|
||||
{
|
||||
tooltip = GameObject.Find("TooltipHandler").GetComponent<TooltipHandler>();
|
||||
loadImages();
|
||||
}
|
||||
|
||||
public void updateCurrentBag(int currentBag)
|
||||
@@ -154,5 +155,41 @@ namespace Assets.Scripts
|
||||
{
|
||||
equip = null;
|
||||
}
|
||||
|
||||
private void loadImages()
|
||||
{
|
||||
Texture image = null;
|
||||
switch (place)
|
||||
{
|
||||
case ItemPlace.LEFTHAND:
|
||||
image = Resources.Load<Texture>("Equipment/" + GameObject.Find("Player").GetComponent<Player>().getClass().classname + "/Inv_LeftHand");
|
||||
break;
|
||||
case ItemPlace.RIGHTHAND:
|
||||
image = Resources.Load<Texture>("Equipment/" + GameObject.Find("Player").GetComponent<Player>().getClass().classname + "/Inv_RightHand");
|
||||
break;
|
||||
case ItemPlace.HELMET:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Helmet");
|
||||
break;
|
||||
case ItemPlace.BOOTS:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Boots");
|
||||
break;
|
||||
case ItemPlace.SHOULDER:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Shoulder");
|
||||
break;
|
||||
case ItemPlace.AMULET:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Amulet");
|
||||
break;
|
||||
case ItemPlace.RING:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Ring");
|
||||
break;
|
||||
case ItemPlace.ARMOR:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Chest");
|
||||
break;
|
||||
}
|
||||
if (image != null)
|
||||
{
|
||||
gameObject.GetComponent<RawImage>().texture = image;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ namespace Assets.Scripts
|
||||
ItemPlace place;
|
||||
string itemName;
|
||||
Dictionary<string, int> attributes;
|
||||
public Texture image;
|
||||
public Color32 rarityColor;
|
||||
|
||||
public Item(int luck)
|
||||
{
|
||||
@@ -41,6 +43,7 @@ namespace Assets.Scripts
|
||||
}
|
||||
itemName = itemName.ToLower();
|
||||
itemName = char.ToUpper(itemName[0]) + itemName.Substring(1);
|
||||
loadImage();
|
||||
}
|
||||
|
||||
private void calculateRarity(int luck)
|
||||
@@ -49,18 +52,22 @@ namespace Assets.Scripts
|
||||
if (number + luck < 74)
|
||||
{
|
||||
rarity = ItemRarity.COMMON;
|
||||
rarityColor = new Color32(0,255,20,255);
|
||||
}
|
||||
else if (number + luck >= 75 && number + luck < 104)
|
||||
{
|
||||
rarity = ItemRarity.RARE;
|
||||
rarityColor = new Color32(0,100,255, 255);
|
||||
}
|
||||
else if (number + luck >= 105 && number + luck < 113)
|
||||
{
|
||||
rarity = ItemRarity.EPIC;
|
||||
rarityColor = new Color32(255,0,230, 255);
|
||||
}
|
||||
else if (number + luck >= 114)
|
||||
{
|
||||
rarity = ItemRarity.LEGENDARY;
|
||||
rarityColor = new Color32(255,230,0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,6 +206,37 @@ namespace Assets.Scripts
|
||||
}
|
||||
return displayText;
|
||||
}
|
||||
|
||||
private void loadImage()
|
||||
{
|
||||
switch (place)
|
||||
{
|
||||
case ItemPlace.LEFTHAND:
|
||||
image = Resources.Load<Texture>("Equipment/" + GameObject.Find("Player").GetComponent<Player>().getClass().classname + "/Inv_LeftHand");
|
||||
break;
|
||||
case ItemPlace.RIGHTHAND:
|
||||
image = Resources.Load<Texture>("Equipment/" + GameObject.Find("Player").GetComponent<Player>().getClass().classname + "/Inv_RightHand");
|
||||
break;
|
||||
case ItemPlace.HELMET:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Helmet");
|
||||
break;
|
||||
case ItemPlace.BOOTS:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Boots");
|
||||
break;
|
||||
case ItemPlace.SHOULDER:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Shoulder");
|
||||
break;
|
||||
case ItemPlace.AMULET:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Amulet");
|
||||
break;
|
||||
case ItemPlace.RING:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Ring");
|
||||
break;
|
||||
case ItemPlace.ARMOR:
|
||||
image = Resources.Load<Texture>("Equipment/Inv_Chest");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,8 +10,8 @@ namespace Assets.Scripts
|
||||
{
|
||||
HELMET,
|
||||
SHOULDER,
|
||||
WEAPON,
|
||||
SHIELD,
|
||||
RIGHTHAND,
|
||||
LEFTHAND,
|
||||
RING,
|
||||
AMULET,
|
||||
ARMOR,
|
||||
|
||||
Reference in New Issue
Block a user