using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cute;
using UnityEngine;
using Wizard;
using Wizard.Battle.View.Vfx;

public class BattleStartControl : MonoBehaviour
{
	[SerializeField]
	private UIPanel MainPanel;

	[SerializeField]
	private UISprite BgBlack;

	[SerializeField]
	private UITexture CharP;

	[SerializeField]
	private UITexture CharE;

	[SerializeField]
	private ClassInfoParts ClassInfoP;

	[SerializeField]
	private ClassInfoParts ClassInfoE;

	[SerializeField]
	private UILabel ClassNameP;

	[SerializeField]
	private UILabel ClassNameE;

	[SerializeField]
	private UILabel CharaNameP;

	[SerializeField]
	private UILabel CharaNameE;

	[SerializeField]
	private ClassInfoParts _classInfoWithSubClassP;

	[SerializeField]
	private ClassInfoParts _classInfoWithSubClassE;

	[SerializeField]
	private FlexibleGrid _subClassGridP;

	[SerializeField]
	private FlexibleGrid _subClassGridE;

	[SerializeField]
	private MyRotationParts _myRotationInfoP;

	[SerializeField]
	private MyRotationParts _myRotationInfoE;

	[SerializeField]
	private NguiObjs UserPanelP;

	[SerializeField]
	private NguiObjs UserPanelE;

	[SerializeField]
	private UISprite VsArcane;

	[SerializeField]
	private UISprite VsLine;

	[SerializeField]
	private UISprite VsTitle;

	[SerializeField]
	private UISprite CardP;

	[SerializeField]
	private UISprite CardE;

	[SerializeField]
	private UILabel CardLabelP;

	[SerializeField]
	private UILabel CardLabelE;

	[SerializeField]
	private UILabel TurnLabel;

	private IDictionary<string, Vector3> DefaultPosDict = new Dictionary<string, Vector3>();

	private string CardFrontSpriteName = "battle_card_marigan_00";

	private string CardBackSpriteName = "battle_card_marigan_03";

	public bool IsReady { get; private set; }

	public void SetUp(SBattleLoad battleLoad)
	{
		if (GameMgr.GetIns().IsNetworkBattle && !BattleManagerBase.GetIns().IsRecovery && !GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle)
		{
			StartCoroutine(CheckAbleToInitialize(battleLoad));
		}
		else
		{
			Initialize();
		}
	}

	private IEnumerator CheckAbleToInitialize(SBattleLoad battleLoad)
	{
		while (GameMgr.GetIns().GetNetworkUserInfoData().SelfBattleStartInfo == null || GameMgr.GetIns().GetNetworkUserInfoData().OppoBattleStartInfo == null)
		{
			yield return null;
		}
		battleLoad.LoadOpponentAssets(delegate
		{
			Initialize();
		});
	}

	private void Initialize()
	{
		MainPanel.alpha = 0f;
		InitBattleStartControl();
		base.gameObject.SetActive(value: false);
		IsReady = true;
	}

	private void InitBattleStartControl()
	{
		DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
		NetworkUserInfoData networkUserInfoData = GameMgr.GetIns().GetNetworkUserInfoData();
		PuzzleQuestData puzzleQuestData = null;
		bool isPuzzleMgr = BattleManagerBase.GetIns().IsPuzzleMgr;
		if (isPuzzleMgr)
		{
			puzzleQuestData = Data.Master.PuzzleQuestDataList.First((PuzzleQuestData data) => data.Id == GameMgr.GetIns().GetDataMgr().PuzzleQuestId);
		}
		if (GameMgr.GetIns().IsWatchBattle)
		{
			DegreeHelper.InitializeDegree(UserPanelP.textures[0], networkUserInfoData.GetSelfDegreeId(), DegreeHelper.DegreeType.MIDDLE);
		}
		else if (isPuzzleMgr)
		{
			DegreeHelper.InitializeDegree(UserPanelP.textures[0], puzzleQuestData.PlayerDegreeId, DegreeHelper.DegreeType.MIDDLE);
		}
		else
		{
			DegreeHelper.InitializeDegree(UserPanelP.textures[0], PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.MIDDLE);
		}
		int num = (GameMgr.GetIns().IsNetworkBattle ? networkUserInfoData.GetOpponentDegreeId() : (isPuzzleMgr ? puzzleQuestData.EnemyDegreeId : ((dataMgr.m_BattleType == DataMgr.BattleType.Quest) ? dataMgr.QuestBattleData.DegreeId : ((dataMgr.m_BattleType != DataMgr.BattleType.BossRushQuest && dataMgr.m_BattleType != DataMgr.BattleType.SecretBossQuest) ? dataMgr.PracticeDifficultyDegreeId : dataMgr.BossRushBattleData.DegreeId))));
		if (GameMgr.GetIns().IsNetworkBattle || (dataMgr.m_BattleType == DataMgr.BattleType.Practice && dataMgr.PracticeDifficultyDegreeId != -1) || (dataMgr.IsQuestBattleType() && num != -1))
		{
			DegreeHelper.InitializeDegree(UserPanelE.textures[0], num, DegreeHelper.DegreeType.MIDDLE);
		}
		if (GameMgr.GetIns().IsWatchBattle)
		{
			UserPanelP.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetSelfEmblemId().ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		else if (isPuzzleMgr)
		{
			UserPanelP.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(puzzleQuestData.PlayerEmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		else
		{
			PlayerStaticData.AttachUserEmblemTexture(UserPanelP.textures[1], PlayerStaticData.EmblemTexSize.M);
		}
		if (GameMgr.GetIns().IsNetworkBattle)
		{
			UserPanelE.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetOpponentEmblemId().ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		else if (isPuzzleMgr)
		{
			UserPanelE.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(puzzleQuestData.EnemyEmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		else if (dataMgr.m_BattleType == DataMgr.BattleType.Quest)
		{
			UserPanelE.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(dataMgr.QuestBattleData.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		else if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest || dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest)
		{
			UserPanelE.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(dataMgr.BossRushBattleData.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		else
		{
			UserPanelE.textures[1].mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(100000000.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true));
		}
		if (GameMgr.GetIns().IsWatchBattle)
		{
			UIUtil.SetCountryTexture(UserPanelP.textures[2], networkUserInfoData.GetSelfCountryCode());
		}
		else
		{
			bool flag = !string.IsNullOrEmpty(PlayerStaticData.UserCountryCode);
			UserPanelP.textures[2].gameObject.SetActive(flag);
			if (flag)
			{
				PlayerStaticData.AttachUserCountryTexture(UserPanelP.textures[2], PlayerStaticData.CountryTexSize.M);
			}
			else
			{
				UserPanelP.textures[2].mainTexture = null;
			}
		}
		if (GameMgr.GetIns().IsNetworkBattle)
		{
			UIUtil.SetCountryTexture(UserPanelE.textures[2], networkUserInfoData.GetOpponentCountryCode());
		}
		else
		{
			UserPanelE.textures[2].gameObject.SetActive(value: false);
			UserPanelE.textures[2].mainTexture = null;
		}
		if (GameMgr.GetIns().IsWatchBattle)
		{
			UserPanelP.textures[3].mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetSelfRank().ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S, isfetch: true)) as Texture;
		}
		else if (dataMgr.IsDipslayHighRankFormat())
		{
			PlayerStaticData.LoadUserRankTexture(PlayerStaticData.HighRankFormat());
			PlayerStaticData.AttachUserRankTexture(UserPanelP.textures[3], PlayerStaticData.RankTexSize.S);
		}
		else
		{
			UserPanelP.textures[3].mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRankCurrentFormat().ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S, isfetch: true)) as Texture;
		}
		if (GameMgr.GetIns().IsNetworkBattle)
		{
			UserPanelE.textures[3].mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetOpponentRank().ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S, isfetch: true)) as Texture;
		}
		if (GameMgr.GetIns().IsWatchBattle)
		{
			UserPanelP.labels[0].text = networkUserInfoData.GetSelfName();
		}
		else
		{
			UserPanelP.labels[0].text = PlayerStaticData.UserName.ToString();
		}
		if (GameMgr.GetIns().IsNetworkBattle)
		{
			UserPanelE.labels[0].text = VideoHostingUtil.GetUserNameHidden(networkUserInfoData.GetOpponentName().ToString());
		}
		else
		{
			UserPanelE.labels[0].text = dataMgr.GetEnemyCharaData().chara_name;
		}
		Format inFormat = Data.CurrentFormat;
		if (dataMgr.IsDipslayHighRankFormat())
		{
			inFormat = PlayerStaticData.HighRankFormat();
		}
		bool flag2 = dataMgr.m_BattleType == DataMgr.BattleType.RankBattle;
		UILabel uILabel = UserPanelP.labels[1];
		UILabel uILabel2 = UserPanelE.labels[1];
		uILabel.gameObject.SetActive(flag2);
		uILabel2.gameObject.SetActive(flag2);
		if (flag2)
		{
			if (PlayerStaticData.IsMasterRank(inFormat))
			{
				uILabel.text = PlayerStaticData.UserMasterPoint(inFormat).ToString();
			}
			else
			{
				uILabel.text = PlayerStaticData.UserBattlePoint(inFormat).ToString();
			}
			if (GameMgr.GetIns().IsNetworkBattle)
			{
				if (networkUserInfoData.GetOpponentIsMasterRank())
				{
					uILabel2.text = networkUserInfoData.GetOpponentMasterPoint().ToString();
				}
				else
				{
					uILabel2.text = networkUserInfoData.GetOpponentBattlePoint().ToString();
				}
			}
			else
			{
				uILabel2.text = "0";
			}
		}
		bool activeOfficialUserIconSprite = (GameMgr.GetIns().IsWatchBattle ? networkUserInfoData.GetSelfIsOfficialUser() : PlayerStaticData.IsOfficialUserDisplay);
		bool activeOfficialUserIconSprite2 = GameMgr.GetIns().IsNetworkBattle && networkUserInfoData.GetOpponentIsOfficialUser();
		UserPanelP.gameObject.GetComponent<BattleStartUserPanel>().SetActiveOfficialUserIconSprite(activeOfficialUserIconSprite);
		UserPanelE.gameObject.GetComponent<BattleStartUserPanel>().SetActiveOfficialUserIconSprite(activeOfficialUserIconSprite2);
		DefaultPosDict["UserPanelP"] = UserPanelP.transform.localPosition;
		DefaultPosDict["UserPanelE"] = UserPanelE.transform.localPosition;
		DefaultPosDict["CharP"] = CharP.transform.localPosition;
		DefaultPosDict["CharE"] = CharE.transform.localPosition;
		DefaultPosDict["ClassNameP"] = ClassNameP.transform.localPosition;
		DefaultPosDict["ClassNameE"] = ClassNameE.transform.localPosition;
		DefaultPosDict["CharaNameP"] = CharaNameP.transform.localPosition;
		DefaultPosDict["CharaNameE"] = CharaNameE.transform.localPosition;
		DefaultPosDict["CardP"] = CardP.transform.localPosition;
		DefaultPosDict["CardE"] = CardE.transform.localPosition;
		DefaultPosDict["TurnLabel"] = TurnLabel.transform.localPosition;
	}

	public VfxBase CreateStartVfx(float waitTime)
	{
		if (BattleManagerBase.GetIns().IsRecovery)
		{
			return InstantVfx.Create(delegate
			{
				base.gameObject.SetActive(value: false);
			});
		}
		base.gameObject.SetActive(value: true);
		float rot;
		Vector3 p1;
		Vector3 p2;
		Vector3[] path;
		return SequentialVfxPlayer.Create(InstantVfx.Create(delegate
		{
			int playerSkinId = GameMgr.GetIns().GetDataMgr().GetPlayerSkinId();
			Texture mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(playerSkinId.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)) as Texture;
			CharP.mainTexture = mainTexture;
			CharP.material = null;
			mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(GameMgr.GetIns().GetDataMgr().GetEnemySkinId()
				.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)) as Texture;
			CharE.mainTexture = mainTexture;
			CharE.material = null;
			NetworkUserInfoData networkUserInfoData = GameMgr.GetIns().GetNetworkUserInfoData();
			_myRotationInfoP.gameObject.SetActive(value: false);
			if (GameMgr.GetIns().GetDataMgr().TryGetPlayerSubClassId(out var subClassId))
			{
				SetClassInfoWithSubClass(GameMgr.GetIns().GetDataMgr().GetPlayerCharaData(), networkUserInfoData.GetSelfChaosId(), subClassId, ClassInfoP, _classInfoWithSubClassP, _subClassGridP);
			}
			else
			{
				if (GameMgr.GetIns().GetDataMgr().TryGetPlayerMyRotationInfo(out var myRotationInfo))
				{
					_myRotationInfoP.gameObject.SetActive(value: true);
					_myRotationInfoP.SetMyRotationInfo(myRotationInfo);
					_myRotationInfoP.Reposition();
				}
				ClassInfoP.InitByCharaPrm(GameMgr.GetIns().GetDataMgr().GetPlayerCharaData(), networkUserInfoData.GetSelfChaosId());
				_classInfoWithSubClassP.gameObject.SetActive(value: false);
			}
			_myRotationInfoE.gameObject.SetActive(value: false);
			if (GameMgr.GetIns().GetDataMgr().TryGetEnemySubClassId(out var subClassId2))
			{
				SetClassInfoWithSubClass(GameMgr.GetIns().GetDataMgr().GetEnemyCharaData(), networkUserInfoData.GetOpponentChaosId(), subClassId2, ClassInfoE, _classInfoWithSubClassE, _subClassGridE);
			}
			else
			{
				if (GameMgr.GetIns().GetDataMgr().TryGetEnemyMyRotationInfo(out var myRotationInfo2))
				{
					_myRotationInfoE.gameObject.SetActive(value: true);
					_myRotationInfoE.SetMyRotationInfo(myRotationInfo2);
					_myRotationInfoE.Reposition();
				}
				ClassInfoE.InitByCharaPrm(GameMgr.GetIns().GetDataMgr().GetEnemyCharaData(), networkUserInfoData.GetOpponentChaosId());
				_classInfoWithSubClassE.gameObject.SetActive(value: false);
			}
			UserPanelP.transform.localPosition = DefaultPosDict["UserPanelP"];
			UserPanelE.transform.localPosition = DefaultPosDict["UserPanelE"];
			CharP.transform.localPosition = DefaultPosDict["CharP"];
			CharE.transform.localPosition = DefaultPosDict["CharE"];
			ClassNameP.transform.localPosition = DefaultPosDict["ClassNameP"];
			ClassNameE.transform.localPosition = DefaultPosDict["ClassNameE"];
			CharaNameP.transform.localPosition = DefaultPosDict["CharaNameP"];
			CharaNameE.transform.localPosition = DefaultPosDict["CharaNameE"];
			CardP.transform.localPosition = DefaultPosDict["CardP"] + Vector3.down * 1000f;
			CardE.transform.localPosition = DefaultPosDict["CardE"] + Vector3.down * 1000f;
			TurnLabel.transform.localPosition = DefaultPosDict["TurnLabel"];
			BgBlack.alpha = 0f;
			CharP.alpha = 0f;
			CharE.alpha = 0f;
			ClassNameP.alpha = 0f;
			ClassNameE.alpha = 0f;
			CharaNameP.alpha = 0f;
			CharaNameE.alpha = 0f;
			VsArcane.alpha = 0f;
			VsLine.alpha = 0f;
			VsTitle.alpha = 0f;
			CardP.color = Color.white;
			CardE.color = Color.white;
			TurnLabel.alpha = 0f;
			TweenAlpha.Begin(UserPanelP.gameObject, 0f, 0f);
			TweenAlpha.Begin(UserPanelE.gameObject, 0f, 0f);
			VsArcane.transform.localScale = Vector3.one;
			CardLabelP.text = Data.SystemText.Get("Battle_0430");
			CardLabelE.text = Data.SystemText.Get("Battle_0431");
			MainPanel.alpha = 1f;
		}), InstantVfx.Create(delegate
		{
			TweenAlpha.Begin(VsTitle.gameObject, 0.3f, 1f);
			VsTitle.transform.localScale = Vector3.one * 10f;
			iTween.ScaleTo(VsTitle.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInCubic));
		}), WaitVfx.Create(0.3f), InstantVfx.Create(delegate
		{
			TweenAlpha.Begin(BgBlack.gameObject, 0.3f, 0.5f);
			EffectMgr.EffectType type = EffectMgr.EffectType.CMN_START_VS_1;
			Se.TYPE setype = Se.TYPE.BATTLE_START_VS;
			DataMgr.SpecialBattleSetting specialBattleSettingInfo = GameMgr.GetIns().GetDataMgr().SpecialBattleSettingInfo;
			if (specialBattleSettingInfo != null && specialBattleSettingInfo.IsVsEffectOverride)
			{
				type = EffectMgr.EffectType.CMN_START_VS_ST2;
				setype = Se.TYPE.BATTLE_START_VS_ST2;
			}
			GameMgr.GetIns().GetSoundMgr().PlaySe(setype);
			GameMgr.GetIns().GetEffectMgr().Start(type, Vector3.zero);
			TweenAlpha.Begin(VsLine.gameObject, 0.3f, 1f);
			VsLine.transform.localScale = new Vector3(0.1f, 1f, 1f);
			iTween.ScaleTo(VsLine.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
			TweenAlpha.Begin(VsArcane.gameObject, 0.3f, 1f);
			VsArcane.transform.localRotation = Quaternion.identity;
			VsArcane.transform.localScale = Vector3.one * 0.1f;
			iTween.ScaleTo(VsArcane.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
			iTween.RotateAdd(VsArcane.gameObject, iTween.Hash("z", 360f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			TweenAlpha.Begin(CharP.gameObject, 0.3f, 1f);
			TweenAlpha.Begin(CharE.gameObject, 0.3f, 1f);
			CharP.transform.localPosition = DefaultPosDict["CharP"] + Vector3.right * 500f;
			CharE.transform.localPosition = DefaultPosDict["CharE"] + Vector3.left * 500f;
			if (GameMgr.GetIns().GetDataMgr().GetEnemyBattleSkillReverse() == 0)
			{
				CharE.uvRect = new Rect(0f, 0f, 1f, 1f);
			}
			iTween.MoveTo(CharP.gameObject, iTween.Hash("position", DefaultPosDict["CharP"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.MoveTo(CharE.gameObject, iTween.Hash("position", DefaultPosDict["CharE"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			TweenAlpha.Begin(ClassNameP.gameObject, 0.3f, 1f).delay = 0.1f;
			TweenAlpha.Begin(ClassNameE.gameObject, 0.3f, 1f).delay = 0.1f;
			ClassNameP.transform.localPosition = DefaultPosDict["ClassNameP"] + Vector3.right * 200f;
			ClassNameE.transform.localPosition = DefaultPosDict["ClassNameE"] + Vector3.left * 200f;
			iTween.MoveTo(ClassNameP.gameObject, iTween.Hash("position", DefaultPosDict["ClassNameP"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.MoveTo(ClassNameE.gameObject, iTween.Hash("position", DefaultPosDict["ClassNameE"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			TweenAlpha.Begin(CharaNameP.gameObject, 0.3f, 1f).delay = 0.1f;
			TweenAlpha.Begin(CharaNameE.gameObject, 0.3f, 1f).delay = 0.1f;
			CharaNameP.transform.localPosition = DefaultPosDict["CharaNameP"] + Vector3.right * 200f;
			CharaNameE.transform.localPosition = DefaultPosDict["CharaNameE"] + Vector3.left * 200f;
			iTween.MoveTo(CharaNameP.gameObject, iTween.Hash("position", DefaultPosDict["CharaNameP"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.MoveTo(CharaNameE.gameObject, iTween.Hash("position", DefaultPosDict["CharaNameE"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			TweenAlpha.Begin(UserPanelP.gameObject, 0.3f, 1f);
			TweenAlpha.Begin(UserPanelE.gameObject, 0.3f, 1f);
			UserPanelP.transform.localPosition = DefaultPosDict["UserPanelP"] + Vector3.left * 500f;
			UserPanelE.transform.localPosition = DefaultPosDict["UserPanelE"] + Vector3.right * 500f;
			iTween.MoveTo(UserPanelP.gameObject, iTween.Hash("position", DefaultPosDict["UserPanelP"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.MoveTo(UserPanelE.gameObject, iTween.Hash("position", DefaultPosDict["UserPanelE"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
		}), WaitVfx.Create(waitTime), InstantVfx.Create(delegate
		{
			TweenAlpha.Begin(BgBlack.gameObject, 0.3f, 0.9f);
			TweenAlpha.Begin(VsTitle.gameObject, 0.3f, 0f);
			iTween.ScaleTo(VsTitle.gameObject, iTween.Hash("scale", Vector3.one * 2f, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(VsArcane.gameObject, 0.3f, 0f);
			iTween.ScaleTo(VsArcane.gameObject, iTween.Hash("scale", Vector3.one * 5f, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(ClassNameP.gameObject, 0.3f, 0f);
			iTween.MoveTo(ClassNameP.gameObject, iTween.Hash("x", DefaultPosDict["ClassNameP"].x - 200f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(ClassNameE.gameObject, 0.3f, 0f);
			iTween.MoveTo(ClassNameE.gameObject, iTween.Hash("x", DefaultPosDict["ClassNameE"].x + 200f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(CharaNameP.gameObject, 0.3f, 0f);
			iTween.MoveTo(CharaNameP.gameObject, iTween.Hash("x", DefaultPosDict["CharaNameP"].x - 200f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(CharaNameE.gameObject, 0.3f, 0f);
			iTween.MoveTo(CharaNameE.gameObject, iTween.Hash("x", DefaultPosDict["CharaNameE"].x + 200f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(UserPanelP.gameObject, 0.3f, 0f);
			iTween.MoveTo(UserPanelP.gameObject, iTween.Hash("x", DefaultPosDict["UserPanelP"].x + 200f, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
			TweenAlpha.Begin(UserPanelE.gameObject, 0.3f, 0f);
			iTween.MoveTo(UserPanelE.gameObject, iTween.Hash("x", DefaultPosDict["UserPanelE"].x - 200f, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
		}), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.DRAW);
			CardP.spriteName = CardFrontSpriteName;
			CardE.spriteName = CardFrontSpriteName;
			iTween.MoveTo(CardP.gameObject, iTween.Hash("position", DefaultPosDict["CardP"], "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.MoveTo(CardE.gameObject, iTween.Hash("position", DefaultPosDict["CardE"], "time", 0.4f, "delay", 0.05f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
		}), WaitVfx.Create(0.5f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_1);
			iTween.MoveTo(CardP.gameObject, iTween.Hash("position", Vector3.zero, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutCubic));
			iTween.MoveTo(CardE.gameObject, iTween.Hash("position", Vector3.zero, "time", 0.3f, "delay", 0.05f, "islocal", true, "easetype", iTween.EaseType.easeInOutCubic));
			iTween.ScaleTo(CardP.gameObject, iTween.Hash("scale", new Vector3(0.01f, 1.2f, 1f), "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
			iTween.ScaleTo(CardE.gameObject, iTween.Hash("scale", new Vector3(0.01f, 1.2f, 1f), "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
		}), WaitVfx.Create(0.1f), InstantVfx.Create(delegate
		{
			CardP.depth = 0;
			CardE.depth = 2;
			CardLabelP.text = "";
			CardLabelE.text = "";
			CardP.spriteName = CardBackSpriteName;
			CardE.spriteName = CardBackSpriteName;
			iTween.ScaleTo(CardP.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
			iTween.ScaleTo(CardE.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
		}), WaitVfx.Create(0.2f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_2);
			rot = Random.value * 30f - 15f;
			p1 = (Vector3)MotionUtils.GetPositionByAngle(rot) * 400f;
			p2 = (Vector3)MotionUtils.GetPositionByAngle(rot + 180f) * 100f;
			path = MotionUtils.GetBezierCubic(Vector3.zero, p1, p2, Vector3.zero, 20);
			iTween.MoveTo(CardP.gameObject, iTween.Hash("path", path, "movetopath", false, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.linear));
			path = MotionUtils.GetBezierCubic(Vector3.zero, p1 * -1f, p2 * -1f, Vector3.zero, 20);
			iTween.MoveTo(CardE.gameObject, iTween.Hash("path", path, "movetopath", false, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.linear));
		}), WaitVfx.Create(0.1f), InstantVfx.Create(delegate
		{
			CardP.depth = 2;
			CardE.depth = 0;
		}), WaitVfx.Create(0.1f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_2);
			rot = Random.value * 30f - 15f + 180f;
			p1 = (Vector3)MotionUtils.GetPositionByAngle(rot) * 320f;
			p2 = (Vector3)MotionUtils.GetPositionByAngle(rot + 180f) * 80f;
			path = MotionUtils.GetBezierCubic(Vector3.zero, p1, p2, Vector3.zero, 20);
			iTween.MoveTo(CardP.gameObject, iTween.Hash("path", path, "movetopath", false, "time", 0.16f, "islocal", true, "easetype", iTween.EaseType.linear));
			path = MotionUtils.GetBezierCubic(Vector3.zero, p1 * -1f, p2 * -1f, Vector3.zero, 20);
			iTween.MoveTo(CardE.gameObject, iTween.Hash("path", path, "movetopath", false, "time", 0.16f, "islocal", true, "easetype", iTween.EaseType.linear));
		}), WaitVfx.Create(0.08f), InstantVfx.Create(delegate
		{
			CardP.depth = 0;
			CardE.depth = 2;
		}), WaitVfx.Create(0.08f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_2);
			rot = Random.value * 30f - 15f;
			p1 = (Vector3)MotionUtils.GetPositionByAngle(rot) * 320f;
			p2 = (Vector3)MotionUtils.GetPositionByAngle(rot + 180f) * 80f;
			path = MotionUtils.GetBezierCubic(Vector3.zero, p1, p2, Vector3.zero, 20);
			iTween.MoveTo(CardP.gameObject, iTween.Hash("path", path, "movetopath", false, "time", 0.12f, "islocal", true, "easetype", iTween.EaseType.linear));
			path = MotionUtils.GetBezierCubic(Vector3.zero, p1 * -1f, p2 * -1f, Vector3.zero, 20);
			iTween.MoveTo(CardE.gameObject, iTween.Hash("path", path, "movetopath", false, "time", 0.12f, "islocal", true, "easetype", iTween.EaseType.linear));
		}), WaitVfx.Create(0.06f), InstantVfx.Create(delegate
		{
			CardP.depth = 2;
			CardE.depth = 0;
		}), WaitVfx.Create(0.06f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_1);
			iTween.MoveTo(CardP.gameObject, iTween.Hash("position", new Vector3(240f, -160f, 0f), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.MoveTo(CardE.gameObject, iTween.Hash("position", new Vector3(-240f, 160f, 0f), "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
		}), WaitVfx.Create(0.3f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_MOVE_SINGLE_3);
			iTween.ScaleTo(CardP.gameObject, iTween.Hash("scale", new Vector3(0.01f, 1.2f, 1f), "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
			iTween.ScaleTo(CardE.gameObject, iTween.Hash("scale", new Vector3(0.01f, 1.2f, 1f), "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
		}), WaitVfx.Create(0.1f), InstantVfx.Create(delegate
		{
			GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_START_CARD_1, CardP.transform.position);
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.DRAW_CARD_OPEN);
			CardP.spriteName = CardFrontSpriteName;
			CardE.spriteName = CardFrontSpriteName;
			if (BattleManagerBase.GetIns().IsFirst)
			{
				CardLabelP.text = Data.SystemText.Get("Battle_0430");
				CardLabelE.text = Data.SystemText.Get("Battle_0431");
				TurnLabel.text = Data.SystemText.Get("Battle_0432");
			}
			else
			{
				CardLabelP.text = Data.SystemText.Get("Battle_0431");
				CardLabelE.text = Data.SystemText.Get("Battle_0430");
				TurnLabel.text = Data.SystemText.Get("Battle_0433");
			}
			TweenAlpha.Begin(TurnLabel.gameObject, 0.3f, 1f);
			TurnLabel.transform.localPosition = DefaultPosDict["TurnLabel"] + Vector3.right * 50f;
			iTween.MoveTo(TurnLabel.gameObject, iTween.Hash("position", DefaultPosDict["TurnLabel"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			TweenColor.Begin(CardE.gameObject, 0.1f, Color.gray);
			TweenColor.Begin(CardLabelE.gameObject, 0.1f, Color.gray);
			iTween.ScaleTo(CardP.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
			iTween.ScaleTo(CardE.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
		}), WaitVfx.Create(1.5f), InstantVfx.Create(delegate
		{
			TweenAlpha.Begin(BgBlack.gameObject, 0.1f, 0f);
			TweenAlpha.Begin(CardP.gameObject, 0.1f, 0f);
			TweenAlpha.Begin(CardE.gameObject, 0.1f, 0f);
			TweenAlpha.Begin(CharP.gameObject, 0.1f, 0f);
			TweenAlpha.Begin(CharE.gameObject, 0.1f, 0f);
			TweenAlpha.Begin(VsLine.gameObject, 0.1f, 0f);
			TweenAlpha.Begin(TurnLabel.gameObject, 0.1f, 0f);
		}), WaitVfx.Create(0.1f), InstantVfx.Create(delegate
		{
			base.gameObject.SetActive(value: false);
		}));
	}

	private static void SetClassInfoWithSubClass(ClassCharacterMasterData charaData, int chaosId, int subClassId, ClassInfoParts defaultClassInfoParts, ClassInfoParts classInfoParts, FlexibleGrid grid)
	{
		classInfoParts.gameObject.SetActive(value: true);
		defaultClassInfoParts.ClassNameLabel.text = string.Empty;
		classInfoParts.InitByCharaPrm(charaData, chaosId);
		classInfoParts.SetSubClass((CardBasePrm.ClanType)subClassId);
		UIUtil.AdjustClassInfoPartsSize(classInfoParts, grid, 375);
	}
}
