using FairyGUI; using UnityEngine; using UI.Main; using System.Collections; using System.Collections.Generic; using ET; namespace GFGGame { public class StroyFightResultView : BaseView { private UI_StoryFightResultUI _ui; private GameObject _scenePrefab; private GameObject _sceneObject; private StoryFightResultData _resultData; public override void Dispose() { if (_ui != null) { _ui.Dispose(); } _ui = null; base.Dispose(); } protected override void Init() { base.Init(); _ui = UI_StoryFightResultUI.Create(); viewCom = _ui.target; isfullScreen = true; } protected override void OnInit() { base.OnInit(); _ui.m_btnClose.enabled = false; _ui.m_btnClose.onClick.Add(OnClickBtnClose); // _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("fightBg"); _scenePrefab = GFGAsset.Load(ResPathUtil.GetPrefabPath("SceneFightResult")); } protected override void OnShown() { base.OnShown(); _resultData = (StoryFightResultData)this.viewData; InstanceZonesDataManager.usedRecommend = false; InstanceZonesDataManager.isResultFighting = true; FightData roleData = InstanceZonesDataManager.roleData; if (_sceneObject == null) { _sceneObject = GameObject.Instantiate(_scenePrefab); MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false, null, false); } MyDressUpHelper.dressUpObj.PutOnItemList(roleData.itemList); _ui.m_comResult.m_c1.selectedIndex = _resultData.Star; _ui.m_comResult.m_txtScore.text = "" + _resultData.Score; RoleInfoManager.Instance.UpdateHeadWithLv1(_ui.m_comExpBar.m_comHead, RoleDataManager.headId, RoleDataManager.headBorderId, RoleDataManager.lvl); if (!this._resultData.Result) { _ui.m_comExpBar.target.visible = false; InstanceZonesDataManager.isResultFighting = false; } else { _ui.m_comExpBar.target.visible = true; _ui.m_btnClose.enabled = false; StoryLevelCfg _levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId); StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID); _ui.m_comExpBar.m_txtExpAdded.SetVar("value", fightCfg.exp.ToString()).FlushVars(); } if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Field) { _ui.m_comExpBar.target.visible = false; Timers.inst.Add(3, 1, OnClickBtnClose); } AddExp(); } protected override void OnHide() { base.OnHide(); if (_sceneObject != null) { GameObject.Destroy(_sceneObject); _sceneObject = null; } InstanceZonesDataManager.isResultFighting = false; MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT)); } private async void OnClickBtnClose(object param) { this.Hide(); if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Field) { Timers.inst.Remove(OnClickBtnClose); if (!this._resultData.Result || FieldDataManager.Instance.currFightLv == FieldCfgArray.Instance.GetCfg(FieldDataManager.Instance.chapterId).num) { ViewManager.Show(); if (FieldDataManager.Instance.currFightLv <= 1) return; bool result = await FieldSProxy.ReqFieldInstanceResult(); if (result) { ViewManager.Show(); } } else { ViewManager.Show(); ViewManager.Show(); } } else { InstanceZonesController.OnFinishStoryLevel(InstanceZonesDataManager.currentLevelCfgId, _resultData.FirstPass, true); //尝试显示奖励 BonusController.TryShowBonusList(_resultData.BonusList); } InstanceZonesDataManager.currentCardId = -1; } private void AddExp() { float exp = GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp); float cfgExp = RoleLevelCfgArray.Instance.GetCfg(RoleDataManager.lvl).exp; _ui.m_comExpBar.m_txtCurExp.text = exp.ToString(); _ui.m_comExpBar.m_txtAllExp.text = cfgExp.ToString(); _ui.m_comExpBar.m_proExp.max = cfgExp; _ui.m_comExpBar.m_proExp.value = 0; _ui.m_comExpBar.m_proExp.TweenValue(exp, 0.2f).OnComplete(() => { InstanceZonesDataManager.isResultFighting = false; }); _ui.m_btnClose.enabled = true; UpdateToCheckGuide(null); } } }