From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/heromvp.cs | 145 +++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/heromvp.cs (limited to 'Client/Assets/Scripts/XMainClient/heromvp.cs') diff --git a/Client/Assets/Scripts/XMainClient/heromvp.cs b/Client/Assets/Scripts/XMainClient/heromvp.cs new file mode 100644 index 00000000..ba7678f8 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/heromvp.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class heromvp + { + private static uint _token = 0u; + + private static XActor _actor = null; + + private static bool _started = false; + + private static Vector3 _pos = Vector3.zero; + + public static bool Do(List actors) + { + bool flag = !heromvp._started; + if (flag) + { + heromvp._started = true; + heromvp.Start(); + } + else + { + bool flag2 = !XSingleton.singleton.IsPlaying; + if (flag2) + { + heromvp._started = false; + heromvp.End(); + } + } + return true; + } + + private static void Start() + { + DlgBase.singleton.SetVisible(true, true); + XHeroBattleDocument specificDocument = XDocuments.GetSpecificDocument(XHeroBattleDocument.uuID); + HeroBattleMapCenter.RowData bySceneID = specificDocument.HeroBattleMapReader.GetBySceneID(XSingleton.singleton.SceneID); + Vector3 one = Vector3.one; + float angle = 0f; + bool flag = bySceneID != null && bySceneID.MVPPos.Length >= 4; + if (flag) + { + one = new Vector3(bySceneID.MVPPos[0], bySceneID.MVPPos[1], bySceneID.MVPPos[2]); + angle = bySceneID.MVPPos[3]; + } + heromvp._pos = one; + heromvp._pos.y = XSingleton.singleton.TerrainY(heromvp._pos); + XLevelRewardDocument specificDocument2 = XDocuments.GetSpecificDocument(XLevelRewardDocument.uuID); + XLevelRewardDocument.HeroBattleData heroBattleData = (XSingleton.singleton.SceneType == SceneType.SCENE_HEROBATTLE) ? specificDocument2.HeroData : specificDocument2.MobaData; + OverWatchTable.RowData byHeroID = specificDocument.OverWatchReader.GetByHeroID(heroBattleData.MvpHeroID); + bool flag2 = byHeroID == null; + if (flag2) + { + XSingleton.singleton.AddErrorLog("MvpHeroID error! ID = ", heroBattleData.MvpHeroID.ToString(), null, null, null, null); + } + else + { + uint presentID = XSingleton.singleton.EntityStatistics.GetByID(byHeroID.StatisticsID[0]).PresentID; + XEntityPresentation.RowData byPresentID = XSingleton.singleton.EntityInfo.GetByPresentID(presentID); + bool flag3 = byPresentID == null; + if (flag3) + { + XSingleton.singleton.AddErrorLog("MvpHeroID error! ID = ", presentID.ToString(), null, null, null, null); + } + else + { + string str = "Animation/" + byPresentID.AnimLocation; + heromvp._actor = new XActor("Prefabs/" + byPresentID.Prefab, heromvp._pos, XSingleton.singleton.FloatToQuaternion(angle), str + byHeroID.CutSceneAniamtion); + heromvp._actor.Initilize(0); + heromvp._actor.GetCurrentAnimLength(new OverrideAnimCallback(heromvp.AnimLoadCallback)); + } + } + } + + private static void AnimLoadCallback(XAnimationClip clip) + { + float num = (clip != null) ? clip.length : 0f; + bool flag = num > 0f; + if (flag) + { + heromvp._token = XSingleton.singleton.SetTimer(num, new XTimerMgr.ElapsedEventHandler(heromvp.Idled), null); + } + else + { + heromvp.Idled(null); + } + } + + private static void Idled(object o) + { + bool flag = heromvp._actor != null; + if (flag) + { + XHeroBattleDocument specificDocument = XDocuments.GetSpecificDocument(XHeroBattleDocument.uuID); + XLevelRewardDocument specificDocument2 = XDocuments.GetSpecificDocument(XLevelRewardDocument.uuID); + XLevelRewardDocument.HeroBattleData heroBattleData = (XSingleton.singleton.SceneType == SceneType.SCENE_HEROBATTLE) ? specificDocument2.HeroData : specificDocument2.MobaData; + OverWatchTable.RowData byHeroID = specificDocument.OverWatchReader.GetByHeroID(heroBattleData.MvpHeroID); + bool flag2 = byHeroID == null; + if (flag2) + { + XSingleton.singleton.AddErrorLog("MvpHeroID error! ID = ", heroBattleData.MvpHeroID.ToString(), null, null, null, null); + } + else + { + uint presentID = XSingleton.singleton.EntityStatistics.GetByID(byHeroID.StatisticsID[0]).PresentID; + XEntityPresentation.RowData byPresentID = XSingleton.singleton.EntityInfo.GetByPresentID(presentID); + bool flag3 = byPresentID == null; + if (flag3) + { + XSingleton.singleton.AddErrorLog("MvpHeroID error! ID = ", presentID.ToString(), null, null, null, null); + } + else + { + bool flag4 = string.IsNullOrEmpty(byHeroID.CutSceneIdleAni); + if (!flag4) + { + string str = "Animation/" + byPresentID.AnimLocation; + heromvp._actor.OverrideAnim(str + byHeroID.CutSceneIdleAni); + } + } + } + } + } + + private static void End() + { + XSingleton.singleton.KillTimer(heromvp._token); + DlgBase.singleton.SetVisible(false, true); + bool flag = heromvp._actor != null; + if (flag) + { + heromvp._actor.Uninitilize(); + heromvp._actor = null; + } + } + } +} -- cgit v1.1-26-g67d0