示例#1
0
    public void SaveInventory()
    {
        int slot_id, quantity;

        Int32.TryParse(transform.Find("slotInput").GetComponent <InputField>().text, out slot_id);
        Int32.TryParse(transform.Find("quantityInput").GetComponent <InputField>().text, out quantity);
        Dropdown itemDropdown = transform.Find("itemInput").GetComponent <Dropdown>();
        Item     it           = items.ElementAt(itemDropdown.value);

        InventorySlot sl = new InventorySlot();

        sl.slotID   = slot_id;
        sl.item     = it;
        sl.quantity = quantity;

        Mysql mysql = FindObjectOfType <Mysql>();

        mysql.SaveInventorySlot(player_id, sl);

        slot = null;
        transform.gameObject.SetActive(false);

        InventoryTable script = inventoryTable.GetComponent <InventoryTable>();

        script.Reload(player_id);
    }
示例#2
0
    public void InventoryButtonClick()
    {
        inventoryTable.SetActive(!inventoryTable.activeSelf);
        InventoryTable script = inventoryTable.GetComponent <InventoryTable>();

        script.Reload();
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I))
        {
            itemsTable.SetActive(!itemsTable.activeSelf);
            ItemsTable script = itemsTable.GetComponent <ItemsTable>();
            script.Reload();
        }

        if (Input.GetKeyDown(KeyCode.N))
        {
            inventoryTable.SetActive(!inventoryTable.activeSelf);
            InventoryTable script = inventoryTable.GetComponent <InventoryTable>();
            script.Reload();
        }
    }