void ClickInBag(GameObject go, object parameter) { Parameter.Box p = (Parameter.Box)parameter; CharBag.Goods goods = (CharBag.Goods)p.obj; #if _Debug Debug.Log("ok!!" + " Name:" + goods.Name + " ID:" + p.ID); #endif SlotBox slotbox = new SlotBox(); if (SlotList.ContainsKey(p.ID)) { slotbox = SlotList[p.ID]; slotbox.button.transform.Find("Text").GetComponent <Text>().text = goods.Name; slotbox.button.transform.Find("Bottom/Image").GetComponent <Image>().sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID); slotbox.button.transform.Find("Bottom/Image").GetComponent <Image>().color = new Color(1, 1, 1, 1f); //把物品添加到合成系统的slotlist中 slotbox.slot = goods; SlotList[p.ID] = slotbox; //CloseBag _bagInstance.CloseBagMenu(gameObject); } }
//上架商品 void ClickInBag(GameObject go, object parameter) { Parameter.Box p = (Parameter.Box)parameter; CharBag.Goods goods = (CharBag.Goods)p.obj; //如果货架上有商品,则添加道具到背包 if (goodslist[p.ID - 1].Name != null && goodslist[p.ID - 1].ID != 0) { CharBag.AddGoods(goodslist[p.ID - 1]); } //添加选中的商品到商品列 goodslist[p.ID - 1] = goods; string path = p.ID.ToString() + "/itemIcon"; transform.Find(path).GetComponent <SpriteRenderer>().sprite = Materiral.GetMaterialIcon(goods.MateriralType, goods.ID); //显示商品价格 string priceiconpath = p.ID.ToString() + "/price/icon"; string pricepath = p.ID.ToString() + "/price/text"; transform.Find(priceiconpath).gameObject.SetActive(true); transform.Find(pricepath).gameObject.SetActive(true); transform.Find(pricepath).GetComponent <TextMesh>().text = goods.Price.ToString(); //移除背包中的商品 CharBag.RemoveGoods(goods.UID); _bagInstance.CloseBagMenu(gameObject); ChangeRecipeUiState(); PlayerData.ShopGoodsData.SaveShopGoods(goodslist); CharBag.SaveBagGoods(); questManager.CheckQuestListWithGoods(QuestManager.QuestTypeList.PutGoods, goods, 0); //更新物品信息 PlayerInfo.AddGoodsInfo(goods.MateriralType, goods.ID, PlayerInfo.GoodsInfoType.PutCount); }