Beispiel #1
0
    public void RefreshSelected(InventoryDisplayItem item)
    {
        if (item == null)
        {
            return;
        }

        var qty         = PF_PlayerData.GetItemQty(item.category.itemId);
        var isContainer = item.category.catalogRef.Container != null && item.category.catalogRef.Container.ResultTableContents != null;

        itemData             = item;
        icon.overrideSprite  = item.category.icon;
        itemName.text        = item.category.catalogRef.DisplayName;
        itemDescription.text = item.category.catalogRef.Description;
        annotation.text      = item.category.inventory[0].Annotation;
        totalUses.text       = " x" + qty;

        UnlockAction.gameObject.SetActive(isContainer);
        UseAction.gameObject.SetActive(!isContainer && controller.activeFilter == DialogCanvasController.InventoryFilters.UsableInCombat);
        totalUses.gameObject.SetActive(qty != 1);
    }
Beispiel #2
0
    public void RefreshSelected(StoreDisplayItem item)
    {
        if (item == null)
        {
            return;
        }

        itemData             = item;
        icon.overrideSprite  = item.image.overrideSprite;
        itemName.text        = item.catalogItem.DisplayName;
        itemDescription.text = item.catalogItem.Description;

        itemCost.text = string.Format(" x{0}", item.finalPrice);
        currencyIcon.overrideSprite = GameController.Instance.iconManager.GetIconById(item.currencyKey, IconManager.IconTypes.Misc);

        var qty = PF_PlayerData.GetItemQty(itemData.catalogItem.ItemId);

        if (qty != 1)
        {
            totalUses.text = " x" + qty;
        }
    }
Beispiel #3
0
    public void SetupSlider(UnityAction <UnlockContainerItemResult> callback = null)
    {
        afterUnlock          = callback;
        ItemDescription.text = controller.selectedItem.Description;

        if (controller.selectedItem.Container != null)
        {
            var keyId        = controller.selectedItem.Container.KeyItemId;
            var keyReference = PF_GameData.GetCatalogItemById(keyId);
            endIcon.gameObject.SetActive(keyReference != null);
            if (keyReference != null)
            {
                var chestQty = PF_PlayerData.GetItemQty(controller.selectedItem.ItemId);
                var keyQty   = PF_PlayerData.GetItemQty(keyId);
                var useColor = (chestQty > 0 && keyQty > 0) ? Color.cyan : Color.red;

                endIcon.color       = useColor;
                sliderMessage.text  = string.Format("{0} Required ({1} available)", keyReference.DisplayName, Mathf.Min(chestQty, keyQty));
                sliderMessage.color = useColor;

                var iconName = PF_GameData.GetIconByItemById(keyReference.ItemId, GlobalStrings.BRONZE_KEY_ICON);
                var icon     = GameController.Instance.iconManager.GetIconById(iconName, IconManager.IconTypes.Item);
                handle.overrideSprite = icon;
            }
            else
            {
                handle.overrideSprite = GameController.Instance.iconManager.GetIconById(GlobalStrings.DARKSTONE_LOCK_ICON, IconManager.IconTypes.Misc);
                sliderMessage.text    = GlobalStrings.UNLOCKED_MSG;
            }
        }
        else
        {
            sliderMessage.text = GlobalStrings.UNLOCKED_MSG;
            // set default key icon or lock or something...
        }
    }