Exemple #1
0
    /**<summary> Show Simple Dialog list </summary>*/
    public static SimpleDialog ShowSimple(string titleText, string[] options, bool cancellable, bool closeOnSelect, Action <int> onItemClick)
    {
        SimpleDialog dialog = Instantiate((GameObject)Resources.Load("SimpleDialog"), tr).GetComponent <SimpleDialog>();

        dialog.Initialize(titleText, options, cancellable, closeOnSelect, onItemClick);
        return(dialog);
    }
Exemple #2
0
    /**<summary> Refresh player inventory UI </summary>*/
    public void RefreshInventory()
    {
        if (!inventoryDialog)
        {
            return;
        }
        inventoryDialog.Initialize("Inventory", data.inventory.Select(b => (b.count > 1 ? " " + b.count + " | " : string.Empty) + b.itemData.name + (equippedItems.Count > 0 && equippedItems.Select(x => x.data.id).Contains(b.itemData.id) ? " (equipped)" : "")).ToArray(), true, false,
                                   (int selectedIndex) =>
        {
            DialogManager.ShowAlert(data.inventory[selectedIndex].itemData.name + " | " + data.inventory[selectedIndex].count, data.inventory[selectedIndex].itemData.description + "\nValue: " + data.inventory[selectedIndex].itemData.value, true,
                                    new DialogManager.DialogButton("Close", () => { }),
                                    new DialogManager.DialogButton("Discard", () =>
            {
                DiscardItem(selectedIndex);
            }),
                                    // Disable hiding for now, uncomment to enable

                                    /*new DialogManager.DialogButton("Hide", () =>
                                     * {
                                     *  DialogManager.ShowAlert("Hide " + data.inventory[selectedIndex].itemData.name + " to world?", "You get rewarded based on the time the item stays hidden and base value of it", true,
                                     *      new DialogManager.DialogButton("No", () => { }),
                                     *      new DialogManager.DialogButton("Yes", () =>
                                     *      {
                                     *          DropItem(selectedIndex);
                                     *      })
                                     *  );
                                     * }),*/
                                    equippedItems.Select(x => x.data.id).Contains(data.inventory[selectedIndex].itemData.id) ?
                                    new DialogManager.DialogButton("Unequip", () =>
            {
                UnequipItem(equippedItems.FindIndex(x => x.data.id == data.inventory[selectedIndex].itemData.id));
            })
                    :
                                    new DialogManager.DialogButton("Equip", () =>
            {
                EquipItem(data.inventory[selectedIndex].itemData);
            })
                                    );
        });
    }