public void Confirm()
    {
        // Abandom 0 inventory means cancel
        if (currentNumber == 0)
        {
            Cancel();
        }

        // Consume
        Data.player.ConsumeInventory(inventory, currentNumber);

        // Create inventory bag in small map
        GameObject go = Instantiate(bagPrefab, PlayerControl.instance.transform.position, Quaternion.identity);

        go.transform.SetParent(container);
        SmallMapObject          smo         = go.GetComponent <SmallMapObject>();
        InteractionObtainObject interaction = new InteractionObtainObject("捡起" + inventory.name,
                                                                          inventory, currentNumber, smo);

        smo.interaction = interaction;

        // Show info on top info board
        UIManager.instance.AddInfoInBoard("你丢弃了" + inventory.name + " x " + currentNumber);

        // Disactive boards
        gameObject.SetActive(false);

        operationUI.inventoryUI.listUI.UpdateUI();
        operationUI.inventoryUI.currentUI.UpdateUI();
        operationUI.gameObject.SetActive(false);
    }
Beispiel #2
0
    private void InitTestBag(SmallMapObject bag)
    {
        // 探险家之剑
        Weapon weapon = Data.AllWeapons[2001];
        InteractionObtainObject swordBag = new InteractionObtainObject("捡起" + weapon.name, weapon, 1, bag);

        bag.interaction = swordBag;
    }