Эх сурвалжийг харах

限时累充添加红点,活动公告

zhangyuqian 1 жил өмнө
parent
commit
4835f102d4

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Notice/UI_ListActivityItem.cs

@@ -10,6 +10,7 @@ namespace UI.Notice
         public GLoader m_loaShow;
         public GImage m_imgTips;
         public GTextField m_txtTime;
+        public GTextField m_txtName;
         public const string URL = "ui://d8t5ezjbkjq3l";
         public const string PACKAGE_NAME = "Notice";
         public const string RES_NAME = "ListActivityItem";
@@ -60,12 +61,14 @@ namespace UI.Notice
             m_loaShow = (GLoader)comp.GetChild("loaShow");
             m_imgTips = (GImage)comp.GetChild("imgTips");
             m_txtTime = (GTextField)comp.GetChild("txtTime");
+            m_txtName = (GTextField)comp.GetChild("txtName");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_loaShow = null;
             m_imgTips = null;
             m_txtTime = null;
+            m_txtName = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 58 - 10
GameClient/Assets/Game/HotUpdate/Views/DailyWelfare/NewLimitChargeView.cs

@@ -52,18 +52,17 @@ namespace GFGGame
             base.AddEventListener();
             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
             EventAgent.AddEventListener(ConstMessage.NEWLIMITCHARGE_GET, OnBtnRightClick);
-            //EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
+            EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
         }
         protected override void OnShown()
         {
             base.OnShown();
 
 
-            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zjm_bg1","jpg");
+            _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zjm_bg1", "jpg");
             _activityId = (int)(this.viewData as object[])[0];
             _rechargeCfgs = ActivityRechargeCfgArray.Instance.GetCfgsByactivityId(_activityId);
             _activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(_activityId);
-            //UpdateRedDot();
             //RefreshList();
             //由于这个需要外部参数所以在onshown里面预加载
             PreloadManager.Instance.PreloadSuitRes(_rechargeCfgs[0].suitId, ResType.Both, new int[] { ConstDressUpItemType.BEI_JING }, false);
@@ -88,8 +87,9 @@ namespace GFGGame
             _ui.m_btnLeft.visible = _curSelectIndex == 0 ? false : true;
             _ui.m_btnRight.visible = _curSelectIndex < _rechargeCfgs.Count - 1 ? true : false;
             _ui.m_packageName.text = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[_curSelectIndex].suitId).name;
+            UpdateRedDot();
             //预加载套装,对于不同suitid
-            for (int i = 1; i< _rechargeCfgs.Count; i++)
+            for (int i = 1; i < _rechargeCfgs.Count; i++)
             {
                 if (_rechargeCfgs[i].suitId != _rechargeCfgs[i - 1].suitId)
                 {
@@ -105,7 +105,7 @@ namespace GFGGame
         {
             base.OnHide();
             DressUpObjUI dressUpObjUI = _ui.m_showItem.m_holder.data as DressUpObjUI;
-            if(dressUpObjUI != null)
+            if (dressUpObjUI != null)
             {
                 dressUpObjUI.Dispose();
             }
@@ -118,7 +118,7 @@ namespace GFGGame
             base.RemoveEventListener();
             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, RefreshList);
             EventAgent.RemoveEventListener(ConstMessage.NEWLIMITCHARGE_GET, OnBtnRightClick);
-            //EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
+            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
         }
 
         private void RefreshList()
@@ -163,7 +163,7 @@ namespace GFGGame
                 }
                 dressUpObjUI = item.m_holder.data as DressUpObjUI;
                 dressUpObjUI.ResetSceneObj(120, false, true, null, false);
-                    dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
+                dressUpObjUI.dressUpObj.PutOnSuitCfg(vipCfg.suitId, true, new int[] { ConstDressUpItemType.BEI_JING }, false, false);
                 dressUpObjUI.UpdateWrapper(item.m_holder);
             }
             previousIndex = _rechargeCfgs[index].suitId;
@@ -184,7 +184,7 @@ namespace GFGGame
             item.m_txtGiftBag.text = string.Format("活动期间累计获得{0}会员积分({1}/{2})", _rechargeCfgs[index].value, limitChargeExp, _rechargeCfgs[index].value);
             if (limitChargeExp >= _rechargeCfgs[index].value)
             {
-                if(_activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) >= 0)
+                if (_activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) >= 0)
                 {
                     item.m_btnGetGiftBag.grayed = true;
                     item.m_btnGetGiftBag.title = "已领取";
@@ -248,7 +248,7 @@ namespace GFGGame
             string name = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[_curSelectIndex].suitId).name;
             _ui.m_packageName.text = name;
             UpdateSuitView();
-            //UpdateRedDot();
+            UpdateRedDot();
         }
         private void OnBtnRightClick()
         {
@@ -257,9 +257,57 @@ namespace GFGGame
             string name = SuitCfgArray.Instance.GetCfg(_rechargeCfgs[_curSelectIndex].suitId).name;
             _ui.m_packageName.text = name;
             UpdateSuitView();
-            //UpdateRedDot();
+            UpdateRedDot();
 
         }
+        private void UpdateRedDot()
+        {
+            int indexPrior = Math.Max(0, _curSelectIndex - 1);
+            int indexNext = Math.Min(_rechargeCfgs.Count, _curSelectIndex + 1);
+            SetRedDot(indexPrior);
+            SetRedDot(indexNext);
+        }
+
+        private void SetRedDot(int index)
+        {
+            long limitChargeExp = _activityInfo.CountValue;
+            if (limitChargeExp >= _rechargeCfgs[index].value)
+            {
+                if (_activityInfo.GetRewards.IndexOf(_rechargeCfgs[index].id) >= 0)
+                {
+                    if (index < _curSelectIndex)
+                    {
+                        RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, false);
+                    }
+                    else
+                    {
+                        RedDotController.Instance.SetComRedDot(_ui.m_btnRight, false);
+                    }
+                }
+                else
+                {
+                    if (index < _curSelectIndex)
+                    {
+                        RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, true);
+                    }
+                    else
+                    {
+                        RedDotController.Instance.SetComRedDot(_ui.m_btnRight, true);
+                    }
+                }
+            }
+            else
+            {
+                if (index < _curSelectIndex)
+                {
+                    RedDotController.Instance.SetComRedDot(_ui.m_btnLeft, false);
+                }
+                else
+                {
+                    RedDotController.Instance.SetComRedDot(_ui.m_btnRight, false);
+                }
+            }
+        }
         private void OnBtnChargeClick()
         {
             ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE });

+ 77 - 8
GameClient/Assets/Game/HotUpdate/Views/Notice/NoticeView.cs

@@ -1,6 +1,8 @@
 using UnityEngine;
 using FairyGUI;
 using UI.Notice;
+using System.Collections.Generic;
+using ET;
 
 namespace GFGGame
 {
@@ -9,7 +11,8 @@ namespace GFGGame
         private UI_NoticeUI _ui;
         private EffectUI _effectUI1;
         private EffectUI _effectUI2;
-
+        private AdCfg[] activitydata;
+        private List<AdCfg> showActivity = new List<AdCfg>();
         public override void Dispose()
         {
             EffectUIPool.Recycle(_effectUI1);
@@ -41,7 +44,7 @@ namespace GFGGame
             base.OnInit();
 
             _ui.m_listActivity.itemRenderer = ListActivityItemRender;
-            _ui.m_listActivity.onClick.Add(OnListActivityClick);
+            //_ui.m_listActivity.onClick.Add(OnListActivityClick);
 
             _ui.m_listNotice.itemRenderer = ListNoticeItemRender;
 
@@ -88,7 +91,8 @@ namespace GFGGame
         {
             if (_ui.m_c1.selectedIndex == 0)
             {
-                _ui.m_listActivity.numItems = 0;
+                UpdateInfo();
+                _ui.m_listActivity.numItems = showActivity.Count;
                 _ui.m_txtTips.visible = _ui.m_listActivity.numItems == 0;
             }
             else if (_ui.m_c1.selectedIndex == 1)
@@ -102,17 +106,50 @@ namespace GFGGame
         {
             UI_ListActivityItem item = UI_ListActivityItem.Proxy(obj);
             item.m_loaShow.url = ResPathUtil.GetActivityPath("");
-            item.target.data = index;
+            item.m_txtName.text = showActivity[index].res;
+            switch (showActivity[index].jumpId)
+            {
+                //后续添加其他活动
+                case "LuckyBoxView":
+                    item.m_imgTips.visible = RedDotDataManager.Instance.GetActLuckyBoxRewardRed(ConstLimitTimeActivityType.ActLimitTsy) || RedDotDataManager.Instance.GetLuckyBoxFreeTimes();
+                    break;
+                default:
+                    break;
+            }
+            long endTime = 0;
+            long curTime = TimeHelper.ServerNow();
+            if (showActivity[0] != null || showActivity != null)
+            {
+                endTime = TimeUtil.DateTimeToTimestamp(showActivity[0].endTime);
+            }
+            item.m_txtTime.text = string.Format("剩余时间:{0}", TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime));
+            item.target.onClick.Add(OnListActivityClick);
+            item.target.data = showActivity[index];
             UI_ListActivityItem.ProxyEnd();
         }
 
         private void OnListActivityClick(EventContext context)
         {
-            // _ui.m_listActivity.visible = false;
-            // _ui.m_listNotice.visible = false;
-            // int noticeId = (int)(context.data as GObject).data;
+            AdCfg adCfg = (AdCfg)(context.data as GObject).data;
+            object[] param = null;
+            int jumpIndex = 0;
+            if (adCfg.jumpId == nameof(LimitChargeView))
+            {
+                param = new object[] { adCfg.activityId };
+            }
+            if (adCfg.jumpId == nameof(NewLimitChargeView))
+            {
+                param = new object[] { adCfg.activityId };
+            }
+            if (adCfg.jumpId == nameof(LuckyBoxView))
+            {
+                jumpIndex = adCfg.jumpParamArr[0];
+            }
 
-            // ViewManager.Show<NoticeActivityShowView>(null, new object[] { typeof(NoticeView).Name, this.viewData });
+            if (jumpIndex != 0)
+                ViewManager.Show($"GFGGame.{adCfg.jumpId}", jumpIndex);
+            else
+                ViewManager.Show($"GFGGame.{adCfg.jumpId}", param);
         }
 
         private void ListNoticeItemRender(int index, GObject obj)
@@ -149,5 +186,37 @@ namespace GFGGame
                 ViewManager.Show<NoticeSystemShowView>(noticeInfo);
             }
         }
+
+        private void UpdateInfo()
+        {
+            if(activitydata == null)
+            {
+                activitydata = AdCfgArray.Instance.dataArray;
+            }
+            showActivity.Clear();
+            for (int i = 0; i < activitydata.Length; i++)
+            {
+                AdCfg adCfg = activitydata[i];
+                if (adCfg.activityId > 0)
+                {
+                    if (ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.activityId) == null) continue;
+                    ActivityInfo activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(adCfg.activityId);
+                    if (TimeHelper.ServerNow() < activityInfo.StartTime || TimeHelper.ServerNow() > activityInfo.EndTime) continue;
+                }
+                if (adCfg.startTime != "" && adCfg.startTime != null)
+                {
+                    long startTime = TimeUtil.DateTimeToTimestamp(adCfg.startTime);
+                    long endTime = TimeUtil.DateTimeToTimestamp(adCfg.endTime);
+                    if (TimeHelper.ServerNow() < startTime || TimeHelper.ServerNow() > endTime)
+                    {
+                        continue;
+                    }
+                    else
+                    {
+                        showActivity.Add(adCfg);
+                    }
+                }
+            }
+        }
     }
 }

BIN
GameClient/Assets/ResIn/UI/DailyWelfare/DailyWelfare_fui.bytes


BIN
GameClient/Assets/ResIn/UI/Notice/Notice_fui.bytes