Browse Source

限时礼包

何晓捷 2 years ago
parent
commit
c665f80fdd

+ 1 - 1
FGUIProject/assets/EnduringGiftBox/SpecialOfferGiftBoxUI.xml

@@ -6,7 +6,7 @@
     <image id="n3_yjmk" name="n3" src="yjmk2e" fileName="images/thlb_lihui.png" xy="51,-5"/>
     <image id="n2_yjmk" name="n2" src="yjmk2g" fileName="images/wz_thlb.png" xy="76,39"/>
     <image id="n5_yjmk" name="n5" src="yjmk2f" fileName="images/thlb_sj_db.png" xy="699,233"/>
-    <text id="n6_yjmk" name="txtResidueTime" xy="701,229" size="251,42" fontSize="28" color="#fffcf9" align="center" autoSize="none" text="剩余6天23时13分"/>
+    <text id="n6_yjmk" name="txtBoxResidueTime" xy="701,229" size="251,42" fontSize="28" color="#fffcf9" align="center" autoSize="none" text="剩余6天23时13分"/>
     <list id="n18_yjmk" name="list" xy="68,270" size="957,690" layout="flow_vt" scroll="both" lineGap="15" defaultItem="ui://bdi1qe15yjmk37">
       <item/>
       <item/>

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

@@ -129,5 +129,11 @@ namespace GFGGame
         public const string ACTIVITY_REMOVE = "ACTIVITY_REMOVE";
         //通知活动添加
         public const string ACTIVITY_ADD = "ACTIVITY_ADD";
+        
+        //活动界面时间同步限时抢购
+        public const string LUCKY_BOX_ACTIVITY_TIMERS = "LUCKY_BOX_ACTIVITY_TIMERS";
+        
+        //主界面同步时间到限时特惠
+        public const string MAIN_SYNC_TIME_TO_GIFTBOX = "MAIN_SYNC_TIME_TO_GIFTBOX";
     }
 }

+ 5 - 4
GameClient/Assets/Game/HotUpdate/Controller/EnduringGiftBoxController.cs

@@ -2,21 +2,21 @@
 
 namespace GFGGame
 {
-
     public class EnduringGiftBoxController : SingletonBase<EnduringGiftBoxController>
     {
         private static EnduringGiftBoxView _enduringGiftBoxView;
 
-        public static void Show(int itemId, int count, Action onSuccess = null, string message = "")
+        public static void Show(int itemId, int count, Action onSuccess = null, string message = "", int type = 0)
         {
             if (_enduringGiftBoxView == null)
             {
                 _enduringGiftBoxView = new EnduringGiftBoxView();
             }
-            _enduringGiftBoxView.SetParams(itemId, count, onSuccess, message);
+
+            _enduringGiftBoxView.SetParams(itemId, count, onSuccess, message, type);
             _enduringGiftBoxView.Show();
         }
-        
+
         public static void hide()
         {
             if (_enduringGiftBoxView != null)
@@ -24,6 +24,7 @@ namespace GFGGame
                 _enduringGiftBoxView.Hide();
             }
         }
+
         public static void Dispose()
         {
             _enduringGiftBoxView = null;

+ 1 - 10
GameClient/Assets/Game/HotUpdate/Data/LimitedTimeGiftBoxDataManager.cs

@@ -22,18 +22,9 @@ namespace GFGGame
         //圆形样式数据5--时间条件的数据
         private List<LimitedTimeGiftBoxItemYxData> _ltgGbItemData5 = new List<LimitedTimeGiftBoxItemYxData>();
         public List<LimitedTimeGiftBoxItemYxData> LtgGbItemData5 => _ltgGbItemData5;
-
-        // public void InitData()
-        // {
-        //     _activityOpenEndTimeDic.Clear();
-        //     _ltgGbItemData3.Clear();
-        //     _ltgGbItemData4.Clear();
-        //     _ltgGbItemData5.Clear();
-        // }
-
+        
         public void UpAllData()
         {
-            //UpActivityOpenEndTimeDic(); //等之后搞好活动有效期组件之后,再替换成真实数据的更新
             UpLtgGbItemData3();
             UpLtgGbItemData4();
             UpLtgGbItemData5();

+ 3 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/EnduringGiftBox/UI_SpecialOfferGiftBoxUI.cs

@@ -7,7 +7,7 @@ namespace UI.EnduringGiftBox
     public partial class UI_SpecialOfferGiftBoxUI
     {
         public GComponent target;
-        public GTextField m_txtResidueTime;
+        public GTextField m_txtBoxResidueTime;
         public GList m_list;
         public GImage m_back;
         public GImage m_btnNext;
@@ -59,7 +59,7 @@ namespace UI.EnduringGiftBox
 
         private void Init(GComponent comp)
         {
-            m_txtResidueTime = (GTextField)comp.GetChild("txtResidueTime");
+            m_txtBoxResidueTime = (GTextField)comp.GetChild("txtBoxResidueTime");
             m_list = (GList)comp.GetChild("list");
             m_back = (GImage)comp.GetChild("back");
             m_btnNext = (GImage)comp.GetChild("btnNext");
@@ -67,7 +67,7 @@ namespace UI.EnduringGiftBox
         }
         public void Dispose(bool disposeTarget = false)
         {
-            m_txtResidueTime = null;
+            m_txtBoxResidueTime = null;
             m_list = null;
             m_back = null;
             m_btnNext = null;

+ 4 - 5
GameClient/Assets/Game/HotUpdate/Utils/ItemUtil.cs

@@ -33,7 +33,7 @@ namespace GFGGame
             }
         }
 
-        public static void AddPower(string prefix = "", Action onSuccess = null)
+        public static void AddPower(string prefix = "", Action onSuccess = null, int type = 0)
         {
             EnduringGiftBoxController.Show(ConstItemID.POWER, 1, () =>
             {
@@ -41,19 +41,18 @@ namespace GFGGame
                 {
                     onSuccess();
                 }
-            });
+            }, "", type);
         }
 
-        public static void AddGold(long value = 0, Action onSuccess = null)
+        public static void AddGold(long value = 0, Action onSuccess = null, int type = 0)
         {
-
             EnduringGiftBoxController.Show(ConstItemID.GOLD, 1, () =>
             {
                 if (onSuccess != null)
                 {
                     onSuccess();
                 }
-            });
+            }, "", type);
         }
 
         public static void AddDiamondPurple()

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/Common/Controller/ValueBarController.cs

@@ -25,11 +25,11 @@ namespace GFGGame
         }
         private void OnClickGold()
         {
-            ItemUtil.AddGold();
+            ItemUtil.AddGold(0, null, 1);
         }
         private void OnClickPower()
         {
-            ItemUtil.AddPower();
+            ItemUtil.AddPower("", null, 1);
         }
         private void OnClickDiamondPurple()
         {

+ 10 - 3
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/EnduringGiftBoxView.cs

@@ -15,6 +15,7 @@ namespace GFGGame
         private int _itemId; //道具id,该页面目前只给:体力,金币使用
         private int _count; //本次购买次数
         private int _buyTimes = 0; //已购次数
+        private int _type = 0; //0从别的地方跳转过来. 1从点击TOP菜单栏icon跳转过来
 
         private Action _onSuccess;
         private int _maxTimes = 0;
@@ -117,13 +118,15 @@ namespace GFGGame
                 out _gameObject4, out _wrapper4);
         }
 
-        public void SetParams(int itemId, int count, Action onSuccess, string message = "")
+        public void SetParams(int itemId, int count, Action onSuccess, string message = "", int type = 0)
         {
             _itemId = itemId;
             _count = count;
 
             _onSuccess = onSuccess;
             _message = message;
+
+            _type = type;
         }
 
         private void UpdateView()
@@ -330,7 +333,7 @@ namespace GFGGame
                     }
                 }
             }
-            
+
             item.m_icoWeekPromptTag.onClick.Add(RuleController.ShowRuleView);
             item.m_icoWeekPromptTag.data = 300013;
             //领取按钮点击事件
@@ -493,7 +496,11 @@ namespace GFGGame
             }
 
             UpdateView();
-            //this.Hide();
+            //判断一下是不是从主要界面进来的
+            if (_type == 0)
+            {
+                this.Hide();
+            }
         }
 
         //购买连续礼包之后,更新数据+更新界面

+ 40 - 2
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/RushSaleGiftBoxView.cs

@@ -54,16 +54,22 @@ namespace GFGGame
             AddEffect();
             InitPageInex();
 
-            UpdateView(ListUtil.NavigateType.None);
+            UpViewNone();
         }
 
         protected override void AddEventListener()
         {
             base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
+            EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
+            EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
         }
 
         protected override void RemoveEventListener()
         {
+            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             base.RemoveEventListener();
         }
 
@@ -90,12 +96,38 @@ namespace GFGGame
             }
         }
 
-        private void UpdateView(ListUtil.NavigateType type)
+        private void UpTime()
         {
             //筛选一条数据用来界面渲染
             var list = _type == ConstActivityType.ActLimitGiftYxByLevel
                 ? LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData4
                 : LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData5;
+
+            list = list.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("活动已结束");
+                OnHide();
+                return;
+            }
+
+            _ui.m_txtBoxResidueTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime);
+        }
+
+        private void UpdateView(ListUtil.NavigateType type)
+        {
+            var list = _type == ConstActivityType.ActLimitGiftYxByLevel
+                ? LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData4
+                : LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData5;
+
+            list = list.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("活动已结束");
+                OnHide();
+                return;
+            }
+
             var data = ListUtil.Navigate(list, type, _pageIndex, out int newIndex);
             _pageIndex = newIndex;
 
@@ -188,6 +220,12 @@ namespace GFGGame
             uiItem.m_comRewardIconItem.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
         }
 
+        private void UpViewNone()
+        {
+            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData4();
+            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData5();
+            UpdateView(ListUtil.NavigateType.None);
+        }
 
         //上一条
         private void OnBtnPreviousClick()

+ 41 - 3
GameClient/Assets/Game/HotUpdate/Views/EnduringGiftBox/SpecialOfferGiftBoxView.cs

@@ -49,16 +49,22 @@ namespace GFGGame
             AddEffect();
             InitPageInex();
 
-            UpdateView(ListUtil.NavigateType.None);
+            UpViewNone();
         }
 
         protected override void AddEventListener()
         {
             base.AddEventListener();
+            EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
+            EventAgent.AddEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
+            EventAgent.AddEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
         }
 
         protected override void RemoveEventListener()
         {
+            EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS, UpTime);
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_REMOVE, UpViewNone);
+            EventAgent.RemoveEventListener(ConstMessage.ACTIVITY_ADD, UpViewNone);
             base.RemoveEventListener();
         }
 
@@ -66,6 +72,22 @@ namespace GFGGame
         {
         }
 
+        private void UpTime()
+        {
+            //筛选一条数据用来界面渲染
+            var list = LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData3;
+
+            list = list.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("活动已结束");
+                OnHide();
+                return;
+            }
+
+            _ui.m_txtBoxResidueTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime);
+        }
+
         //实例化索引
         private void InitPageInex()
         {
@@ -76,10 +98,19 @@ namespace GFGGame
         {
             //筛选一条数据用来界面渲染
             var list = LimitedTimeGiftBoxDataManager.Instance.LtgGbItemData3;
+
+            list = list.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
+            if (list.Count == 0)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("活动已结束");
+                OnHide();
+                return;
+            }
+
             var data = ListUtil.Navigate(list, type, _pageIndex, out int newIndex);
             _pageIndex = newIndex;
-            
-            _ui.m_txtResidueTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), data.EndTime);
+
+            _ui.m_txtBoxResidueTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), data.EndTime);
             _ui.m_list.data = data.ShopCfgIds;
             _ui.m_list.itemRenderer = ListItemRender;
             _ui.m_list.numItems = data.ShopCfgIds.Count;
@@ -205,6 +236,13 @@ namespace GFGGame
             GoodsItemTipsController.ShowItemTips(itemCfg.id);
         }
 
+        private void UpViewNone()
+        {
+            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData4();
+            LimitedTimeGiftBoxDataManager.Instance.UpLtgGbItemData5();
+            UpdateView(ListUtil.NavigateType.None);
+        }
+
         //上一条
         private void OnBtnPreviousClick()
         {

+ 3 - 0
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxActivityView.cs

@@ -85,6 +85,9 @@ namespace GFGGame
             }
             TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
             _ui.m_txtTime.text = TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime);
+            
+            //限时礼包窗口内的倒计时
+            EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_ACTIVITY_TIMERS);
         }
 
         private void UpdateView()

+ 10 - 10
GameClient/Assets/Game/HotUpdate/Views/Mail/MailView.cs

@@ -13,13 +13,13 @@ namespace GFGGame
         private UI_MailUI _ui;
         private MailDataManager mailDataMgr;
         private const int _maxMailCount = 300;
-        private const int _retainDay = 30;//邮件保存时间
+        private const int _retainDay = 30;//閭�欢淇濆瓨鏃堕棿
                                           // private const int _showCount = 5;//??????????
 
-        private int _firstPage = 0;//当前页面
-        private int _endPage = 0;//当前页面
+        private int _firstPage = 0;//褰撳墠椤甸潰
+        private int _endPage = 0;//褰撳墠椤甸潰
 
-        public bool _canShowContent = false;//获取内容数据返回前不可查看
+        public bool _canShowContent = false;//鑾峰彇鍐呭�鏁版嵁杩斿洖鍓嶄笉鍙�煡鐪�
         public List<MailInfo> mailInfos;//= new List<MailInfo>();
 
         public override void Dispose()
@@ -81,8 +81,8 @@ namespace GFGGame
         {
             _ui.m_list.numItems = mailDataMgr.TotolCount;
             _ui.m_txtTips.visible = mailDataMgr.TotolCount == 0 ? true : false;
-            _ui.m_txtCount.text = string.Format("当前邮件:{0}/{1}", StringUtil.GetColorText(mailDataMgr.TotolCount.ToString(), mailDataMgr.TotolCount >= _maxMailCount ? "#B19977" : "#E27D78"), _maxMailCount);
-            _ui.m_txtMaxCount.text = string.Format("最高可储存{0}封邮箱,请及时查看", _maxMailCount);
+            _ui.m_txtCount.text = string.Format("褰撳墠閭�欢锛歿0}/{1}", StringUtil.GetColorText(mailDataMgr.TotolCount.ToString(), mailDataMgr.TotolCount >= _maxMailCount ? "#B19977" : "#E27D78"), _maxMailCount);
+            _ui.m_txtMaxCount.text = string.Format("鏈€楂樺彲鍌ㄥ瓨{0}灏侀偖绠憋紝璇峰強鏃舵煡鐪�", _maxMailCount);
             RefreshMailInfo(true);
         }
 
@@ -97,7 +97,7 @@ namespace GFGGame
             // item.m_btnLook.data = mailId;
             if (mailId < 0)
             {
-                item.m_txtTitle.text = "请稍后...";
+                item.m_txtTitle.text = "璇风◢鍚�...";
                 item.m_txtTime.text = "";
                 return;
             }
@@ -109,7 +109,7 @@ namespace GFGGame
             item.m_txtTitle.text = data.title;
             long endTime = (data.timeSec + _retainDay * TimeUtil.SECOND_PER_DAY * 1000);
             string str = TimeUtil.FormattingTime(TimeHelper.ServerNow(), endTime);
-            item.m_txtTime.text = string.Format("剩余时间:{0}", str);
+            item.m_txtTime.text = string.Format("鍓╀綑鏃堕棿锛歿0}", str);
             if (item.m_btnLook.data == null)
             {
                 item.m_btnLook.onClick.Add(OnClickBtnLook);
@@ -182,10 +182,10 @@ namespace GFGGame
         {
             if (mailDataMgr.TotolCount == 0)
             {
-                PromptController.Instance.ShowFloatTextPrompt("暂无邮件可删除");
+                PromptController.Instance.ShowFloatTextPrompt("鏆傛棤閭�欢鍙�垹闄�");
                 return;
             }
-            AlertUI.Show("是否删除所有已读文件?").SetLeftButton(true).SetRightButton(true, "确认", (object data) =>
+            AlertUI.Show("鏄�惁鍒犻櫎鎵€鏈夊凡璇绘枃浠讹紵").SetLeftButton(true).SetRightButton(true, "纭��", (object data) =>
             {
                 SendDeleteAll();
             });

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -663,6 +663,8 @@ namespace GFGGame
             {
                 _ui.m_btnActivityDay7.visible = false;
             }
+            //特惠礼包窗口内的倒计时
+            EventAgent.DispatchEvent(ConstMessage.MAIN_SYNC_TIME_TO_GIFTBOX);
         }
 
         private void ShowExitAlert()

BIN
GameClient/Assets/ResIn/UI/EnduringGiftBox/EnduringGiftBox_fui.bytes