123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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 StoryLevelCfg _levelCfg;
- // private StoryFightResultData _resultData;
- private List<FightRoleData> roleDatas;
- private List<ArenaTargetData> targetDatas;
- 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.GetFightBgImgPath("fightBg");
- }
- protected override void OnShown()
- {
- base.OnShown();
- int myScore = (int)(this.viewData as object[])[0];
- int targetScore = (int)(this.viewData as object[])[0];
- ArenaDataManager.Instance.myScore.Add(myScore);
- ArenaDataManager.Instance.targetFightScore.Add(targetScore);
- _ui.m_btnClose.enabled = false;
- bool isWin = myScore > targetScore;
- NTexture nTexture = new NTexture(FightDataManager.Instance.RoleTextuex);
- _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_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()
- {
- ViewManager.Show<ArenaResultView>();
- _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);
- 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();
- }
- }
- }
|