| 
					
				 | 
			
			
				@@ -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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |