ArenaFightResultView.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. private GameObject _scenePrefab;
  13. private GameObject _sceneObject;
  14. private GameObject _gameObject0;
  15. private GameObject _gameObject1;
  16. private GameObject _gameObject2;
  17. private GameObject _gameObject3;
  18. private GameObject _gameObject4;
  19. private GameObject _gameObject5;
  20. private GameObject _gameObject6;
  21. private GameObject _gameObject7;
  22. private GameObject _gameObject8;
  23. private GameObject _gameObject9;
  24. private GameObject _gameObject10;
  25. private GameObject _gameObject11;
  26. private GoWrapper _wrapper0;
  27. private GoWrapper _wrapper1;
  28. private GoWrapper _wrapper2;
  29. private GoWrapper _wrapper3;
  30. private GoWrapper _wrapper4;
  31. private GoWrapper _wrapper5;
  32. private GoWrapper _wrapper6;
  33. private GoWrapper _wrapper7;
  34. private GoWrapper _wrapper8;
  35. private GoWrapper _wrapper9;
  36. private GoWrapper _wrapper10;
  37. private GoWrapper _wrapper11;
  38. public override void Dispose()
  39. {
  40. SceneController.DestroyObjectFromView(_gameObject0, _wrapper0);
  41. SceneController.DestroyObjectFromView(_gameObject1, _wrapper1);
  42. SceneController.DestroyObjectFromView(_gameObject2, _wrapper2);
  43. SceneController.DestroyObjectFromView(_gameObject3, _wrapper3);
  44. SceneController.DestroyObjectFromView(_gameObject4, _wrapper4);
  45. SceneController.DestroyObjectFromView(_gameObject5, _wrapper5);
  46. SceneController.DestroyObjectFromView(_gameObject6, _wrapper6);
  47. SceneController.DestroyObjectFromView(_gameObject7, _wrapper7);
  48. if (_ui != null)
  49. {
  50. _ui.Dispose();
  51. }
  52. _ui = null;
  53. base.Dispose();
  54. }
  55. protected override void Init()
  56. {
  57. base.Init();
  58. _ui = UI_ArenaFightResultUI.Create();
  59. viewCom = _ui.target;
  60. isfullScreen = true;
  61. }
  62. protected override void OnInit()
  63. {
  64. base.OnInit();
  65. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  66. // _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("fightBg");
  67. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneFightResult"));
  68. AddEffect();
  69. }
  70. private void AddEffect()
  71. {
  72. string resPath0 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_lose");
  73. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult0, resPath0, out _gameObject0, out _wrapper0);
  74. string resPath1 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_qualified");
  75. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult1, resPath1, out _gameObject1, out _wrapper1);
  76. string resPath2 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_good");
  77. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult2, resPath2, out _gameObject2, out _wrapper2);
  78. string resPath3 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_Perfect");
  79. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult3, resPath3, out _gameObject3, out _wrapper3);
  80. string resPath4 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_Text_kuang");
  81. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderScore, resPath4, out _gameObject4, out _wrapper4);
  82. string resPath5 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_STAR");
  83. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderStar3, resPath5, out _gameObject7, out _wrapper7);
  84. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderStar2, resPath5, out _gameObject6, out _wrapper6);
  85. SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderStar1, resPath5, out _gameObject5, out _wrapper5);
  86. }
  87. protected override void OnShown()
  88. {
  89. base.OnShown();
  90. FightData roleData = ArenaDataManager.Instance.DressupList[ArenaDataManager.Instance.CurFightIndex];
  91. if (_sceneObject == null)
  92. {
  93. _sceneObject = GameObject.Instantiate(_scenePrefab);
  94. MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false, null, false);
  95. }
  96. MyDressUpHelper.dressUpObj.PutOnItemList(roleData.itemList);
  97. long myScore = ArenaDataManager.Instance.myScore[ArenaDataManager.Instance.CurFightIndex];
  98. long targetScore = ArenaDataManager.Instance.targetScore[ArenaDataManager.Instance.CurFightIndex];
  99. _ui.m_comResult.m_c1.selectedIndex = myScore > targetScore ? 3 : 0;
  100. _ui.m_comResult.m_txtScore.text = myScore.ToString();
  101. _ui.m_btnClose.enabled = false;
  102. ShowResultView();
  103. }
  104. private void ShowResultView()
  105. {
  106. ArenaDataManager.Instance.CurFightIndex++;
  107. _ui.m_comResult.m_t0.Play(() =>
  108. {
  109. ViewManager.Show<ArenaRoundResultView>();
  110. _ui.m_btnClose.enabled = true;
  111. });
  112. }
  113. protected override void OnHide()
  114. {
  115. base.OnHide();
  116. if (_sceneObject != null)
  117. {
  118. GameObject.Destroy(_sceneObject);
  119. _sceneObject = null;
  120. }
  121. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
  122. // _ui.m_comResult.target.height = 0;
  123. _ui.m_comResult.m_t1.Play();
  124. if (ArenaDataManager.Instance.CurFightIndex > 2)
  125. {
  126. object[] goBackDatas = ViewManager.GetGoBackDatas(typeof(ArenaView).FullName);
  127. ViewManager.Show<ArenaView>(null, goBackDatas, true);
  128. }
  129. }
  130. private void OnClickBtnClose(object param)
  131. {
  132. this.Hide();
  133. }
  134. }
  135. }