CardShowView.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using FairyGUI;
  2. using System.Collections;
  3. using UI.Card;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class CardShowView : BaseWindow
  8. {
  9. private UI_CardShowUI _ui;
  10. public override void Dispose()
  11. {
  12. if (_ui != null)
  13. {
  14. _ui.Dispose();
  15. _ui = null;
  16. }
  17. base.Dispose();
  18. }
  19. protected override void OnInit()
  20. {
  21. base.OnInit();
  22. _ui = UI_CardShowUI.Create();
  23. this.viewCom = _ui.target;
  24. isfullScreen = true;
  25. // viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  26. this.modal = true;
  27. _ui.m_loaCard.onClick.Add(OnClickBtnBack);
  28. }
  29. protected override void OnShown()
  30. {
  31. base.OnShown();
  32. CardData cardData = (viewData as CardData);
  33. _ui.m_loaCard.url = ResPathUtil.GetCardPath(cardData.resources[cardData.resIndex]);
  34. _ui.m_loaCard.width = _ui.m_loaCard.image.width;
  35. _ui.target.scrollPane.SetPercX(0.5f, false);
  36. }
  37. private void OnClickBtnBack()
  38. {
  39. ViewManager.GoBackFrom(ViewName.CARD_SHOW_VIEW);
  40. EventAgent.DispatchEvent(ConstMessage.PLAT_CARDFOSTER_T1);
  41. _ui.target.scrollPane.SetPercX(0.5f, true);
  42. }
  43. protected override void OnHide()
  44. {
  45. base.OnHide();
  46. }
  47. }
  48. }