CardView.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using FairyGUI;
  2. using System;
  3. using UI.Card;
  4. namespace GFGGame
  5. {
  6. public class CardView : BaseView
  7. {
  8. private UI_CardUI _ui;
  9. public override void Dispose()
  10. {
  11. if (_ui != null)
  12. {
  13. _ui.Dispose();
  14. _ui = null;
  15. }
  16. base.Dispose();
  17. }
  18. protected override void OnInit()
  19. {
  20. base.OnInit();
  21. packageName = UI_CardUI.PACKAGE_NAME;
  22. _ui = UI_CardUI.Create();
  23. viewCom = _ui.target;
  24. isfullScreen = true;
  25. isReturnView = true;
  26. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  27. _ui.m_loaStory1.target.onClick.Add(() => { OnClickLoaStory(1); });
  28. _ui.m_loaStory2.target.onClick.Add(() => { OnClickLoaStory(2); });
  29. _ui.m_loaStory3.target.onClick.Add(() => { OnClickLoaStory(3); });
  30. _ui.m_loaStory4.target.onClick.Add(() => { OnClickLoaStory(4); });
  31. _ui.m_loaDetail.onClick.Add(OnClickLoaDetail);
  32. }
  33. protected override void OnShown()
  34. {
  35. base.OnShown();
  36. // GuideController.TryGuideCardViewBtnDetail(_ui.m_loaDetail);
  37. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gxhd_bjbj");
  38. }
  39. /*******************************************************źŕĚýşŻĘý**************************************************/
  40. private void OnClickBtnBack()
  41. {
  42. ViewManager.GoBackFrom(typeof(CardView).FullName);
  43. _ui.m_c1.selectedIndex = 0;
  44. _ui.m_t0.Stop(true, false);
  45. }
  46. private void OnClickLoaStory(int roleId)
  47. {
  48. PromptController.Instance.ShowFloatTextPrompt("ÔÝδżŞˇĹ" + roleId);
  49. }
  50. private void OnClickLoaDetail()
  51. {
  52. _ui.m_c1.selectedIndex = 1;
  53. _ui.m_t0.Play(() =>
  54. {
  55. _ui.m_c1.selectedIndex = 0;
  56. });
  57. _ui.m_t0.SetHook("open", () =>
  58. {
  59. ViewManager.Show<CardDetailView>();
  60. });
  61. }
  62. protected override void OnHide()
  63. {
  64. base.OnHide();
  65. }
  66. }
  67. }