123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- 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 _sceneObject;
- private EffectUI _effectUI1;
- private EffectUI _effectUI2;
- private EffectUI _effectUI3;
- private EffectUI _effectUI4;
- private EffectUI _effectUI5;
- private EffectUI _effectUI6;
- private EffectUI _effectUI7;
- private EffectUI _effectUI8;
- public override void Dispose()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- EffectUIPool.Recycle(_effectUI2);
- _effectUI2 = null;
- EffectUIPool.Recycle(_effectUI3);
- _effectUI3 = null;
- EffectUIPool.Recycle(_effectUI4);
- _effectUI4 = null;
- EffectUIPool.Recycle(_effectUI5);
- _effectUI5 = null;
- EffectUIPool.Recycle(_effectUI6);
- _effectUI6 = null;
- EffectUIPool.Recycle(_effectUI7);
- _effectUI7 = null;
- EffectUIPool.Recycle(_effectUI8);
- _effectUI8 = null;
- 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");
- AddEffect();
- }
- private void AddEffect()
- {
- _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult0, "ui_fight_new", "ZDJS_lose");
- _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult1, "ui_fight_new", "ZDJS_qualified");
- _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult2, "ui_fight_new", "ZDJS_good");
- _effectUI4 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult3, "ui_fight_new", "ZDJS_Perfect");
- _effectUI5 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderScore, "ui_fight_new", "ZDJS_Text_kuang");
- _effectUI6 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderStar3, "ui_fight_new", "ZDJS_STAR");
- _effectUI7 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderStar2, "ui_fight_new", "ZDJS_STAR");
- _effectUI8 = EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderStar1, "ui_fight_new", "ZDJS_STAR");
- }
- protected override void OnShown()
- {
- base.OnShown();
- FightData roleData = ArenaDataManager.Instance.DressupList[ArenaDataManager.Instance.CurFightIndex];
- if (_sceneObject == null)
- {
- _sceneObject = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetPrefabPath("SceneFightResult"));
- 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_btnClose.enabled = false;
- ShowResultView();
- }
- private void ShowResultView()
- {
- ArenaDataManager.Instance.CurFightIndex++;
- _ui.m_comResult.m_t0.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.PlayCroutine(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
- // _ui.m_comResult.target.height = 0;
- _ui.m_comResult.m_t1.Play();
- 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();
- }
- }
- }
|