150 lines
5.9 KiB
C#
150 lines
5.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class EquipCGPanelController : MonoBehaviour {
|
|
[SerializeField] public EquipCGLayerController shoes;
|
|
[SerializeField] public EquipCGLayerController outfit;
|
|
[SerializeField] public EquipCGLayerController outfitUnderBody;
|
|
[SerializeField] public EquipCGLayerController bow;
|
|
[SerializeField] public EquipCGLayerController gloves;
|
|
|
|
[SerializeField] public Sprite noArmorBody;
|
|
[SerializeField] public Sprite noArmorBow;
|
|
|
|
ItemSpriteCollectionController itemSpriteCollectionController;
|
|
|
|
public static Dictionary<ItemSubType, int> equipCGIndices = new Dictionary<ItemSubType, int>() {
|
|
{ ItemSubType.ARCHER_BOOTS, 0 },
|
|
{ ItemSubType.BANDIT_BOOTS, 1 },
|
|
{ ItemSubType.FAIRY_SANDALS, 2 },
|
|
{ ItemSubType.GUARDIAN_BOOTS, 3 },
|
|
{ ItemSubType.ELITE_BOOTS, 4 },
|
|
{ ItemSubType.DISGRACED_SNEAKERS, 5 },
|
|
{ ItemSubType.WITCH_SHOES, 6 },
|
|
{ ItemSubType.MOUNTAINEER_BOOTS, 7 },
|
|
{ ItemSubType.SPIRIT_BOOTS, 8 },
|
|
{ ItemSubType.GODDESS_SANDALS, 9 },
|
|
|
|
{ ItemSubType.ARCHER_BOW, 0 },
|
|
{ ItemSubType.BANDIT_BOW, 1 },
|
|
{ ItemSubType.FAIRY_BOW, 2 },
|
|
{ ItemSubType.GUARDIAN_BOW, 3 },
|
|
{ ItemSubType.ELITE_BOW, 4 },
|
|
{ ItemSubType.DISGRACED_BOW, 5 },
|
|
{ ItemSubType.WITCH_BOW, 6 },
|
|
{ ItemSubType.MOUNTAINEER_BOW, 7 },
|
|
{ ItemSubType.SPIRIT_BOW, 8 },
|
|
{ ItemSubType.GODDESS_BOW, 9 },
|
|
|
|
{ ItemSubType.ARCHER_GLOVES, 0 },
|
|
{ ItemSubType.BANDIT_GLOVES, 1 },
|
|
{ ItemSubType.GUARDIAN_CUFFS, 2 },
|
|
{ ItemSubType.MOUNTAINEER_GLOVES, 3 },
|
|
{ ItemSubType.GODDESS_CUFFS, 4 },
|
|
{ ItemSubType.ARTISAN_GLOVES_KARA, 5 },
|
|
{ ItemSubType.ARTISAN_GLOVES_REESE, 6 },
|
|
{ ItemSubType.ARTISAN_GLOVES_RYOTHE, 7 },
|
|
{ ItemSubType.ARTISAN_GLOVES_SUMMIT, 8 },
|
|
|
|
{ ItemSubType.ARCHER_TUNIC, 0 },
|
|
{ ItemSubType.BANDIT_OUTFIT, 1 },
|
|
{ ItemSubType.FAIRY_DRESS, 2 },
|
|
{ ItemSubType.GUARDIAN_OUTFIT, 3 },
|
|
{ ItemSubType.ELITE_DRESS, 4 },
|
|
{ ItemSubType.DISGRACED_DRESS, 5 },
|
|
{ ItemSubType.WITCH_DRESS, 6 },
|
|
{ ItemSubType.MOUNTAINEER_DRESS, 7 },
|
|
{ ItemSubType.SPIRIT_DRESS, 8 },
|
|
{ ItemSubType.GODDESS_DRESS, 9 },
|
|
{ ItemSubType.OVERSUIT_1, 10 },
|
|
{ ItemSubType.OVERSUIT_2, 11 },
|
|
{ ItemSubType.OVERSUIT_3, 12 },
|
|
{ ItemSubType.OVERSUIT_4, 13 },
|
|
{ ItemSubType.OVERSUIT_5, 14 },
|
|
{ ItemSubType.OVERSUIT_6, 15 },
|
|
{ ItemSubType.OVERSUIT_7, 16 },
|
|
{ ItemSubType.OVERSUIT_8, 17 },
|
|
{ ItemSubType.OVERSUIT_9, 18 },
|
|
{ ItemSubType.OVERSUIT_10, 19 },
|
|
{ ItemSubType.OVERSUIT_11, 20 },
|
|
};
|
|
|
|
public void Refresh() {
|
|
if (State.state.inventory.equipped.ContainsKey(ItemType.EQUIP_SHOES)) {
|
|
Item item = (Item)State.state.inventory.equipped[ItemType.EQUIP_SHOES];
|
|
if (item != null && equipCGIndices.ContainsKey(item.subType)) {
|
|
shoes.image.sprite =
|
|
itemSpriteCollectionController.shoesEquipSprites[equipCGIndices[item.subType]];
|
|
shoes.image.color = Color.white;
|
|
}
|
|
else {
|
|
shoes.image.sprite = null;
|
|
shoes.image.color = Color.clear;
|
|
}
|
|
} else {
|
|
shoes.image.sprite = null;
|
|
shoes.image.color = Color.clear;
|
|
}
|
|
|
|
if (State.state.inventory.equipped.ContainsKey(ItemType.EQUIP_OVERALL)) {
|
|
Item item = (Item)State.state.inventory.equipped[ItemType.EQUIP_OVERALL];
|
|
if (item != null && equipCGIndices.ContainsKey(item.subType)) {
|
|
int index = equipCGIndices[item.subType];
|
|
outfit.image.sprite =
|
|
itemSpriteCollectionController.outfitEquipSprites[index];
|
|
outfitUnderBody.image.sprite =
|
|
itemSpriteCollectionController.outfitEquipSprites[index];
|
|
outfitUnderBody.image.color = Color.white;
|
|
} else {
|
|
outfit.image.sprite = noArmorBody;
|
|
outfitUnderBody.image.sprite = null;
|
|
outfitUnderBody.image.color = Color.clear;
|
|
}
|
|
} else {
|
|
outfit.image.sprite = noArmorBody;
|
|
outfitUnderBody.image.sprite = null;
|
|
outfitUnderBody.image.color = Color.clear;
|
|
}
|
|
|
|
if (State.state.inventory.equipped.ContainsKey(ItemType.EQUIP_GLOVES)) {
|
|
Item item = (Item)State.state.inventory.equipped[ItemType.EQUIP_GLOVES];
|
|
if (item != null && equipCGIndices.ContainsKey(item.subType)) {
|
|
gloves.image.sprite =
|
|
itemSpriteCollectionController.glovesEquipSprites[equipCGIndices[item.subType]];
|
|
gloves.image.color = Color.white;
|
|
} else {
|
|
gloves.image.sprite = null;
|
|
gloves.image.color = Color.clear;
|
|
}
|
|
} else {
|
|
gloves.image.sprite = null;
|
|
gloves.image.color = Color.clear;
|
|
}
|
|
|
|
if (State.state.inventory.equipped.ContainsKey(ItemType.EQUIP_BOW)) {
|
|
Item item = (Item)State.state.inventory.equipped[ItemType.EQUIP_BOW];
|
|
if (item != null && equipCGIndices.ContainsKey(item.subType)) {
|
|
bow.image.sprite =
|
|
itemSpriteCollectionController.bowEquipSprites[equipCGIndices[item.subType]];
|
|
} else {
|
|
bow.image.sprite = noArmorBow;
|
|
}
|
|
} else {
|
|
bow.image.sprite = noArmorBow;
|
|
}
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Awake()
|
|
{
|
|
itemSpriteCollectionController = GameObject.FindGameObjectWithTag("ItemSpriteCollection").GetComponent<ItemSpriteCollectionController>();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|