| | |
| | | [SerializeField] Button reduceBtn; |
| | | [SerializeField] Text itemNum; |
| | | |
| | | [SerializeField] Transform queryItemTf; |
| | | [SerializeField] PutawayItem[] queryItems; |
| | | [SerializeField] GameObject noOtherTip; |
| | | |
| | | [SerializeField] Text putawayBtnText; |
| | |
| | | model.queryMarketItemList.TryGetValue(0, out list); |
| | | if (list != null) |
| | | { |
| | | int _Cnt = 0; |
| | | var index = 0; |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | MarketItemData data = list[i]; |
| | | if (data.PlayerID != PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | Transform child = queryItemTf.GetChild(_Cnt); |
| | | _Cnt++; |
| | | child.gameObject.SetActive(true); |
| | | ItemConfig cfg = Config.Instance.Get<ItemConfig>((int)data.ItemTypeID); |
| | | Text text = child.Find("PriceCnt").GetComponent<Text>(); |
| | | int uintprice = (int)data.PriceCount / data.Count; |
| | | if (uintprice < 1) text.text = "<1"; |
| | | else text.text = data.PriceCount.ToString(); |
| | | Button btn = child.GetComponent<Button>(); |
| | | btn.onClick.RemoveAllListeners(); |
| | | btn.onClick.AddListener(() => |
| | | { |
| | | OnQueryItemClick(data); |
| | | }); |
| | | if (cfg != null) |
| | | { |
| | | text = child.Find("ItemName").GetComponent<Text>(); |
| | | text.text = cfg.ItemName; |
| | | Image img = child.Find("Item/EquipBG").GetComponent<Image>(); |
| | | var _itemColor = cfg.ItemColor; |
| | | if (cfg.Type == 111)//翅膀 |
| | | { |
| | | _itemColor = UIHelper.GetItemColor(cfg.ID, ConfigParse.Analysis(data.UserData)); |
| | | } |
| | | img.SetItemBackGround(_itemColor); |
| | | bool _bright = (text is RichText) ? (text as RichText).colorType == RichText.ColorType.Bright : true; |
| | | text.color = UIHelper.GetUIColor(_itemColor, _bright); |
| | | img = child.Find("Item/ItemIcon").GetComponent<Image>(); |
| | | img.SetSprite(cfg.IconKey); |
| | | for (int j = 0; j < 3; j++) |
| | | { |
| | | GameObject obj = child.transform.Find(string.Format("Item/StarList/{0}", j)).gameObject; |
| | | if (j < cfg.StarLevel) |
| | | { |
| | | obj.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | obj.SetActive(false); |
| | | } |
| | | } |
| | | if (index < queryItems.Length)
|
| | | {
|
| | | queryItems[index].gameObject.SetActive(true);
|
| | | queryItems[index].Init(data, OnQueryItemClick);
|
| | | } |
| | | text = child.Find("Item/CountText").GetComponent<Text>(); |
| | | if (data.Count == 1) text.gameObject.SetActive(false); |
| | | else |
| | | { |
| | | text.gameObject.SetActive(true); |
| | | text.text = data.Count.ToString(); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | for (int i = _Cnt; i < 3; i++) |
| | | for (int i = index; i < 3; i++) |
| | | { |
| | | queryItemTf.GetChild(i).gameObject.SetActive(false); |
| | | } |
| | | if (_Cnt > 0) |
| | | { |
| | | queryItemTf.gameObject.SetActive(true); |
| | | noOtherTip.SetActive(false); |
| | | } |
| | | queryItems[i].gameObject.SetActive(false); |
| | | }
|
| | | noOtherTip.SetActive(index == 0); |
| | | } |
| | | } |
| | | #region 购买物品 |
| | |
| | | |
| | | private void InitData() |
| | | { |
| | | queryItemTf.gameObject.SetActive(false); |
| | | for (int i = 0; i < queryItems.Length; i++)
|
| | | {
|
| | | queryItems[i].gameObject.SetActive(false);
|
| | | } |
| | | noOtherTip.SetActive(true); |
| | | if (PutawayData.Instance.itemModel == null) |
| | | { |