zhaoyang 3 years ago
parent
commit
925652957e

+ 3 - 3
FGUIProject/assets/RechargeStore/GiftBagBuyUI.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="936,695">
-  <controller name="c1" pages="0,,1," selected="1"/>
+  <controller name="c1" pages="0,,1," selected="0"/>
   <displayList>
     <image id="n0_10not" name="bg" src="lwri5u" fileName="imagesExport/hc_kuang_6.png" pkg="mk0fwx0x" xy="0,0" size="936,695"/>
     <image id="n18_iftf" name="n18" src="iftfta9" fileName="images/hyhy_btbt_1.png" xy="230,32"/>
@@ -13,8 +13,8 @@
       <item/>
     </list>
     <image id="n5_10not" name="n5" src="dmsi1l" fileName="images/sc_kuangsjsj.png" xy="729,107" group="n7_10not"/>
-    <text id="n6_10not" name="txtRefreshTime" xy="756,105" pivot="0.5,0" size="94,41" group="n7_10not" fontSize="30" color="#ffffff" align="center" leading="-5" letterSpacing="-2" strokeColor="#b98653" strokeSize="2" text="12小时"/>
-    <group id="n7_10not" name="grpRefreshTime" xy="729,105" size="155,42" advanced="true"/>
+    <text id="n6_10not" name="txtEndTime" xy="756,105" pivot="0.5,0" size="94,41" group="n7_10not" fontSize="30" color="#ffffff" align="center" leading="-5" letterSpacing="-2" strokeColor="#b98653" strokeSize="2" text="12小时"/>
+    <group id="n7_10not" name="grpEndTime" xy="729,105" size="155,42" advanced="true"/>
     <loader id="n8_10not" name="loaPriceIcon" xy="379,507" size="60,60" group="n10_10not" visible="false" url="ui://vlgobc1510not1w" fill="scale"/>
     <text id="n9_10not" name="txtIcon" xy="379,506" size="50,61" group="n10_10not" fontSize="46" color="#a17d5f" text="¥"/>
     <group id="n10_10not" name="grpIcon" xy="379,506" size="50,61" group="n15_10not" advanced="true" layout="hz" excludeInvisibles="true"/>

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

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <component size="478,401">
-  <controller name="c1" alias="礼包购买状态" pages="0,,1," selected="1"/>
-  <controller name="c2" alias="礼包解锁状态" pages="0,,1," selected="1"/>
+  <controller name="c1" alias="礼包购买状态" pages="0,,1," selected="0"/>
+  <controller name="c2" alias="礼包解锁状态" pages="0,,1," selected="0"/>
   <displayList>
     <image id="n22_10not" name="n22" src="dmsi1k" fileName="images/sc_kuangdikjia_2.png" xy="0,0"/>
     <loader id="n23_10not" name="icon" xy="45,170" size="162,162" url="ui://vlgobc15d4iwl"/>
@@ -10,8 +10,8 @@
     <text id="n25_10not" name="txtDesc" xy="31,121" size="69,81" group="n26_10not" font="ui://eg2y0ldpk1kha2" fontSize="34" color="#ffe5cf" align="center" leading="-5" letterSpacing="-2" vars="true" text="超值&#xA;{count=250}%"/>
     <group id="n26_10not" name="grpDiscount" xy="2,98" size="128,132" advanced="true"/>
     <image id="n28_10not" name="n28" src="dmsi1l" fileName="images/sc_kuangsjsj.png" xy="269,232" group="n30_10not"/>
-    <text id="n29_10not" name="txtRefreshTime" xy="298,230" pivot="0.5,0" size="94,41" group="n30_10not" fontSize="30" color="#ffffff" align="center" leading="-5" letterSpacing="-2" strokeColor="#b98653" strokeSize="2" text="12小时"/>
-    <group id="n30_10not" name="grpRefreshTime" xy="269,230" size="155,42" advanced="true">
+    <text id="n29_10not" name="txtEndTime" xy="298,230" pivot="0.5,0" size="94,41" group="n30_10not" fontSize="30" color="#ffffff" align="center" leading="-5" letterSpacing="-2" strokeColor="#b98653" strokeSize="2" text="12小时"/>
+    <group id="n30_10not" name="grpEndTime" xy="269,230" size="155,42" advanced="true">
       <gearDisplay controller="c1" pages="0"/>
     </group>
     <text id="n32_10not" name="txtLimit" xy="35,332" pivot="0.5,0" size="189,36" fontSize="26" color="#ab9a87" align="center" leading="-5" letterSpacing="-2" ubb="true" text="每日限购(0/1)">

+ 44 - 33
GameClient/Assets/Game/HotUpdate/Data/RechargeDataManager.cs

@@ -18,13 +18,13 @@ namespace GFGGame
         public static int STORY_LV = 1;
         public static int ROLE_LV = 2;
     }
-    public class RefreshType
-    {
-        public static int NONE = 0;
-        public static int DAY = 1;
-        public static int WEEK = 2;
-        public static int MONTH = 3;
-    }
+    // public class RefreshType
+    // {
+    //     public static int NONE = 0;
+    //     public static int DAY = 1;
+    //     public static int WEEK = 2;
+    //     public static int MONTH = 3;
+    // }
     public class CostType
     {
         public static int FREE = 0;
@@ -128,15 +128,39 @@ namespace GFGGame
         {
             giftBagCfgs.Sort((GiftBagCfg a, GiftBagCfg b) =>
             {
-                // if (GetGiftBuyNumById(a.id) < a.maxBuyNum && GetGiftBuyNumById(b.id) < b.maxBuyNum)
-                // {
-                //     return -1;
-                // }
-                // else if (GetGiftBuyNumById(a.id) < a.maxBuyNum && GetGiftBuyNumById(b.id) < b.maxBuyNum)
-                int buyTypeA = a.maxBuyNum - GetGiftBuyNumById(a.id) > 0 ? 1 : a.maxBuyNum - GetGiftBuyNumById(a.id) == 0 ? 0 : -1;
-                int buyTypeB = b.maxBuyNum - GetGiftBuyNumById(b.id) > 0 ? 1 : b.maxBuyNum - GetGiftBuyNumById(b.id) == 0 ? 0 : -1;
-                return buyTypeA.CompareTo(buyTypeB);
 
+                //未售罄的>未解锁>已售罄的
+                int buyTypeA = (a.maxBuyNum == 0 || a.maxBuyNum - GetGiftBuyNumById(a.id) > 0) ? 1 : -1;
+                int buyTypeB = (b.maxBuyNum == 0 || b.maxBuyNum - GetGiftBuyNumById(b.id) > 0) ? 1 : -1;
+                if (buyTypeA > buyTypeB) return -1;
+                if (buyTypeA < buyTypeB) return -1;
+
+                //解锁状态
+                int lockA = GetGiftStateById(a.id) ? 1 : -1;
+                int lockB = GetGiftStateById(b.id) ? 1 : -1;
+                if (lockA > lockB) return -1;
+                if (lockA < lockB) return 1;
+
+                //免费>钻石>现金>道具
+                if (a.costType < b.costType) return -1;
+                if (a.costType > b.costType) return 1;
+
+                //有下架时间的 > 没有下架时间的
+                int endTimeA = a.endTime != "" ? 1 : -1;
+                int endTimeB = b.endTime != "" ? 1 : -1;
+                if (endTimeA > endTimeB) return -1;
+                if (endTimeA < endTimeB) return 1;
+
+
+
+                int descA = a.desc == "" ? 0 : int.Parse(a.desc);
+                int descB = b.desc == "" ? 0 : int.Parse(b.desc);
+                if (descA != descB) return descA - descB;
+
+                if (a.price != b.price) return a.price - b.price;
+
+
+                return 0;
             });
             return giftBagCfgs;
         }
@@ -212,30 +236,17 @@ namespace GFGGame
             }
         }
         /// <summary>
-        /// 根据礼包id获取剩余刷新时间
+        /// 根据礼包id获取下架时间
         /// </summary>
         /// <param name="giftId"></param>
         /// <returns></returns>
-        public string GetRefreshTime(int giftId)
+        public string GetEndTime(int giftId)
         {
             int endTime = 0;
             GiftBagCfg cfg = GiftBagCfgArray.Instance.GetCfg(giftId);
-            if (cfg.refreshType == RefreshType.NONE)
-            {
-                return "";
-            }
-            else if (cfg.refreshType == RefreshType.DAY)
-            {
-                endTime = TimeUtil.GetTomorrowTime(GlobalCfgArray.globalCfg.refreshTime);
-            }
-            else if (cfg.refreshType == RefreshType.WEEK)
-            {
-                endTime = TimeUtil.GetNextWeekTime(GlobalCfgArray.globalCfg.refreshTime);
-            }
-            if (cfg.refreshType == RefreshType.MONTH)
-            {
-                endTime = TimeUtil.GetNextMonthTime(GlobalCfgArray.globalCfg.refreshTime);
-            }
+            if (cfg.endTime == "") return "";
+
+            endTime = TimeUtil.DateTimeToTimestamp(cfg.endTime);
             return TimeUtil.FormattingTime(TimeHelper.ServerNowSecs, endTime);
         }
     }

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

@@ -13,8 +13,8 @@ namespace UI.RechargeStore
         public GLoader m_loaIcon;
         public GTextField m_txtLimit;
         public GList m_list;
-        public GTextField m_txtRefreshTime;
-        public GGroup m_grpRefreshTime;
+        public GTextField m_txtEndTime;
+        public GGroup m_grpEndTime;
         public GLoader m_loaPriceIcon;
         public GTextField m_txtIcon;
         public GGroup m_grpIcon;
@@ -77,8 +77,8 @@ namespace UI.RechargeStore
             m_loaIcon = (GLoader)comp.GetChild("loaIcon");
             m_txtLimit = (GTextField)comp.GetChild("txtLimit");
             m_list = (GList)comp.GetChild("list");
-            m_txtRefreshTime = (GTextField)comp.GetChild("txtRefreshTime");
-            m_grpRefreshTime = (GGroup)comp.GetChild("grpRefreshTime");
+            m_txtEndTime = (GTextField)comp.GetChild("txtEndTime");
+            m_grpEndTime = (GGroup)comp.GetChild("grpEndTime");
             m_loaPriceIcon = (GLoader)comp.GetChild("loaPriceIcon");
             m_txtIcon = (GTextField)comp.GetChild("txtIcon");
             m_grpIcon = (GGroup)comp.GetChild("grpIcon");
@@ -97,8 +97,8 @@ namespace UI.RechargeStore
             m_loaIcon = null;
             m_txtLimit = null;
             m_list = null;
-            m_txtRefreshTime = null;
-            m_grpRefreshTime = null;
+            m_txtEndTime = null;
+            m_grpEndTime = null;
             m_loaPriceIcon = null;
             m_txtIcon = null;
             m_grpIcon = null;

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

@@ -13,8 +13,8 @@ namespace UI.RechargeStore
         public GTextField m_txtName;
         public GTextField m_txtDesc;
         public GGroup m_grpDiscount;
-        public GTextField m_txtRefreshTime;
-        public GGroup m_grpRefreshTime;
+        public GTextField m_txtEndTime;
+        public GGroup m_grpEndTime;
         public GTextField m_txtLimit;
         public GTextField m_txtLock;
         public GLoader m_loaIcon;
@@ -77,8 +77,8 @@ namespace UI.RechargeStore
             m_txtName = (GTextField)comp.GetChild("txtName");
             m_txtDesc = (GTextField)comp.GetChild("txtDesc");
             m_grpDiscount = (GGroup)comp.GetChild("grpDiscount");
-            m_txtRefreshTime = (GTextField)comp.GetChild("txtRefreshTime");
-            m_grpRefreshTime = (GGroup)comp.GetChild("grpRefreshTime");
+            m_txtEndTime = (GTextField)comp.GetChild("txtEndTime");
+            m_grpEndTime = (GGroup)comp.GetChild("grpEndTime");
             m_txtLimit = (GTextField)comp.GetChild("txtLimit");
             m_txtLock = (GTextField)comp.GetChild("txtLock");
             m_loaIcon = (GLoader)comp.GetChild("loaIcon");
@@ -97,8 +97,8 @@ namespace UI.RechargeStore
             m_txtName = null;
             m_txtDesc = null;
             m_grpDiscount = null;
-            m_txtRefreshTime = null;
-            m_grpRefreshTime = null;
+            m_txtEndTime = null;
+            m_grpEndTime = null;
             m_txtLimit = null;
             m_txtLock = null;
             m_loaIcon = null;

+ 3 - 2
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/GiftBagBuyView.cs

@@ -57,8 +57,9 @@ namespace GFGGame
             }
             int buyNum = RechargeDataManager.Instance.GetGiftBuyNumById(cfg.id);
             _ui.m_txtLimit.text = string.Format("每{0}限购({1}/{2})", RechargeDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
-            _ui.m_txtRefreshTime.text = RechargeDataManager.Instance.GetRefreshTime(cfg.id);
-            _ui.m_grpRefreshTime.visible = RechargeDataManager.Instance.GetRefreshTime(cfg.id) != "";
+            if (cfg.refreshType == RefreshType.NONE) _ui.m_txtLimit.text = "永久限购";
+            _ui.m_txtEndTime.text = RechargeDataManager.Instance.GetEndTime(cfg.id);
+            _ui.m_grpEndTime.visible = cfg.endTime != "";
 
             _ui.m_txtOriginalPrice.text = cfg.originalPrice.ToString();
             if (cfg.price > 0 && cfg.costType != CostType.FREE)

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

@@ -121,8 +121,8 @@ namespace GFGGame
             item.m_txtDesc.SetVar("count", cfg.desc);
             item.m_grpDiscount.visible = cfg.desc != "";
 
-            item.m_txtRefreshTime.text = RechargeDataManager.Instance.GetRefreshTime(cfg.id);
-            item.m_grpRefreshTime.visible = RechargeDataManager.Instance.GetRefreshTime(cfg.id) != "";
+            item.m_txtEndTime.text = RechargeDataManager.Instance.GetEndTime(cfg.id);
+            item.m_grpEndTime.visible = cfg.endTime != "";
 
             item.m_c2.selectedIndex = RechargeDataManager.Instance.GetGiftStateById(cfg.id) ? 0 : 1;
             if (cfg.lockType == LockType.STORY_LV)
@@ -137,6 +137,7 @@ namespace GFGGame
 
             int buyNum = RechargeDataManager.Instance.GetGiftBuyNumById(cfg.id);
             item.m_txtLimit.text = string.Format("每{0}限购({1}/{2})", RechargeDataManager.Instance.refreshType[cfg.refreshType], StringUtil.GetColorText(buyNum.ToString(), "#DA8870"), cfg.maxBuyNum);
+            if (cfg.refreshType == RefreshType.NONE) item.m_txtLimit.text = "永久限购";
             // UI_Button14 btn = UI_Button14.Proxy(item.m_btnBuy);
             item.m_c1.selectedIndex = cfg.maxBuyNum == 0 || buyNum < cfg.maxBuyNum ? 0 : 1;
             if (item.m_c1.selectedIndex == 0)

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