ArenaFightResultView.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using FairyGUI;
  2. using UnityEngine;
  3. using UI.Main;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using ET;
  7. namespace GFGGame
  8. {
  9. public class ArenaFightResultView : BaseView
  10. {
  11. private UI_ArenaFightResultUI _ui;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. }
  18. _ui = null;
  19. base.Dispose();
  20. }
  21. protected override void Init()
  22. {
  23. base.Init();
  24. _ui = UI_ArenaFightResultUI.Create();
  25. viewCom = _ui.target;
  26. isfullScreen = true;
  27. }
  28. protected override void OnInit()
  29. {
  30. base.OnInit();
  31. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  32. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("fightBg");
  33. }
  34. protected override void OnShown()
  35. {
  36. base.OnShown();
  37. long myScore = ArenaDataManager.Instance.myScore[ArenaDataManager.Instance.CurFightIndex];
  38. long targetScore = ArenaDataManager.Instance.targetScore[ArenaDataManager.Instance.CurFightIndex];
  39. bool isWin = myScore > targetScore;
  40. NTexture nTexture = new NTexture(ArenaDataManager.Instance.TextureDic[ArenaDataManager.Instance.CurFightIndex]);
  41. _ui.m_comRoleResult.m_c1.selectedIndex = isWin ? 3 : 0;
  42. _ui.m_comRoleResult.m_comRole.m_imgRole.SetSize(GRoot.inst.width, GRoot.inst.height);
  43. _ui.m_comRoleResult.m_comRole.m_imgRole.texture = nTexture;
  44. _ui.m_comRoleResult.m_comRole.m_imgRole.alpha = 1;
  45. _ui.m_comResult.m_c1.selectedIndex = isWin ? 3 : 0;
  46. _ui.m_comResult.m_txtScore.text = myScore.ToString();
  47. _ui.m_comResult.m_grpStar.visible = false;
  48. _ui.m_btnClose.enabled = false;
  49. _ui.m_t0.Play();//播放重置动画
  50. _ui.m_comRoleResult.m_t0.Play();//播放重置动画
  51. _ui.m_comRoleResult.m_comRole.m_t0.Play(() =>
  52. {
  53. if (isWin)
  54. {
  55. _ui.m_comRoleResult.m_t3.Play(ShowResultView);
  56. }
  57. else
  58. {
  59. _ui.m_comRoleResult.m_t0.Play(ShowResultView);
  60. }
  61. });
  62. }
  63. private void ShowResultView()
  64. {
  65. ArenaDataManager.Instance.CurFightIndex++;
  66. _ui.m_t1.Play(() =>
  67. {
  68. ViewManager.Show<ArenaRoundResultView>();
  69. _ui.m_btnClose.enabled = true;
  70. });
  71. }
  72. protected override void OnHide()
  73. {
  74. base.OnHide();
  75. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
  76. _ui.m_comResult.target.height = 0;
  77. _ui.m_t1.Stop(true, false);
  78. _ui.m_t0.Stop(true, false);
  79. _ui.m_comRoleResult.m_t3.Stop(true, false);
  80. _ui.m_comRoleResult.m_t0.Stop(true, false);
  81. if (ArenaDataManager.Instance.CurFightIndex > 2)
  82. {
  83. object[] goBackDatas = ViewManager.GetGoBackDatas(typeof(ArenaView).FullName);
  84. ViewManager.Show<ArenaView>(null, goBackDatas, true);
  85. }
  86. }
  87. private void OnClickBtnClose(object param)
  88. {
  89. this.Hide();
  90. }
  91. }
  92. }