NoticeView.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. }
  40. private void ListActivityItemRender(int index, GObject obj)
  41. {
  42. UI_ListActivityItem item = UI_ListActivityItem.Proxy(obj);
  43. item.m_loaShow.url = ResPathUtil.GetActivityPath("");
  44. item.target.data = index;
  45. }
  46. private void OnListActivityClick(EventContext context)
  47. {
  48. _ui.m_listActivity.visible = false;
  49. _ui.m_listNotice.visible = false;
  50. //(context.data as GObject).data
  51. ViewManager.Show<NoticeActivityShowView>(null, new object[] { typeof(NoticeView).Name, this.viewData });
  52. }
  53. private void ListNoticeItemRender(int index, GObject obj)
  54. {
  55. UI_ListNoticeItem item = UI_ListNoticeItem.Proxy(obj);
  56. if (item.m_btnGo.data == null)
  57. {
  58. item.m_btnGo.onClick.Add(OnListNoticeBtnGoClick);
  59. }
  60. }
  61. private void OnListNoticeBtnGoClick(EventContext context)
  62. {
  63. _ui.m_listActivity.visible = false;
  64. _ui.m_listNotice.visible = false;
  65. //(context.data as GObject).data
  66. ViewManager.Show<NoticeSystemShowView>(null, new object[] { typeof(NoticeView).Name, this.viewData });
  67. }
  68. }
  69. }