ArenaFightResultView.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. public override void Dispose()
  15. {
  16. if (_ui != null)
  17. {
  18. _ui.Dispose();
  19. }
  20. _ui = null;
  21. base.Dispose();
  22. }
  23. protected override void Init()
  24. {
  25. base.Init();
  26. _ui = UI_ArenaFightResultUI.Create();
  27. viewCom = _ui.target;
  28. isfullScreen = true;
  29. }
  30. protected override void OnInit()
  31. {
  32. base.OnInit();
  33. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  34. // _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("fightBg");
  35. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneFightResult"));
  36. }
  37. protected override void OnShown()
  38. {
  39. base.OnShown();
  40. FightData roleData = ArenaDataManager.Instance.DressupList[ArenaDataManager.Instance.CurFightIndex];
  41. if (_sceneObject == null)
  42. {
  43. _sceneObject = GameObject.Instantiate(_scenePrefab);
  44. MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false, null, false);
  45. }
  46. MyDressUpHelper.dressUpObj.PutOnItemList(roleData.itemList);
  47. long myScore = ArenaDataManager.Instance.myScore[ArenaDataManager.Instance.CurFightIndex];
  48. long targetScore = ArenaDataManager.Instance.targetScore[ArenaDataManager.Instance.CurFightIndex];
  49. _ui.m_comResult.m_c1.selectedIndex = myScore > targetScore ? 3 : 0;
  50. _ui.m_comResult.m_txtScore.text = myScore.ToString();
  51. // _ui.m_comResult.m_grpStar.visible = false;
  52. _ui.m_btnClose.enabled = false;
  53. ShowResultView();
  54. }
  55. private void ShowResultView()
  56. {
  57. ArenaDataManager.Instance.CurFightIndex++;
  58. _ui.m_comResult.m_t0.Play(() =>
  59. {
  60. ViewManager.Show<ArenaRoundResultView>();
  61. _ui.m_btnClose.enabled = true;
  62. });
  63. }
  64. protected override void OnHide()
  65. {
  66. base.OnHide();
  67. if (_sceneObject != null)
  68. {
  69. GameObject.Destroy(_sceneObject);
  70. _sceneObject = null;
  71. }
  72. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
  73. _ui.m_comResult.target.height = 0;
  74. _ui.m_comResult.m_t1.Play();
  75. _ui.m_comResult.m_t0.Stop(true, false);
  76. // _ui.m_t0.Stop(true, false);
  77. // _ui.m_comRoleResult.m_t3.Stop(true, false);
  78. // _ui.m_comRoleResult.m_t0.Stop(true, false);
  79. if (ArenaDataManager.Instance.CurFightIndex > 2)
  80. {
  81. object[] goBackDatas = ViewManager.GetGoBackDatas(typeof(ArenaView).FullName);
  82. ViewManager.Show<ArenaView>(null, goBackDatas, true);
  83. }
  84. }
  85. private void OnClickBtnClose(object param)
  86. {
  87. this.Hide();
  88. }
  89. }
  90. }