| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 | 
							- using UnityEngine;
 
- using FairyGUI;
 
- using UI.Notice;
 
- using System.Collections.Generic;
 
- using ET;
 
- namespace GFGGame
 
- {
 
-     public class NoticeView : BaseWindow
 
-     {
 
-         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);
 
-             _effectUI1 = null;
 
-             EffectUIPool.Recycle(_effectUI2);
 
-             _effectUI2 = null;
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void Init()
 
-         {
 
-             base.Init();
 
-             packageName = UI_NoticeUI.PACKAGE_NAME;
 
-             _ui = UI_NoticeUI.Create();
 
-             this.viewCom = _ui.target;
 
-             this.viewCom.Center();
 
-             this.modal = true;
 
-             viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
 
-             //isReturnView = true;
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             _ui.m_listActivity.itemRenderer = ListActivityItemRender;
 
-             //_ui.m_listActivity.onClick.Add(OnListActivityClick);
 
-             _ui.m_listNotice.itemRenderer = ListNoticeItemRender;
 
-             _ui.m_c1.onChanged.Add(OnCtrlChange);
 
-             AddEffect();
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.NOTICE_SYSTOM_ADD, OnCtrlChange);
 
-             EventAgent.AddEventListener(ConstMessage.NOTICE_SYSTOM_REMOVE, OnCtrlChange);
 
-             EventAgent.AddEventListener(ConstMessage.SHOW_SYSTEM_NOTICE, UpdateView);
 
-             EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             
 
-             if (backRefresh)
 
-             {
 
-                 _ui.m_c1.selectedIndex = 0;
 
-             }
 
-             UpdateView();
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.NOTICE_SYSTOM_ADD, OnCtrlChange);
 
-             EventAgent.RemoveEventListener(ConstMessage.NOTICE_SYSTOM_REMOVE, OnCtrlChange);
 
-             EventAgent.RemoveEventListener(ConstMessage.SHOW_SYSTEM_NOTICE, UpdateView);
 
-             EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
 
-         }
 
-         private void AddEffect()
 
-         {
 
-             //邊框左上角特效
 
-             _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holderLeftTop, "ui_Activity", "Com_window_L_up");
 
-             //邊框右下角特效
 
-             _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holderRightDowm, "ui_Activity", "Com_window_R_Down");
 
-         }
 
-         private void OnCtrlChange()
 
-         {
 
-             if (_ui.m_c1.selectedIndex == 0)
 
-             {
 
-                 UpdateInfo();
 
-                 _ui.m_listActivity.numItems = showActivity.Count;
 
-                 _ui.m_txtTips.visible = _ui.m_listActivity.numItems == 0;
 
-             }
 
-             else if (_ui.m_c1.selectedIndex == 1)
 
-             {
 
-                 _ui.m_listNotice.numItems = NoticeDataManager.Instance.NoticeInfos.Count;
 
-                 _ui.m_txtTips.visible = _ui.m_listNotice.numItems == 0;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 活动公告 0
 
-         /// </summary>
 
-         /// <param name="index"></param>
 
-         /// <param name="obj"></param>
 
-         private void ListActivityItemRender(int index, GObject obj)
 
-         {
 
-             UI_ListActivityItem item = UI_ListActivityItem.Proxy(obj);
 
-             item.m_loaShow.url = ResPathUtil.GetActivityPath(showActivity[index].NoticeTips, "png");
 
-             item.m_txtName.text = "";
 
-             long endTime = 0;
 
-             long curTime = TimeHelper.ServerNow();
 
-             if (showActivity.Count > 0)
 
-             {
 
-                 if (showActivity[index].endTime != "" && showActivity[index].endTime != null)
 
-                 {
 
-                     endTime = TimeUtil.DateTimeToTimestamp(showActivity[0].endTime);
 
-                 }
 
-                 else
 
-                 {
 
-                     ActivityInfo activityInfo = ActivityGlobalDataManager.Instance.GetActivityInfo(showActivity[index].activityId);
 
-                     endTime = activityInfo.EndTime;
 
-                 }
 
-             }
 
-             item.m_txtTime.text = string.Format("剩余时间:{0}", TimeUtil.FormattingTimeTo_DDHHmm(endTime - curTime));
 
-             item.target.onClick.Add(OnListActivityClick);
 
-             item.target.data = showActivity[index];
 
-             item.m_imgTips.visible = NoticeDataManager.Instance.GetRedDotState(showActivity[index].jumpId, showActivity[index].activityId);
 
-             UI_ListActivityItem.ProxyEnd();
 
-         }
 
-         private void OnListActivityClick(EventContext context)
 
-         {
 
-             AdCfg adCfg = (AdCfg)(context.sender 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];
 
-             }
 
-             if (jumpIndex != 0)
 
-             {
 
-                 Hide();
 
-                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", jumpIndex, false, false);
 
-             }
 
-             else
 
-             {
 
-                 Hide();
 
-                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", param, false, false);
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 系统公告 1
 
-         /// </summary>
 
-         /// <param name="index"></param>
 
-         /// <param name="obj"></param>
 
-         private void ListNoticeItemRender(int index, GObject obj)
 
-         {
 
-             NoticeInfo noticeInfo = NoticeDataManager.Instance.NoticeInfos[index];
 
-             UI_ListNoticeItem item = UI_ListNoticeItem.Proxy(obj);
 
-             item.m_txtTitle.text = noticeInfo.title;
 
-             item.m_txtTime.text = TimeUtil.FormattingTimeTo_yyyMMdd0(noticeInfo.time);
 
-             // item.m_imgTips.visible = !noticeInfo.readStatus;
 
-             RedDotController.Instance.SetComRedDot(item.target, !noticeInfo.readStatus, "gg_gg_hdhdgth", -40, 32);
 
-             if (item.m_btnGo.data == null)
 
-             {
 
-                 item.m_btnGo.onClick.Add(OnListNoticeBtnGoClick);
 
-             }
 
-             item.m_btnGo.data = noticeInfo;
 
-             UI_ListNoticeItem.ProxyEnd();
 
-         }
 
-         private async void OnListNoticeBtnGoClick(EventContext context)
 
-         {
 
-             _ui.m_listActivity.visible = false;
 
-             _ui.m_listNotice.visible = false;
 
-             _ui.m_buttonCom.visible = false;
 
-             NoticeInfo noticeInfo = (context.sender as GObject).data as NoticeInfo;
 
-             if (noticeInfo.content == "")
 
-             {
 
-                 bool result = await NoticeSProxy.ReqSystemNotice(noticeInfo.noticeId);
 
-                 if (result)
 
-                 {
 
-                     ViewManager.Show<NoticeSystemShowView>(NoticeDataManager.Instance.GetNoticeInfoById(noticeInfo.noticeId), false, false);
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 ViewManager.Show<NoticeSystemShowView>(noticeInfo, false, false);
 
-             }
 
-         }
 
-         private void UpdateInfo()
 
-         {
 
-             showActivity = NoticeDataManager.Instance.UpdateShowActivity();
 
-         }
 
-         private void UpdateTitleRedDot()
 
-         {
 
-             bool btnActivityFlag = false;
 
-             bool btnNoticeFlag = false;
 
-             // 活动公告
 
-             for (int i = 0; i < showActivity.Count; i++)
 
-             {
 
-                 if (NoticeDataManager.Instance.GetRedDotState(showActivity[i].jumpId, showActivity[i].activityId))
 
-                 {
 
-                     btnActivityFlag = true;
 
-                     break;
 
-                 }
 
-             }
 
-             // 系统公告
 
-             for (int i = 0; i < NoticeDataManager.Instance.NoticeInfos.Count; i++)
 
-             {
 
-                 if (!NoticeDataManager.Instance.NoticeInfos[i].readStatus)
 
-                 {
 
-                     btnNoticeFlag = true;
 
-                     break;
 
-                 }
 
-             }
 
-             RedDotController.Instance.SetComRedDot(_ui.m_btnActivity, btnActivityFlag, "", -25);
 
-             RedDotController.Instance.SetComRedDot(_ui.m_btnNotice, btnNoticeFlag, "", -25);
 
-         }
 
-         private void UpdateView()
 
-         {
 
-             _ui.m_listActivity.visible = true;
 
-             _ui.m_listNotice.visible = true;
 
-             _ui.m_buttonCom.visible = true;
 
-             OnCtrlChange();
 
-             UpdateInfo();
 
-             UpdateTitleRedDot();
 
-         }
 
-         private void UpdateRedDot()
 
-         {
 
-             if(_ui.m_c1.selectedIndex == 0)
 
-             {
 
-                 OnCtrlChange();
 
-                 UpdateInfo();
 
-                 UpdateTitleRedDot();
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |