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; 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"); } protected override void OnShown() { base.OnShown(); long myScore = ArenaDataManager.Instance.myScore[ArenaDataManager.Instance.CurFightIndex]; long targetScore = ArenaDataManager.Instance.targetScore[ArenaDataManager.Instance.CurFightIndex]; bool isWin = myScore > targetScore; NTexture nTexture = new NTexture(ArenaDataManager.Instance.TextureDic[ArenaDataManager.Instance.CurFightIndex]); _ui.m_comRoleResult.m_c1.selectedIndex = isWin ? 3 : 0; _ui.m_comRoleResult.m_comRole.m_imgRole.SetSize(GRoot.inst.width, GRoot.inst.height); _ui.m_comRoleResult.m_comRole.m_imgRole.texture = nTexture; _ui.m_comRoleResult.m_comRole.m_imgRole.alpha = 1; _ui.m_comResult.m_c1.selectedIndex = isWin ? 3 : 0; _ui.m_comResult.m_txtScore.text = myScore.ToString(); _ui.m_comResult.m_grpStar.visible = false; _ui.m_btnClose.enabled = false; _ui.m_t0.Play();//播放重置动画 _ui.m_comRoleResult.m_t0.Play();//播放重置动画 _ui.m_comRoleResult.m_comRole.m_t0.Play(() => { if (isWin) { _ui.m_comRoleResult.m_t3.Play(ShowResultView); } else { _ui.m_comRoleResult.m_t0.Play(ShowResultView); } }); } private void ShowResultView() { ArenaDataManager.Instance.CurFightIndex++; _ui.m_t1.Play(() => { ViewManager.Show(); _ui.m_btnClose.enabled = true; }); } protected override void OnHide() { base.OnHide(); 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(null, goBackDatas, true); } } private void OnClickBtnClose(object param) { this.Hide(); } } }