123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- 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;
- private GameObject _gameObject0;
- private GameObject _gameObject1;
- private GameObject _gameObject2;
- private GameObject _gameObject3;
- private GameObject _gameObject4;
- private GameObject _gameObject5;
- private GameObject _gameObject6;
- private GameObject _gameObject7;
- private GameObject _gameObject8;
- private GameObject _gameObject9;
- private GameObject _gameObject10;
- private GameObject _gameObject11;
- private GoWrapper _wrapper0;
- private GoWrapper _wrapper1;
- private GoWrapper _wrapper2;
- private GoWrapper _wrapper3;
- private GoWrapper _wrapper4;
- private GoWrapper _wrapper5;
- private GoWrapper _wrapper6;
- private GoWrapper _wrapper7;
- private GoWrapper _wrapper8;
- private GoWrapper _wrapper9;
- private GoWrapper _wrapper10;
- private GoWrapper _wrapper11;
- public override void Dispose()
- {
- SceneController.DestroyObjectFromView(_gameObject0, _wrapper0);
- SceneController.DestroyObjectFromView(_gameObject1, _wrapper1);
- SceneController.DestroyObjectFromView(_gameObject2, _wrapper2);
- SceneController.DestroyObjectFromView(_gameObject3, _wrapper3);
- SceneController.DestroyObjectFromView(_gameObject4, _wrapper4);
- SceneController.DestroyObjectFromView(_gameObject5, _wrapper5);
- SceneController.DestroyObjectFromView(_gameObject6, _wrapper6);
- SceneController.DestroyObjectFromView(_gameObject7, _wrapper7);
- 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"));
- AddEffect();
- }
- private void AddEffect()
- {
- string resPath0 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_lose");
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult0, resPath0, out _gameObject0, out _wrapper0);
- string resPath1 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_qualified");
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult1, resPath1, out _gameObject1, out _wrapper1);
- string resPath2 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_good");
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult2, resPath2, out _gameObject2, out _wrapper2);
- string resPath3 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_Perfect");
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderResult3, resPath3, out _gameObject3, out _wrapper3);
- string resPath4 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_Text_kuang");
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderScore, resPath4, out _gameObject4, out _wrapper4);
- string resPath5 = ResPathUtil.GetViewEffectPath("ui_fight_new", "ZDJS_STAR");
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderStar3, resPath5, out _gameObject7, out _wrapper7);
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderStar2, resPath5, out _gameObject6, out _wrapper6);
- SceneController.AddObjectToView(null, null, _ui.m_comResult.m_holderStar1, resPath5, out _gameObject5, out _wrapper5);
- }
- 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_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.Play(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();
- }
- }
- }
|