zhaoyang 2 years ago
parent
commit
dc4c240f55

+ 1 - 1
FGUIProject/assets/Store/components/Button5.xml

@@ -8,7 +8,7 @@
     <image id="n6_l500" name="n6" src="fqortas" fileName="imagesNew/sc_jinxiexian.png" xy="41,16" pivot="0.5,0" group="n7_l500">
       <relation target="n5_l500" sidePair="width-width"/>
     </image>
-    <group id="n7_l500" name="n7" xy="41,-3" size="60,44" group="n8_l500"/>
+    <group id="n7_l500" name="grpOriginalPrice" xy="41,-3" size="60,44" group="n8_l500" advanced="true"/>
     <text id="n4_l500" name="txtPrice" xy="103,-9" size="43,54" group="n8_l500" fontSize="40" color="#5a3e16" text="99"/>
     <group id="n8_l500" name="n8" xy="3,-9" size="143,54" advanced="true" layout="hz" colGap="2" excludeInvisibles="true">
       <relation target="" sidePair="center-center"/>

+ 100 - 0
GameClient/Assets/Game/HotUpdate/Data/ShopViewManager.cs

@@ -19,6 +19,7 @@ namespace GFGGame
             }, true, false, GameConst.MAX_COUNT_TO_BUY_ITEMS);
         }
 
+        //更行vip进度
         public void UpdateVipProgressCom(GObject obj)
         {
             UI_ComVipLv com = UI_ComVipLv.Proxy(obj);
@@ -42,5 +43,104 @@ namespace GFGGame
             }
             UI_ComVipLv.ProxyEnd();
         }
+
+        //更新商品item
+        public void UptadeItem(GObject obj, ShopCfg shopCfg)
+        {
+            UI_ListShopItem item = UI_ListShopItem.Proxy(obj);
+
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
+
+            item.m_txtName.text = shopCfg.itemName;
+            item.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
+
+            item.m_grpDiscount.visible = shopCfg.price < shopCfg.originalPrice;
+            item.m_txtDesc.text = ((double)(shopCfg.originalPrice / shopCfg.price) * 100).ToString();
+
+            item.m_txtEndTime.SetVar("value", ShopDataManager.Instance.GetEndTime(shopCfg.id)).FlushVars();
+            item.m_txtEndTime.visible = shopCfg.endTime != "";
+
+            item.m_c2.selectedIndex = ShopDataManager.Instance.GetShopGoodsStateById(shopCfg.id) ? 0 : 1;
+            if (shopCfg.lockType == LockType.STORY_LV)
+            {
+                StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(shopCfg.storyLevelId);
+                item.m_txtLock.text = string.Format("通关{0}-{1}解锁", StoryUtil.GetChapterOrder(storyLevelCfg.chapterId), storyLevelCfg.order);
+            }
+            else if (shopCfg.lockType == LockType.ROLE_LV)
+            {
+                item.m_txtLock.text = string.Format("角色达到{0}级解锁", shopCfg.lv);
+            }
+            else if (shopCfg.lockType == LockType.MONTH_CARD_TYPE)
+            {
+                item.m_txtLock.text = string.Format("开通{0}解锁", shopCfg.MonthlyCardType == MonthCardType.Gold ? "金卡" : "黑金卡");
+            }
+
+            int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
+            item.m_txtLimit.visible = shopCfg.maxBuyNum > 0;
+            item.m_txtLimit.text = string.Format("{0}({1}/{2})", ShopDataManager.Instance.refreshType[shopCfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#5A3E16"), shopCfg.maxBuyNum);
+
+            item.m_c1.selectedIndex = shopCfg.maxBuyNum == 0 || buyNum < shopCfg.maxBuyNum ? 0 : 1;
+            if (item.m_c1.selectedIndex == 0)//可购买
+            {
+                item.m_btnBuy.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(shopCfg.originalPrice);
+                if (shopCfg.price > 0 && shopCfg.costType != CostType.FREE)//不免费
+                {
+                    item.m_btnBuy.m_grpOriginalPrice.visible = shopCfg.originalPrice > 0;
+                    item.m_btnBuy.m_loaIcon.visible = true;
+                    item.m_btnBuy.m_txtPrice.text = NumberUtil.ChangeNumberUnit(shopCfg.price);// cfg.price.ToString();
+
+                    if (shopCfg.costType == CostType.RMB)//人民币
+                    {
+                        item.m_btnBuy.m_loaIcon.visible = false;
+                        item.m_btnBuy.m_txtIcon.visible = true;
+                        item.m_btnBuy.m_txtIcon.text = "¥";
+                    }
+                    else//道具
+                    {
+                        ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.costId);
+                        item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(costItemCfg.res);
+                        item.m_btnBuy.m_loaIcon.visible = true;
+                        item.m_btnBuy.m_txtIcon.visible = false;
+                    }
+                }
+                else
+                {
+                    item.m_btnBuy.m_txtIcon.text = "";
+                    item.m_btnBuy.m_loaIcon.visible = false;
+                    item.m_btnBuy.m_grpOriginalPrice.visible = false;
+                    item.m_btnBuy.m_txtPrice.text = "免费";
+                }
+            }
+
+            if (item.target.data == null)
+            {
+                item.target.onClick.Add(OnBtnBuyClick);
+            }
+            item.target.data = shopCfg.id;
+            bool isRed = item.m_c1.selectedIndex == 0 && item.m_c2.selectedIndex == 0 && shopCfg.price == 0;
+
+            RedDotController.Instance.SetComRedDot(item.target, isRed, "", -6, 100);
+            UI_ListShopItem.ProxyEnd();
+        }
+
+        private void OnBtnBuyClick(EventContext context)
+        {
+            GObject btn = context.sender as GObject;
+            int giftId = (int)btn.data;
+            ShopCfg cfg = ShopCfgArray.Instance.GetCfg(giftId);
+            if (cfg.maxBuyNum != 0 && ShopDataManager.Instance.GetGoodsBuyNumById(giftId) == cfg.maxBuyNum)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("已售罄");
+                return;
+            }
+            if (cfg.price == 0 || cfg.costType == CostType.FREE)
+            {
+                RechargeSProxy.ReqBuyGiftBag((int)btn.data).Coroutine();
+            }
+            else
+            {
+                ViewManager.Show<GiftBagBuyView>(btn.data);
+            }
+        }
     }
 }

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Store/UI_Button5.cs

@@ -10,6 +10,7 @@ namespace UI.Store
         public GTextField m_txtIcon;
         public GLoader m_loaIcon;
         public GTextField m_txtOriginalPrice;
+        public GGroup m_grpOriginalPrice;
         public GTextField m_txtPrice;
         public const string URL = "ui://p9mtgheol500tbb";
         public const string PACKAGE_NAME = "Store";
@@ -61,6 +62,7 @@ namespace UI.Store
             m_txtIcon = (GTextField)comp.GetChild("txtIcon");
             m_loaIcon = (GLoader)comp.GetChild("loaIcon");
             m_txtOriginalPrice = (GTextField)comp.GetChild("txtOriginalPrice");
+            m_grpOriginalPrice = (GGroup)comp.GetChild("grpOriginalPrice");
             m_txtPrice = (GTextField)comp.GetChild("txtPrice");
         }
         public void Dispose(bool disposeTarget = false)
@@ -68,6 +70,7 @@ namespace UI.Store
             m_txtIcon = null;
             m_loaIcon = null;
             m_txtOriginalPrice = null;
+            m_grpOriginalPrice = null;
             m_txtPrice = null;
             if(disposeTarget && target != null)
             {

+ 3 - 72
GameClient/Assets/Game/HotUpdate/Views/Store/GiftBagStoreView.cs

@@ -40,7 +40,8 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
-            _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE);
+            int menu2 = (int)this.viewData;
+            _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_GIFT_BAG, menu2);
             _ui.m_list.numItems = _shopCfgs.Count;
         }
 
@@ -56,78 +57,8 @@ namespace GFGGame
 
         private void ListItemRenderer(int index, GObject obj)
         {
-            UI_ListShopItem item = UI_ListShopItem.Proxy(obj);
             ShopCfg shopCfg = _shopCfgs[index];
-            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
-
-            item.m_txtName.text = shopCfg.itemName;
-            item.m_icon.url = ResPathUtil.GetIconPath(itemCfg); // string.Format("ui://RechargeStore/{0}", cfg.res);
-
-            item.m_grpDiscount.visible = shopCfg.price < shopCfg.originalPrice;
-            item.m_txtDesc.text = ((double)(shopCfg.originalPrice / shopCfg.price) * 100).ToString();
-
-            item.m_txtEndTime.SetVar("value", ShopDataManager.Instance.GetEndTime(shopCfg.id)).FlushVars();
-            item.m_txtEndTime.visible = shopCfg.endTime != "";
-
-            item.m_c2.selectedIndex = ShopDataManager.Instance.GetShopGoodsStateById(shopCfg.id) ? 0 : 1;
-            if (shopCfg.lockType == LockType.STORY_LV)
-            {
-                StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(shopCfg.storyLevelId);
-                item.m_txtLock.text = string.Format("通关{0}-{1}解锁", StoryUtil.GetChapterOrder(storyLevelCfg.chapterId), storyLevelCfg.order);
-            }
-            else if (shopCfg.lockType == LockType.ROLE_LV)
-            {
-                item.m_txtLock.text = string.Format("角色达到{0}级解锁", shopCfg.lv);
-            }
-            else if (shopCfg.lockType == LockType.MONTH_CARD_TYPE)
-            {
-                item.m_txtLock.text = string.Format("开通{0}解锁", shopCfg.MonthlyCardType == MonthCardType.Gold ? "金卡" : "黑金卡");
-            }
-
-            int buyNum = ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);
-            item.m_txtLimit.text = string.Format("{0}({1}/{2})", ShopDataManager.Instance.refreshType[shopCfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), shopCfg.maxBuyNum);
-            item.m_txtLimit.visible = shopCfg.maxBuyNum > 0;
-            item.m_c1.selectedIndex = shopCfg.maxBuyNum == 0 || buyNum < shopCfg.maxBuyNum ? 0 : 1;
-            // if (item.m_c1.selectedIndex == 0)
-            // {
-            //     item.m_btnBuy.m_txtOriginalPrice.text = NumberUtil.ChangeNumberUnit(shopCfg.originalPrice);// cfg.originalPrice.ToString();
-            //     if (shopCfg.price > 0 && shopCfg.costType != CostType.FREE)
-            //     {
-            //         item.m_btnBuy.m_grpOriginalPrice.visible = shopCfg.originalPrice > 0;
-            //         item.m_btnBuy.m_grpIcon.visible = true;
-            //         item.m_btnBuy.m_txtPrice.text = NumberUtil.ChangeNumberUnit(shopCfg.price);// cfg.price.ToString();
-
-            //         if (shopCfg.costType == CostType.RMB)
-            //         {
-            //             item.m_btnBuy.m_loaIcon.visible = false;
-            //             item.m_btnBuy.m_txtIcon.visible = true;
-            //             item.m_btnBuy.m_txtIcon.text = "¥";
-            //         }
-            //         else
-            //         {
-            //             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.costId);
-            //             item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
-            //             item.m_btnBuy.m_loaIcon.visible = true;
-            //             item.m_btnBuy.m_txtIcon.visible = false;
-            //         }
-            //     }
-            //     else
-            //     {
-            //         item.m_btnBuy.m_grpIcon.visible = false;
-            //         item.m_btnBuy.m_grpOriginalPrice.visible = false;
-            //         item.m_btnBuy.m_txtPrice.text = "免费";
-            //     }
-            // }
-
-            // if (item.target.data == null)
-            // {
-            //     item.target.onClick.Add(OnBtnBuyClick);
-            // }
-            // item.target.data = shopCfg.id;
-            // bool isRed = item.m_c1.selectedIndex == 0 && item.m_c2.selectedIndex == 0 && shopCfg.price == 0;
-
-            // RedDotController.Instance.SetComRedDot(item.target, isRed, "", -6, 100);
-            UI_ListShopItem.ProxyEnd();
+            ShopViewManager.Instance.UptadeItem(obj, shopCfg);
         }
     }
 }

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

@@ -167,7 +167,7 @@ namespace GFGGame
             ViewManager.Hide(_curViewName);
             if (!string.IsNullOrEmpty(viewName) && viewName != "“”")
             {
-                ViewManager.Show("GFGGame." + viewName, index);
+                ViewManager.Show("GFGGame." + viewName, tabCfg.subTabArr[index][1]);
             }
             _curSubTabIndex = index;
             _curViewName = "GFGGame." + viewName;

BIN
GameClient/Assets/ResIn/UI/Store/Store_fui.bytes