| | |
| | | [SerializeField] Button m_RightBtn;
|
| | | [SerializeField] Button m_CloseBtn;
|
| | | [SerializeField] ScrollerController m_ShopCtrl;
|
| | | [SerializeField] ScrollerController m_ShopSecondCtrl;
|
| | | [SerializeField] GameObject m_FollowStoreBottom;
|
| | | [SerializeField] Text m_CoinsType1;
|
| | | [SerializeField] Text m_CoinsType2;
|
| | |
| | | protected override void AddListeners()
|
| | | {
|
| | | m_ShopCtrl.OnRefreshCell += RefreshShopCell;
|
| | | m_ShopSecondCtrl.OnRefreshCell += RefreshShopSecondCell;
|
| | | m_ShopCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | | m_ShopSecondCtrl.lockType = EnhanceLockType.KeepVertical;
|
| | |
|
| | | m_DayStoreTitle.SetListener(OpenDayStore);
|
| | | m_WeekStoreTitle.SetListener(OpenMysteryStore);
|
| | |
| | | model.RefreshTCBPlayerDataEvent += OnRefreshPlayerInfo;
|
| | | model.RefreshBuyShopLimitEvent += OnCreate;
|
| | | model.mysteryShopRefreshEvent += OnCreate;
|
| | | model.selectClassifyRefresh += OnSecondTypeRefresh;
|
| | | GlobalTimeEvent.Instance.secondEvent += UpdateRefreshTime;
|
| | | RefreshCoins();
|
| | | UpdateRefreshTime();
|
| | |
| | | model.storeFuncType = StoreFunc.DayStore;
|
| | | model.RefreshBuyShopLimitEvent -= OnCreate;
|
| | | model.mysteryShopRefreshEvent -= OnCreate;
|
| | | model.selectClassifyRefresh -= OnSecondTypeRefresh;
|
| | | GlobalTimeEvent.Instance.secondEvent -= UpdateRefreshTime;
|
| | | model.RefreshTCBPlayerDataEvent -= OnRefreshPlayerInfo;
|
| | | }
|
| | |
| | | {
|
| | | if (model.jumpToItemId != 0)
|
| | | {
|
| | | var p_shopItemlist = model.TryGetStoreDatas(model.storeFuncType);
|
| | | var p_shopItemlist = model.TryGetStoreDatasBySecondType((int)model.storeFuncType, model.selectSecondType);
|
| | | for (int i = 0; i < p_shopItemlist.Count; i++)
|
| | | {
|
| | | var storeData = p_shopItemlist[i];
|
| | |
| | | {
|
| | | if (commodities == null || commodities.Count < 1)
|
| | | {
|
| | | commodities = model.TryGetStoreDatas(model.storeFuncType);
|
| | | commodities = model.TryGetStoreDatasBySecondType((int)model.storeFuncType, model.selectSecondType);
|
| | | }
|
| | |
|
| | | if (commodities == null || commodities.Count == 0)
|
| | |
| | | m_CoinsType3.text = UIHelper.ReplaceXianYuanCoinsNum(UIHelper.GetMoneyCnt(17));
|
| | | }
|
| | |
|
| | | private void OnSecondTypeRefresh()
|
| | | {
|
| | | OnCreate();
|
| | | m_ShopSecondCtrl.m_Scorller.RefreshActiveCellViews();
|
| | | }
|
| | |
|
| | | private void OnCreateSecondType()
|
| | | {
|
| | | var arrayList = model.GetStoreSecondTypeList((int)model.storeFuncType);
|
| | | m_ShopSecondCtrl.Refresh();
|
| | | foreach(int secondType in arrayList)
|
| | | {
|
| | | m_ShopSecondCtrl.AddCell(ScrollerDataType.Header, secondType);
|
| | |
|
| | | }
|
| | | m_ShopSecondCtrl.Restart();
|
| | | }
|
| | |
|
| | | private void OnCreate()
|
| | | {
|
| | | shopId = 0;
|
| | | commodities = model.TryGetStoreDatas(model.storeFuncType);
|
| | | commodities = model.TryGetStoreDatasBySecondType((int)model.storeFuncType, model.selectSecondType);
|
| | | m_ShopCtrl.Refresh();
|
| | | if (commodities.Count > 0)
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | | m_ShopCtrl.Restart();
|
| | | m_ShopCtrl.JumpIndex(0);
|
| | | //m_ShopCtrl.JumpIndex(0);
|
| | | RefreshUI();
|
| | | }
|
| | |
|
| | |
| | | default:
|
| | | break;
|
| | | }
|
| | | }
|
| | | private void RefreshShopSecondCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var secondCell = cell as ShopSecondCell;
|
| | | secondCell.Display(secondCell.index);
|
| | | }
|
| | |
|
| | | private void RefreshShopCell(ScrollerDataType type, CellView cell)
|
| | |
| | | {
|
| | | shopItemCell.stateImage.gameObject.SetActive(false);
|
| | | }
|
| | |
|
| | | shopItemCell.buyOnceText.gameObject.SetActive(false);
|
| | |
|
| | | var config = ItemConfig.Get(model.GetReplaceId(shopInfo.ID, shopInfo.ItemID));
|
| | | if (config != null)
|
| | |
| | | isShowBuyPrice = false;
|
| | | }
|
| | | }
|
| | | else if (PlayerDatas.Instance.baseData.LV < shopInfo.LV)
|
| | | {
|
| | | //等级购买限制
|
| | | shopItemCell.coinsIcon.gameObject.SetActive(false);
|
| | | shopItemCell.vipText.gameObject.SetActive(true);
|
| | | shopItemCell.vipText.text = Language.Get("StoreWin115", shopInfo.LV);
|
| | | shopItemCell.sellImage.gameObject.SetActive(false);
|
| | | shopItemCell.itemNameText.color = UIHelper.GetUIColor(TextColType.Red, true);
|
| | | shopItemCell.vipText.color = UIHelper.GetUIColor(TextColType.Red, true);
|
| | | isShowBuyPrice = false;
|
| | | }
|
| | |
|
| | | if (isShowBuyPrice)
|
| | | {
|
| | |
| | | shopItemCell.sellImage.gameObject.SetActive(false);
|
| | |
|
| | | shopItemCell.itemCell.countText.gameObject.SetActive(false);
|
| | | int buyCntYet = canBuyCnt;
|
| | | if (canBuyCnt > 0)
|
| | | {
|
| | | shopItemCell.itemCell.countText.gameObject.SetActive(true);
|
| | |
| | | if (shopItemLimit != null)
|
| | | {
|
| | | remainNum = canBuyCnt - shopItemLimit.BuyCnt;
|
| | | buyCntYet = shopItemLimit.BuyCnt;
|
| | | }
|
| | | else
|
| | | {
|
| | | buyCntYet = 0;
|
| | | }
|
| | |
|
| | |
|
| | | if (shopInfo.ShopType == (int)StoreFunc.MysteryStore)
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | var remainNumDescription = remainNum > 0 ? remainNum.ToString() : UIHelper.AppendColor(TextColType.Red, remainNum.ToString());
|
| | | shopItemCell.itemCell.countText.text = StringUtility.Contact(remainNumDescription, "/", canBuyCnt);
|
| | | shopItemCell.itemCell.countText.text = shopInfo.TheOnlyShop == 1 ? "" : StringUtility.Contact(remainNumDescription, "/", canBuyCnt);
|
| | | }
|
| | |
|
| | | if (remainNum > 0)
|
| | |
| | | shopItemCell.sellImage.gameObject.SetActive(true);
|
| | | shopItemCell.stateImage.gameObject.SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | | if (shopInfo.TheOnlyShop == 1)
|
| | | {
|
| | | shopItemCell.buyOnceText.gameObject.SetActive(true);
|
| | | shopItemCell.buyOnceText.text = Language.Get("StoreWin116", buyCntYet, canBuyCnt);
|
| | | }
|
| | |
|
| | | shopItemCell.itemNameText.color = UIHelper.GetUIColor(config.ItemColor, true);
|
| | |
| | | {
|
| | | model.CloseAllRedpoint(StoreFunc.IntegralStore);
|
| | | model.storeFuncType = StoreFunc.IntegralStore;
|
| | | OnCreateSecondType();
|
| | | model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
|
| | | OnCreate();
|
| | | UpdateRefreshTime();
|
| | | functionOrder = m_IntegralStoreTitle.order;
|
| | |
| | | {
|
| | | model.CloseAllRedpoint(StoreFunc.GrowStrongerStore);
|
| | | model.storeFuncType = StoreFunc.GrowStrongerStore;
|
| | | OnCreateSecondType();
|
| | | model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
|
| | | OnCreate();
|
| | | UpdateRefreshTime();
|
| | | functionOrder = m_GrowStrongerStoreTitle.order;
|
| | |
| | | {
|
| | | model.CloseAllRedpoint(StoreFunc.CommonStore);
|
| | | model.storeFuncType = StoreFunc.CommonStore;
|
| | | OnCreateSecondType();
|
| | | model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
|
| | | OnCreate();
|
| | | UpdateRefreshTime();
|
| | | functionOrder = m_CommonStoreTitle.order;
|
| | |
| | | {
|
| | | model.CloseAllRedpoint(StoreFunc.DayStore);
|
| | | model.storeFuncType = StoreFunc.DayStore;
|
| | | OnCreateSecondType();
|
| | | model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
|
| | | OnCreate();
|
| | | UpdateRefreshTime();
|
| | | functionOrder = m_DayStoreTitle.order;
|