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

public class CardPackManager : MonoBehaviour
{
	public class GachaMaskDark
	{
		public int PackId;

		public Rect UvRect;

		public Color Color;

		public GachaMaskDark(string[] columns)
		{
			int num = 0;
			PackId = int.Parse(columns[num]);
			num++;
			UvRect = new Rect(float.Parse(columns[num]), float.Parse(columns[num + 1]), float.Parse(columns[num + 2]), float.Parse(columns[num + 3]));
			num += 4;
			Color = new Color(float.Parse(columns[num]), float.Parse(columns[num + 1]), float.Parse(columns[num + 2]), float.Parse(columns[num + 3]));
		}
	}

	private InputMgr m_InputMgrIns;

	private EffectMgr m_EfcMgrIns;

	private const int DRAW_NUM = 8;

	private const int ANIM_CNT_NONE = 100;

	private const int CARD_TOUCH_POS_DIV_CNT = 10;

	private const float DELAY_FADEOUT_SE = 1.5f;

	private const float WAIT_FADEOUT_FOR_DISPOSE = 1f;

	private const float SCALE_3D_OBJECT = 0.003125f;

	private const string PACK_BOX_NAME = "md_gachabox_{0}";

	private const string PACK_EFFECT_IDLE_1 = "gch_box_idle_1_{0}";

	private const string PACK_EFFECT_TAP_1 = "gch_box_tap_1_{0}";

	private const string PACK_EFFECT_SHINE_1 = "gch_box_shine_1_{0}";

	private const string PACK_EFFECT_SPECIAL_1 = "gch_box_special_1";

	private const string PACK_EFFECT_SPECIAL_2 = "gch_box_special_2";

	private const string CUESHEETNAME_GACHA_SE = "se_gacha";

	private const string CUENAME_SE_GACHA_APPEAR = "se_sys_gacha_appear_{0}";

	private const string CUENAME_SE_GACHA_OPEN = "se_sys_gacha_open_{0}";

	private const int EFFECT_LAYER = 30;

	private const float FOV_ASPECT_BORDER = 1.5f;

	private const int FOV_UNDER_BORDER_SIZE = 70;

	private const int FOV_OVER_BORDER_SIZE = 64;

	private readonly Vector3 POSITION_CARDVIEW_CAMERA = new Vector3(9600f, 92f, -2900f);

	[HideInInspector]
	public GameObject CardPackParent;

	private IList<GameObject> m_CardPackList;

	private IList<GameObject> m_CardAnimList;

	private Queue<GameObject> m_openCardQueue = new Queue<GameObject>();

	private IList<int> m_CardOpenList;

	private IList<Vector3> m_CardPosList;

	private IList<Vector3> m_CardRotList;

	private IList<int> m_RarityList;

	private IList<GameObject> m_CostIconList;

	private IList<GameObject> m_LifeIconList;

	private IList<GameObject> m_AtkIconList;

	private IList<GameObject> m_NameLabelList;

	private int layer_Gacha = 18;

	private int animCnt = 100;

	private int currentCnt;

	private int packOpenCnt = 1;

	private bool _isAutoOpen;

	private bool _isCoutainSpecialCard;

	private Camera GachaCamera;

	private GameObject GachaLight;

	private GameObject GachaBox;

	private Animation GachaBoxAnim;

	private GameObject ClanLabels;

	private IList<UILabel> ClanLabelList = new List<UILabel>();

	private UITexture DarkSideTex;

	private UITexture BgBlackTex;

	private GameObject PackEffectIdle1;

	private GameObject PackEffectTap1;

	private GameObject PackEffectShine1;

	private GameObject PackEffectSpecial1;

	private GameObject PackEffectSpecial2;

	private GameObject CardBefore;

	private Vector3 GachaObjScale = new Vector3(250f, 250f, 50f);

	private int cardPackSize;

	private int cardPackNum;

	private int lastLoadedCardIndex;

	private Vector3 mousePosPrev = Vector3.zero;

	private const int PAGE_CARD_COUNT = 8;

	private float m_BackupBgmVolume;

	private List<string> PackAssetNameList = new List<string>();

	private List<string> EffectAssetPathList;

	private GameObject GachaStay1Pool;

	private GameObject GachaStay2Pool;

	private GameObject GachaStay3Pool;

	private GameObject GachaSpecialStay1Pool;

	private GameObject GachaTwinkle1Pool;

	private bool m_IsNextCardCreated = true;

	private bool m_IsHideCardFinish = true;

	private const float DelayOpenCard = 0.05f;

	[SerializeField]
	private UIButton SkipBtn;

	[SerializeField]
	private UIButton OkBtn;

	[SerializeField]
	private UILabel LabelPackNum;

	[SerializeField]
	private UILabel LabelPackUnit;

	[SerializeField]
	private NguiObjs TouchObj;

	private CardDetailUI _cardDetail;

	private UIManager.ViewScene _nextScene;

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

	private bool _isNextCardAnim;

	private bool _isDispose;

	private string _seNameGachaAppear = "";

	private string _seNameGachaOpen = "";

	private bool _isSpecialCardPackSet;

	public bool IsSkipped { get; private set; }

	public void Init(bool isAutoOpen, CardDetailUI cardDetail, UIManager.ViewScene nextScene, bool isCoutainSpecialCard, Action callback)
	{
		_isAutoOpen = isAutoOpen;
		_isCoutainSpecialCard = isCoutainSpecialCard;
		_cardDetail = cardDetail;
		_nextScene = nextScene;
		IsSkipped = false;
		GameMgr.GetIns().GetPrefabMgr().Load("Gacha/GachaObj");
		m_InputMgrIns = GameMgr.GetIns().GetInputMgr();
		m_EfcMgrIns = GameMgr.GetIns().GetEffectMgr();
		CardPackParent = GameMgr.GetIns().GetGameObjMgr().AddUIManagerChildPrefab(GameMgr.GetIns().GetPrefabMgr().GetObj("Gacha/GachaObj") as GameObject);
		CardPackParent.layer = layer_Gacha;
		CardPackParent.transform.localScale = new Vector3(0.003125f, 0.003125f, 0.003125f);
		GachaObj component = CardPackParent.GetComponent<GachaObj>();
		CardPackParent.SetActive(value: false);
		GachaCamera = component.GachaCamera;
		GachaLight = component.GachaLight;
		GachaBox = component.GachaBox;
		ClanLabels = component.ClanLabels;
		DarkSideTex = component.DarkSideTex;
		BgBlackTex = component.BgBlackTex;
		ClanLabelList.Clear();
		for (int i = 0; i < ClanLabels.transform.childCount; i++)
		{
			ClanLabelList.Add(ClanLabels.transform.GetChild(i).GetComponent<UILabel>());
		}
		OkBtn.onClick.Clear();
		OkBtn.onClick.Add(new EventDelegate(delegate
		{
			OnClickNextBtn();
		}));
		SkipBtn.onClick.Clear();
		SkipBtn.onClick.Add(new EventDelegate(delegate
		{
			if (!_cardDetail.GetIsDetailOn())
			{
				OnClickSkipBtn();
			}
		}));
		TouchObj.labels[0].text = Data.SystemText.Get("Common_0146");
		EffectAssetPathList = GameMgr.GetIns().GetEffectMgr().InitCommonEffect("Json/CardPackEffectData", isBattle: false, isField: false, isBattleEffect: false, delegate
		{
			callback.Call();
		});
	}

	public void StartInstantiateCardPack(PackConfig packConfig)
	{
		_isDispose = false;
		SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr();
		m_BackupBgmVolume = soundMgr.GetBgmVolume();
		soundMgr.FadeBgmVolume(0f);
		animCnt = 0;
		currentCnt = 0;
		packOpenCnt = 1;
		m_CardPackList = new List<GameObject>();
		m_CardAnimList = new List<GameObject>();
		m_CardOpenList = new List<int>();
		m_CardPosList = new List<Vector3>();
		m_CardRotList = new List<Vector3>();
		m_RarityList = new List<int>();
		m_CostIconList = new List<GameObject>();
		m_LifeIconList = new List<GameObject>();
		m_AtkIconList = new List<GameObject>();
		m_NameLabelList = new List<GameObject>();
		CardBefore = null;
		GachaCamera.transform.localPosition = new Vector3(0f, 360f, -840f);
		GachaCamera.transform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
		GachaCamera.fieldOfView = ((GameMgr.GetIns().ScreenAspect < 1.5f) ? 70 : 64);
		GachaBox.SetActive(value: true);
		LabelPackNum.gameObject.SetActive(value: false);
		OkBtn.gameObject.SetActive(value: true);
		OkBtn.isEnabled = false;
		SkipBtn.gameObject.SetActive(value: true);
		ClanLabels.SetActive(value: false);
		DarkSideTex.alpha = 1f;
		DarkSideTex.transform.localScale = Vector3.one * 2f;
		BgBlackTex.alpha = 0f;
		CardPackParent.SetActive(value: true);
		lastLoadedCardIndex = 0;
		GachaCamera.gameObject.SetActive(value: true);
		_isSpecialCardPackSet = packConfig.IsSpecialCardPack;
		GameMgr.GetIns().GetSoundMgr().LoadSe("se_gacha", delegate
		{
			InstantiateCardPack(packConfig.GetGachaIdForEffectResource());
		});
	}

	private IEnumerator loadNextPage(Action onFinish)
	{
		m_IsNextCardCreated = false;
		int b = cardPackSize - lastLoadedCardIndex;
		int takeNum = Mathf.Min(8, b);
		List<CardPack> targetCardList = Data.PackOpen.data.pack_list.Skip(lastLoadedCardIndex).Take(takeNum).ToList();
		List<string> assetList = Toolbox.ResourcesManager.CardListAssetPathList;
		Dictionary<int, List<UIBase_CardManager.CardObjData>> cardObjectDic = new Dictionary<int, List<UIBase_CardManager.CardObjData>>();
		foreach (IGrouping<int, CardPack> item in from x in targetCardList
			group x by x.SleeveId)
		{
			PackAssetNameList.AddRange(assetList);
			assetList.Clear();
			int sleeveId = item.Key;
			yield return CreateGachaCardPack(item.Select((CardPack x) => x.card_id).ToList(), sleeveId);
			cardObjectDic.Add(sleeveId, UIManager.GetInstance().getSelectCardListObjs());
		}
		List<GameObject> SetShaderList = new List<GameObject>();
		List<GameObject> specialEffectList = new List<GameObject>();
		for (int num = 0; num < takeNum; num++)
		{
			CardPack cardPack = targetCardList[num];
			int card_id = cardPack.card_id;
			List<UIBase_CardManager.CardObjData> list = cardObjectDic[cardPack.SleeveId];
			UIBase_CardManager.CardObjData cardObjData = list[0];
			list.RemoveAt(0);
			GameObject gameObject = cardObjData.CardObj.gameObject;
			gameObject.SetActive(value: true);
			Transform transform = gameObject.transform;
			AttachCardDetailButton(gameObject);
			if (CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(card_id).CharType == CardBasePrm.CharaType.NORMAL)
			{
				GameObject gameObject2 = transform.Find("Life(Clone)").gameObject;
				gameObject2.transform.localPosition = Global.POSITION_LIFE_ICON;
				m_LifeIconList.Add(gameObject2);
				GameObject gameObject3 = transform.Find("Atk(Clone)").gameObject;
				gameObject3.transform.localPosition = Global.POSITION_ATK_ICON;
				m_AtkIconList.Add(gameObject3);
			}
			else
			{
				m_LifeIconList.Add(null);
				m_AtkIconList.Add(null);
			}
			GameObject gameObject4 = transform.Find("Cost(Clone)").gameObject;
			gameObject4.transform.localPosition = Global.POSITION_COST_ICON;
			m_CostIconList.Add(gameObject4);
			GameObject gameObject5 = transform.Find("Name(Clone)").gameObject;
			gameObject5.SetActive(value: false);
			m_NameLabelList.Add(gameObject5);
			Transform transform2 = transform.Find("CardBase");
			GameObject gameObject6 = null;
			if (transform2 != null)
			{
				gameObject6 = transform2.Find("CardBase_Specular").gameObject;
				gameObject6.layer = layer_Gacha;
				gameObject6.SetActive(value: true);
			}
			if (!Data.Master.PackRarityEffectOverrideDic.TryGetValue(card_id, out var value))
			{
				value = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(card_id).Rarity;
			}
			m_RarityList.Add(value);
			if (value > 1)
			{
				GameObject gobj = null;
				switch (value)
				{
				case 2:
					gobj = GachaStay1Pool;
					break;
				case 3:
					gobj = GachaStay2Pool;
					break;
				case 4:
					gobj = GachaStay3Pool;
					break;
				}
				GameObject gameObject7 = GameMgr.GetIns().GetGameObjMgr().AddUIManagerChildPrefab(gobj);
				gameObject7.transform.parent = transform;
				gameObject7.name = "cmn_gacha_stay";
				gameObject7.transform.localPosition = Vector3.zero;
				gameObject7.transform.localScale = Vector3.one;
				gameObject7.layer = 30;
				SetShaderList.Add(gameObject7);
			}
			GameObject gameObject8 = GameMgr.GetIns().GetGameObjMgr().AddUIManagerChildPrefab(GachaTwinkle1Pool);
			gameObject8.transform.parent = transform;
			gameObject8.name = "cmn_gacha_move";
			gameObject8.transform.localPosition = Vector3.back * 0.2f;
			gameObject8.transform.localScale = Vector3.one;
			gameObject8.layer = 30;
			SetShaderList.Add(gameObject8);
			if (cardPack.IsSpecialCard || cardPack.IsFreePackLeaderSkin)
			{
				gameObject6?.SetActive(value: false);
				GameObject gameObject9 = GameMgr.GetIns().GetGameObjMgr().AddUIManagerChildPrefab(GachaSpecialStay1Pool);
				gameObject9.transform.parent = transform;
				gameObject9.name = "cmn_gacha_special";
				gameObject9.transform.localPosition = Vector3.forward * 0.1f;
				gameObject9.transform.localScale = Vector3.one;
				gameObject9.layer = 30;
				SetShaderList.Add(gameObject9);
				specialEffectList.Add(gameObject9);
			}
			gameObject.GetComponent<CharIdx>().SetIdx(lastLoadedCardIndex + num);
			transform.parent = CardPackParent.transform;
			gameObject.layer = layer_Gacha;
			transform.localScale = GachaObjScale;
			m_CardPackList.Add(gameObject);
		}
		lastLoadedCardIndex += takeNum;
		List<string> collection = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(SetShaderList, delegate
		{
			for (int i = 0; i < SetShaderList.Count; i++)
			{
				SetShaderList[i].SetActive(value: false);
			}
			specialEffectList.ForEach(delegate(GameObject effect)
			{
				effect.SetActive(value: true);
			});
			m_IsNextCardCreated = true;
			onFinish?.Invoke();
		});
		EffectAssetPathList.AddRange(collection);
	}

	private IEnumerator CreateGachaCardPack(IList<int> cardPackList, int sleeveId)
	{
		UIManager.GetInstance().CardLoadGachaPack(base.gameObject, cardPackList, layer_Gacha, is2D: false, sleeveId);
		while (UIManager.GetInstance().getSelectCardListObjs() == null)
		{
			yield return null;
		}
		while (UIManager.GetInstance().getSelectCardListObjs().Count < cardPackList.Count)
		{
			yield return null;
		}
		while (!UIManager.GetInstance().getUIBase_CardManager().getCreateEndFlag() || !UIManager.GetInstance().getUIBase_CardManager().isAssetAllReady)
		{
			yield return null;
		}
	}

	private void AttachCardDetailButton(GameObject cardObject)
	{
		cardObject.GetComponentInChildren<BoxCollider>().gameObject.AddComponent<UIButton>().onClick.Add(new EventDelegate(delegate
		{
			OnClickCard(cardObject);
		}));
	}

	private void InstantiateCardPack(int parent_id)
	{
		_seNameGachaAppear = $"se_sys_gacha_appear_{parent_id}";
		_seNameGachaOpen = $"se_sys_gacha_open_{parent_id}";
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_stay_2", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_stay_3", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_stay_4", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_move_1", ResourcesManager.AssetLoadPathType.Effect2D));
		bool isExistFreePackLeaderSkin = false;
		foreach (CardPack item in Data.PackOpen.data.pack_list)
		{
			if (item.IsFreePackLeaderSkin)
			{
				isExistFreePackLeaderSkin = true;
				break;
			}
		}
		if (_isSpecialCardPackSet || isExistFreePackLeaderSkin)
		{
			PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_special_1", ResourcesManager.AssetLoadPathType.Effect2D));
		}
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath($"gch_box_idle_1_{parent_id}", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath($"gch_box_tap_1_{parent_id}", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath($"gch_box_shine_1_{parent_id}", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("gch_box_special_1", ResourcesManager.AssetLoadPathType.Effect2D));
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath("gch_box_special_2", ResourcesManager.AssetLoadPathType.Effect2D));
		string packBoxName = $"md_gachabox_{parent_id}";
		PackAssetNameList.Add(Toolbox.ResourcesManager.GetAssetTypePath(packBoxName, ResourcesManager.AssetLoadPathType.PackBox));
		StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(PackAssetNameList, delegate
		{
			GameObject prefab = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(packBoxName, ResourcesManager.AssetLoadPathType.PackBox, isfetch: true)) as GameObject;
			GameObject gameObject = NGUITools.AddChild(GachaBox, prefab);
			GachaBoxAnim = gameObject.GetComponent<Animation>();
			GachaBoxAnim[GachaBoxAnim.clip.name].speed = -1f;
			GachaBoxAnim.Play();
			GameObject original = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath($"gch_box_idle_1_{parent_id}", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			GameObject original2 = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath($"gch_box_tap_1_{parent_id}", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			GameObject original3 = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath($"gch_box_shine_1_{parent_id}", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			PackEffectIdle1 = UnityEngine.Object.Instantiate(original);
			PackEffectIdle1.transform.position = Vector3.zero;
			PackEffectIdle1.transform.parent = m_EfcMgrIns.EffectContainer.transform;
			PackEffectIdle1.SetActive(value: false);
			PackEffectTap1 = UnityEngine.Object.Instantiate(original2);
			PackEffectTap1.transform.parent = m_EfcMgrIns.EffectContainer.transform;
			PackEffectTap1.transform.position = Vector3.zero;
			PackEffectTap1.SetActive(value: false);
			PackEffectShine1 = UnityEngine.Object.Instantiate(original3);
			PackEffectShine1.transform.parent = m_EfcMgrIns.EffectContainer.transform;
			PackEffectShine1.transform.position = Vector3.zero;
			PackEffectShine1.SetActive(value: false);
			_boxEffectList.Add(PackEffectIdle1);
			_boxEffectList.Add(PackEffectTap1);
			_boxEffectList.Add(PackEffectShine1);
			if (_isCoutainSpecialCard)
			{
				GameObject original4 = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("gch_box_special_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
				GameObject original5 = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("gch_box_special_2", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
				PackEffectSpecial1 = UnityEngine.Object.Instantiate(original4);
				PackEffectSpecial1.transform.parent = m_EfcMgrIns.EffectContainer.transform;
				PackEffectSpecial1.transform.position = Vector3.zero;
				PackEffectSpecial1.SetActive(value: false);
				PackEffectSpecial2 = UnityEngine.Object.Instantiate(original5);
				PackEffectSpecial2.transform.parent = m_EfcMgrIns.EffectContainer.transform;
				PackEffectSpecial2.transform.position = Vector3.zero;
				PackEffectSpecial2.SetActive(value: false);
				_boxEffectList.Add(PackEffectSpecial1);
				_boxEffectList.Add(PackEffectSpecial2);
			}
			GachaStay1Pool = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_stay_2", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			GachaStay2Pool = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_stay_3", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			GachaStay3Pool = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_stay_4", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			GachaTwinkle1Pool = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_move_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			if (_isSpecialCardPackSet || isExistFreePackLeaderSkin)
			{
				GachaSpecialStay1Pool = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_gacha_special_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
			}
			cardPackSize = Data.PackOpen.data.pack_list.Count;
			cardPackNum = (cardPackSize - 1) / 8 + 1;
			LabelPackUnit.text = Data.SystemText.Get("Shop_0089", cardPackNum.ToString());
			List<string> collection = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_boxEffectList, delegate
			{
				StartCoroutine(loadNextPage(delegate
				{
					for (int i = 0; i < m_CardPackList.Count; i++)
					{
						if (m_CardPackList[i] != null)
						{
							m_CardPackList[i].SetActive(value: false);
						}
					}
					ToolboxGame.UIManager.closeInSceneLoading();
					UIManager.GetInstance().CreatFadeOpen();
					SetLabelPackOpenCount();
					RunGachaAnim();
				}));
			});
			EffectAssetPathList.AddRange(collection);
			SetDarkSideParameter(parent_id);
		}));
	}

	private void SetDarkSideParameter(int packId)
	{
		if (Data.Master.GachaMaskDarkDic.TryGetValue(packId, out var value))
		{
			DarkSideTex.color = value.Color;
			DarkSideTex.uvRect = value.UvRect;
		}
	}

	private IEnumerator DisposeCardPackSecen()
	{
		_isDispose = true;
		yield return new WaitForSeconds(1f);
		while (_isNextCardAnim)
		{
			yield return null;
		}
		animCnt = 100;
		StartCoroutine(WaitForCreateCards(delegate
		{
			for (int i = 0; i < m_CardPackList.Count; i++)
			{
				UnityEngine.Object.Destroy(m_CardPackList[i]);
			}
			m_CardPackList.Clear();
			m_EfcMgrIns.DisposeLatestMadeEffects();
			UnityEngine.Object.Destroy(PackEffectIdle1);
			UnityEngine.Object.Destroy(PackEffectTap1);
			UnityEngine.Object.Destroy(PackEffectShine1);
			if (_isCoutainSpecialCard)
			{
				UnityEngine.Object.Destroy(PackEffectSpecial1);
				UnityEngine.Object.Destroy(PackEffectSpecial2);
			}
			_boxEffectList.Clear();
			UnityEngine.Object.Destroy(CardPackParent);
			SkipBtn.gameObject.SetActive(value: false);
			OkBtn.gameObject.SetActive(value: false);
			LabelPackNum.gameObject.SetActive(value: false);
			TouchObj.gameObject.SetActive(value: false);
			GameMgr.GetIns().GetSoundMgr().FadeBgmVolume(m_BackupBgmVolume);
			RemoveAssets();
			MyPageMenu.SetEnableReloadCard();
			UIManager instance = UIManager.GetInstance();
			UIBase uIBase = instance.GetUIBase(_nextScene);
			if (uIBase != null)
			{
				uIBase.Open();
			}
			else
			{
				instance.ChangeViewScene(_nextScene);
			}
		}));
	}

	private IEnumerator WaitForCreateCards(Action callback, bool isCenterLoading = false)
	{
		if (isCenterLoading && !m_IsNextCardCreated)
		{
			UIManager.GetInstance().createInSceneCenterLoading(notBlack: false, notCollider: true);
		}
		while (true)
		{
			if (!m_IsNextCardCreated)
			{
				yield return null;
				continue;
			}
			if (m_IsHideCardFinish)
			{
				break;
			}
			yield return null;
		}
		callback.Call();
	}

	private void OnClickNextBtn()
	{
		SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr();
		if (currentCnt < cardPackSize)
		{
			packOpenCnt++;
			SetLabelPackOpenCount();
			RunGachaAnim();
			soundMgr.PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			soundMgr.PlaySe(Se.TYPE.SYS_GACHA_CARD_OUT);
		}
		else
		{
			soundMgr.PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS);
			animCnt = 100;
			UIManager.GetInstance().CreatFadeClose();
			StartCoroutine(DisposeCardPackSecen());
		}
	}

	private void OnClickSkipBtn()
	{
		UIManager.GetInstance().createInSceneCenterLoading();
		GameMgr.GetIns().GetSoundMgr().StopSeAll(1.5f);
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS);
		IsSkipped = true;
		UIManager.GetInstance().CreatFadeClose();
		StartCoroutine(DisposeCardPackSecen());
	}

	private void RemoveAssets()
	{
		PackAssetNameList.AddRange(EffectAssetPathList);
		PackAssetNameList.AddRange(Toolbox.ResourcesManager.CardListAssetPathList);
		Toolbox.ResourcesManager.RemoveAssetGroup(PackAssetNameList);
		PackAssetNameList.Clear();
		EffectAssetPathList.Clear();
		Toolbox.ResourcesManager.CardListAssetPathList.Clear();
		GameMgr.GetIns().GetPrefabMgr().UnLoad("Gacha/GachaObj");
		GameMgr.GetIns().GetSoundMgr().UnloadSe("se_gacha");
	}

	private void Update()
	{
		if (animCnt == 100)
		{
			return;
		}
		switch (animCnt)
		{
		case 2:
			if (m_InputMgrIns.IsDown())
			{
				RunGachaAnim();
			}
			break;
		case 6:
			if (m_InputMgrIns.IsDown() || m_InputMgrIns.IsPress())
			{
				CheckPressCardOpen();
				mousePosPrev = Input.mousePosition;
			}
			else
			{
				mousePosPrev = Vector3.zero;
			}
			break;
		case 8:
			if (!_cardDetail.GetIsDetailOn() && GameMgr.GetIns().GetInputMgr().isBackKeyEnable)
			{
				GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false;
			}
			break;
		}
	}

	private void OnClickCard(GameObject cardObject)
	{
		if (animCnt == 8 && !_isDispose && !_cardDetail.GetIsDetailOn())
		{
			GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true;
			_cardDetail.OnPushCardDetailOn(cardObject);
		}
	}

	private void RunGachaAnim()
	{
		animCnt++;
		switch (animCnt)
		{
		default:
			_ = 100;
			break;
		case 1:
			GameMgr.GetIns().GetSoundMgr().PlaySeByStr(_seNameGachaAppear, "se_gacha", 0f, 0L);
			GachaLight.transform.localRotation = Quaternion.Euler(Vector3.up * 45f);
			iTween.RotateBy(GachaLight, iTween.Hash("z", -1f, "time", 2f, "looptype", iTween.LoopType.loop, "easetype", iTween.EaseType.linear));
			PackEffectIdle1.SetActive(value: true);
			if (_isCoutainSpecialCard)
			{
				PackEffectSpecial1.SetActive(value: true);
			}
			iTween.MoveTo(GachaCamera.gameObject, iTween.Hash("position", new Vector3(0f, -1200f, -2000f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
			iTween.RotateTo(GachaCamera.gameObject, iTween.Hash("rotation", Vector3.left * 30f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
			iTween.ScaleTo(DarkSideTex.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "easetype", iTween.EaseType.easeInOutExpo));
			Invoke("RunGachaAnim", 2f);
			break;
		case 2:
			TouchObj.gameObject.SetActive(value: true);
			DarkSideTex.transform.localScale = Vector3.one;
			iTween.ScaleTo(DarkSideTex.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 1f, "looptype", iTween.LoopType.pingPong, "easetype", iTween.EaseType.easeInOutQuad));
			break;
		case 3:
			PackEffectIdle1.SetActive(value: false);
			PackEffectTap1.SetActive(value: true);
			if (_isCoutainSpecialCard)
			{
				PackEffectSpecial1.SetActive(value: false);
				PackEffectSpecial2.SetActive(value: true);
			}
			iTween.Stop(DarkSideTex.gameObject);
			GameMgr.GetIns().GetSoundMgr().PlaySeByStr(_seNameGachaOpen, "se_gacha", 0f, 0L);
			TouchObj.gameObject.SetActive(value: false);
			Invoke("RunGachaAnim", 1f);
			break;
		case 4:
			GachaBoxAnim[GachaBoxAnim.clip.name].speed = 1f;
			GachaBoxAnim.Play();
			PackEffectShine1.SetActive(value: true);
			iTween.ScaleTo(DarkSideTex.gameObject, iTween.Hash("scale", Vector3.one * 1.5f, "time", 1f, "delay", 2.5f, "easetype", iTween.EaseType.easeInOutExpo));
			Invoke("RunGachaAnim", 3.5f);
			break;
		case 5:
		{
			for (int num2 = 0; num2 < m_CardPackList.Count; num2++)
			{
				if (!(m_CardPackList[num2] == null))
				{
					m_CardPackList[num2].transform.localPosition = Vector3.back * 200f;
					m_CardPackList[num2].transform.localRotation = Quaternion.Euler(Vector3.up * 180f);
					m_CardPackList[num2].SetActive(value: true);
				}
			}
			if (m_CardPackList.Count <= 8)
			{
				iTween.MoveTo(GachaCamera.gameObject, iTween.Hash("position", POSITION_CARDVIEW_CAMERA, "time", 2.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
				iTween.RotateTo(GachaCamera.gameObject, iTween.Hash("rotation", Vector3.zero, "time", 2.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
				TweenAlpha.Begin(DarkSideTex.gameObject, 2.5f, 0f);
				TweenAlpha.Begin(BgBlackTex.gameObject, 2.5f, 0.8f);
				iTween.RotateTo(GachaLight, iTween.Hash("x", -45f, "y", 0f, "time", 2.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
			}
			SetCardAnimList();
			if (_isAutoOpen)
			{
				SetCardPosResult();
				for (int num3 = 0; num3 < m_CardAnimList.Count; num3++)
				{
					StartCoroutine(AlignCardFirst(num3));
				}
				animCnt = 7;
				Invoke("OpenCardAuto", 1.5f);
			}
			else
			{
				SetCardPosFirst();
				for (int num4 = 0; num4 < m_CardAnimList.Count; num4++)
				{
					StartCoroutine(AlignCardFirst(num4));
				}
			}
			float time = 0.1f;
			float time2 = 1.6f;
			if (m_CardPackList.Count <= 8)
			{
				time = 1.1f;
				time2 = 2.6f;
			}
			else if (_isAutoOpen)
			{
				for (int num5 = 0; num5 < m_CardAnimList.Count; num5++)
				{
					int idx2 = m_CardAnimList[num5].GetComponent<CharIdx>().m_Idx;
					if (m_NameLabelList[idx2] != null)
					{
						m_NameLabelList[idx2].SetActive(value: true);
					}
				}
			}
			Invoke("drawSound", time);
			Invoke("RunGachaAnim", time2);
			m_openCardQueue.Clear();
			break;
		}
		case 6:
			mousePosPrev = Vector3.zero;
			_isNextCardAnim = false;
			LabelPackNum.gameObject.SetActive(value: true);
			m_CardOpenList.Clear();
			m_EfcMgrIns.Start(EffectMgr.EffectType.CMN_GACHA_CURSOR_1, new Vector3(30f, 0f, -1.5f));
			StartCoroutine("OpenCardList_Coroutine");
			break;
		case 7:
			SetCardPosResult();
			AlignCard(0.5f, 0.5f);
			Invoke("RunGachaAnim", 1.1f);
			break;
		case 8:
			_isNextCardAnim = false;
			SetClanLabels(flg: true);
			if (currentCnt < cardPackSize)
			{
				StartCoroutine(loadNextPage(null));
			}
			if (_isAutoOpen)
			{
				for (int num = 0; num < m_CardAnimList.Count; num++)
				{
					int idx = m_CardAnimList[num].GetComponent<CharIdx>().m_Idx;
					if (m_LifeIconList[idx] != null)
					{
						m_LifeIconList[idx].SetActive(value: true);
					}
					if (m_AtkIconList[idx] != null)
					{
						m_AtkIconList[idx].SetActive(value: true);
					}
					if (m_CostIconList[idx] != null)
					{
						m_CostIconList[idx].SetActive(value: true);
					}
					if (m_NameLabelList[idx] != null)
					{
						m_NameLabelList[idx].SetActive(value: true);
					}
				}
				LabelPackNum.gameObject.SetActive(value: true);
			}
			OkBtn.isEnabled = true;
			break;
		case 9:
			_isNextCardAnim = true;
			SetClanLabels(flg: false);
			OkBtn.isEnabled = false;
			HideCard();
			RunGachaAnim();
			break;
		case 10:
			StartCoroutine(WaitForCreateCards(delegate
			{
				animCnt = 4;
				RunGachaAnim();
				UIManager.GetInstance().closeInSceneCenterLoading();
			}, isCenterLoading: true));
			break;
		}
	}

	private void SetCardAnimList()
	{
		foreach (GameObject cardAnim in m_CardAnimList)
		{
			UnityEngine.Object.Destroy(cardAnim);
		}
		m_CardAnimList.Clear();
		for (int i = 0; i < currentCnt; i++)
		{
			m_CardPackList[i] = null;
		}
		for (int j = 0; j < m_CardPackList.Count; j++)
		{
			if (m_CardAnimList.Count >= 8)
			{
				break;
			}
			if (currentCnt >= m_CardPackList.Count)
			{
				break;
			}
			m_CardAnimList.Add(m_CardPackList[currentCnt]);
			currentCnt++;
		}
	}

	private void CheckPressCardOpen()
	{
		Vector3 mousePosition = Input.mousePosition;
		if (mousePosPrev != Vector3.zero)
		{
			Vector3 vector = (mousePosition - mousePosPrev) / 10f;
			for (int i = 1; i <= 10; i++)
			{
				RaycastHit[] array = Physics.RaycastAll(GachaCamera.ScreenPointToRay(vector * i + mousePosPrev));
				for (int j = 0; j < array.Length; j++)
				{
					SetOpenCardQueue(array[j].collider.transform.parent.gameObject);
				}
			}
		}
		else
		{
			RaycastHit[] array = Physics.RaycastAll(GachaCamera.ScreenPointToRay(mousePosition));
			for (int k = 0; k < array.Length; k++)
			{
				SetOpenCardQueue(array[k].collider.transform.parent.gameObject);
			}
		}
	}

	private void SetOpenCardQueue(GameObject obj)
	{
		if (obj.CompareTag("Card") && !m_openCardQueue.Contains(obj) && !IsOpenedCard(obj))
		{
			m_openCardQueue.Enqueue(obj);
		}
	}

	private IEnumerator OpenCardList_Coroutine()
	{
		while (animCnt == 6)
		{
			if (m_openCardQueue.Count > 0)
			{
				OpenCard(m_openCardQueue.Dequeue());
				yield return new WaitForSeconds(0.05f);
			}
			else
			{
				yield return null;
			}
		}
	}

	private void AppearCardComplete(int cnt)
	{
		m_CardPackList[cnt].SetActive(value: false);
	}

	private bool IsOpenedCard(GameObject obj)
	{
		for (int i = 0; i < m_CardOpenList.Count; i++)
		{
			if (m_CardOpenList[i] == obj.GetComponent<CharIdx>().m_Idx)
			{
				return true;
			}
		}
		return false;
	}

	private void OpenCard(GameObject obj)
	{
		if (!IsOpenedCard(obj))
		{
			m_EfcMgrIns.Stop(EffectMgr.EffectType.CMN_GACHA_CURSOR_1);
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GACHA_COMMON);
			float num = 0f;
			int idx = obj.GetComponent<CharIdx>().m_Idx;
			switch (m_RarityList[idx])
			{
			case 1:
				num = 0.3f;
				iTween.MoveTo(obj, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.95f + 30f, "y", obj.transform.position.y * 0.95f, "z", obj.transform.position.z - 0.5f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				break;
			case 2:
			{
				GameMgr.GetIns().GetSoundMgr().StopSe(Se.TYPE.SYS_GACHA_COMMON);
				GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GACHA_RARE);
				num = 0.3f;
				GameObject gameObjIns = m_EfcMgrIns.Start(EffectMgr.EffectType.CMN_GACHA_OPEN_2, obj.transform.position).GetGameObjIns();
				iTween.MoveTo(obj, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.9f + 30f, "y", obj.transform.position.y * 0.9f, "z", obj.transform.position.z - 1f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				iTween.MoveTo(gameObjIns, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.9f + 30f, "y", obj.transform.position.y * 0.9f, "z", obj.transform.position.z - 1f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				break;
			}
			case 3:
			{
				GameMgr.GetIns().GetSoundMgr().StopSe(Se.TYPE.SYS_GACHA_COMMON);
				GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GACHA_EPIC);
				num = 0.5f;
				GameObject gameObjIns = m_EfcMgrIns.Start(EffectMgr.EffectType.CMN_GACHA_OPEN_3, obj.transform.position).GetGameObjIns();
				iTween.MoveTo(obj, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.5f + 30f, "y", obj.transform.position.y * 0.5f, "z", obj.transform.position.z - 4f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				iTween.MoveTo(gameObjIns, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.5f + 30f, "y", obj.transform.position.y * 0.5f, "z", obj.transform.position.z - 4f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				iTween.ShakePosition(GachaCamera.gameObject, iTween.Hash("amount", Vector3.one * 0.1f, "time", num, "oncomplete", "InitCameraPos", "oncompletetarget", base.gameObject));
				break;
			}
			case 4:
			{
				GameMgr.GetIns().GetSoundMgr().StopSe(Se.TYPE.SYS_GACHA_COMMON);
				GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GACHA_LEGEND);
				num = 0.7f;
				GameObject gameObjIns = m_EfcMgrIns.Start(EffectMgr.EffectType.CMN_GACHA_OPEN_4, obj.transform.position).GetGameObjIns();
				iTween.MoveTo(obj, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.25f + 30f, "y", obj.transform.position.y * 0.25f, "z", obj.transform.position.z - 6f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				iTween.MoveTo(gameObjIns, iTween.Hash("x", (obj.transform.position.x - 30f) * 0.25f + 30f, "y", obj.transform.position.y * 0.25f, "z", obj.transform.position.z - 6f, "time", num, "easetype", iTween.EaseType.easeOutExpo));
				iTween.ShakePosition(GachaCamera.gameObject, iTween.Hash("amount", Vector3.one * 0.2f, "time", num, "oncomplete", "InitCameraPos", "oncompletetarget", base.gameObject));
				break;
			}
			}
			iTween.MoveTo(obj, iTween.Hash("position", obj.transform.position, "time", num, "delay", num, "easetype", iTween.EaseType.easeInExpo));
			float num2 = ((CardBefore != null) ? ((!(obj.transform.localPosition.x > CardBefore.transform.localPosition.x)) ? 180f : (-180f)) : ((!(obj.transform.localPosition.x - 9600f < 0f)) ? 180f : (-180f)));
			iTween.RotateAdd(obj, iTween.Hash("y", num2, "time", num, "easetype", iTween.EaseType.easeOutExpo));
			CardBefore = obj;
			m_CardOpenList.Add(idx);
			if (m_CardOpenList.Count >= m_CardAnimList.Count)
			{
				Invoke("RunGachaAnim", 2f);
			}
			OpenCardSetting(obj);
		}
	}

	private void InitCameraPos()
	{
		GachaCamera.transform.localPosition = POSITION_CARDVIEW_CAMERA;
	}

	private void OpenCardSetting(GameObject obj)
	{
		int idx = obj.GetComponent<CharIdx>().m_Idx;
		if (m_RarityList[idx] > 1)
		{
			obj.transform.Find("cmn_gacha_stay").gameObject.SetActive(value: true);
		}
		if (_isSpecialCardPackSet)
		{
			obj.transform.Find("cmn_gacha_special")?.gameObject.SetActive(value: false);
		}
		m_CostIconList[idx].SetActive(value: true);
		if (m_LifeIconList[idx] != null)
		{
			m_LifeIconList[idx].SetActive(value: true);
		}
		if (m_AtkIconList[idx] != null)
		{
			m_AtkIconList[idx].SetActive(value: true);
		}
		if (m_NameLabelList[idx] != null)
		{
			m_NameLabelList[idx].SetActive(value: true);
		}
	}

	private void OpenCardAuto()
	{
		if (!_isDispose)
		{
			for (int i = 0; i < m_CardAnimList.Count; i++)
			{
				OpenCardSetting(m_CardAnimList[i]);
			}
		}
	}

	private IEnumerator AlignCardFirst(int idx)
	{
		iTween.Stop(m_CardAnimList[idx]);
		yield return new WaitForSeconds((float)idx / ((float)m_CardAnimList.Count - 1f) * 0.5f);
		if (_isDispose)
		{
			yield break;
		}
		if (m_CardPackList.Count <= 8)
		{
			iTween.MoveTo(m_CardAnimList[idx], iTween.Hash("z", -1000f, "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			yield return new WaitForSeconds(1f);
			if (_isDispose)
			{
				yield break;
			}
		}
		else
		{
			m_CardAnimList[idx].transform.localPosition += Vector3.back * 1000f;
		}
		m_CardAnimList[idx].transform.Find("cmn_gacha_move").gameObject.SetActive(value: true);
		iTween.MoveTo(m_CardAnimList[idx], iTween.Hash("position", m_CardPosList[idx], "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
		iTween.RotateTo(m_CardAnimList[idx], iTween.Hash("rotation", m_CardRotList[idx], "time", 1f, "easetype", iTween.EaseType.easeOutExpo));
	}

	private void drawSound()
	{
		if (currentCnt != 8)
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GACHA_CARD_IN);
		}
	}

	private void AlignCard(float time, float delay)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GACHA_MOVE);
		for (int i = 0; i < m_CardAnimList.Count; i++)
		{
			iTween.MoveTo(m_CardAnimList[i], iTween.Hash("position", m_CardPosList[i], "time", time, "delay", (float)i / ((float)m_CardAnimList.Count - 1f) * delay, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
			iTween.RotateTo(m_CardAnimList[i], iTween.Hash("rotation", m_CardRotList[i], "time", time, "delay", (float)i / ((float)m_CardAnimList.Count - 1f) * delay, "easetype", iTween.EaseType.easeOutExpo));
		}
	}

	private void HideCard()
	{
		m_IsHideCardFinish = false;
		for (int i = 0; i < m_CardAnimList.Count; i++)
		{
			iTween.MoveTo(m_CardAnimList[i], iTween.Hash("x", 14400f, "time", 0.3f, "delay", (float)i / ((float)m_CardAnimList.Count - 1f) * 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
		}
		Invoke("HideCardFinish", 0.6f);
	}

	private void HideCardFinish()
	{
		m_IsHideCardFinish = true;
	}

	private void SetCardPosFirst()
	{
		m_CardPosList.Clear();
		m_CardRotList.Clear();
		for (int i = 0; i < m_CardAnimList.Count; i++)
		{
			float num = (float)i / ((float)m_CardAnimList.Count - 1f);
			float num2 = ((!(num < 0.5f)) ? (MotionUtils.GetEase(num * 2f - 1f, MotionUtils.EaseType.easeInQuad) * 0.5f + 0.5f) : (MotionUtils.GetEase(num * 2f, MotionUtils.EaseType.easeOutQuad) * 0.5f));
			Vector3 item = new Vector3(num * 4000f - 2000f + 9600f, Mathf.Abs(num2 - 0.5f) * -500f + 250f, (float)i * -10f - 100f);
			Vector3 item2 = new Vector3(0f, -185f, num * 10f - 5f);
			m_CardPosList.Add(item);
			m_CardRotList.Add(item2);
		}
	}

	private void SetCardPosResult()
	{
		float num = 5000f;
		float num2 = 2800f;
		m_CardPosList.Clear();
		m_CardRotList.Clear();
		int num3 = ((m_CardAnimList.Count <= 5) ? m_CardAnimList.Count : ((int)Mathf.Ceil((float)m_CardAnimList.Count / 2f)));
		int num4 = (int)Mathf.Ceil((float)m_CardAnimList.Count / (float)num3);
		for (int i = 0; i < m_CardAnimList.Count; i++)
		{
			int num5 = ((i >= m_CardAnimList.Count - m_CardAnimList.Count % num3) ? (m_CardAnimList.Count % num3) : num3);
			float num6 = num / (float)num5;
			float num7 = num2 / (float)num4;
			float x = (float)(i % num3) * num6 + num6 / 2f - num / 2f + 9600f;
			float y = Mathf.Floor((float)i / (float)num3) * (0f - num7) - num7 / 2f + num2 / 2f + 220f;
			m_CardPosList.Add(new Vector3(x, y, -100f));
			m_CardRotList.Add(Vector3.zero);
		}
	}

	private void SetLabelPackOpenCount()
	{
		LabelPackNum.text = packOpenCnt + "/" + cardPackNum;
	}

	private void SetClanLabels(bool flg)
	{
	}
}
