Browse Source

商城兑换

zhaoyang 3 years ago
parent
commit
ffe4146c90

+ 4 - 15
FGUIProject/assets/CommonGame/BuyCountUI.xml

@@ -1,19 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="936,536">
-  <controller name="c1" pages="0,,1," selected="0"/>
   <displayList>
-    <image id="n0_hinb" name="bg" src="lwri5u" fileName="imagesExport/hc_kuang_6.png" pkg="mk0fwx0x" xy="0,0" size="936,536">
-      <gearSize controller="c1" pages="0" values="936,536,1,1" default="936,695,1,1"/>
-    </image>
+    <image id="n0_hinb" name="bg" src="lwri5u" fileName="imagesExport/hc_kuang_6.png" pkg="mk0fwx0x" xy="0,0" size="936,536"/>
     <component id="n23_ai2z" name="btnAll" src="ai2z9f" fileName="components/Button12.xml" xy="731,131"/>
-    <image id="n19_ai2z" name="n19" src="ai2z9e" fileName="imagesExport/hb_kuangdi_2.png" xy="69,237" group="n21_ai2z">
-      <gearDisplay controller="c1" pages="0"/>
-    </image>
+    <image id="n19_ai2z" name="n19" src="ai2z9e" fileName="imagesExport/hb_kuangdi_2.png" xy="69,237" group="n21_ai2z"/>
     <loader id="n4_hinb" name="icon" xy="101,66" size="200,200" group="n21_ai2z" aspect="true"/>
     <loader id="n17_ugdz" name="rarity" xy="257,66" size="44,94" group="n21_ai2z" url="ui://eg2y0ldpd4iw52" autoSize="true"/>
-    <text id="n5_hinb" name="txtName" xy="100,236" size="201,41" group="n21_ai2z" fontSize="30" color="#ffffff" align="center" autoSize="height" text="名字">
-      <gearDisplay controller="c1" pages="0"/>
-    </text>
+    <text id="n5_hinb" name="txtName" xy="100,236" size="201,41" group="n21_ai2z" fontSize="30" color="#ffffff" align="center" autoSize="height" text="名字"/>
     <group id="n21_ai2z" name="n21" xy="69,66" size="264,211"/>
     <image id="n8_hinb" name="n8" src="ai2z9d" fileName="imagesExport/hb_kuangdi_1.png" xy="353,138" group="n22_ai2z"/>
     <component id="n9_hinb" name="btnPlus" src="hinb5s" fileName="components/ButtonPlus2.xml" xy="618,130" group="n22_ai2z"/>
@@ -26,16 +19,12 @@
     <text id="n15_ugdz" name="txtPrice" xy="459,288" pivot="0.5,0" size="93,49" group="n16_ugdz" fontSize="36" color="#fdf3d7" autoClearText="true" text="9999"/>
     <group id="n16_ugdz" name="n16" xy="331,288" size="273,49" advanced="true"/>
     <component id="n6_hinb" name="btnSure" src="q08x7" fileName="components/Button2.xml" pkg="mk0fwx0x" xy="496,354">
-      <gearText controller="c1" pages="0" values="确认" default="兑换"/>
       <Button title="确认"/>
     </component>
     <component id="n7_hinb" name="btnCancel" src="q08x6" fileName="components/Button1.xml" pkg="mk0fwx0x" xy="54,354">
-      <gearDisplay controller="c1" pages="0"/>
       <Button title="取消"/>
     </component>
-    <text id="n24_ai2z" name="txtBuyTips" xy="314,471" pivot="0.5,0" size="308,36" fontSize="26" color="#a0845c" text="消耗1珍珠,可兑换10缴销">
-      <gearDisplay controller="c1" pages="0"/>
-    </text>
+    <text id="n24_ai2z" name="txtBuyTips" xy="314,471" pivot="0.5,0" size="308,36" fontSize="26" color="#a0845c" text="消耗1珍珠,可兑换10缴销"/>
   </displayList>
   <relation target="n0_hinb" sidePair="height-height"/>
 </component>

BIN
FGUIProject/assets/CommonGame/images/sc_tc_kuang_2.png


+ 1 - 0
FGUIProject/assets/CommonGame/package.xml

@@ -182,6 +182,7 @@
     <component id="10nota6" name="Button14.xml" path="/components/" exported="true"/>
     <component id="10nota7" name="Button15.xml" path="/components/" exported="true"/>
     <image id="dmsi1h" name="sc_xtxtxt.png" path="/images/" scale="9grid" scale9grid="12,0,44,2"/>
+    <image id="iftfta9" name="sc_tc_kuang_2.png" path="/images/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\CommonGame" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

+ 4 - 8
FGUIProject/assets/RechargeStore/ItemExchangeUI.xml

@@ -7,9 +7,9 @@
     <loader id="n4_hinb" name="icon" xy="57,158" size="200,200" group="n21_ai2z" aspect="true"/>
     <loader id="n17_ugdz" name="rarity" xy="215,158" size="44,94" group="n21_ai2z" url="ui://eg2y0ldpd4iw52" autoSize="true"/>
     <text id="n28_10not" name="txtNum" xy="123,313" pivot="0.5,0" size="69,49" group="n21_ai2z" fontSize="36" color="#fff7e6" align="center" strokeColor="#816531" text="x10"/>
-    <text id="n29_10not" name="txtBuyCount" xy="86,358" pivot="0.5,0" size="138,44" group="n21_ai2z" fontSize="32" color="#bc8068" text="剩余:100"/>
+    <text id="n29_10not" name="txtLastCount" xy="86,358" pivot="0.5,0" size="138,44" group="n21_ai2z" fontSize="32" color="#bc8068" text="剩余:100"/>
     <group id="n21_ai2z" name="n21" xy="48,148" size="220,254"/>
-    <text id="n30_10not" name="txtHasCount" xy="692,121" size="138,46" fontSize="34" color="#a38e66" align="center" text="已拥有:"/>
+    <text id="n30_10not" name="txtHasCount" xy="692,121" size="138,46" fontSize="34" color="#a38e66" align="center" ubb="true" text="已拥有:"/>
     <text id="n32_10not" name="n32" xy="40,422" size="180,59" group="n22_ai2z" fontSize="44" color="#a08249" align="center" text="兑换数量"/>
     <image id="n8_hinb" name="n8" src="dmsi1p" fileName="images/sc_tc_kuang_3.png" xy="241,429" group="n22_ai2z"/>
     <text id="n25_t1at" name="txtCount" xy="368,426" size="200,56" group="n22_ai2z" fontSize="42" color="#fdf3d7" align="center" vAlign="middle" autoSize="none" text="找钱"/>
@@ -25,14 +25,10 @@
     <text id="n15_ugdz" name="txtPrice" xy="484,510" size="93,49" group="n27_10not" fontSize="36" color="#fdf3d7" autoClearText="true" text="9999"/>
     <group id="n27_10not" name="n27" xy="358,510" size="219,49" group="n16_ugdz"/>
     <group id="n16_ugdz" name="n16" xy="331,510" size="274,49" advanced="true"/>
-    <component id="n6_hinb" name="btnSure" src="q08x7" fileName="components/Button2.xml" pkg="mk0fwx0x" xy="278,566">
+    <component id="n6_hinb" name="btnExchange" src="q08x7" fileName="components/Button2.xml" pkg="mk0fwx0x" xy="278,566">
       <Button title="兑换"/>
     </component>
-    <component id="n7_hinb" name="btnCancel" src="q08x6" fileName="components/Button1.xml" pkg="mk0fwx0x" xy="54,354" visible="false">
-      <Button title="取消"/>
-    </component>
-    <text id="n24_ai2z" name="txtBuyTips" xy="314,471" pivot="0.5,0" size="308,36" visible="false" fontSize="26" color="#a0845c" text="消耗1珍珠,可兑换10缴销"/>
-    <text id="n31_10not" name="txtDiscribe" xy="315,176" size="550,49" fontSize="36" color="#a38b64" align="center" autoSize="none" text="描述描述描述描述描述描述描述描述"/>
+    <text id="n31_10not" name="txtDiscribe" xy="315,176" size="550,49" fontSize="36" color="#a38b64" autoSize="none" text="描述描述描述描述描述描述描述描述"/>
   </displayList>
   <relation target="n0_hinb" sidePair="height-height"/>
 </component>

+ 9 - 9
FGUIProject/assets/RechargeStore/RechargeStoreUI.xml

@@ -1,20 +1,17 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="1080,1920">
-  <controller name="c1" pages="0,,1,,2," selected="1"/>
+  <controller name="c1" pages="0,,1,,2," selected="2"/>
   <displayList>
     <image id="n2_d4iw" name="n2" src="10nota3" fileName="bgimg/scsc_bjbj.jpg" pkg="eg2y0ldp" xy="0,-240">
       <relation target="" sidePair="center-center,middle-middle"/>
     </image>
     <component id="n3_d4iw" name="btnBack" src="9xlo8" fileName="components/ButtonBack1.xml" pkg="eg2y0ldp" xy="35,80"/>
     <component id="n1_d4iw" name="valueBar" src="v3541v" fileName="components/ComponentValueBar.xml" pkg="eg2y0ldp" xy="159,90"/>
-    <image id="n15_10not" name="n15" src="dmsi1d" fileName="images/sc_kuangjia_1.png" xy="0,410" size="1080,1510">
+    <image id="n15_10not" name="n15" src="dmsi1d" fileName="images/sc_kuangjia_1.png" xy="0,414" size="1080,1506">
       <relation target="" sidePair="height-height,top-top"/>
     </image>
-    <image id="n16_10not" name="n16" src="10not1r" fileName="images/sc_kuangjia_3.png" xy="0,1613">
-      <relation target="" sidePair="left-left,bottom-bottom"/>
-    </image>
-    <component id="n17_10not" name="comTab" src="10not1s" fileName="components/Component1.xml" xy="95,398"/>
-    <list id="n10_d4iw" name="list" xy="0,468" size="1080,1060" layout="flow_hz" overflow="scroll" scrollBarFlags="64" colGap="22" defaultItem="ui://vlgobc15d4iwr" align="center" scrollItemToViewOnClick="false">
+    <component id="n17_10not" name="comTab" src="10not1s" fileName="components/Component1.xml" xy="95,401"/>
+    <list id="n10_d4iw" name="list" xy="0,472" size="1080,1232" layout="flow_hz" overflow="scroll" scrollBarFlags="64" colGap="22" defaultItem="ui://vlgobc15d4iwr" align="center" scrollItemToViewOnClick="false">
       <gearDisplay controller="c1" pages="0"/>
       <relation target="" sidePair="bottomext-bottom"/>
       <item/>
@@ -25,7 +22,7 @@
       <item/>
       <item/>
     </list>
-    <list id="n23_10not" name="listGift" xy="0,468" size="1080,1060" layout="flow_hz" overflow="scroll" colGap="10" defaultItem="ui://vlgobc1510not1t" align="center">
+    <list id="n23_10not" name="listGift" xy="0,472" size="1080,1232" layout="flow_hz" overflow="scroll" colGap="10" defaultItem="ui://vlgobc1510not1t" align="center">
       <gearDisplay controller="c1" pages="1"/>
       <relation target="" sidePair="bottomext-bottom"/>
       <item/>
@@ -39,7 +36,7 @@
       <item/>
       <item/>
     </list>
-    <list id="n24_10not" name="listExchange" xy="0,468" size="1080,1060" layout="flow_hz" overflow="scroll" scrollBarFlags="64" colGap="22" defaultItem="ui://vlgobc15d4iwr" align="center" scrollItemToViewOnClick="false">
+    <list id="n24_10not" name="listExchange" xy="0,472" size="1080,1232" layout="flow_hz" overflow="scroll" scrollBarFlags="64" colGap="22" defaultItem="ui://vlgobc15d4iwr" align="center" scrollItemToViewOnClick="false">
       <gearDisplay controller="c1" pages="2"/>
       <relation target="" sidePair="bottomext-bottom"/>
       <item/>
@@ -50,5 +47,8 @@
       <item/>
       <item/>
     </list>
+    <image id="n16_10not" name="n16" src="10not1r" fileName="images/sc_kuangjia_3.png" xy="0,1613">
+      <relation target="" sidePair="left-left,bottom-bottom"/>
+    </image>
   </displayList>
 </component>

+ 1 - 1
FGUIProject/assets/RechargeStore/components/StoreListItem.xml

@@ -3,7 +3,7 @@
   <displayList>
     <image id="n17_dmsi" name="n17" src="dmsi1c" fileName="images/sc_kuangdikjia_1.png" xy="0,0"/>
     <image id="n12_d4iw" name="imgDouble" src="dmsi1e" fileName="images/sc_kuangjia_2.png" xy="234,109"/>
-    <loader id="n15_d4iw" name="icon" xy="70,211" size="162,162" url="ui://vlgobc15d4iwl"/>
+    <loader id="n15_d4iw" name="icon" xy="70,211" size="162,162" url="ui://vlgobc15d4iwl" fill="scaleMatchHeight"/>
     <text id="n16_d4iw" name="txtName" xy="76,140" pivot="0.5,0" size="149,51" fontSize="38" color="#906d4b" align="center" text="钻石600">
       <relation target="" sidePair="center-center,middle-middle"/>
     </text>

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstBuyType.cs

@@ -5,6 +5,7 @@ namespace GFGGame
         public const int TYPE_NORMAL = 0;//无类型兑换,无表格
         public const int TYPE_ITEM = 1;//物品兑换,对应兑换表
         public const int TYPE_SHOP = 2;//商店兑换,对应商店表
+        public const int TYPE_ITEM_Store = 2;//物品兑换,对应兑换商店表
 
     }
 }

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -42,7 +42,9 @@ namespace GFGGame
 
         public const string LUCKY_BOX = "LUCKY_BOX";
 
+        public const string BUY_RECHARGE_SUCCESS = "BUY_RECHARGE_SUCCESS";//充值成功
         public const string BUY_GIFT_SUCCESS = "BUY_GIFT_SUCCESS";//购买礼包成功
+        public const string BUY_EXCHANGE_SUCCESS = "BUY_EXCHANGE_SUCCESS";//商城兑换成功
 
     }
 }

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

@@ -189,8 +189,8 @@ namespace GFGGame
             MainStorySProxy.GetStoryInfos().Coroutine();
             CardSProxy.GetCardInfos().Coroutine();
             RechargeSProxy.ReqRechargeInfo().Coroutine();
-            RechargeSProxy.ReqRequestGiftBagInfo().Coroutine();
-            RechargeSProxy.ReqExchangeInfo().Coroutine();
+            // RechargeSProxy.ReqRequestGiftBagInfo().Coroutine();
+            // RechargeSProxy.ReqExchangeInfo().Coroutine();
 
             EquipDataCache.cacher.autoPlay = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY) <= 0 ? false : true;
             EquipDataCache.cacher.fightSpeed = StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED) <= 1 ? 1 : StorageDataManager.Instance.GetStorageValue(ConstStorageId.STORAGE_AUTO_PLAY_SPEED);

+ 6 - 12
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/RechargeStore/UI_ItemExchangeUI.cs

@@ -12,7 +12,7 @@ namespace UI.RechargeStore
         public GLoader m_icon;
         public GLoader m_rarity;
         public GTextField m_txtNum;
-        public GTextField m_txtBuyCount;
+        public GTextField m_txtLastCount;
         public GTextField m_txtHasCount;
         public GTextField m_txtCount;
         public GButton m_btnPlus;
@@ -20,9 +20,7 @@ namespace UI.RechargeStore
         public GButton m_btnAll;
         public GLoader m_iconPrice;
         public GTextField m_txtPrice;
-        public GButton m_btnSure;
-        public GButton m_btnCancel;
-        public GTextField m_txtBuyTips;
+        public GButton m_btnExchange;
         public GTextField m_txtDiscribe;
         public const string URL = "ui://vlgobc1510nota8";
         public const string PACKAGE_NAME = "RechargeStore";
@@ -76,7 +74,7 @@ namespace UI.RechargeStore
             m_icon = (GLoader)comp.GetChild("icon");
             m_rarity = (GLoader)comp.GetChild("rarity");
             m_txtNum = (GTextField)comp.GetChild("txtNum");
-            m_txtBuyCount = (GTextField)comp.GetChild("txtBuyCount");
+            m_txtLastCount = (GTextField)comp.GetChild("txtLastCount");
             m_txtHasCount = (GTextField)comp.GetChild("txtHasCount");
             m_txtCount = (GTextField)comp.GetChild("txtCount");
             m_btnPlus = (GButton)comp.GetChild("btnPlus");
@@ -84,9 +82,7 @@ namespace UI.RechargeStore
             m_btnAll = (GButton)comp.GetChild("btnAll");
             m_iconPrice = (GLoader)comp.GetChild("iconPrice");
             m_txtPrice = (GTextField)comp.GetChild("txtPrice");
-            m_btnSure = (GButton)comp.GetChild("btnSure");
-            m_btnCancel = (GButton)comp.GetChild("btnCancel");
-            m_txtBuyTips = (GTextField)comp.GetChild("txtBuyTips");
+            m_btnExchange = (GButton)comp.GetChild("btnExchange");
             m_txtDiscribe = (GTextField)comp.GetChild("txtDiscribe");
         }
         public void Dispose(bool disposeTarget = false)
@@ -96,7 +92,7 @@ namespace UI.RechargeStore
             m_icon = null;
             m_rarity = null;
             m_txtNum = null;
-            m_txtBuyCount = null;
+            m_txtLastCount = null;
             m_txtHasCount = null;
             m_txtCount = null;
             m_btnPlus = null;
@@ -104,9 +100,7 @@ namespace UI.RechargeStore
             m_btnAll = null;
             m_iconPrice = null;
             m_txtPrice = null;
-            m_btnSure = null;
-            m_btnCancel = null;
-            m_txtBuyTips = null;
+            m_btnExchange = null;
             m_txtDiscribe = null;
             if(disposeTarget && target != null)
             {

+ 7 - 1
GameClient/Assets/Game/HotUpdate/ServerProxy/RechargeSProxy.cs

@@ -14,6 +14,8 @@ namespace GFGGame
                 {
                     RechargeDataManager.Instance.UpdateRechargeData(response.RechargeId, response.RechargedTimes);
                     PromptController.Instance.ShowFloatTextPrompt("虚拟充值成功", MessageType.SUCCESS);
+                    EventAgent.DispatchEvent(ConstMessage.BUY_RECHARGE_SUCCESS);
+
                 }
             }
         }
@@ -78,7 +80,7 @@ namespace GFGGame
                 }
             }
         }
-        public static async ETTask ReqExchangeShopItem(int exchangeId)
+        public static async ETTask<bool> ReqExchangeShopItem(int exchangeId, int buyNum)
         {
             M2C_ExchangeShopItem response = null;
             response = (M2C_ExchangeShopItem)await MessageHelper.SendToServer(new C2M_ExchangeShopItem() { ExchangeId = exchangeId });
@@ -87,8 +89,12 @@ namespace GFGGame
                 if (response.Error == ErrorCode.ERR_Success)
                 {
                     RechargeDataManager.Instance.UpdateExchangeData(response.ExchangeId, response.ExchangeTimes);
+                    EventAgent.DispatchEvent(ConstMessage.BUY_EXCHANGE_SUCCESS);
+
+                    return true;
                 }
             }
+            return false;
         }
     }
 }

+ 136 - 0
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/ItemExchangeView.cs

@@ -0,0 +1,136 @@
+using System;
+using FairyGUI;
+using UI.RechargeStore;
+
+namespace GFGGame
+{
+    public class ItemExchangeView : BaseWindow
+    {
+        private UI_ItemExchangeUI _ui;
+        private int _exchangeId;
+        private int _buyCount = 0;
+        private int _maxCanBuy = 0;
+        public override void Dispose()
+        {
+
+            if (_ui != null)
+            {
+                _ui.Dispose();
+            }
+            _ui = null;
+            base.Dispose();
+        }
+        protected override void OnHide()
+        {
+            base.OnHide();
+
+        }
+        protected override void OnInit()
+        {
+            base.OnInit();
+            packageName = UI_GiftBagBuyUI.PACKAGE_NAME;
+            _ui = UI_ItemExchangeUI.Create();
+            this.viewCom = _ui.target;
+            this.viewCom.Center();
+            this.modal = true;
+            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
+
+            _ui.m_btnPlus.onClick.Add(OnBtnPlusClick);
+            _ui.m_btnMinus.onClick.Add(OnBtnMinusClick);
+            _ui.m_btnAll.onClick.Add(OnBtnAllClick);
+            _ui.m_btnExchange.onClick.Add(OnBtnExchangeClick);
+        }
+
+        protected override void OnShown()
+        {
+            base.OnShown();
+
+            _exchangeId = (int)this.viewData;
+            ShopExchangeCfg cfg = ShopExchangeCfgArray.Instance.GetCfg(_exchangeId);
+
+            _buyCount = 1;
+            if (cfg.maxLimit == 0)
+            {
+                _maxCanBuy = GameConst.MAX_COUNT_TO_BUY_ITEMS;
+            }
+            else
+            {
+                _maxCanBuy = Math.Min(ItemDataManager.GetItemNum(cfg.costId) / cfg.costNum, cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id));
+            }
+
+            UpdateStaticView();
+            UpdateView();
+        }
+        private void UpdateStaticView()
+        {
+            ShopExchangeCfg cfg = ShopExchangeCfgArray.Instance.GetCfg(_exchangeId);
+            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
+            _ui.m_txtName.text = itemCfg.name;
+            _ui.m_txtDiscribe.text = itemCfg.desc;
+            _ui.m_txtHasCount.text = string.Format("已拥有:{0}", StringUtil.GetColorText(ItemDataManager.GetItemNum(cfg.itemId).ToString(), "#BC8068"));
+            _ui.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
+            _ui.m_rarity.visible = false;
+            if (ItemUtilCS.IsDressUpItem(cfg.itemId))
+            {
+                _ui.m_rarity.visible = true;
+                RarityIconController.UpdateRarityIcon(_ui.m_rarity, cfg.itemId, false);
+            }
+            _ui.m_txtLastCount.text = string.Format("剩余:{0}", cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id));
+            if (cfg.maxLimit == 0) _ui.m_txtLastCount.text = "剩余:不限";
+
+            ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(cfg.costId);
+            _ui.m_iconPrice.url = ResPathUtil.GetCommonGameResPath(costItemCfg.res);
+
+        }
+        private void UpdateView()
+        {
+
+            _ui.m_btnAll.enabled = _buyCount < _maxCanBuy;
+            _ui.m_btnPlus.enabled = _buyCount < _maxCanBuy;
+
+            ShopExchangeCfg cfg = ShopExchangeCfgArray.Instance.GetCfg(_exchangeId);
+            _ui.m_txtNum.text = string.Format("x{0}", cfg.num * _buyCount);
+            _ui.m_txtCount.text = _buyCount.ToString();
+            _ui.m_txtPrice.text = (_buyCount * cfg.costNum).ToString();
+        }
+
+
+        private void OnBtnPlusClick()
+        {
+            _buyCount++;
+            UpdateView();
+
+        }
+
+        private void OnBtnMinusClick()
+        {
+            if (_buyCount == 1)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("已经是最小数量了");
+                return;
+            }
+
+            _buyCount--;
+            UpdateView();
+        }
+        private void OnBtnAllClick()
+        {
+            _buyCount = _maxCanBuy;
+            UpdateView();
+        }
+        private async void OnBtnExchangeClick()
+        {
+            ShopExchangeCfg cfg = ShopExchangeCfgArray.Instance.GetCfg(_exchangeId);
+            if (ItemDataManager.GetItemNum(cfg.costId) < cfg.costNum)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("道具不足");
+                return;
+            }
+            bool result = await RechargeSProxy.ReqExchangeShopItem(_exchangeId, _buyCount);
+            if (result)
+            {
+
+            }
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/ItemExchangeView.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 576edac729323bb408cd636f0f39c338
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 14
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/RechargeStoreView.cs

@@ -42,6 +42,14 @@ namespace GFGGame
             _ui.m_c1.onChanged.Add(OnTabChange);
 
             EventAgent.AddEventListener(ConstMessage.BUY_GIFT_SUCCESS, UpdateGiftBagList);
+            EventAgent.AddEventListener(ConstMessage.BUY_RECHARGE_SUCCESS, () =>
+            {
+                _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
+            });
+            EventAgent.AddEventListener(ConstMessage.BUY_EXCHANGE_SUCCESS, () =>
+            {
+                _ui.m_listExchange.numItems = ShopExchangeCfgArray.Instance.dataArray.Length;
+            });
         }
 
         protected override void OnShown()
@@ -64,22 +72,16 @@ namespace GFGGame
         private void OnComTabChange()
         {
             _ui.m_c1.selectedIndex = _ui.m_comTab.m_c1.selectedIndex;
+            _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
+            _ui.m_listExchange.numItems = ShopExchangeCfgArray.Instance.dataArray.Length;
+            UpdateGiftBagList();
 
         }
         private void OnTabChange()
         {
-            if (_ui.m_c1.selectedIndex == RechargeStoreType.RECHARGE)
-            {
-                _ui.m_list.numItems = RechargeCfgArray.Instance.dataArray.Length;
-            }
-            else if (_ui.m_c1.selectedIndex == RechargeStoreType.GIFT)
-            {
-                UpdateGiftBagList();
-            }
-            else if (_ui.m_c1.selectedIndex == RechargeStoreType.EXCHANGE)
-            {
-                _ui.m_listExchange.numItems = ShopExchangeCfgArray.Instance.dataArray.Length;
-            }
+            _ui.m_list.ScrollToView(0);
+            _ui.m_listGift.ScrollToView(0);
+            _ui.m_listExchange.ScrollToView(0);
         }
         private void UpdateGiftBagList()
         {
@@ -191,7 +193,7 @@ namespace GFGGame
             {
                 item.m_btnBuy.target.onClick.Add(() =>
                 {
-                    // RechargeSProxy.ReqRecharge(cfg.id).Coroutine();
+                    ViewManager.Show<ItemExchangeView>(cfg.id);
                 });
             }
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
@@ -199,8 +201,8 @@ namespace GFGGame
             item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costId).res);
             item.m_txtName.text = itemCfg.name;
             item.m_txtDesc.text = string.Format("剩余:{0}", cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id));
+            if (cfg.maxLimit == 0) item.m_txtDesc.text = "剩余:不限";
             item.m_imgDouble.visible = false;
-            item.m_txtDesc.visible = false;
             item.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
 
             UI_StoreListItem.ProxyEnd();

BIN
GameClient/Assets/ResIn/UI/RechargeStore/RechargeStore_fui.bytes