123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using FairyGUI;
- using UnityEngine;
- using UI.Main;
- using System.Collections;
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class ArenaFightResultView : BaseView
- {
- private UI_ArenaFightResultUI _ui;
- private GameObject _scenePrefab;
- private GameObject _sceneObject;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void Init()
- {
- base.Init();
- _ui = UI_ArenaFightResultUI.Create();
- viewCom = _ui.target;
- isfullScreen = true;
- }
- protected override void OnInit()
- {
- base.OnInit();
- _ui.m_btnClose.onClick.Add(OnClickBtnClose);
- // _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("fightBg");
- _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneFightResult"));
- }
- protected override void OnShown()
- {
- base.OnShown();
- FightData roleData = ArenaDataManager.Instance.DressupList[ArenaDataManager.Instance.CurFightIndex];
- if (_sceneObject == null)
- {
- _sceneObject = GameObject.Instantiate(_scenePrefab);
- MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false, null, false);
- }
- MyDressUpHelper.dressUpObj.PutOnItemList(roleData.itemList);
- long myScore = ArenaDataManager.Instance.myScore[ArenaDataManager.Instance.CurFightIndex];
- long targetScore = ArenaDataManager.Instance.targetScore[ArenaDataManager.Instance.CurFightIndex];
- _ui.m_comResult.m_c1.selectedIndex = myScore > targetScore ? 3 : 0;
- _ui.m_comResult.m_txtScore.text = myScore.ToString();
- _ui.m_comResult.m_grpStar.visible = false;
- _ui.m_btnClose.enabled = false;
- ShowResultView();
- }
- private void ShowResultView()
- {
- ArenaDataManager.Instance.CurFightIndex++;
- _ui.m_t1.Play(() =>
- {
- ViewManager.Show<ArenaRoundResultView>();
- _ui.m_btnClose.enabled = true;
- });
- }
- protected override void OnHide()
- {
- base.OnHide();
- if (_sceneObject != null)
- {
- GameObject.Destroy(_sceneObject);
- _sceneObject = null;
- }
- MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
- _ui.m_comResult.target.height = 0;
- _ui.m_t1.Stop(true, false);
- // _ui.m_t0.Stop(true, false);
- // _ui.m_comRoleResult.m_t3.Stop(true, false);
- // _ui.m_comRoleResult.m_t0.Stop(true, false);
- if (ArenaDataManager.Instance.CurFightIndex > 2)
- {
- object[] goBackDatas = ViewManager.GetGoBackDatas(typeof(ArenaView).FullName);
- ViewManager.Show<ArenaView>(null, goBackDatas, true);
- }
- }
- private void OnClickBtnClose(object param)
- {
- this.Hide();
- }
- }
- }
|