private void Awake()
    {
        ItemInfo[] tempItemInfoArr;
        Load(out tempItemInfoArr, "JsonFiles/ItemInfos");

        ItemSpriteDic = new Dictionary <eItemID, Sprite>();
        ItemInfoDic   = new Dictionary <eItemID, ItemInfo>();

        Sprite[] ItemSprites = Resources.LoadAll <Sprite>("Sprites/Item&Icon/items");

        for (int i = 0; i < ItemSprites.Length; i++)
        {
            ItemSpriteDic.Add((eItemID)i, ItemSprites[i]);
        }

        for (int i = 0; i < tempItemInfoArr.Length; i++)
        {
            ItemInfoDic.Add(tempItemInfoArr[i].ItemID, tempItemInfoArr[i]);
        }

        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
    public override void UpdateUnit(int _main_idx)
    {
        main_idx = _main_idx;

        int selected_idx = main_idx;

        itemInfo = ItemInfoManager.Inst;

        DBItemData itemData = CSVData.Inst.GetItemData(itemInfo.ItemList[selected_idx].id);

        ImageGrade.sprite = CSVData.Inst.GetSpriteGrade(itemData.grade);
        imageItem.sprite  = itemData.ItemIcon;

        int item_count = itemInfo.ItemList[selected_idx].count;

        if (item_count < 0)
        {
            DebugLog.Log(true, "Item Count 0");
            textItemCount.text = "";
        }
        else if (item_count == 1)
        {
            textItemCount.text = "";
        }
        else
        {
            textItemCount.text = string.Format("X{0}", item_count);
        }

        textItemName.text = itemData.name;

        textType.text = itemData.itemType;
    }
 private void Awake()
 {
     ins = this;
 }
Esempio n. 4
0
 private void Awake()
 {
     Instance = this;
     DontDestroyOnLoad(gameObject);
 }