Răsfoiți Sursa

登录时打开商城改成打开1元礼包

huangxiaoyue 1 an în urmă
părinte
comite
6ed26f45a0

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -273,7 +273,7 @@ namespace GFGGame
             FieldDataManager.Instance.waitToShowFieldFightEndView = false;
             GameGlobal.AutoSevenDayLoginView = true;
             GameGlobal.AutoDailySignView = true;
-            GameGlobal.AutoStoreView = true;
+            GameGlobal.AutoSpecialOfferGiftBoxView = true;
             GameGlobal.AutoShowCompleted = false;
             GameGlobal.PreDataInited = false;
             GameGlobal.AfterDataInited = false;

+ 31 - 0
GameClient/Assets/Game/HotUpdate/Data/LimitedTimeGiftBoxDataManager.cs

@@ -173,5 +173,36 @@ namespace GFGGame
                 listData[index] = ltgGbItemData;
             }
         }
+
+        //1元礼包是否还可购买
+
+        public bool SpecialOfferGiftBoxCanBuy()
+        {
+            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData3();
+            if (SpecialOfferGiftBoxCanTypeBuy(ListUtil.NavigateType.None))
+                return true;
+            if (SpecialOfferGiftBoxCanTypeBuy(ListUtil.NavigateType.Next))
+                return true;
+
+            return false;
+        }
+
+        public bool SpecialOfferGiftBoxCanTypeBuy(ListUtil.NavigateType type)
+        {
+            var list = LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData3;
+            list = list.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+                return false;
+
+            var data = ListUtil.Navigate(list, type, 0, out int newIndex);
+            foreach (var shopCfgId in data.ShopCfgIds)
+            {
+                var shopCfg = ShopCfgArray.Instance.GetCfg(shopCfgId);
+                var remainBuyNum = shopCfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
+                if (remainBuyNum > 0)
+                    return true;
+            }
+            return false;
+        }
     }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/GameGlobal.cs

@@ -36,7 +36,7 @@ namespace GFGGame
         public static int lastLoginTime;//上次登录时间
         public static bool AutoSevenDayLoginView = true;
         public static bool AutoDailySignView = true;
-        public static bool AutoStoreView = true;
+        public static bool AutoSpecialOfferGiftBoxView = true;
         //用于标记自动检测打开界面流程已执行完毕
         public static bool AutoShowCompleted;
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/SpecialOfferGiftBoxView.cs

@@ -53,6 +53,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
+            GameGlobal.AutoSpecialOfferGiftBoxView = false;
             AddEffect();
             _ui.m_t0.Play();
             InitPageInex();
@@ -166,7 +167,6 @@ namespace GFGGame
             UI_ComSpecialOfferGiftBoxItem uiItem = UI_ComSpecialOfferGiftBoxItem.Proxy(obj);
             var shopCfgIds = uiItem.target.parent.data as List<int>;
             var shopCfgId = shopCfgIds[index];
-
             var shopCfg = ShopCfgArray.Instance.GetCfg(shopCfgId);
             var shopItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
 

+ 11 - 4
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -1082,14 +1082,21 @@ namespace GFGGame
                     return;
                 }
             }
-            if (GameGlobal.AutoStoreView)
+            if (GameGlobal.AutoSpecialOfferGiftBoxView)
             {
-                List<int> shopListId = new List<int>() { 40012, 40013 };
-                if (ShopDataManager.Instance.GetShopIdCanBuyInShop(ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY, shopListId))
+                //List<int> shopListId = new List<int>() { 40012, 40013 };
+                //if (ShopDataManager.Instance.GetShopIdCanBuyInShop(ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY, shopListId))
+                //{
+                //    ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_GIFT_BAG, ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY });
+                //    return;
+                //}
+
+                if (LimitedTimeGiftBoxDataManager.Instance.SpecialOfferGiftBoxCanBuy())
                 {
-                    ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_GIFT_BAG, ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY });
+                    ViewManager.Show<SpecialOfferGiftBoxView>();
                     return;
                 }
+
             }
             if (FieldDataManager.Instance.waitToShowFieldFightEndView)
             {

+ 0 - 1
GameClient/Assets/Game/HotUpdate/Views/Store/StoreView.cs

@@ -63,7 +63,6 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            GameGlobal.AutoStoreView = false;
             StoreTabCfg arenaTab = StoreTabCfgArray.Instance.GetCfgByfunctionId(ConstFunctionId.STORE_ARENA);
             _arenaSubTab.Clear();
             _arenaSubTab.Add(new List<string>() { arenaTab.subTabArr[0][0], arenaTab.subTabArr[0][1], arenaTab.subTabArr[0][2] });