Browse Source

商城兑换

zhaoyang 3 years ago
parent
commit
b2f51ce6ef

+ 8 - 8
FGUIProject/assets/RechargeStore/components/ListGiftItem.xml

@@ -20,16 +20,16 @@
     <text id="n31_10not" name="txtLock" xy="347,300" pivot="0.5,0" anchor="true" size="215,49" fontSize="36" color="#aa9561" align="center" leading="-5" letterSpacing="-2" text="通关4-10解锁">
       <gearDisplay controller="c2" pages="1"/>
     </text>
-    <loader id="n36_iftf" name="loaIcon" xy="258,294" size="60,60" group="n38_iftf" visible="false" url="ui://vlgobc15iftftad" fill="scaleFree"/>
-    <text id="n37_iftf" name="txtIcon" xy="258,299" pivot="0.5,0" size="44,54" group="n38_iftf" fontSize="40" color="#896e5f" text="¥"/>
-    <group id="n38_iftf" name="grpIcon" xy="258,299" size="44,54" group="n43_iftf" advanced="true" layout="hz" excludeInvisibles="true"/>
-    <text id="n39_iftf" name="txtOriginalPrice" xy="312,299" pivot="0.5,0" size="54,54" group="n41_iftf" fontSize="40" color="#bca89d" align="center" text="10"/>
-    <image id="n40_iftf" name="n40" src="iftftae" fileName="images/sc_xtxtxt(1).png" xy="318,326" pivot="0.5,0" size="48,2" group="n41_iftf">
+    <loader id="n36_iftf" name="loaIcon" xy="246,294" size="60,60" group="n38_iftf" visible="false" url="ui://vlgobc15iftftad" fill="scaleFree"/>
+    <text id="n37_iftf" name="txtIcon" xy="246,299" pivot="0.5,0" size="44,54" group="n38_iftf" fontSize="40" color="#896e5f" text="¥"/>
+    <group id="n38_iftf" name="grpIcon" xy="246,299" size="44,54" group="n43_iftf" advanced="true" layout="hz" excludeInvisibles="true"/>
+    <text id="n39_iftf" name="txtOriginalPrice" xy="300,299" pivot="0.5,0" size="78,54" group="n41_iftf" fontSize="40" color="#bca89d" align="center" text="100"/>
+    <image id="n40_iftf" name="n40" src="iftftae" fileName="images/sc_xtxtxt(1).png" xy="306,326" pivot="0.5,0" size="72,2" group="n41_iftf">
       <relation target="n39_iftf" sidePair="width-width"/>
     </image>
-    <group id="n41_iftf" name="grpOriginalPrice" xy="312,299" size="54,54" group="n43_iftf" advanced="true"/>
-    <text id="n42_iftf" name="txtPrice" xy="376,299" pivot="0.5,0" size="54,54" group="n43_iftf" fontSize="40" color="#896e5f" align="right" text="10"/>
-    <group id="n43_iftf" name="grpPrice" xy="258,299" size="172,54" advanced="true" layout="hz" colGap="10" excludeInvisibles="true">
+    <group id="n41_iftf" name="grpOriginalPrice" xy="300,299" size="78,54" group="n43_iftf" advanced="true"/>
+    <text id="n42_iftf" name="txtPrice" xy="388,299" pivot="0.5,0" size="54,54" group="n43_iftf" fontSize="40" color="#896e5f" align="right" text="10"/>
+    <group id="n43_iftf" name="grpPrice" xy="246,299" size="196,54" advanced="true" layout="hz" colGap="10" excludeInvisibles="true">
       <gearDisplay controller="c1" pages="0"/>
       <gearDisplay2 controller="c2" pages="0" condition="0"/>
       <relation target="" sidePair="center-center"/>

+ 14 - 2
FGUIProject/assets/RechargeStore/components/StoreListItem.xml

@@ -1,13 +1,25 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="302,517" pivot="0.5,0">
+  <controller name="c1" pages="0,,1," selected="0"/>
   <displayList>
-    <image id="n17_dmsi" name="n17" src="dmsi1c" fileName="images/sc_kuangdikjia_1.png" xy="0,0"/>
+    <image id="n17_dmsi" name="n17" src="dmsi1c" fileName="images/sc_kuangdikjia_1.png" xy="0,0">
+      <gearDisplay controller="c1" pages="0"/>
+    </image>
+    <image id="n20_t8xr" name="n20" src="t8xrtag" fileName="images/sc_kuangdikjia_3.png" xy="0,0">
+      <gearDisplay controller="c1" pages="1"/>
+    </image>
     <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" 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">
+      <gearColor controller="c1" pages="1" values="#837d6f,#000000" default="#906d4b,#000000"/>
       <relation target="" sidePair="center-center,middle-middle"/>
     </text>
-    <component id="n14_d4iw" name="btnBuy" src="iftftaf" fileName="components/Component2.xml" xy="19,433"/>
+    <component id="n14_d4iw" name="btnBuy" src="iftftaf" fileName="components/Component2.xml" xy="18,420" size="265,80">
+      <gearDisplay controller="c1" pages="0"/>
+    </component>
+    <loader id="n21_t8xr" name="loaBuy" xy="18,433" size="265,80">
+      <gearDisplay controller="c1" pages="1"/>
+    </loader>
     <text id="n18_dmsi" name="txtDesc" xy="6,380" pivot="0.5,0" size="290,49" font="ui://eg2y0ldpk1kha2" fontSize="36" color="#bb674e" letterSpacing="-2" text="首充赠送+6000钻石"/>
   </displayList>
 </component>

BIN
FGUIProject/assets/RechargeStore/images/sc_kuangdikjia_1.png


BIN
FGUIProject/assets/RechargeStore/images/sc_kuangdikjia_3.png


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

@@ -48,6 +48,7 @@
     <image id="iftftad" name="jinbi_1(1).png" path="/imagesExport/"/>
     <image id="iftftae" name="sc_xtxtxt(1).png" path="/images/" scale="9grid" scale9grid="12,0,44,2"/>
     <component id="iftftaf" name="Component2.xml" path="/components/"/>
+    <image id="t8xrtag" name="sc_kuangdikjia_3.png" path="/images/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\RechargeStore" packageCount="2" genCode="true" extractAlpha="true"/>
 </packageDescription>

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Data/RechargeDataManager.cs

@@ -220,8 +220,8 @@ namespace GFGGame
             shopExchangeCfgs.Sort((ShopExchangeCfg a, ShopExchangeCfg b) =>
             {
                 //未售罄的>已售罄的
-                int buyTypeA = (a.num == 0 || a.num - GetExchangeBuyNumById(a.id) > 0) ? 1 : -1;
-                int buyTypeB = (b.num == 0 || b.num - GetExchangeBuyNumById(b.id) > 0) ? 1 : -1;
+                int buyTypeA = (a.maxLimit == 0 || a.maxLimit - GetExchangeBuyNumById(a.id) > 0) ? 1 : -1;
+                int buyTypeB = (b.maxLimit == 0 || b.maxLimit - GetExchangeBuyNumById(b.id) > 0) ? 1 : -1;
                 if (buyTypeA > buyTypeB) return -1;
                 if (buyTypeA < buyTypeB) return 1;
                 return 0;

+ 6 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/RechargeStore/UI_StoreListItem.cs

@@ -7,10 +7,12 @@ namespace UI.RechargeStore
     public partial class UI_StoreListItem
     {
         public GComponent target;
+        public Controller m_c1;
         public GImage m_imgDouble;
         public GLoader m_icon;
         public GTextField m_txtName;
         public UI_Component2 m_btnBuy;
+        public GLoader m_loaBuy;
         public GTextField m_txtDesc;
         public const string URL = "ui://vlgobc15d4iwr";
         public const string PACKAGE_NAME = "RechargeStore";
@@ -59,19 +61,23 @@ namespace UI.RechargeStore
 
         private void Init(GComponent comp)
         {
+            m_c1 = comp.GetController("c1");
             m_imgDouble = (GImage)comp.GetChild("imgDouble");
             m_icon = (GLoader)comp.GetChild("icon");
             m_txtName = (GTextField)comp.GetChild("txtName");
             m_btnBuy = (UI_Component2)UI_Component2.Create(comp.GetChild("btnBuy"));
+            m_loaBuy = (GLoader)comp.GetChild("loaBuy");
             m_txtDesc = (GTextField)comp.GetChild("txtDesc");
         }
         public void Dispose(bool disposeTarget = false)
         {
+            m_c1 = null;
             m_imgDouble = null;
             m_icon = null;
             m_txtName = null;
             m_btnBuy.Dispose();
             m_btnBuy = null;
+            m_loaBuy = null;
             m_txtDesc = null;
             if(disposeTarget && target != null)
             {

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

@@ -51,7 +51,7 @@ namespace GFGGame
             _buyCount = 1;
             if (cfg.maxLimit == 0)
             {
-                _maxCanBuy = GameConst.MAX_COUNT_TO_BUY_ITEMS;
+                _maxCanBuy = Math.Min(ItemDataManager.GetItemNum(cfg.costId) / cfg.costNum, GameConst.MAX_COUNT_TO_BUY_ITEMS);
             }
             else
             {

+ 8 - 2
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/RechargeStoreView.cs

@@ -219,15 +219,21 @@ namespace GFGGame
             UI_StoreListItem item = UI_StoreListItem.Proxy(obj);
             item.m_btnBuy.m_c1.selectedIndex = 0;
             item.m_btnBuy.m_txtTitle.text = cfg.costNum.ToString();
+            bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
+            item.m_c1.selectedIndex = isSellOut ? 1 : 0;
             if (item.m_btnBuy.target.data == null)
             {
-                item.m_btnBuy.target.onClick.Add(() =>
+                item.m_loaBuy.onClick.Add(() =>
                 {
-                    if (cfg.num > 0 && cfg.num - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0)
+                    if (isSellOut)
                     {
                         PromptController.Instance.ShowFloatTextPrompt("已售罄");
                         return;
                     }
+                });
+                item.m_btnBuy.target.onClick.Add(() =>
+                {
+                    if (isSellOut) return;
                     ViewManager.Show<ItemExchangeView>(cfg.id);
                 });
             }

BIN
GameClient/Assets/ResIn/UI/RechargeStore/RechargeStore_atlas0!a.png


BIN
GameClient/Assets/ResIn/UI/RechargeStore/RechargeStore_atlas0.png


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