private void DestroyItem(MarketItemView item) { item.Clicked -= OnItemClicked; item.Hide(); item.ApplyModel(null); Destroy(item.gameObject); }
public void SetItems(List <MarketItem> items) { this.items = items; if (list.Count > items.Count) { CloseAllItem(); } if (list.Count < items.Count) { Transform cell = gameObject.transform.FindChild("list/PropCell"); Transform listStage = gameObject.transform.FindChild("list"); int dc = items.Count - list.Count; for (int i = 0; i < dc; i++) { GameObject copyCell = GameObject.Instantiate(cell.gameObject) as GameObject; MarketItemView itemCell = new MarketItemView(copyCell.transform); itemCell.AddToParent(listStage, gameObject.transform.rotation); list.Add(itemCell); itemCell.LocalPosition = cell.localPosition + new Vector3(CELL_WIDTH * (list.Count - 1), 0, 0); } } for (int i = 0; i < items.Count; i++) { list[i].SetItem(items[i]); list[i].Open(); } UpdatePageNum(); // 处理分页问题 ShowArrow(); // 处理箭头显示 }
public virtual void ApplyItem(MarketItemView item) { Target = item; if (Target.Model != null) { ModelUpdate(); } }
private MarketItemView CreateItemInstance() { MarketItemView item = Instantiate(_itemPrefab, _itemsContent); item.Initialize(); item.Clicked += OnItemClicked; return(item); }
public override void ApplyItem(MarketItemView item) { base.ApplyItem(item); if (_text == null) { _text = GetComponent <TextMeshProUGUI>(); ShowFormat = _text.text; } }
public override void ApplyItem(MarketItemView item) { _img = GetComponent <Image>(); _defaultColor = _img.color; base.ApplyItem(item); }
public override void ApplyItem(MarketItemView item) { base.ApplyItem(item); TargetImage = GetComponent <Image>(); SetLoadAnim(false); }
void Awake() { m_instance = this; m_spMarketUIMogoUIRefreshCtrl = transform.FindChild("MarketUIMogoUIRefreshCtrl").GetComponentsInChildren <UISprite>(true)[0]; keyView = transform.FindChild("keyView").gameObject; keyActivateBtn = keyView.transform.FindChild("Button").GetComponent <MogoButton>(); keyInput = keyView.transform.FindChild("Input").GetComponent <UIInput>(); // 热销 hotImgBtn = transform.FindChild("hot").GetComponent <UIImageButton>(); hot = transform.FindChild("hot").GetComponent <MogoButton>(); hot.clickHandler = HotList; hot.pressHandler = HotPress; // 等级礼包 itemImgBtn = transform.FindChild("item").GetComponent <UIImageButton>(); item = transform.FindChild("item").GetComponent <MogoButton>(); item.clickHandler = ItemList; item.pressHandler = ItemPress; m_goItemIconNotice = transform.FindChild("item/ItemIconNotice").gameObject; // 宝石 jewelImgBtn = transform.FindChild("jewel").GetComponent <UIImageButton>(); jewel = transform.FindChild("jewel").GetComponent <MogoButton>(); jewel.clickHandler = JewelList; jewel.pressHandler = JewelPress; // 激活码礼包 keyImgBtn = transform.FindChild("key").GetComponent <UIImageButton>(); key = transform.FindChild("key").GetComponent <MogoButton>(); key.clickHandler = KeyView; key.pressHandler = KeyPress; keyActivateBtn.clickHandler = Activate; //翅膀 wingImgBtn = transform.FindChild("Wing").GetComponent <UIImageButton>(); wing = transform.FindChild("Wing").GetComponent <MogoButton>(); wing.clickHandler = WingView; wing.pressHandler = WingPress; m_marketUIBtnClose = transform.FindChild("MarketUIBtnClose").GetComponentsInChildren <MogoButton>(true)[0]; m_marketUIBtnClose.clickHandler = CloseHandler; m_goMarketUIArrowL = transform.FindChild("MarketUIArrow/MarketUIArrowL").gameObject; m_goMarketUIArrowR = transform.FindChild("MarketUIArrow/MarketUIArrowR").gameObject; pay = transform.FindChild("MarketUIBtnPay").GetComponent <MogoButton>(); rmb = transform.FindChild("MarketUIDiamondNum").GetComponent <UILabel>(); page = transform.FindChild("MarketUIPageNum").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.HotTab] = transform.FindChild("hot/HotLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.JewelTab] = transform.FindChild("jewel/JewelLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.ItemTab] = transform.FindChild("item/ItemLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.KeyTab] = transform.FindChild("key/KeyLabel").GetComponent <UILabel>(); m_MarketTabLabelList[(int)MarketUITab.WingTab] = transform.FindChild("Wing/WingLabel").GetComponent <UILabel>(); foreach (var pair in m_MarketTabLabelList) { if (pair.Key == (int)MarketUITab.HotTab) { MarketTabDown(pair.Key); } else { MarketTabUp(pair.Key); } } // ChineseData if (m_MarketTabLabelList[(int)MarketUITab.HotTab] != null) { m_MarketTabLabelList[(int)MarketUITab.HotTab].text = LanguageData.GetContent(200011); // "热销"; } if (m_MarketTabLabelList[(int)MarketUITab.JewelTab] != null) { m_MarketTabLabelList[(int)MarketUITab.JewelTab].text = LanguageData.GetContent(200012); // "宝石"; } if (m_MarketTabLabelList[(int)MarketUITab.ItemTab] != null) { m_MarketTabLabelList[(int)MarketUITab.ItemTab].text = LanguageData.GetContent(200013); // "道具"; } if (m_MarketTabLabelList[(int)MarketUITab.KeyTab] != null) { m_MarketTabLabelList[(int)MarketUITab.KeyTab].text = LanguageData.GetContent(200014); // "激活码"; } if (m_MarketTabLabelList[(int)MarketUITab.WingTab] != null) { m_MarketTabLabelList[(int)MarketUITab.WingTab].text = LanguageData.GetContent(7525); //翅膀 } gameObject.transform.FindChild("MarketUIBtnPay/MarketUIBtnPayText").GetComponent <UILabel>().text = LanguageData.GetContent(5001); // "充值"; Transform cell = transform.FindChild("list/PropCell"); Transform listStage = transform.FindChild("list"); listView = listStage.GetComponent <MogoList>(); listView.turnPage = TurnPage; list.Add(new MarketItemView(cell)); for (int ii = 1; ii <= pageSize - 1; ii++) { GameObject copyCell = GameObject.Instantiate(cell.gameObject) as GameObject; MarketItemView itemCell = new MarketItemView(copyCell.transform); itemCell.AddToParent(listStage, gameObject.transform.rotation); list.Add(itemCell); itemCell.LocalPosition = cell.localPosition + new Vector3(CELL_WIDTH * ii, 0, 0); } //pre.clickHandler = PrePage; //next.clickHandler = NextPage; pay.clickHandler = Pay; buy = new MarketBuyView(gameObject.transform.FindChild("Buy")); buy.Close(); hotImgBtn.SelectedStatus(true); keyView.SetActive(false); EventDispatcher.AddEventListener <MarketItem>(MarketEvent.OpenBuy, OpenBuy); EventDispatcher.AddEventListener <bool>(MarketEvent.LigthArrow, LightArrowHandler); }
private void AddItemToPool(MarketItemView item) { item.Hide(); _marketItemsPool.Enqueue(item); }
void Awake() { m_instance = this; m_spMarketUIMogoUIRefreshCtrl = transform.FindChild("MarketUIMogoUIRefreshCtrl").GetComponentsInChildren<UISprite>(true)[0]; keyView = transform.FindChild("keyView").gameObject; keyActivateBtn = keyView.transform.FindChild("Button").GetComponent<MogoButton>(); keyInput = keyView.transform.FindChild("Input").GetComponent<UIInput>(); // 热销 hotImgBtn = transform.FindChild("hot").GetComponent<UIImageButton>(); hot = transform.FindChild("hot").GetComponent<MogoButton>(); hot.clickHandler = HotList; hot.pressHandler = HotPress; // 等级礼包 itemImgBtn = transform.FindChild("item").GetComponent<UIImageButton>(); item = transform.FindChild("item").GetComponent<MogoButton>(); item.clickHandler = ItemList; item.pressHandler = ItemPress; m_goItemIconNotice = transform.FindChild("item/ItemIconNotice").gameObject; // 宝石 jewelImgBtn = transform.FindChild("jewel").GetComponent<UIImageButton>(); jewel = transform.FindChild("jewel").GetComponent<MogoButton>(); jewel.clickHandler = JewelList; jewel.pressHandler = JewelPress; // 激活码礼包 keyImgBtn = transform.FindChild("key").GetComponent<UIImageButton>(); key = transform.FindChild("key").GetComponent<MogoButton>(); key.clickHandler = KeyView; key.pressHandler = KeyPress; keyActivateBtn.clickHandler = Activate; //翅膀 wingImgBtn = transform.FindChild("Wing").GetComponent<UIImageButton>(); wing = transform.FindChild("Wing").GetComponent<MogoButton>(); wing.clickHandler = WingView; wing.pressHandler = WingPress; m_marketUIBtnClose = transform.FindChild("MarketUIBtnClose").GetComponentsInChildren<MogoButton>(true)[0]; m_marketUIBtnClose.clickHandler = CloseHandler; m_goMarketUIArrowL = transform.FindChild("MarketUIArrow/MarketUIArrowL").gameObject; m_goMarketUIArrowR = transform.FindChild("MarketUIArrow/MarketUIArrowR").gameObject; pay = transform.FindChild("MarketUIBtnPay").GetComponent<MogoButton>(); rmb = transform.FindChild("MarketUIDiamondNum").GetComponent<UILabel>(); page = transform.FindChild("MarketUIPageNum").GetComponent<UILabel>(); m_MarketTabLabelList[(int)MarketUITab.HotTab] = transform.FindChild("hot/HotLabel").GetComponent<UILabel>(); m_MarketTabLabelList[(int)MarketUITab.JewelTab] = transform.FindChild("jewel/JewelLabel").GetComponent<UILabel>(); m_MarketTabLabelList[(int)MarketUITab.ItemTab] = transform.FindChild("item/ItemLabel").GetComponent<UILabel>(); m_MarketTabLabelList[(int)MarketUITab.KeyTab] = transform.FindChild("key/KeyLabel").GetComponent<UILabel>(); m_MarketTabLabelList[(int)MarketUITab.WingTab] = transform.FindChild("Wing/WingLabel").GetComponent<UILabel>(); foreach (var pair in m_MarketTabLabelList) { if (pair.Key == (int)MarketUITab.HotTab) MarketTabDown(pair.Key); else MarketTabUp(pair.Key); } // ChineseData if (m_MarketTabLabelList[(int)MarketUITab.HotTab] != null) m_MarketTabLabelList[(int)MarketUITab.HotTab].text = LanguageData.GetContent(200011); // "热销"; if (m_MarketTabLabelList[(int)MarketUITab.JewelTab] != null) m_MarketTabLabelList[(int)MarketUITab.JewelTab].text = LanguageData.GetContent(200012); // "宝石"; if (m_MarketTabLabelList[(int)MarketUITab.ItemTab] != null) m_MarketTabLabelList[(int)MarketUITab.ItemTab].text = LanguageData.GetContent(200013); // "道具"; if (m_MarketTabLabelList[(int)MarketUITab.KeyTab] != null) m_MarketTabLabelList[(int)MarketUITab.KeyTab].text = LanguageData.GetContent(200014); // "激活码"; if (m_MarketTabLabelList[(int)MarketUITab.WingTab] != null) m_MarketTabLabelList[(int)MarketUITab.WingTab].text = LanguageData.GetContent(7525); //翅膀 gameObject.transform.FindChild("MarketUIBtnPay/MarketUIBtnPayText").GetComponent<UILabel>().text = LanguageData.GetContent(5001); // "充值"; Transform cell = transform.FindChild("list/PropCell"); Transform listStage = transform.FindChild("list"); listView = listStage.GetComponent<MogoList>(); listView.turnPage = TurnPage; list.Add(new MarketItemView(cell)); for (int ii = 1; ii <= pageSize - 1; ii++) { GameObject copyCell = GameObject.Instantiate(cell.gameObject) as GameObject; MarketItemView itemCell = new MarketItemView(copyCell.transform); itemCell.AddToParent(listStage, gameObject.transform.rotation); list.Add(itemCell); itemCell.LocalPosition = cell.localPosition + new Vector3(CELL_WIDTH * ii, 0, 0); } //pre.clickHandler = PrePage; //next.clickHandler = NextPage; pay.clickHandler = Pay; buy = new MarketBuyView(gameObject.transform.FindChild("Buy")); buy.Close(); hotImgBtn.SelectedStatus(true); keyView.SetActive(false); EventDispatcher.AddEventListener<MarketItem>(MarketEvent.OpenBuy, OpenBuy); EventDispatcher.AddEventListener<bool>(MarketEvent.LigthArrow, LightArrowHandler); }
public void SetItems(List<MarketItem> items) { this.items = items; if (list.Count > items.Count) { CloseAllItem(); } if (list.Count < items.Count) { Transform cell = gameObject.transform.FindChild("list/PropCell"); Transform listStage = gameObject.transform.FindChild("list"); int dc = items.Count - list.Count; for (int i = 0; i < dc; i++) { GameObject copyCell = GameObject.Instantiate(cell.gameObject) as GameObject; MarketItemView itemCell = new MarketItemView(copyCell.transform); itemCell.AddToParent(listStage, gameObject.transform.rotation); list.Add(itemCell); itemCell.LocalPosition = cell.localPosition + new Vector3(CELL_WIDTH * (list.Count - 1), 0, 0); } } for (int i = 0; i < items.Count; i++) { list[i].SetItem(items[i]); list[i].Open(); } UpdatePageNum(); // 处理分页问题 ShowArrow(); // 处理箭头显示 }
public override void ApplyItem(MarketItemView item) { base.ApplyItem(item); _spriteComponent = new LoadingSpriteComponent(SpriteManager); _spriteComponent.Updated += OnSpriteUpdated; }
public override void ApplyItem(MarketItemView item) { base.ApplyItem(item); _overlayImage = GetComponent <Image>(); }
public override void ApplyItem(MarketItemView item) { base.ApplyItem(item); SetState(false); }
public override void ApplyItem(MarketItemView item) { base.ApplyItem(item); _btn = GetComponent <Button>(); _btn.onClick.AddListener(OnClicked); }