summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/heromvp.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/heromvp.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/heromvp.cs145
1 files changed, 145 insertions, 0 deletions
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<XActor> actors)
+ {
+ bool flag = !heromvp._started;
+ if (flag)
+ {
+ heromvp._started = true;
+ heromvp.Start();
+ }
+ else
+ {
+ bool flag2 = !XSingleton<XCutScene>.singleton.IsPlaying;
+ if (flag2)
+ {
+ heromvp._started = false;
+ heromvp.End();
+ }
+ }
+ return true;
+ }
+
+ private static void Start()
+ {
+ DlgBase<HeroBattleMVPDlg, HeroBattleMVPBehaviour>.singleton.SetVisible(true, true);
+ XHeroBattleDocument specificDocument = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
+ HeroBattleMapCenter.RowData bySceneID = specificDocument.HeroBattleMapReader.GetBySceneID(XSingleton<XScene>.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<XScene>.singleton.TerrainY(heromvp._pos);
+ XLevelRewardDocument specificDocument2 = XDocuments.GetSpecificDocument<XLevelRewardDocument>(XLevelRewardDocument.uuID);
+ XLevelRewardDocument.HeroBattleData heroBattleData = (XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE) ? specificDocument2.HeroData : specificDocument2.MobaData;
+ OverWatchTable.RowData byHeroID = specificDocument.OverWatchReader.GetByHeroID(heroBattleData.MvpHeroID);
+ bool flag2 = byHeroID == null;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("MvpHeroID error! ID = ", heroBattleData.MvpHeroID.ToString(), null, null, null, null);
+ }
+ else
+ {
+ uint presentID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(byHeroID.StatisticsID[0]).PresentID;
+ XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(presentID);
+ bool flag3 = byPresentID == null;
+ if (flag3)
+ {
+ XSingleton<XDebug>.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<XCommon>.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<XTimerMgr>.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>(XHeroBattleDocument.uuID);
+ XLevelRewardDocument specificDocument2 = XDocuments.GetSpecificDocument<XLevelRewardDocument>(XLevelRewardDocument.uuID);
+ XLevelRewardDocument.HeroBattleData heroBattleData = (XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE) ? specificDocument2.HeroData : specificDocument2.MobaData;
+ OverWatchTable.RowData byHeroID = specificDocument.OverWatchReader.GetByHeroID(heroBattleData.MvpHeroID);
+ bool flag2 = byHeroID == null;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("MvpHeroID error! ID = ", heroBattleData.MvpHeroID.ToString(), null, null, null, null);
+ }
+ else
+ {
+ uint presentID = XSingleton<XEntityMgr>.singleton.EntityStatistics.GetByID(byHeroID.StatisticsID[0]).PresentID;
+ XEntityPresentation.RowData byPresentID = XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(presentID);
+ bool flag3 = byPresentID == null;
+ if (flag3)
+ {
+ XSingleton<XDebug>.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<XTimerMgr>.singleton.KillTimer(heromvp._token);
+ DlgBase<HeroBattleMVPDlg, HeroBattleMVPBehaviour>.singleton.SetVisible(false, true);
+ bool flag = heromvp._actor != null;
+ if (flag)
+ {
+ heromvp._actor.Uninitilize();
+ heromvp._actor = null;
+ }
+ }
+ }
+}