示例#1
0
 public void RemoveMyItem()
 {
     if (instance.playerwhichbag == 2)
     {
         instance.playEqBag.coin.itemHeld += instance.playEqBag.itemlist[instance.choseid].sellprice;
         if (instance.playEqBag.itemlist[instance.choseid].itemHeld > 1)
         {
             instance.playEqBag.itemlist[instance.choseid].itemHeld -= 1;
         }
         else if (instance.playEqBag.itemlist[instance.choseid].itemHeld == 1)
         {
             //instance.playEqBag.itemlist[instance.choseid] = null;
             instance.playEqBag.itemlist.Remove(instance.playEqBag.itemlist[instance.choseid]);
         }
         chooseBagReflash(2);
         instance.CoinCount.text = string.Join("", instance.playEqBag.coin.itemHeld);
     }
     else if (instance.playerwhichbag == 1)
     {
         instance.playGoodsBag.coin.itemHeld += instance.playGoodsBag.itemlist[instance.choseid].sellprice;
         if (instance.playGoodsBag.itemlist[instance.choseid].itemHeld > 1)
         {
             instance.playGoodsBag.itemlist[instance.choseid].itemHeld -= 1;
         }
         else if (instance.playGoodsBag.itemlist[instance.choseid].itemHeld == 1)
         {
             instance.playGoodsBag.itemlist[instance.choseid] = null;
         }
         chooseBagReflash(1);
         instance.CoinCount.text = string.Join("", instance.playGoodsBag.coin.itemHeld);
         InventoryMG.reflashHMPcount();
     }
 }
示例#2
0
 public void BuyGoods()
 {
     if (!instance.ismybaggoods && instance.ShopBag.itemlist[instance.choseid] != null)
     {
         int tempprice = instance.ShopBag.itemlist[instance.choseid].itemprice;
         int allcoin   = instance.playEqBag.coin.itemHeld;
         if (tempprice <= allcoin)
         {
             instance.playEqBag.coin.itemHeld -= tempprice;
             if (instance.ShopBag.itemlist[instance.choseid].isequip)
             {
                 InventoryMG.MGAddToBag(instance.ShopBag.itemlist[instance.choseid], 0);
                 chooseBagReflash(2);
             }
             else
             {
                 Debug.Log("Buy Medicines");
                 InventoryMG.MGAddToBag(instance.ShopBag.itemlist[instance.choseid], 1);
                 //                    chooseBagReflash(1);
                 InventoryMG.reflashHMPcount();
             }
             instance.goodsinfo.text = "";
             instance.ShopBag.itemlist[instance.choseid] = null;
             chooseBagReflash(0);
         }
         else
         {
             instance.WarningPanel.SetActive(true);
         }
     }
 }