From 83a5355c80bee53c88c83932a9015ec4384d7d41 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 12 十二月 2019 00:43:43 +0800
Subject: [PATCH] 8354 商城优化
---
System/Store/StoreWin.cs | 72 +++++++++++++++++++++++++++++++++--
1 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/System/Store/StoreWin.cs b/System/Store/StoreWin.cs
index 2c1d460..59aaac4 100644
--- a/System/Store/StoreWin.cs
+++ b/System/Store/StoreWin.cs
@@ -26,6 +26,7 @@
[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;
@@ -50,7 +51,9 @@
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);
@@ -71,6 +74,7 @@
model.RefreshTCBPlayerDataEvent += OnRefreshPlayerInfo;
model.RefreshBuyShopLimitEvent += OnCreate;
model.mysteryShopRefreshEvent += OnCreate;
+ model.selectClassifyRefresh += OnSecondTypeRefresh;
GlobalTimeEvent.Instance.secondEvent += UpdateRefreshTime;
RefreshCoins();
UpdateRefreshTime();
@@ -123,6 +127,7 @@
model.storeFuncType = StoreFunc.DayStore;
model.RefreshBuyShopLimitEvent -= OnCreate;
model.mysteryShopRefreshEvent -= OnCreate;
+ model.selectClassifyRefresh -= OnSecondTypeRefresh;
GlobalTimeEvent.Instance.secondEvent -= UpdateRefreshTime;
model.RefreshTCBPlayerDataEvent -= OnRefreshPlayerInfo;
}
@@ -140,7 +145,7 @@
{
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];
@@ -170,7 +175,7 @@
{
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)
@@ -248,10 +253,28 @@
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)
{
@@ -268,7 +291,7 @@
}
}
m_ShopCtrl.Restart();
- m_ShopCtrl.JumpIndex(0);
+ //m_ShopCtrl.JumpIndex(0);
RefreshUI();
}
@@ -287,6 +310,11 @@
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)
@@ -318,6 +346,8 @@
{
shopItemCell.stateImage.gameObject.SetActive(false);
}
+
+ shopItemCell.buyOnceText.gameObject.SetActive(false);
var config = ItemConfig.Get(model.GetReplaceId(shopInfo.ID, shopInfo.ItemID));
if (config != null)
@@ -352,6 +382,17 @@
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)
{
@@ -360,6 +401,7 @@
shopItemCell.sellImage.gameObject.SetActive(false);
shopItemCell.itemCell.countText.gameObject.SetActive(false);
+ int buyCntYet = canBuyCnt;
if (canBuyCnt > 0)
{
shopItemCell.itemCell.countText.gameObject.SetActive(true);
@@ -368,7 +410,13 @@
if (shopItemLimit != null)
{
remainNum = canBuyCnt - shopItemLimit.BuyCnt;
+ buyCntYet = shopItemLimit.BuyCnt;
}
+ else
+ {
+ buyCntYet = 0;
+ }
+
if (shopInfo.ShopType == (int)StoreFunc.MysteryStore)
{
@@ -377,7 +425,7 @@
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)
@@ -389,6 +437,12 @@
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);
@@ -421,6 +475,8 @@
{
model.CloseAllRedpoint(StoreFunc.IntegralStore);
model.storeFuncType = StoreFunc.IntegralStore;
+ OnCreateSecondType();
+ model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
OnCreate();
UpdateRefreshTime();
functionOrder = m_IntegralStoreTitle.order;
@@ -439,6 +495,8 @@
{
model.CloseAllRedpoint(StoreFunc.GrowStrongerStore);
model.storeFuncType = StoreFunc.GrowStrongerStore;
+ OnCreateSecondType();
+ model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
OnCreate();
UpdateRefreshTime();
functionOrder = m_GrowStrongerStoreTitle.order;
@@ -448,6 +506,8 @@
{
model.CloseAllRedpoint(StoreFunc.CommonStore);
model.storeFuncType = StoreFunc.CommonStore;
+ OnCreateSecondType();
+ model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
OnCreate();
UpdateRefreshTime();
functionOrder = m_CommonStoreTitle.order;
@@ -466,6 +526,8 @@
{
model.CloseAllRedpoint(StoreFunc.DayStore);
model.storeFuncType = StoreFunc.DayStore;
+ OnCreateSecondType();
+ model.selectSecondType = model.GetFirstStoreSecondType((int)model.storeFuncType);
OnCreate();
UpdateRefreshTime();
functionOrder = m_DayStoreTitle.order;
--
Gitblit v1.8.0