using FairyGUI; using UnityEngine; using UI.Main; using System.Collections; using System.Collections.Generic; using cfg.GfgCfg; using ET; namespace GFGGame { public class StroyFightResultView : BaseView { private UI_StoryFightResultUI _ui; private GameObject _sceneObject; private EffectUI _effectUI0; private EffectUI _effectUI1; private EffectUI _effectUI2; private EffectUI _effectUI3; private EffectUI _effectUI4; private EffectUI _effectUI5; private EffectUI _effectUI6; private EffectUI _effectUI7; private EffectUI _effectUI8; private EffectUI _effectUI9; private EffectUI _effectUI10; private EffectUI _effectUI11; private StoryFightResultData _resultData; public override void Dispose() { EffectUIPool.Recycle(_effectUI0); _effectUI0 = null; 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; EffectUIPool.Recycle(_effectUI9); _effectUI9 = null; EffectUIPool.Recycle(_effectUI10); _effectUI10 = null; EffectUIPool.Recycle(_effectUI11); _effectUI11 = null; if (_ui != null) { _ui.Dispose(); } _ui = null; base.Dispose(); } protected override void Init() { base.Init(); _ui = UI_StoryFightResultUI.Create(); viewCom = _ui.target; isfullScreen = true; //isReturnView = 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"); _ui.m_comExpBar.m_proExp.m_comHolder.target.width = 0; AddEffect(); } private void AddEffect() { EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult0, "ui_fight_new", "ZDJS_lose", onComplete: (effect) => { if (effect != null) { _effectUI0 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult1, "ui_fight_new", "ZDJS_qualified", onComplete: (effect) => { if (effect != null) { _effectUI1 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult2, "ui_fight_new", "ZDJS_good", onComplete: (effect) => { if (effect != null) { _effectUI2 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderResult3, "ui_fight_new", "ZDJS_Perfect", onComplete: (effect) => { if (effect != null) { _effectUI3 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderScore, "ui_fight_new", "ZDJS_Text_kuang", onComplete: (effect) => { if (effect != null) { _effectUI4 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderStar3, "ui_fight_new", "ZDJS_STAR", onComplete: (effect) => { if (effect != null) { _effectUI5 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderStar2, "ui_fight_new", "ZDJS_STAR", onComplete: (effect) => { if (effect != null) { _effectUI6 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comResult.m_holderStar1, "ui_fight_new", "ZDJS_STAR", onComplete: (effect) => { if (effect != null) { _effectUI7 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comExpBar.m_holderProHead, "ui_fight_new", "ZDJS_jindu_di", onComplete: (effect) => { if (effect != null) { _effectUI8 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comExpBar.m_proExp.m_holder, "ui_fight_new", "ZDJS_jindu_head", onComplete: (effect) => { if (effect != null) { _effectUI9 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comExpBar.m_proExp.m_comHolder.m_holder, "ui_fight_new", "ZDJS_jindu_tx", onComplete: (effect) => { if (effect != null) { _effectUI10 = effect; } }); EffectUIPool.CreateEffectUI(_ui.m_comExpBar.m_holderHead, "ui_fight_new", "ZDJS_player", onComplete: (effect) => { if (effect != null) { _effectUI11 = effect; } }); } protected async override void OnShown() { base.OnShown(); _resultData = (StoryFightResultData)this.viewData; InstanceZonesDataManager.usedRecommend = false; InstanceZonesDataManager.isResultFighting = true; FightData roleData = InstanceZonesDataManager.roleData; if (_sceneObject == null) { PrefabManager.Instance.InstantiateAsync(ResPathUtil.GetPrefabPath("SceneFightResult"), (gameObj) => { _sceneObject = gameObj; MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false, null, true); MyDressUpHelper.dressUpObj.AddOrRemove(180014, 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); _ui.m_btnClose.enabled = false; if (!this._resultData.Result) { _ui.m_comExpBar.target.visible = false; InstanceZonesDataManager.isResultFighting = false; } else { _ui.m_comExpBar.target.visible = true; StoryLevelCfg _levelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(InstanceZonesDataManager .currentLevelCfgId); StoryFightCfg fightCfg = CommonDataManager.Tables.TblStoryFightCfg.GetOrDefault(int.Parse(_levelCfg.FightID)); _ui.m_comExpBar.m_txtExpAdded.SetVar("value", fightCfg.Exp.ToString()).FlushVars(); } if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Field && this._resultData.Result && FieldDataManager.Instance.currFightLv < CommonDataManager.Tables .TblFieldCfg.GetOrDefault(FieldDataManager.Instance.chapterId).Num) { _ui.m_comExpBar.target.visible = false; Timers.inst.Add(3, 1, OnClickBtnClose); } _ui.m_comResult.m_t0.Play(AddExp); }); return; } 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); _ui.m_btnClose.enabled = false; if (!this._resultData.Result) { _ui.m_comExpBar.target.visible = false; InstanceZonesDataManager.isResultFighting = false; } else { _ui.m_comExpBar.target.visible = true; StoryLevelCfg _levelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(InstanceZonesDataManager.currentLevelCfgId); StoryFightCfg fightCfg = CommonDataManager.Tables.TblStoryFightCfg.GetOrDefault(int.Parse(_levelCfg.FightID)); _ui.m_comExpBar.m_txtExpAdded.SetVar("value", fightCfg.Exp.ToString()).FlushVars(); } if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Field && this._resultData.Result && FieldDataManager.Instance.currFightLv < CommonDataManager.Tables.TblFieldCfg .GetOrDefault(FieldDataManager.Instance.chapterId).Num) { _ui.m_comExpBar.target.visible = false; Timers.inst.Add(3, 1, OnClickBtnClose); } _ui.m_comResult.m_t0.Play(AddExp); StoryLevelCfg storylevel = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(InstanceZonesDataManager.currentLevelCfgId); if (_resultData.Result && storylevel.Type == 6 && storylevel.SubType == 2) { await TimeTracingSProxy.ReqGetMaxLevelInfo(TimeTracingDataManager._currentChapterId); await TimeTracingSProxy.ReqGetAppointLevelRewardStatus(InstanceZonesDataManager.currentLevelCfgId); await TimeTracingSProxy.ReqGetSuitRewardStatus(); } } protected override void OnHide() { base.OnHide(); if (_sceneObject != null) { PrefabManager.Instance.Restore(_sceneObject); _sceneObject = null; } MusicManager.Instance.PlayCroutine(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT)); _ui.m_comResult.m_t1.Play(); _ui.m_comExpBar.m_proExp.m_comHolder.target.width = 0; InstanceZonesDataManager.isResultFighting = false; if (InstanceZonesDataManager.FightScene == ConstInstanceZonesType.Field) { InstanceZonesDataManager.isFightResultHide = true; InstanceZonesDataManager.resultData = this._resultData; //ViewManager.DeleteViewStackCountDown(1); //ViewManager.Show(); Timers.inst.Remove(OnClickBtnClose); } else { InstanceZonesController.OnFinishStoryLevel(InstanceZonesDataManager.currentLevelCfgId, _resultData.FirstPass, true); //尝试显示奖励 BonusController.TryShowBonusList(_resultData.BonusList); } InstanceZonesDataManager.currentCardId = -1; } private void OnClickBtnClose(object param) { this.Hide(); } private void AddExp() { float exp = GameGlobal.myNumericComponent.GetAsInt(NumericType.Exp); float cfgExp = CommonDataManager.Tables.TblRoleLevelCfg.GetOrDefault(RoleDataManager.lvl).Exp; _ui.m_comExpBar.m_txtCurExp.text = exp.ToString(); _ui.m_comExpBar.m_txtAllExp.text = cfgExp.ToString(); _ui.m_comExpBar.m_proExp.target.max = cfgExp; _ui.m_comExpBar.m_proExp.target.value = 0; _ui.m_comExpBar.m_proExp.target.TweenValue(exp, 0.2f).OnUpdate((GTweener t) => { _ui.m_comExpBar.m_proExp.m_comHolder.target.width = t.value.x / cfgExp * _ui.m_comExpBar.m_proExp.m_comHolder.target.initWidth; }).OnComplete(() => { if (!this._resultData.Result) ViewManager.Show(); InstanceZonesDataManager.isResultFighting = false; _ui.m_btnClose.enabled = true; }); UpdateToCheckGuide(null); } } }