NoticeView.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using UnityEngine;
  2. using FairyGUI;
  3. using UI.Notice;
  4. namespace GFGGame
  5. {
  6. public class NoticeView : BaseWindow
  7. {
  8. private UI_NoticeUI _ui;
  9. public override void Dispose()
  10. {
  11. base.Dispose();
  12. }
  13. protected override void Init()
  14. {
  15. base.Init();
  16. packageName = UI_NoticeUI.PACKAGE_NAME;
  17. _ui = UI_NoticeUI.Create();
  18. this.viewCom = _ui.target;
  19. this.viewCom.Center();
  20. this.modal = true;
  21. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  22. }
  23. protected override void OnInit()
  24. {
  25. base.OnInit();
  26. _ui.m_listActivity.itemRenderer = ListActivityItemRender;
  27. _ui.m_listActivity.onClick.Add(OnListActivityClick);
  28. _ui.m_listNotice.itemRenderer = ListNoticeItemRender;
  29. }
  30. protected override void OnShown()
  31. {
  32. base.OnShown();
  33. _ui.m_listActivity.visible = true;
  34. _ui.m_listNotice.visible = true;
  35. }
  36. protected override void OnHide()
  37. {
  38. base.OnHide();
  39. // ViewManager.GoBackFrom(typeof(NoticeView).Name);
  40. }
  41. private void ListActivityItemRender(int index, GObject obj)
  42. {
  43. UI_ListActivityItem item = UI_ListActivityItem.Proxy(obj);
  44. item.m_loaShow.url = ResPathUtil.GetActivityPath("");
  45. item.target.data = index;
  46. }
  47. private void OnListActivityClick(EventContext context)
  48. {
  49. _ui.m_listActivity.visible = false;
  50. _ui.m_listNotice.visible = false;
  51. //(context.data as GObject).data
  52. ViewManager.Show<NoticeActivityShowView>(null, new object[] { typeof(NoticeView).Name, this.viewData });
  53. }
  54. private void ListNoticeItemRender(int index, GObject obj)
  55. {
  56. UI_ListNoticeItem item = UI_ListNoticeItem.Proxy(obj);
  57. if (item.m_btnGo.data == null)
  58. {
  59. item.m_btnGo.onClick.Add(OnListNoticeBtnGoClick);
  60. }
  61. }
  62. private void OnListNoticeBtnGoClick(EventContext context)
  63. {
  64. _ui.m_listActivity.visible = false;
  65. _ui.m_listNotice.visible = false;
  66. //(context.data as GObject).data
  67. ViewManager.Show<NoticeSystemShowView>(null, new object[] { typeof(NoticeView).Name, this.viewData });
  68. }
  69. }
  70. }