Exemple #1
0
    public void OnClickUse()
    {
        Debug.Log("点击使用");
        int id = mitem.GetID();

        int num = PlayerData.Instance.GetItemNum(id);

        if (num <= 0)
        {
            return;
        }
        ItemData data = ItemDataManager.Instance.GetItemData(id);

        //数据更改
        PlayerData.Instance.AddItemNum(id, -1);
        PlayerData.Instance.AddMaterialNum(data.useType, 10);

        //界面显示
        mitem.SetNum(PlayerData.Instance.GetItemNum(id)); //更新背包界面显示
        TopBar.Instance.Show();                           //更新显示元宝(和menu界面的4中材料)
    }