using System.Collections;
using System.Collections.Generic;
using Cute;
using UnityEngine;

public class SpecialArenaField : BackGroundBase
{
	private const string TAPESTRY_OBJECT_PATH = "md_bf_arn2_01_tapestry/tapestry_big";

	private const string TAPESTRY_TEXTURE_NAME = "tx_bf_arn2_01_tapestry_d";

	private const string CANDLE_ROAD_EFFECT_NAME = "candle_road";

	public override int FieldId => 1001;

	public SpecialArenaField(string bgmId = "NONE")
		: base(bgmId)
	{
	}

	protected override List<string> CollectAdditionalAssets()
	{
		return new List<string> { Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_arn2_01_tapestry_d", ResourcesManager.AssetLoadPathType.Uilang3DField) };
	}

	protected override void BattleFieldBuild()
	{
		BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate
		{
			base.Field = GameObject.Find(_str3DFieldPath);
			base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform;
			GimicAudioList = base.Field.GetComponent<AudioList>().GimicAudioList;
			_fieldModel = base.Field.transform.Find("md_bf_arn2_root").gameObject;
			_fieldParticles = _fieldModel.transform.Find("Particles09").gameObject;
			_fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles);
			ParticleSystem component = _fieldParticles.transform.Find("candle_road").GetComponent<ParticleSystem>();
			component.gameObject.SetActive(value: false);
			_fieldParticleSystemDictionary.Add("candle_road", component);
			SkinnedMeshRenderer skinnedMeshRenderer = _fieldModel.transform.Find("md_bf_arn2_01_tapestry/tapestry_big")?.GetComponent<SkinnedMeshRenderer>();
			if (skinnedMeshRenderer != null)
			{
				string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_arn2_01_tapestry_d", ResourcesManager.AssetLoadPathType.Uilang3DField, isfetch: true);
				Texture texture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture;
				if (texture != null)
				{
					skinnedMeshRenderer.material.SetTexture("_MainTex", texture);
				}
			}
			List<string> list = new List<string>(_fieldObjDictionary.Keys);
			List<GameObject> list2 = new List<GameObject>();
			for (int i = 0; i < _fieldObjDictionary.Count; i++)
			{
				list2.Add(_fieldObjDictionary[list[i]]);
			}
			GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate
			{
				base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent<SetShaderGlobalColorBG>();
				base.IsLoadDone = true;
			}, isBattle: true, isField: true);
		}));
	}

	public override void StartFieldSetEffect(Vector3 pos)
	{
		GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1001, pos);
	}

	public override void StartFieldTapEffect(int areaId, Vector3 pos)
	{
		base.StartFieldTapEffect(areaId, pos);
		GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1001_1, pos);
	}

	protected override IEnumerator RunFieldOpening()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L);
		GameObject candleRoadEffectObj = _fieldParticleSystemDictionary["candle_road"].gameObject;
		candleRoadEffectObj.SetActive(value: true);
		_battleCamera.Camera.transform.localPosition = new Vector3(3300f, -1070f, 50f);
		_battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-15f, -56f, 80f));
		iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(20f, -10f, -70f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
		iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-18f, -105f, 95f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
		yield return new WaitForSeconds(2f);
		candleRoadEffectObj.SetActive(value: false);
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT);
		iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
		iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
		yield return new WaitForSeconds(0f);
	}

	protected override IEnumerator RunFieldGimic(GameObject obj)
	{
		yield return new WaitForSeconds(0f);
	}

	protected override IEnumerator RunFieldShake()
	{
		yield return new WaitForSeconds(0f);
	}
}
