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

public class SBattleLoad : MonoBehaviour
{
	public class CardFrameMaterialHolder
	{
		public static Material GetHandUnitFrame(int rarity)
		{
			string text = null;
			Material material = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath(rarity switch
			{
				0 => "CardFrame_F_Bronze", 
				1 => "CardFrame_F_Bronze", 
				2 => "CardFrame_F_Silver", 
				3 => "CardFrame_F_Gold", 
				4 => "CardFrame_F_Legend", 
				_ => "CardFrame_F_Bronze", 
			}, ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			material.shader = Shader.Find(material.shader.name);
			return material;
		}

		public static Material GetInPlayNormalUnitFrame(int rarity)
		{
			string text = null;
			Material material = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath(rarity switch
			{
				2 => "CardFrame_BTL_Silver", 
				3 => "CardFrame_BTL_Gold", 
				4 => "CardFrame_BTL_Legend", 
				_ => "CardFrame_BTL_Bronze", 
			}, ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			material.shader = Shader.Find(material.shader.name);
			return material;
		}

		public static Material GetInPlayEvolveUnitFrame(int rarity)
		{
			string text = null;
			Material material = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath(rarity switch
			{
				2 => "CardFrame_BTL_Silver", 
				3 => "CardFrame_BTL_Gold", 
				4 => "CardFrame_BTL_Legend", 
				_ => "CardFrame_BTL_Bronze", 
			}, ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			material.shader = Shader.Find(material.shader.name);
			return material;
		}

		public static Material GetHandFieldFrame(int rarity)
		{
			string text = null;
			Material material = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath(rarity switch
			{
				0 => "CardFrame_SF_Bronze", 
				1 => "CardFrame_SF_Bronze", 
				2 => "CardFrame_SF_Silver", 
				3 => "CardFrame_SF_Gold", 
				4 => "CardFrame_SF_Legend", 
				_ => "CardFrame_SF_Bronze", 
			}, ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			material.shader = Shader.Find(material.shader.name);
			return material;
		}
	}

	private static readonly Vector3 CARDHOLDER_COLL_SIZE = new Vector3(70f, 90f, 50f);

	private static readonly Vector3 PLAYER_CARDHOLDER_POS = new Vector3(950f, -190f, 0f);

	private static readonly Vector3 PLAYER_CARDHOLDER_ROT = new Vector3(0f, 0f, 80f);

	private static readonly Vector3 ENEMY_CARDHOLDER_POS = new Vector3(965f, 180f, 0f);

	private static readonly Vector3 ENEMY_CARDHOLDER_ROT = new Vector3(0f, 0f, 100f);

	private static readonly Vector3 NOT_CANCEL_COLIDER_SCALE = new Vector3(5f, 4.4f, 25f);

	private GameMgr _gameMgr;

	private DataMgr _dataMgr;

	private BattleManagerBase _btlMgr;

	[SerializeField]
	private GameObject m_BtlContainer;

	[SerializeField]
	private GameObject m_BtlUIContainer;

	[SerializeField]
	private GameObject m_SubParticleContainer;

	[SerializeField]
	private GameObject m_CutInContainer;

	[SerializeField]
	private GameObject m_AnimationMgr;

	[SerializeField]
	private GameObject m_PanelMgr;

	public CardTemplate UnitCardTemplate;

	public CardTemplate SpellCardTemplate;

	public CardTemplate FieldCardTemplate;

	public Material[] m_RarelityFrameSkillList = new Material[5];

	public Material[] _choiceBraveCardFrame = new Material[5];

	private Material _sharedMaterialNormal;

	private GameObject UnitGameObj;

	private GameObject SpellGameObj;

	private GameObject FieldGameObj;

	public GameObject LifePoolIcon;

	private GameObject AtkPoolIcon;

	private GameObject CostPoolIcon;

	private GameObject NamePoolIcon;

	private GameObject SkillDescPool;

	private GameObject CardBasePool;

	private bool isAnimDone;

	private NetworkManager networkManager;

	private List<GameObject> unitCardEffectObjs = new List<GameObject>();

	private List<GameObject> spellCardEffectObjs = new List<GameObject>();

	private List<GameObject> fieldCardEffectObjs = new List<GameObject>();

	public bool isDbgEnableEnemyHandView = true;

	private int _playerSkinId = -1;

	public bool isLoadEnd;

	public TurnEndButtonUI m_TurnEndBtnUI { get; private set; }

	public event Action OnEndWaitCallBack;

	public void WaitCallBack()
	{
		if (networkManager == null)
		{
			networkManager = Toolbox.NetworkManager;
		}
		isAnimDone = false;
		if (_gameMgr == null)
		{
			_gameMgr = GameMgr.GetIns();
		}
		_dataMgr = _gameMgr.GetDataMgr();
		_btlMgr = BattleManagerBase.GetIns();
		_btlMgr.SBattleLoad = this;
		foreach (Transform item in _gameMgr.GetGameObjMgr().GetUIContainer().transform)
		{
			UnityEngine.Object.Destroy(item.gameObject);
		}
		_gameMgr.GetGameObjMgr().GetUIContainer().SetActive(value: true);
		if (_gameMgr.IsNetworkBattle)
		{
			StartLoadNetworkBattle();
		}
		else
		{
			StartLoadQuest();
		}
	}

	public void Dispoose()
	{
		if (UnitCardTemplate != null)
		{
			UnityEngine.Object.Destroy(UnitCardTemplate.gameObject);
		}
		if (SpellCardTemplate != null)
		{
			UnityEngine.Object.Destroy(SpellCardTemplate.gameObject);
		}
		if (FieldCardTemplate != null)
		{
			UnityEngine.Object.Destroy(FieldCardTemplate.gameObject);
		}
		UnitCardTemplate = null;
		SpellCardTemplate = null;
		FieldCardTemplate = null;
		m_RarelityFrameSkillList = null;
		_choiceBraveCardFrame = null;
		_sharedMaterialNormal = null;
		UnitGameObj = null;
		SpellGameObj = null;
		FieldGameObj = null;
		LifePoolIcon = null;
		AtkPoolIcon = null;
		CostPoolIcon = null;
		NamePoolIcon = null;
		SkillDescPool = null;
		CardBasePool = null;
		unitCardEffectObjs = null;
		spellCardEffectObjs = null;
		fieldCardEffectObjs = null;
		this.OnEndWaitCallBack = null;
		m_TurnEndBtnUI = null;
	}

	private void StartLoadQuest()
	{
		Init();
	}

	private void StartLoadNetworkBattle()
	{
		Init();
	}

	private void Init()
	{
		_gameMgr.GetPrefabMgr().Load("Prefab/Game/_NetworkBattleManager");
		StartCoroutine(CreateVSObjects());
	}

	private IEnumerator InitLoad()
	{
		while (UnitCardTemplate == null || SpellCardTemplate == null || FieldCardTemplate == null)
		{
			yield return null;
		}
		yield return StartCoroutine(Loading());
		CardVoiceInfoCache.ClearCardVoiceInfo();
		InitPlayer();
		InitEnemy();
	}

	private void CreateUnitCardTemplate()
	{
		GameObject gameObject = _gameMgr.GetPrefabMgr().CloneObjectToParent(UnitGameObj, _btlMgr.Battle3DContainer);
		UnitCardTemplate = gameObject.AddComponent<CardTemplate>();
		UnitCardTemplate.CardWrapObjTemp = gameObject.transform.Find("CardObj").gameObject;
		UnitCardTemplate.CardNormalTemp = UnitCardTemplate.CardWrapObjTemp.transform.Find("Normal");
		UnitCardTemplate.CardNormalLodGroup = UnitCardTemplate.CardNormalTemp.GetComponent<LODGroup>();
		UnitCardTemplate.FieldNormalMeshTemp = UnitCardTemplate.CardWrapObjTemp.transform.Find("NormalField").GetComponent<MeshRenderer>();
		UnitCardTemplate.FieldEvolMeshTemp = UnitCardTemplate.CardWrapObjTemp.transform.Find("EvolField").GetComponent<MeshRenderer>();
		UnitCardTemplate.Collider = gameObject.transform.Find("Collider").GetComponent<BoxCollider>();
		UnitCardTemplate.NotCancelCollider = gameObject.transform.Find("NotCancelCollider").GetComponent<BoxCollider>();
		UnitCardTemplate.FieldNormalMeshTemp.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Card_Unit_n", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		UnitCardTemplate.FieldEvolMeshTemp.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Card_Unit_e", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		MeshFilter[] componentsInChildren = UnitCardTemplate.CardNormalTemp.GetComponentsInChildren<MeshFilter>();
		Mesh sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_unit", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		Mesh sharedMesh2 = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_unit_low", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		componentsInChildren[0].sharedMesh = sharedMesh;
		componentsInChildren[1].sharedMesh = sharedMesh2;
		GameObject gameObject2 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_char_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject2.transform.parent = UnitCardTemplate.CardWrapObjTemp.transform;
		gameObject2.transform.localPosition = new Vector3(0f, 0f, 0f);
		gameObject2.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject2.AddComponent<Effect>();
		UnitCardTemplate.FrameEffectNormal = gameObject2;
		GameObject gameObject3 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_char_2", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject3.transform.parent = UnitCardTemplate.CardWrapObjTemp.transform;
		gameObject3.transform.localPosition = new Vector3(0f, 0f, 0f);
		gameObject3.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject3.AddComponent<Effect>();
		UnitCardTemplate.FrameEffectEvolve = gameObject3;
		GameObject gameObject4 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject4.transform.parent = UnitCardTemplate.CardWrapObjTemp.transform;
		gameObject4.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject4.AddComponent<Effect>();
		UnitCardTemplate.FrameEffectHandCard = gameObject4;
		UnitCardTemplate.FrameEffectHandRenderer = gameObject4.GetComponentsInChildren<ParticleSystemRenderer>(includeInactive: true);
		GameObject gameObject5 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("stt_loop_spellcharge_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject5.transform.parent = UnitCardTemplate.CardWrapObjTemp.transform;
		gameObject5.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject5.AddComponent<Effect>();
		UnitCardTemplate._spellBoostFrameEffect = gameObject5;
		unitCardEffectObjs.Add(gameObject2);
		unitCardEffectObjs.Add(gameObject3);
		unitCardEffectObjs.Add(gameObject5);
		unitCardEffectObjs.Add(gameObject4);
		GameObject gameObject6 = _gameMgr.GetPrefabMgr().CloneObjectToParent(CardBasePool, _btlMgr.Battle3DContainer);
		gameObject6.transform.localPosition = Global.CARD_BASE_POS;
		gameObject6.transform.localRotation = Quaternion.Euler(Global.CARD_BASE_ROT);
		gameObject6.transform.parent = UnitCardTemplate.CardNormalTemp;
		gameObject6.transform.localScale = Global.CARD_BASE_SCALE;
		gameObject6.layer = 10;
		GameObject cardBasePool = CardBasePool;
		cardBasePool.transform.localPosition = Global.CARD_BASE_POS;
		cardBasePool.transform.localRotation = Quaternion.Euler(Global.CARD_BASE_ROT);
		cardBasePool.transform.localScale = Global.CARD_BASE_SCALE;
		cardBasePool.layer = 10;
		UnitCardTemplate.CardWrapObjTemp.transform.localScale = new Vector3(3.2f, 3.2f, 25f);
		UnitCardTemplate.Collider.transform.localScale = new Vector3(3.2f, 3.2f, 25f);
		UnitCardTemplate.NotCancelCollider.transform.localScale = NOT_CANCEL_COLIDER_SCALE;
		UnitCardTemplate.NormalCardBaseMeshTemp = gameObject6.GetComponent<MeshRenderer>();
		UnitCardTemplate.NormalCardBaseMeshTemp.sharedMaterial = _sharedMaterialNormal;
		UnitCardTemplate.EvolCardBaseMeshTemp = cardBasePool.GetComponent<MeshRenderer>();
		UnitCardTemplate.EvolCardBaseMeshTemp.sharedMaterial = _sharedMaterialNormal;
		GameObject obj = _gameMgr.GetPrefabMgr().CloneObjectToParent(LifePoolIcon, _btlMgr.Battle3DContainer);
		obj.transform.parent = UnitCardTemplate.CardWrapObjTemp.transform;
		obj.transform.localPosition = new Vector3(22f, -24.5f, -0.1f);
		obj.transform.localScale = new Vector3(9f, 9f, 0.5f);
		obj.SetActive(value: false);
		UILabel component = obj.transform.Find("LifeLabel").GetComponent<UILabel>();
		UnitCardTemplate.LifeLabelTemp = component;
		GameObject obj2 = _gameMgr.GetPrefabMgr().CloneObjectToParent(LifePoolIcon, _btlMgr.Battle3DContainer);
		obj2.transform.parent = UnitCardTemplate.CardNormalTemp;
		UILabel component2 = obj2.transform.Find("LifeLabel").GetComponent<UILabel>();
		Color color = (component.color = Global.CARD_DEFAULT_COLOR);
		component2.color = color;
		obj2.transform.localPosition = new Vector3(-1.61f, -2.14f, 0.2f);
		obj2.transform.localScale = Global.SCALE_CARD_ICON;
		obj2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
		UnitCardTemplate.NormalLifeLabelTemp = component2;
		GameObject gameObject7 = _gameMgr.GetPrefabMgr().CloneObjectToParent(CostPoolIcon, _btlMgr.Battle3DContainer);
		gameObject7.transform.parent = UnitCardTemplate.CardNormalTemp;
		gameObject7.transform.localPosition = new Vector3(1.68f, 2.12f, 0.12f);
		gameObject7.transform.localScale = Global.SCALE_CARD_ICON;
		SetNormalCostLabel(UnitCardTemplate, gameObject7);
		GameObject gameObject8 = _gameMgr.GetPrefabMgr().CloneObjectToParent(NamePoolIcon, _btlMgr.Battle3DContainer);
		gameObject8.transform.parent = UnitCardTemplate.CardNormalTemp;
		gameObject8.transform.localPosition = new Vector3(0f, 2f, 0.2f);
		gameObject8.transform.localScale = Global.SCALE_NAME_TEXT;
		SetNormalNameLabel(UnitCardTemplate, gameObject8);
		GameObject gameObject9 = _gameMgr.GetPrefabMgr().CloneObjectToParent(SkillDescPool, _btlMgr.Battle3DContainer);
		gameObject9.transform.parent = gameObject.transform.Find("CardObj").transform;
		gameObject9.transform.localPosition = new Vector3(1.3f, 1f, 0.1f);
		gameObject9.transform.localScale = new Vector3(0.01f, 0.01f, 0f);
		UnitCardTemplate.SkillIconTemp = gameObject9.GetComponent<UISprite>();
		UILabel component3 = gameObject9.transform.Find("SkillIconLabel").GetComponent<UILabel>();
		gameObject9.gameObject.SetActive(value: false);
		UnitCardTemplate.SkillIconLabelTemp = component3;
		GameObject obj3 = _gameMgr.GetPrefabMgr().CloneObjectToParent(AtkPoolIcon, _btlMgr.Battle3DContainer);
		obj3.transform.parent = UnitCardTemplate.CardWrapObjTemp.transform;
		obj3.transform.localPosition = new Vector3(-22f, -24.5f, -0.1f);
		obj3.transform.localScale = new Vector3(9f, 9f, 0.5f);
		UILabel component4 = obj3.transform.Find("AtkLabel").GetComponent<UILabel>();
		obj3.SetActive(value: false);
		UnitCardTemplate.AtkLabelTemp = component4;
		GameObject obj4 = _gameMgr.GetPrefabMgr().CloneObjectToParent(AtkPoolIcon, _btlMgr.Battle3DContainer);
		obj4.transform.parent = UnitCardTemplate.CardNormalTemp;
		UILabel component5 = obj4.transform.Find("AtkLabel").GetComponent<UILabel>();
		component5.text = component4.text;
		color = (component4.color = Global.CARD_DEFAULT_COLOR);
		component5.color = color;
		obj4.transform.localPosition = new Vector3(1.63f, -2.14f, 0.2f);
		obj4.transform.localScale = Global.SCALE_CARD_ICON;
		UnitCardTemplate.NormalAtkLabelTemp = component5;
		UnitCardTemplate.transform.localScale = Global.CARD_BATTLE_SCALE;
		UnitCardTemplate.transform.parent = base.transform;
		UnitCardTemplate.gameObject.SetActive(value: false);
		_gameMgr.GetEffectMgr().SetUIParticleShader(unitCardEffectObjs, delegate
		{
			for (int i = 0; i < unitCardEffectObjs.Count; i++)
			{
				unitCardEffectObjs[i].SetActive(value: false);
			}
			unitCardEffectObjs.Clear();
			unitCardEffectObjs = null;
			CreateSpellCardTemplate();
		});
	}

	private void CreateSpellCardTemplate()
	{
		GameObject gameObject = _gameMgr.GetPrefabMgr().CloneObjectToParent(SpellGameObj, _btlMgr.Battle3DContainer);
		SpellCardTemplate = gameObject.AddComponent<CardTemplate>();
		SpellCardTemplate.CardWrapObjTemp = gameObject.transform.Find("CardObj").gameObject;
		SpellCardTemplate.CardNormalTemp = SpellCardTemplate.CardWrapObjTemp.transform.Find("Skill");
		SpellCardTemplate.CardNormalLodGroup = SpellCardTemplate.CardNormalTemp.GetComponent<LODGroup>();
		SpellCardTemplate.FieldNormalMeshTemp = SpellCardTemplate.CardWrapObjTemp.transform.Find("NormalField").GetComponent<MeshRenderer>();
		SpellCardTemplate.Collider = gameObject.transform.Find("Collider").GetComponent<BoxCollider>();
		SpellCardTemplate.NotCancelCollider = gameObject.transform.Find("NotCancelCollider").GetComponent<BoxCollider>();
		SpellCardTemplate.FieldNormalMeshTemp.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_spell_n", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		MeshFilter[] componentsInChildren = SpellCardTemplate.CardNormalTemp.GetComponentsInChildren<MeshFilter>();
		Mesh sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_spell", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		Mesh sharedMesh2 = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_spell_low", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		componentsInChildren[0].sharedMesh = sharedMesh;
		componentsInChildren[1].sharedMesh = sharedMesh2;
		GameObject gameObject2 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_3", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject2.transform.parent = SpellCardTemplate.CardWrapObjTemp.transform;
		gameObject2.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject2.AddComponent<Effect>();
		SpellCardTemplate.FrameEffectHandCard = gameObject2;
		SpellCardTemplate.FrameEffectHandRenderer = gameObject2.GetComponentsInChildren<ParticleSystemRenderer>(includeInactive: true);
		GameObject gameObject3 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("stt_loop_spellcharge_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject3.transform.parent = SpellCardTemplate.CardWrapObjTemp.transform;
		gameObject3.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject3.AddComponent<Effect>();
		SpellCardTemplate._spellBoostFrameEffect = gameObject3;
		spellCardEffectObjs.Add(gameObject2);
		spellCardEffectObjs.Add(gameObject3);
		GameObject gameObject4 = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab(CardBasePool);
		gameObject4.transform.localPosition = Global.CARD_BASE_POS;
		gameObject4.transform.localRotation = Quaternion.Euler(Global.CARD_BASE_ROT);
		gameObject4.transform.parent = SpellCardTemplate.CardNormalTemp;
		gameObject4.transform.localScale = Global.CARD_BASE_SCALE;
		gameObject4.layer = 10;
		SpellCardTemplate.NormalCardBaseMeshTemp = gameObject4.GetComponent<MeshRenderer>();
		SpellCardTemplate.NormalCardBaseMeshTemp.sharedMaterial = _sharedMaterialNormal;
		spellCardEffectObjs.Add(gameObject2);
		spellCardEffectObjs.Add(gameObject3);
		GameObject gameObject5 = null;
		gameObject5 = _gameMgr.GetPrefabMgr().CloneObjectToParent(SkillDescPool, _btlMgr.Battle3DContainer);
		gameObject5.transform.parent = gameObject.transform.Find("CardObj").transform;
		gameObject5.transform.localPosition = new Vector3(1.3f, 1f, 0.1f);
		gameObject5.transform.localScale = new Vector3(0.01f, 0.01f, 0f);
		SpellCardTemplate.SkillIconTemp = gameObject5.GetComponent<UISprite>();
		UILabel component = gameObject5.transform.Find("SkillIconLabel").GetComponent<UILabel>();
		SpellCardTemplate.SkillIconTemp.gameObject.SetActive(value: false);
		SpellCardTemplate.SkillIconLabelTemp = component;
		GameObject gameObject6 = _gameMgr.GetPrefabMgr().CloneObjectToParent(CostPoolIcon, _btlMgr.Battle3DContainer);
		gameObject6.transform.parent = SpellCardTemplate.CardNormalTemp;
		gameObject6.transform.localPosition = new Vector3(1.68f, 2.12f, 0.1f);
		gameObject6.transform.localScale = Global.SCALE_CARD_ICON;
		SetNormalCostLabel(SpellCardTemplate, gameObject6);
		GameObject gameObject7 = _gameMgr.GetPrefabMgr().CloneObjectToParent(NamePoolIcon, _btlMgr.Battle3DContainer);
		gameObject7.transform.parent = SpellCardTemplate.CardNormalTemp;
		gameObject7.transform.localPosition = new Vector3(0f, 2f, 0.2f);
		gameObject7.transform.localScale = Global.SCALE_NAME_TEXT;
		SetNormalNameLabel(SpellCardTemplate, gameObject7);
		SpellCardTemplate.transform.localScale = Global.CARD_BATTLE_SCALE;
		SpellCardTemplate.transform.parent = base.transform;
		SpellCardTemplate.gameObject.SetActive(value: false);
		SpellCardTemplate.CardWrapObjTemp.transform.localScale = new Vector3(3.2f, 3.2f, 25f);
		SpellCardTemplate.Collider.transform.localScale = new Vector3(3.2f, 3.2f, 25f);
		SpellCardTemplate.NotCancelCollider.transform.localScale = NOT_CANCEL_COLIDER_SCALE;
		m_RarelityFrameSkillList[0] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
		m_RarelityFrameSkillList[1] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
		m_RarelityFrameSkillList[2] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
		m_RarelityFrameSkillList[3] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
		m_RarelityFrameSkillList[4] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
		if (Data.CurrentFormat == Format.Avatar)
		{
			_choiceBraveCardFrame[0] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			_choiceBraveCardFrame[1] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			_choiceBraveCardFrame[2] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			_choiceBraveCardFrame[3] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
			_choiceBraveCardFrame[4] = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true));
		}
		_gameMgr.GetEffectMgr().SetUIParticleShader(spellCardEffectObjs, delegate
		{
			for (int i = 0; i < spellCardEffectObjs.Count; i++)
			{
				spellCardEffectObjs[i].SetActive(value: false);
			}
			spellCardEffectObjs.Clear();
			spellCardEffectObjs = null;
			CreateFieldCardTemplate();
		});
	}

	private void CreateFieldCardTemplate()
	{
		GameObject gameObject = _gameMgr.GetPrefabMgr().CloneObjectToParent(FieldGameObj, _btlMgr.Battle3DContainer);
		FieldCardTemplate = gameObject.AddComponent<CardTemplate>();
		FieldCardTemplate.CardWrapObjTemp = gameObject.transform.Find("CardObj").gameObject;
		FieldCardTemplate.CardNormalTemp = FieldCardTemplate.CardWrapObjTemp.transform.Find("Normal");
		FieldCardTemplate.CardNormalLodGroup = FieldCardTemplate.CardNormalTemp.GetComponent<LODGroup>();
		FieldCardTemplate.FieldNormalMeshTemp = FieldCardTemplate.CardWrapObjTemp.transform.Find("NormalField").GetComponent<MeshRenderer>();
		FieldCardTemplate.Collider = gameObject.transform.Find("Collider").GetComponent<BoxCollider>();
		FieldCardTemplate.NotCancelCollider = gameObject.transform.Find("NotCancelCollider").GetComponent<BoxCollider>();
		FieldCardTemplate.FieldNormalMeshTemp.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_field_n", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		MeshFilter[] componentsInChildren = FieldCardTemplate.CardNormalTemp.GetComponentsInChildren<MeshFilter>();
		Mesh sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_field", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		Mesh sharedMesh2 = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_card_field_low", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true));
		componentsInChildren[0].sharedMesh = sharedMesh;
		componentsInChildren[1].sharedMesh = sharedMesh2;
		GameObject gameObject2 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_field_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject2.transform.parent = FieldCardTemplate.CardWrapObjTemp.transform;
		gameObject2.transform.localPosition = new Vector3(0f, 0f, 0f);
		gameObject2.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject2.AddComponent<Effect>();
		FieldCardTemplate.FrameEffectNormal = gameObject2;
		GameObject gameObject3 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_2", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject3.transform.parent = FieldCardTemplate.CardWrapObjTemp.transform;
		gameObject3.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject3.AddComponent<Effect>();
		FieldCardTemplate.FrameEffectHandCard = gameObject3;
		FieldCardTemplate.FrameEffectHandRenderer = gameObject3.GetComponentsInChildren<ParticleSystemRenderer>(includeInactive: true);
		GameObject gameObject4 = _gameMgr.GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("stt_loop_spellcharge_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), _btlMgr.Battle3DContainer);
		gameObject4.transform.parent = FieldCardTemplate.CardWrapObjTemp.transform;
		gameObject4.transform.localScale = new Vector3(160f, 160f, 20.48f);
		gameObject4.AddComponent<Effect>();
		FieldCardTemplate._spellBoostFrameEffect = gameObject4;
		fieldCardEffectObjs.Add(gameObject2);
		fieldCardEffectObjs.Add(gameObject3);
		fieldCardEffectObjs.Add(gameObject4);
		GameObject gameObject5 = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab(CardBasePool);
		gameObject5.transform.localPosition = Global.CARD_BASE_POS;
		gameObject5.transform.localRotation = Quaternion.Euler(Global.CARD_BASE_ROT);
		gameObject5.transform.parent = FieldCardTemplate.CardNormalTemp;
		gameObject5.transform.localScale = Global.CARD_BASE_SCALE;
		gameObject5.layer = 10;
		FieldCardTemplate.NormalCardBaseMeshTemp = gameObject5.GetComponent<MeshRenderer>();
		FieldCardTemplate.NormalCardBaseMeshTemp.sharedMaterial = _sharedMaterialNormal;
		GameObject gameObject6 = null;
		gameObject6 = _gameMgr.GetPrefabMgr().CloneObjectToParent(SkillDescPool, _btlMgr.Battle3DContainer);
		gameObject6.transform.parent = gameObject.transform.Find("CardObj").transform;
		gameObject6.transform.localPosition = new Vector3(1.3f, 1f, 0.1f);
		gameObject6.transform.localScale = new Vector3(0.01f, 0.01f, 0f);
		FieldCardTemplate.SkillIconTemp = gameObject6.GetComponent<UISprite>();
		UILabel component = FieldCardTemplate.SkillIconTemp.transform.Find("SkillIconLabel").GetComponent<UILabel>();
		FieldCardTemplate.SkillIconTemp.gameObject.SetActive(value: false);
		FieldCardTemplate.SkillIconLabelTemp = component;
		GameObject gameObject7 = _gameMgr.GetPrefabMgr().CloneObjectToParent(CostPoolIcon, _btlMgr.Battle3DContainer);
		gameObject7.transform.parent = FieldCardTemplate.CardNormalTemp;
		gameObject7.transform.localPosition = new Vector3(1.68f, 2.12f, 0.1f);
		gameObject7.transform.localScale = Global.SCALE_CARD_ICON;
		SetNormalCostLabel(FieldCardTemplate, gameObject7);
		GameObject gameObject8 = _gameMgr.GetPrefabMgr().CloneObjectToParent(NamePoolIcon, _btlMgr.Battle3DContainer);
		gameObject8.transform.parent = FieldCardTemplate.CardNormalTemp;
		gameObject8.transform.localPosition = new Vector3(0f, 2f, 0.2f);
		gameObject8.transform.localScale = Global.SCALE_NAME_TEXT;
		SetNormalNameLabel(FieldCardTemplate, gameObject8);
		FieldCardTemplate.transform.localScale = Global.CARD_BATTLE_SCALE;
		FieldCardTemplate.transform.parent = base.transform;
		FieldCardTemplate.gameObject.SetActive(value: false);
		FieldCardTemplate.CardWrapObjTemp.transform.localScale = new Vector3(3.2f, 3.2f, 25f);
		FieldCardTemplate.Collider.transform.localScale = new Vector3(3.2f, 3.2f, 25f);
		FieldCardTemplate.NotCancelCollider.transform.localScale = NOT_CANCEL_COLIDER_SCALE;
		_gameMgr.GetEffectMgr().SetUIParticleShader(fieldCardEffectObjs, delegate
		{
			for (int i = 0; i < fieldCardEffectObjs.Count; i++)
			{
				fieldCardEffectObjs[i].SetActive(value: false);
			}
			fieldCardEffectObjs.Clear();
			fieldCardEffectObjs = null;
			StartCoroutine(InitLoad());
		});
	}

	private void SetNormalCostLabel(CardTemplate cardTemplate, GameObject costIconNormal)
	{
		(cardTemplate.NormalCostLabelTemp = costIconNormal.transform.Find("CostLabel").GetComponent<UILabel>()).color = Global.CARD_DEFAULT_COLOR;
		(cardTemplate.NormalZeroCostLabelTemp = costIconNormal.transform.Find("ZeroCostLabel").GetComponent<UILabel>()).color = Global.CARD_DEFAULT_COLOR;
		(cardTemplate.NormalSignLabelTemp = costIconNormal.transform.Find("SignLabel").GetComponent<UILabel>()).color = Global.CARD_DEFAULT_COLOR;
		(cardTemplate.NormalSignedCostLabelTemp = costIconNormal.transform.Find("SignedCostLabel").GetComponent<UILabel>()).color = Global.CARD_DEFAULT_COLOR;
	}

	private void SetNormalNameLabel(CardTemplate cardTemplate, GameObject nameNormal)
	{
		UILabel component = nameNormal.transform.Find("NameLabel").GetComponent<UILabel>();
		cardTemplate.NormalNameLabelTemp = component;
		UILabel component2 = nameNormal.transform.Find("ChoiceBraveNameLabel").GetComponent<UILabel>();
		cardTemplate.NormalChoiceBraveNameLabelTemp = component2;
	}

	private void LoadWithoutResources()
	{
		_btlMgr.BtlUIContainer = _gameMgr.GetGameObjMgr().AddUIManagerRootChildPrefab(m_BtlUIContainer);
		_btlMgr.BattleUIContainer = _btlMgr.BtlUIContainer.GetComponent<BattleUIContainer>();
		_btlMgr.DetailMgr.DetailPanelControl = new NullDetailPanelControl();
		_btlMgr.TurnPanelControl = new NullTurnPanelControl();
		_gameMgr.GetPrefabMgr().Load("Prefab/Container/_Battle3DContainer");
		_btlMgr.Battle3DContainer = GameMgr.GetIns().GetPrefabMgr().CreateIns("Prefab/Container/_Battle3DContainer");
		_btlMgr.Battle3DContainer.transform.parent = _gameMgr.m_GameManagerObj.transform;
		_btlMgr.BattlePlayer.BattleView.Setup(_gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/StatusPanelP"), _btlMgr.BtlUIContainer, _btlMgr.BtlContainer, _btlMgr.Battle3DContainer);
		_btlMgr.BattleEnemy.BattleView.Setup(_gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/StatusPanelE"), _btlMgr.BtlUIContainer, _btlMgr.BtlContainer, _btlMgr.Battle3DContainer);
		InitPlayer();
		InitEnemy();
		_btlMgr.CardHolder = new GameObject();
		_btlMgr.ECardHolder = new GameObject();
		_btlMgr.PSideLog = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/SideLogP");
		_btlMgr.PSideLogControl = _btlMgr.PSideLog.AddMissingComponent<SideLogControl>();
	}

	private List<string> GetHighRankPrefabPathList(int id)
	{
		List<string> list = new List<string>();
		string key = "class_" + id;
		if (Data.Master.HighRankEffect.ContainsKey(key))
		{
			List<HighRankEffectInfo> list2 = Data.Master.HighRankEffect[key];
			for (int i = 0; i < list2.Count; i++)
			{
				list.Add(Toolbox.ResourcesManager.GetAssetTypePath(list2[i].Prefab, ResourcesManager.AssetLoadPathType.Effect2D));
			}
		}
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_" + id + "_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_" + id + "_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_" + id + "_mask", ResourcesManager.AssetLoadPathType.ClassCharaTexture));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_" + id + "_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_" + id + "_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		return list;
	}

	private List<string> Get3dSkinPrefabPathList()
	{
		return new List<string>
		{
			Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_uma_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial),
			Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_uma_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture),
			Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_uma_mask", ResourcesManager.AssetLoadPathType.ClassCharaTexture),
			Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_uma_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh),
			Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_uma_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh)
		};
	}

	private List<string> GetSnCollabPrefabPathList(int skinId)
	{
		List<string> list = new List<string>();
		if (!Global.IsSnCollabSkin(skinId))
		{
			return list;
		}
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_sn_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_sn_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_sn_mask", ResourcesManager.AssetLoadPathType.ClassCharaTexture));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_sn_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		list.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_sn_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		return list;
	}

	private IEnumerator CreateVSObjects()
	{
		_gameMgr.GetEffectMgr().InitCommonEffect("Json/EffectBattleData", isBattle: true, isField: false, isBattleEffect: true);
		List<string> cardPrefabPathList = new List<string>();
		_playerSkinId = _gameMgr.GetDataMgr().GetPlayerSkinId();
		if (_gameMgr.GetDataMgr().IsHighRankSkinPlayer())
		{
			cardPrefabPathList.AddRange(GetHighRankPrefabPathList(_playerSkinId));
		}
		if (_gameMgr.GetDataMgr().Is3DSkin(isPlayer: true))
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_playerSkinId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D));
			cardPrefabPathList.AddRange(Get3dSkinPrefabPathList());
		}
		else
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_playerSkinId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSpine));
			cardPrefabPathList.AddRange(GetSnCollabPrefabPathList(_playerSkinId));
		}
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_encampment_mask_out", ResourcesManager.AssetLoadPathType.ClassCharaTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetPlayerClassId().ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaIconLevel));
		int num;
		if (_gameMgr.IsNetworkBattle && !_gameMgr.GetDataMgr().IsDipslayHighRankFormat())
		{
			num = PlayerStaticData.UserRankCurrentFormat();
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(num.ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S));
		}
		else
		{
			num = PlayerStaticData.UserRankHighAllFormat();
		}
		if (num > 1)
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath((num - 1).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L));
		}
		if (num < Data.Load.data.RankInfoList.Max((RankInfo x) => x.RankId))
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath((num + 1).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L));
		}
		if (_gameMgr.IsNetworkBattle)
		{
			if (_gameMgr.IsWatchBattle || _btlMgr.IsRecovery)
			{
				NetworkUserInfoData networkUserInfoData = _gameMgr.GetNetworkUserInfoData();
				cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetSelfRank().ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S));
				cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(networkUserInfoData.GetSelfDegreeId(), DegreeHelper.DegreeType.SMALL, isFetch: false));
				cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(networkUserInfoData.GetSelfDegreeId(), DegreeHelper.DegreeType.MIDDLE, isFetch: false));
				cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetSelfEmblemId().ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
				cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetSelfCountryCode().ToString(), ResourcesManager.AssetLoadPathType.Country_M));
			}
			if (!_gameMgr.IsWatchBattle)
			{
				cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.SMALL, isFetch: false));
				cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
			}
			cardPrefabPathList.AddRange(LoadOpponentAssets(null));
		}
		else if (_btlMgr.IsPuzzleMgr)
		{
			PuzzleQuestData puzzleQuestData = Data.Master.PuzzleQuestDataList.First((PuzzleQuestData data) => data.Id == GameMgr.GetIns().GetDataMgr().PuzzleQuestId);
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(puzzleQuestData.EnemyEmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(puzzleQuestData.EnemyDegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(puzzleQuestData.EnemyDegreeId, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(puzzleQuestData.PlayerEmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(puzzleQuestData.PlayerDegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(puzzleQuestData.PlayerDegreeId, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
		}
		else if (_gameMgr.GetDataMgr().m_BattleType == DataMgr.BattleType.Quest)
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_dataMgr.QuestBattleData.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(_dataMgr.QuestBattleData.DegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(_dataMgr.QuestBattleData.DegreeId, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
		}
		else if (_gameMgr.GetDataMgr().m_BattleType == DataMgr.BattleType.BossRushQuest || _gameMgr.GetDataMgr().m_BattleType == DataMgr.BattleType.SecretBossQuest)
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_dataMgr.BossRushBattleData.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(_dataMgr.BossRushBattleData.DegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(_dataMgr.BossRushBattleData.DegreeId, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
		}
		else
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(100000000.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(_dataMgr.PracticeDifficultyDegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(_dataMgr.PracticeDifficultyDegreeId, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.SMALL, isFetch: false));
			cardPrefabPathList.AddRange(DegreeHelper.GetDegreeResourceList(PlayerStaticData.UserDegreeID, DegreeHelper.DegreeType.MIDDLE, isFetch: false));
		}
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_encampment_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_encampment_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		cardPrefabPathList.Add("s/se_battle.acb");
		ClassCharacterMasterData playerCharaData = _gameMgr.GetDataMgr().GetPlayerCharaData();
		string path = playerCharaData.path;
		string path2 = "mt_Encampment_Chara_1";
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.ClassCharaMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(((int)playerCharaData.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment));
		string path3 = "mt_Encampment_Chara_1_Rev";
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(path3, ResourcesManager.AssetLoadPathType.ClassCharaMaterial));
		if (!cardPrefabPathList.Contains(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetPlayerSleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveMaterial)))
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetPlayerSleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetPlayerSleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveMaterial));
			if (Data.Master.SleeveMgr.Get(DataMgr.GetAbleSleeveId(_gameMgr.GetDataMgr().GetPlayerSleeveId())).IsPremiumSleeve)
			{
				cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetPlayerSleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveTextureMask));
			}
		}
		if (!cardPrefabPathList.Contains(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetEnemySleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveMaterial)))
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetEnemySleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetEnemySleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveMaterial));
			if (Data.Master.SleeveMgr.Get(_gameMgr.GetDataMgr().GetEnemySleeveId()).IsPremiumSleeve)
			{
				cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(_gameMgr.GetDataMgr().GetEnemySleeveId().ToString(), ResourcesManager.AssetLoadPathType.SleeveTextureMask));
			}
		}
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("UnitCard", ResourcesManager.AssetLoadPathType.CardFrame));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("SpellCard", ResourcesManager.AssetLoadPathType.CardFrame));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("FieldCard", ResourcesManager.AssetLoadPathType.CardFrame));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_char_1", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_char_2", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Card_Unit", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_unit_low", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Card_Unit_n", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_Card_Unit_e", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_F_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_F_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_F_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_F_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_BTL_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_BTL_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_BTL_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_BTL_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_spell", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_spell_low", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_spell_n", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		if (Data.CurrentFormat == Format.Avatar)
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_heroskill", ResourcesManager.AssetLoadPathType.CardFrameMesh));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_heroskill_low", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		}
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_S_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		if (Data.CurrentFormat == Format.Avatar)
		{
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
			cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_HS_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		}
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_field", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_field_low", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("md_card_field_n", ResourcesManager.AssetLoadPathType.CardFrameMesh));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_SF_Bronze", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_SF_Silver", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_SF_Gold", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrame_SF_Legend", ResourcesManager.AssetLoadPathType.CardFrameMaterial));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_CardBase", ResourcesManager.AssetLoadPathType.CardDeco));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_field_1", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_1", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_2", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_3", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_class_1", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("stt_loop_spellcharge_1", ResourcesManager.AssetLoadPathType.Effect2D));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_md_Card", ResourcesManager.AssetLoadPathType.CardFrame));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_deckout_M", ResourcesManager.AssetLoadPathType.BattleTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_deckout", ResourcesManager.AssetLoadPathType.BattleTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_deckout_win_M", ResourcesManager.AssetLoadPathType.BattleTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_deckout_win", ResourcesManager.AssetLoadPathType.BattleTexture));
		cardPrefabPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("CardFrameClassIcon", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus));
		List<string> emotionCsvLoadPath = new List<string>();
		List<string> emotionIds = new List<string>();
		if (_gameMgr.GetDataMgr().GetPlayerEmotionId().Contains("_"))
		{
			string playerEmotionId = _gameMgr.GetDataMgr().GetPlayerEmotionId();
			emotionIds.Add(playerEmotionId);
			cardPrefabPathList.Add(Data.Master.GetEmotionTypePath(playerEmotionId, ref emotionCsvLoadPath));
		}
		yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(cardPrefabPathList, delegate
		{
			Toolbox.ResourcesManager.BattleListAssetPathList.AddRange(cardPrefabPathList);
			_btlMgr.BtlUIContainer = _gameMgr.GetGameObjMgr().AddUIManagerRootChildPrefab(m_BtlUIContainer);
			_btlMgr.BattleUIContainer = _btlMgr.BtlUIContainer.GetComponent<BattleUIContainer>();
			_btlMgr.SubParticleContainer = UnityEngine.Object.Instantiate(m_SubParticleContainer);
			_btlMgr.SubParticleContainer.transform.parent = _gameMgr.m_GameManagerObj.transform;
			_gameMgr.GetPrefabMgr().Load("Prefab/Container/_Battle3DContainer");
			_btlMgr.Battle3DContainer = GameMgr.GetIns().GetPrefabMgr().CreateIns("Prefab/Container/_Battle3DContainer");
			_btlMgr.Battle3DContainer.transform.parent = _gameMgr.m_GameManagerObj.transform;
			_btlMgr.CutInContainer = UnityEngine.Object.Instantiate(m_CutInContainer);
			_btlMgr.CutInContainer.transform.parent = _gameMgr.m_GameManagerObj.transform;
			_btlMgr.BtlContainer = _gameMgr.GetPrefabMgr().CloneObjectToParent(m_BtlContainer, _btlMgr.Battle3DContainer);
			CardBasePool = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_CardBase", ResourcesManager.AssetLoadPathType.CardDeco, isfetch: true)) as GameObject;
			CardBasePool.name = "CardBase";
			CardBasePool.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_md_Card", ResourcesManager.AssetLoadPathType.SleeveMesh, isfetch: true));
			_btlMgr.CardHolder = InitCardHolderObject("CardHolder", "CardHolder", PLAYER_CARDHOLDER_POS, PLAYER_CARDHOLDER_ROT, CARDHOLDER_COLL_SIZE);
			InitHandDeckObject("HandDeck");
			_btlMgr.ECardHolder = InitCardHolderObject("ECardHolder", "ECardHolder", ENEMY_CARDHOLDER_POS, ENEMY_CARDHOLDER_ROT, CARDHOLDER_COLL_SIZE);
			InitHandDeckObject("EHandDeck");
			_btlMgr.ChoiceCardHolder = _btlMgr.BtlContainer.transform.Find("ChoiceHolder").gameObject;
			_btlMgr.EvolveCardHolder = _btlMgr.BtlContainer.transform.Find("EvolveCardHolder").gameObject;
			Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_deckout_M", ResourcesManager.AssetLoadPathType.BattleTexture, isfetch: true)) as Material;
			material.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("sleeve_deckout", ResourcesManager.AssetLoadPathType.BattleTexture, isfetch: true)) as Texture;
			material.shader = Shader.Find(material.shader.name);
			if (Global.PreLoadSkinId.Contains(_playerSkinId))
			{
				LoadHighRankSkinEffectResources(_playerSkinId);
			}
			Material material2 = LoadSleeveMaterial(_gameMgr.GetDataMgr().GetPlayerSleeveId());
			int count = _gameMgr.GetDataMgr().GetCurrentDeckData().Count;
			if (_gameMgr.IsWatchBattle)
			{
				_dataMgr.SetDeckMaxCount(count, isSelf: true);
			}
			for (int i = 0; i < count + 1; i++)
			{
				Material texture = ((i < count) ? material2 : material);
				Vector3 scale = ((i < count) ? Global.CARD_BASE_STAY_SCALE : (Global.CARD_BASE_STAY_SCALE * 0.95f));
				AddDeckCard(i, texture, scale, isPlayer: true);
			}
			Material material3 = LoadSleeveMaterial(_gameMgr.GetDataMgr().GetEnemySleeveId());
			int count2 = _gameMgr.GetDataMgr().GetCurrentEnemyDeckData().Count;
			if (_gameMgr.IsWatchBattle)
			{
				_dataMgr.SetDeckMaxCount(count2, isSelf: false);
			}
			for (int j = 0; j < count2 + 1; j++)
			{
				Material texture2 = ((j < count2) ? material3 : material);
				Vector3 scale2 = ((j < count2) ? Global.CARD_BASE_STAY_SCALE : (Global.CARD_BASE_STAY_SCALE * 0.95f));
				AddDeckCard(j, texture2, scale2, isPlayer: false);
			}
			_btlMgr.PCardPlace = _btlMgr.BtlContainer.transform.Find("PlayerCardPlace").gameObject;
			UnitGameObj = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("UnitCard", ResourcesManager.AssetLoadPathType.CardFrame, isfetch: true));
			SpellGameObj = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("SpellCard", ResourcesManager.AssetLoadPathType.CardFrame, isfetch: true));
			FieldGameObj = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("FieldCard", ResourcesManager.AssetLoadPathType.CardFrame, isfetch: true));
			CostPoolIcon = Resources.Load("Prefab/CardDeco/Cost") as GameObject;
			AtkPoolIcon = Resources.Load("Prefab/CardDeco/Atk") as GameObject;
			LifePoolIcon = Resources.Load("Prefab/CardDeco/Life") as GameObject;
			_gameMgr.GetPrefabMgr().Load("Prefab/CardDeco/Name");
			NamePoolIcon = _gameMgr.GetPrefabMgr().Get("Prefab/CardDeco/Name");
			NamePoolIcon.name = "Name";
			SkillDescPool = _gameMgr.GetPrefabMgr().Get("Prefab/CardDeco/SkillIcon");
			SkillDescPool.name = "SkillIcon";
			Data.Master.DynamicLoadEmoteData(emotionCsvLoadPath, emotionIds);
			StartCoroutine(StartVS());
			_gameMgr.GetEffectMgr().SetupEffectContainer();
			_gameMgr.GetEffectMgr().InitEnemyBattleEffect();
			_gameMgr.GetEffectMgr().InitBattleEffect();
			if (null == _sharedMaterialNormal)
			{
				_sharedMaterialNormal = new Material(Shader.Find("Custom/Card/Unlit Diffuse"));
			}
			_btlMgr.CreateBattleField();
			CreateUnitCardTemplate();
			this.OnEndWaitCallBack.Call();
		}));
	}

	private void LoadHighRankSkinEffectResources(int skinId)
	{
		string key = "class_" + skinId;
		if (!Data.Master.HighRankEffect.ContainsKey(key))
		{
			return;
		}
		foreach (HighRankEffectInfo item in Data.Master.HighRankEffect[key])
		{
			if (!(item.Prefab != ""))
			{
				continue;
			}
			UnityEngine.Object original = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(item.Prefab, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			EffectBattle effObject = (UnityEngine.Object.Instantiate(original) as GameObject).AddComponent<EffectBattle>();
			effObject.gameObject.SetActive(value: false);
			if (BattleManagerBase.GetIns() != null)
			{
				GameMgr.GetIns().GetEffectMgr().LoadUIParticleShader(effObject.gameObject, delegate
				{
					UnityEngine.Object.Destroy(effObject.gameObject);
				}, isBattle: true);
			}
		}
	}

	public List<string> LoadOpponentAssets(Action callback)
	{
		List<string> list = new List<string>();
		NetworkUserInfoData networkUserInfoData = _gameMgr.GetNetworkUserInfoData();
		if (networkUserInfoData.OppoBattleStartInfo != null)
		{
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetOpponentRank().ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S));
			list.AddRange(DegreeHelper.GetDegreeResourceList(networkUserInfoData.GetOpponentDegreeId(), DegreeHelper.DegreeType.MIDDLE, isFetch: false));
			list.AddRange(DegreeHelper.GetDegreeResourceList(networkUserInfoData.GetOpponentDegreeId(), DegreeHelper.DegreeType.SMALL, isFetch: false));
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetOpponentEmblemId().ToString(), ResourcesManager.AssetLoadPathType.Emblem_M));
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(networkUserInfoData.GetOpponentCountryCode().ToString(), ResourcesManager.AssetLoadPathType.Country_M));
			StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(list, delegate
			{
				callback.Call();
			}));
		}
		return list;
	}

	private List<string> GetDelayMaterialPath()
	{
		List<string> list = new List<string>();
		ClassBattleCardBase classBattleCardBase = _btlMgr.BattlePlayer.Class as ClassBattleCardBase;
		bool flag = _gameMgr.GetDataMgr().IsHighRankSkinPlayer();
		bool flag2 = _gameMgr.GetDataMgr().Is3DSkin(isPlayer: true);
		if (flag != classBattleCardBase.ClassBattleCardView.ClassCharacter is HighRankSpineClassCharacter || flag2 != classBattleCardBase.ClassBattleCardView.ClassCharacter is Class3dCharacterBase)
		{
			classBattleCardBase.Setup();
			_btlMgr.BattlePlayer.PlayerBattleView.HandView.SetClassBattleCardView(classBattleCardBase.ClassBattleCardView);
			classBattleCardBase.SkillApplyInformation.ReSetupVfxCreator(classBattleCardBase.VfxCreator);
		}
		int playerSkinId = _gameMgr.GetDataMgr().GetPlayerSkinId();
		if (_playerSkinId != playerSkinId)
		{
			if (flag2)
			{
				list.Add(Toolbox.ResourcesManager.GetAssetTypePath(playerSkinId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D));
				list.AddRange(Get3dSkinPrefabPathList());
			}
			else
			{
				list.Add(Toolbox.ResourcesManager.GetAssetTypePath(playerSkinId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSpine));
				list.AddRange(GetSnCollabPrefabPathList(playerSkinId));
			}
			ClassCharacterMasterData playerCharaData = _gameMgr.GetDataMgr().GetPlayerCharaData();
			string path = playerCharaData.path;
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.ClassCharaMesh));
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(((int)playerCharaData.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment));
			if (flag)
			{
				list.AddRange(GetHighRankPrefabPathList(playerSkinId));
			}
		}
		int enemySkinId = _gameMgr.GetDataMgr().GetEnemySkinId();
		bool flag3 = _gameMgr.GetDataMgr().IsHighRankSkinEnemy();
		bool flag4 = _gameMgr.GetDataMgr().Is3DSkin(isPlayer: false);
		ClassBattleCardBase classBattleCardBase2 = _btlMgr.BattleEnemy.Class as ClassBattleCardBase;
		if (flag3 != classBattleCardBase2.ClassBattleCardView.ClassCharacter is HighRankSpineClassCharacter || flag4 != classBattleCardBase2.ClassBattleCardView.ClassCharacter is Class3dCharacterBase)
		{
			classBattleCardBase2.Setup();
			_btlMgr.BattleEnemy.BattleView.HandView.SetClassBattleCardView(classBattleCardBase2.ClassBattleCardView);
			classBattleCardBase2.SkillApplyInformation.ReSetupVfxCreator(classBattleCardBase2.VfxCreator);
		}
		if (_playerSkinId != enemySkinId)
		{
			if (flag4)
			{
				list.Add(Toolbox.ResourcesManager.GetAssetTypePath(enemySkinId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D));
				list.AddRange(Get3dSkinPrefabPathList());
			}
			else
			{
				list.Add(Toolbox.ResourcesManager.GetAssetTypePath(enemySkinId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSpine));
				list.AddRange(GetSnCollabPrefabPathList(enemySkinId));
			}
			ClassCharacterMasterData enemyCharaData = _gameMgr.GetDataMgr().GetEnemyCharaData();
			string path2 = enemyCharaData.path;
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.ClassCharaMesh));
			list.Add(Toolbox.ResourcesManager.GetAssetTypePath(((int)enemyCharaData.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment));
			if (flag3)
			{
				list.AddRange(GetHighRankPrefabPathList(enemySkinId));
			}
		}
		return list;
	}

	public VfxBase NetworkBattleStartToLoadOpponentObjects(Action onLoaded)
	{
		SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
		List<string> delayMaterialPath = GetDelayMaterialPath();
		List<string> emotionCsvLoadPath = new List<string>();
		List<string> emotionIds = new List<string>();
		if (_gameMgr.GetDataMgr().GetEnemyEmotionId().Contains("_"))
		{
			string enemyEmotionId = _gameMgr.GetDataMgr().GetEnemyEmotionId();
			emotionIds.Add(enemyEmotionId);
			delayMaterialPath.Add(Data.Master.GetEmotionTypePath(enemyEmotionId, ref emotionCsvLoadPath));
		}
		foreach (string item in delayMaterialPath)
		{
			sequentialVfxPlayer.Register(new WaitLoadResourceVfx(item));
		}
		if (_playerSkinId != _gameMgr.GetDataMgr().GetPlayerSkinId() && _gameMgr.GetDataMgr().IsHighRankSkinPlayer())
		{
			int playerSkinId = _gameMgr.GetDataMgr().GetPlayerSkinId();
			if (Global.PreLoadSkinId.Contains(playerSkinId))
			{
				sequentialVfxPlayer.Register(InstantVfx.Create(delegate
				{
					LoadHighRankSkinEffectResources(playerSkinId);
				}));
			}
		}
		sequentialVfxPlayer.Register(InstantVfx.Create(delegate
		{
			Data.Master.DynamicLoadEmoteData(emotionCsvLoadPath, emotionIds);
			onLoaded.Call();
		}));
		return sequentialVfxPlayer;
	}

	private Vector3 GetDeckCardLocalPosition(int idx)
	{
		return new Vector3(-0.1f, 0.4f, 0.1f) * idx;
	}

	public void AddDeckCard(int idx, Material texture, Vector3 scale, bool isPlayer)
	{
		GameObject gameObject = _gameMgr.GetPrefabMgr().CloneObjectToParent(CardBasePool, _btlMgr.Battle3DContainer);
		gameObject.GetComponent<Collider>().enabled = false;
		gameObject.transform.SetParent(isPlayer ? _btlMgr.CardHolder.transform : _btlMgr.ECardHolder.transform);
		IList<GameObject> holderCards = _btlMgr.GetCardParameterListInfo(isPlayer).HolderCards;
		gameObject.name = holderCards.Count.ToString();
		holderCards.Insert(idx, gameObject);
		gameObject.transform.localPosition = GetDeckCardLocalPosition(idx + 1);
		gameObject.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
		MeshRenderer component = gameObject.GetComponent<MeshRenderer>();
		component.material = texture;
		component.material.SetFloat("_CullMode", 2f);
		component.material.SetFloat("_ZWriteMode", 1f);
		gameObject.transform.localScale = scale;
	}

	public void AddDeckCards(int addNum, bool isPlayer)
	{
		for (int i = 0; i < addNum; i++)
		{
			Material texture = (isPlayer ? LoadSleeveMaterial(_gameMgr.GetDataMgr().GetPlayerSleeveId()) : LoadSleeveMaterial(_gameMgr.GetDataMgr().GetEnemySleeveId()));
			int idx = _btlMgr.GetCardParameterListInfo(isPlayer).HolderCards.Count - 1;
			AddDeckCard(idx, texture, Global.CARD_BASE_STAY_SCALE, isPlayer);
		}
		IList<GameObject> holderCards = _btlMgr.GetCardParameterListInfo(isPlayer).HolderCards;
		Vector3 localPosition = holderCards[holderCards.Count - 1].transform.localPosition;
		for (int j = 1; j < holderCards.Count; j++)
		{
			int index = holderCards.Count - 1 - j;
			holderCards[index].transform.localPosition = localPosition - GetDeckCardLocalPosition(j);
		}
	}

	private GameObject InitCardHolderObject(string cardHolderName, string tagName, Vector3 pos, Vector3 rot, Vector3 colliderSize)
	{
		GameObject obj = _btlMgr.BtlContainer.transform.Find(cardHolderName).gameObject;
		obj.GetComponent<BoxCollider>().size = colliderSize;
		obj.tag = tagName;
		obj.GetComponent<UIGrid>().enabled = false;
		obj.SetActive(value: true);
		obj.transform.localPosition = pos;
		obj.transform.eulerAngles = rot;
		obj.GetComponent<BoxCollider>().enabled = false;
		return obj;
	}

	private void InitHandDeckObject(string handDeckName)
	{
		_btlMgr.BtlContainer.transform.Find(handDeckName).GetComponent<UIAnchor>().uiCamera = _btlMgr.Battle3DContainer.transform.Find("Camera").GetComponent<Camera>();
	}

	public IEnumerator StartVS()
	{
		yield return new WaitForSeconds(0.4f);
		RunVS();
	}

	private void RunVS()
	{
		isAnimDone = true;
	}

	private IEnumerator Loading()
	{
		TweenAlpha component = _btlMgr.Battle3DContainer.transform.Find("OverBG").GetComponent<TweenAlpha>();
		m_TurnEndBtnUI = _btlMgr.BtlUIContainer.transform.Find("TurnEndBtn").GetComponent<TurnEndButtonUI>();
		m_TurnEndBtnUI.gameObject.SetActive(value: false);
		_btlMgr.BtlUIContainer.transform.Find("PlayerChoiceBraveBtn").gameObject.SetActive(value: false);
		_btlMgr.BtlUIContainer.transform.Find("EnemyChoiceBraveBtn").gameObject.SetActive(value: false);
		_btlMgr.ChangeCameraFieldOfView(_gameMgr.ScreenAspect);
		component.PlayReverse();
		GameObject gameObject = UnityEngine.Object.Instantiate(m_PanelMgr);
		gameObject.transform.parent = _gameMgr.m_GameManagerObj.transform;
		_btlMgr.PanelMgr = gameObject.GetComponent<PanelMgr>();
		BattlePlayer battlePlayer = _btlMgr.BattlePlayer;
		BattleEnemy battleEnemy = _btlMgr.BattleEnemy;
		yield return null;
		battlePlayer.BattleView.Setup(_gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/StatusPanelP"), _btlMgr.BtlUIContainer, _btlMgr.BtlContainer, _btlMgr.Battle3DContainer);
		battleEnemy.BattleView.Setup(_gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/StatusPanelE"), _btlMgr.BtlUIContainer, _btlMgr.BtlContainer, _btlMgr.Battle3DContainer);
		_gameMgr.GetPrefabMgr().Load("Prefab/UI/Arrow");
		_btlMgr.Arrow = _gameMgr.GetPrefabMgr().CloneObjectToParent(_gameMgr.GetPrefabMgr().Get("Prefab/UI/Arrow"), _btlMgr.Battle3DContainer);
		_btlMgr.Arrow.transform.parent = _btlMgr.BtlContainer.transform;
		_btlMgr.Arrow.transform.Find("ArrowHead").localScale = Vector3.one * 512f;
		_btlMgr.ArrowControl = _btlMgr.Arrow.GetComponent<ArrowControl>();
		_btlMgr.AttackArrowHead = _gameMgr.GetPrefabMgr().CloneObjectToParent("Prefab/UI/ArrowHead", _btlMgr.Battle3DContainer);
		_btlMgr.AttackArrowHead.transform.parent = _btlMgr.BtlContainer.transform;
		_btlMgr.EvolutionArrowHead = _gameMgr.GetPrefabMgr().CloneObjectToParent("Prefab/UI/ArrowEvo", _btlMgr.Battle3DContainer);
		_btlMgr.EvolutionArrowHead.transform.parent = _btlMgr.BtlContainer.transform;
		_btlMgr.AlertDialogue = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/AlertDialogue");
		_btlMgr.AlertDialogue.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.AlertDialogue.SetActive(value: false);
		_btlMgr.AlertDialogueLabel = _btlMgr.AlertDialogue.transform.Find("Panel/DialogueLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailPanel = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/DetailPanel");
		_btlMgr.DetailMgr.DetailPanel.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.DetailMgr.SubDetailPanel = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/DetailPanel");
		_btlMgr.DetailMgr.SubDetailPanel.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.DetailMgr.SubDetailPanelControl = _btlMgr.DetailMgr.SubDetailPanel.GetComponent<DetailPanelControl>();
		_btlMgr.DetailMgr.SubDetailPanelControl.CreateNextPanel();
		_btlMgr.DetailMgr.DetailPanelControl = _btlMgr.DetailMgr.DetailPanel.GetComponent<DetailPanelControl>();
		_btlMgr.DetailMgr.DetailPanelControl.CreateNextPanel();
		_btlMgr.PSideLog = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/SideLogP");
		_btlMgr.PSideLog.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.PSideLogControl = _btlMgr.PSideLog.GetComponent<SideLogControl>();
		_btlMgr.ESideLog = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/SideLogE");
		_btlMgr.ESideLog.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.ESideLogControl = _btlMgr.ESideLog.GetComponent<SideLogControl>();
		_btlMgr.ESelectSkillSideLog = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/SideLogESelectSkill");
		_btlMgr.ESelectSkillSideLog.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.ESelectSkillSideLogControl = _btlMgr.ESelectSkillSideLog.GetComponent<SideLogControl>();
		_btlMgr.ESelectSkillSideLog.SetActive(value: false);
		yield return null;
		_btlMgr.SubUI = _gameMgr.GetGameObjMgr().AddUIManagerRootChildPrefab("Prefab/Container/BattleSubUI").transform;
		_btlMgr.SubUIOverLayBG = _btlMgr.SubUI.Find("BattleMenuOverLay").GetComponent<TweenAlpha>();
		_btlMgr.SetBattleMenuBtn();
		GameObject gameObject2 = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/TurnPanel");
		gameObject2.transform.parent = _btlMgr.BtlUIContainer.transform;
		gameObject2.layer = LayerMask.NameToLayer("Loading");
		_btlMgr.TurnPanelControl = gameObject2.GetComponent<TurnPanelControl>();
		DataMgr dataMgr = _gameMgr.GetDataMgr();
		if (dataMgr.IsQuestBattleType())
		{
			_btlMgr.BattleResult = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/BattleResult/QuestSpecialBattleResultUI");
		}
		else if (dataMgr.m_BattleType == DataMgr.BattleType.RankBattle)
		{
			_btlMgr.BattleResult = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/BattleResult/RankMatchBattleResultUI");
		}
		else if (dataMgr.m_BattleType == DataMgr.BattleType.ColosseumNormal || dataMgr.m_BattleType == DataMgr.BattleType.ColosseumTwoPick || dataMgr.m_BattleType == DataMgr.BattleType.ColosseumWindFall || dataMgr.m_BattleType == DataMgr.BattleType.ColosseumHof)
		{
			_btlMgr.BattleResult = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/BattleResult/ColosseumBattleResultUI");
		}
		else
		{
			_btlMgr.BattleResult = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/BattleResult/BattleResultUI");
		}
		_btlMgr.BattleResult.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.BattleResultControl = _btlMgr.BattleResult.GetComponent<BattleResultUIController>();
		Vector3 zero = Vector3.zero;
		zero.z = -200f;
		_btlMgr.BattleResult.transform.localPosition = zero;
		_btlMgr.BattleStart = _gameMgr.GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/BattleStart");
		_btlMgr.BattleStart.transform.parent = _btlMgr.BtlUIContainer.transform;
		_btlMgr.BattleStartControl = _btlMgr.BattleStart.GetComponent<BattleStartControl>();
		_btlMgr.BattleStartControl.SetUp(this);
		GameObject gobj = _gameMgr.GetPrefabMgr().CloneObjectToParent(UnitCardTemplate.gameObject, _btlMgr.Battle3DContainer).GetComponent<CardTemplate>()
			.CardNormalTemp.gameObject;
		GameObject gameObject3 = _gameMgr.GetPrefabMgr().CloneObjectToParent(gobj, _btlMgr.SubParticleContainer);
		gameObject3.transform.parent = _btlMgr.CutInContainer.transform;
		gameObject3.GetComponent<LODGroup>().enabled = true;
		gameObject3.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
		gameObject3.transform.localScale = new Vector3(50f, 50f, 8f);
		gameObject3.transform.Find("CardBase(Clone)").GetComponent<MeshRenderer>();
		_btlMgr.DetailMgr.DetailNormal = gameObject3;
		_btlMgr.DetailMgr.DetailNormalLodGroup = gameObject3.GetComponent<LODGroup>();
		_btlMgr.DetailMgr.DetailNormalBaseMesh = gameObject3.transform.Find("CardBase(Clone)").GetComponent<MeshRenderer>();
		_btlMgr.DetailMgr.DetailNormalCostLabel = gameObject3.transform.Find("Cost(Clone)").Find("CostLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailNormalAtkLabel = gameObject3.transform.Find("Atk(Clone)").Find("AtkLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailNormalLifeLabel = gameObject3.transform.Find("Life(Clone)").Find("LifeLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailNormalNameLabel = gameObject3.transform.Find("Name(Clone)").Find("NameLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailNormalBaseMesh.gameObject.tag = "DetailCard";
		UIAnchor uIAnchor = gameObject3.AddComponent<UIAnchor>();
		uIAnchor.side = UIAnchor.Side.Left;
		uIAnchor.relativeOffset = new Vector2(0.11f, 0.1f);
		MotionUtils.SetLayerAll(gameObject3, 31);
		gameObject3.SetActive(value: false);
		GameObject gobj2 = _gameMgr.GetPrefabMgr().CloneObjectToParent(SpellCardTemplate.gameObject, _btlMgr.Battle3DContainer).GetComponent<CardTemplate>()
			.CardNormalTemp.gameObject;
		GameObject gameObject4 = _gameMgr.GetPrefabMgr().CloneObjectToParent(gobj2, _btlMgr.SubParticleContainer);
		gameObject4.transform.parent = _btlMgr.CutInContainer.transform;
		gameObject4.GetComponent<LODGroup>().enabled = true;
		gameObject4.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
		gameObject4.transform.localScale = new Vector3(50f, 50f, 8f);
		_btlMgr.DetailMgr.DetailSkill = gameObject4;
		_btlMgr.DetailMgr.DetailSkillLodGroup = gameObject4.GetComponent<LODGroup>();
		_btlMgr.DetailMgr.DetailSkillBaseMesh = gameObject4.transform.Find("CardBase(Clone)").GetComponent<MeshRenderer>();
		_btlMgr.DetailMgr.DetailSkillCostLabel = gameObject4.transform.Find("Cost(Clone)").Find("CostLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailSkillNameLabel = gameObject4.transform.Find("Name(Clone)").Find("NameLabel").GetComponent<UILabel>();
		gameObject4.transform.Find("CardBase(Clone)").tag = "DetailCard";
		UIAnchor uIAnchor2 = gameObject4.AddComponent<UIAnchor>();
		uIAnchor2.side = UIAnchor.Side.Left;
		uIAnchor2.relativeOffset = new Vector2(0.11f, 0.1f);
		MotionUtils.SetLayerAll(gameObject4, 31);
		gameObject4.SetActive(value: false);
		GameObject gobj3 = _gameMgr.GetPrefabMgr().CloneObjectToParent(FieldCardTemplate.gameObject, _btlMgr.Battle3DContainer).GetComponent<CardTemplate>()
			.CardNormalTemp.gameObject;
		GameObject gameObject5 = _gameMgr.GetPrefabMgr().CloneObjectToParent(gobj3, _btlMgr.SubParticleContainer);
		gameObject5.transform.parent = _btlMgr.CutInContainer.transform;
		gameObject5.GetComponent<LODGroup>().enabled = true;
		gameObject5.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
		gameObject5.transform.localScale = new Vector3(50f, 50f, 8f);
		_btlMgr.DetailMgr.DetailField = gameObject5;
		_btlMgr.DetailMgr.DetailFieldLodGroup = gameObject5.GetComponent<LODGroup>();
		_btlMgr.DetailMgr.DetailFieldBaseMesh = gameObject5.transform.Find("CardBase(Clone)").GetComponent<MeshRenderer>();
		_btlMgr.DetailMgr.DetailFieldCostLabel = gameObject5.transform.Find("Cost(Clone)").Find("CostLabel").GetComponent<UILabel>();
		_btlMgr.DetailMgr.DetailFieldNameLabel = gameObject5.transform.Find("Name(Clone)").Find("NameLabel").GetComponent<UILabel>();
		gameObject5.transform.Find("CardBase(Clone)").tag = "DetailCard";
		UIAnchor uIAnchor3 = gameObject5.AddComponent<UIAnchor>();
		uIAnchor3.side = UIAnchor.Side.Left;
		uIAnchor3.relativeOffset = new Vector2(0.11f, 0.1f);
		MotionUtils.SetLayerAll(gameObject5, 31);
		gameObject5.SetActive(value: false);
	}

	private static Material LoadSleeveMaterial(long sleeveId)
	{
		Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(sleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveMaterial, isfetch: true)) as Material;
		if (material != null)
		{
			material.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(sleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true));
			if (Data.Master.SleeveMgr.Get(sleeveId).IsPremiumSleeve)
			{
				Texture value = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(sleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTextureMask, isfetch: true));
				material.SetTexture("_MaskTex", value);
			}
			material.shader = Shader.Find(material.shader.name);
		}
		return material;
	}

	public void InitPlayer()
	{
		BattlePlayer battlePlayer = _btlMgr.BattlePlayer;
		_btlMgr.BattleResourceMgr.LoadSleeveMaterial(_gameMgr.GetDataMgr().GetPlayerSleeveId(), isPlayer: true).Play();
		IList<int> currentDeckData = _gameMgr.GetDataMgr().GetCurrentDeckData();
		CardVoiceInfoCache.CacheCardVoiceInfoForBattle(currentDeckData);
		for (int i = 0; i < currentDeckData.Count; i++)
		{
			BattleCardBase card = CardCreatorBase.CreateCard(currentDeckData[i], isPlayer: true, i + 1, this, _btlMgr, _btlMgr.BattleResourceMgr, _btlMgr.CreatePlayerInnerOptionsBuilder());
			battlePlayer.AddToDeck(card);
		}
		battlePlayer.BattleStartDeckCardList = new List<BattleCardBase>(battlePlayer.DeckCardList);
		battlePlayer.cardTotalNum = currentDeckData.Count + 1;
	}

	public void InitEnemy()
	{
		BattleEnemy battleEnemy = _btlMgr.BattleEnemy;
		_btlMgr.BattleResourceMgr.LoadSleeveMaterial(_gameMgr.GetDataMgr().GetEnemySleeveId(), isPlayer: false).Play();
		IList<int> currentEnemyDeckData = _gameMgr.GetDataMgr().GetCurrentEnemyDeckData();
		CardVoiceInfoCache.CacheCardVoiceInfoForBattle(currentEnemyDeckData);
		for (int i = 0; i < currentEnemyDeckData.Count; i++)
		{
			BattleCardBase card = CardCreatorBase.CreateCard(currentEnemyDeckData[i], isPlayer: false, i + 1, this, _btlMgr, _btlMgr.BattleResourceMgr, _btlMgr.CreateEnemyInnerOptionsBuilder());
			battleEnemy.AddToDeck(card);
		}
		battleEnemy.BattleStartDeckCardList = new List<BattleCardBase>(battleEnemy.DeckCardList);
		battleEnemy.cardTotalNum = currentEnemyDeckData.Count + 1;
		StartCoroutine(LoadComplete());
	}

	private IEnumerator LoadComplete()
	{
		while (!isAnimDone || !_btlMgr.IsBackGroundLoad || !_gameMgr.GetEffectMgr().IsEnemyBattleEffectReady || !_gameMgr.GetEffectMgr().IsPlayerBattleEffectReady)
		{
			yield return null;
		}
		StopAllCoroutines();
		if (_btlMgr is SingleBattleMgr)
		{
			((SingleBattleMgr)_btlMgr).SingleBattleFirstRecoverySetting();
		}
		ReadyFPS();
	}

	private IEnumerator CheckPlayerStatus()
	{
		while (true)
		{
			if (!ToolboxGame.RealTimeNetworkAgent)
			{
				yield break;
			}
			if (ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus == RealTimeNetworkAgent.MatchingStatus.Prepared)
			{
				break;
			}
			yield return null;
		}
		UIManager.GetInstance().CreatFadeBlack();
		yield return new WaitForSeconds(1f);
		while (!BattleManagerBase.GetIns().BattleStartControl.IsReady)
		{
			yield return null;
		}
		StartBattleScene();
	}

	private void ReadyFPS()
	{
		if (_gameMgr.IsNetworkBattle)
		{
			if (ToolboxGame.RealTimeNetworkAgent != null && !_btlMgr.IsRecovery)
			{
				ToolboxGame.RealTimeNetworkAgent.SetCurrentMatchingStatus(RealTimeNetworkAgent.MatchingStatus.Loaded);
				StartCoroutine(CheckPlayerStatus());
				if (!_gameMgr.IsAINetwork)
				{
					(_btlMgr as NetworkBattleManagerBase).IsStopIntervalCheck = true;
				}
				if (!GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle)
				{
					ToolboxGame.RealTimeNetworkAgent.EmitMsgPack(NetworkBattleDefine.NetworkBattleURI.Loaded);
				}
			}
		}
		else
		{
			StartBattleScene();
		}
		isLoadEnd = true;
	}

	public void StartBattleScene()
	{
		StopAllCoroutines();
		if (_gameMgr.IsNetworkBattle && ToolboxGame.RealTimeNetworkAgent == null)
		{
			LocalLog.AccumulateLastTraceLog("StartBattleScene NotNetworkObject");
		}
		else
		{
			_gameMgr.GetBattleCtrl().Init();
		}
	}
}
