using System;
using System.Collections.Generic;
using System.Linq;
using Cute;
using UnityEngine;
using Wizard;
using Wizard.DeckCardEdit;
using Wizard.Dialog.Setting;

public class DeckCreateMenuUI : MonoBehaviour
{
	private enum DeckCopyCodeType
	{
		QRCode,
		DeckCode
	}

	public const int DECK_CODE_LENGTH_MIN = 4;

	[SerializeField]
	private UIButton m_btnCreateNew;

	[SerializeField]
	private UIButton m_btnCopy;

	[SerializeField]
	private UIButton m_btnDeckCode;

	[SerializeField]
	private UIButton m_btnAutoDeck;

	[SerializeField]
	private UIButton _btnCamera;

	[SerializeField]
	private UIButton _btnLibrary;

	[SerializeField]
	private DeckCopyDialog _deckCopyDialogPrefab;

	[SerializeField]
	private DeckCopyDialog _useSubClassDeckCopyDialogPrefab;

	[SerializeField]
	private SubClassSelectDialog _subClassSelectDialogPrefab;

	[SerializeField]
	private ItemToggle _foilPreferred;

	[SerializeField]
	private ItemToggle _isPrizePreferred;

	[SerializeField]
	private UISprite _centerSeparatorLine;

	private DialogBase _parentDialog;

	private Format _format;

	private ConventionDeckList _conventionDeckList;

	private IFormatBehavior _formatBehavior;

	private Action _onStartChangeViewScene;

	private const float CENTER_SEPARATOR_LINE_OFFSET = -70f;

	private static readonly Version ENABLE_USE_CAMERA_LIBRARY_IOS_VERSION = new Version("11.0");

	public static void ShowDeckCreateMenu(DeckData deck, ConventionDeckList conventionDeckList, Action onStartChangeViewScene = null)
	{
		Format format = deck.Format;
		DeckCardEditUI.SetDeckEditParameter(deck, conventionDeckList);
		DeckCreateMenuUI menu = UnityEngine.Object.Instantiate(UIManager.GetInstance()._deckCreateMenuOriginal);
		UnityEngine.Object.Destroy(menu._btnCamera.gameObject);
		menu._btnLibrary.gameObject.transform.SetSiblingIndex(0);
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0108"));
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.SetPanelDepth(10);
		if (conventionDeckList == null)
		{
			menu._foilPreferred.gameObject.SetActive(value: true);
			menu._foilPreferred.SetTitleLabel("プレミアムカード優先");
			menu._foilPreferred.SetValue(Data.Load.data._userConfig.IsFoilPreferred);
			menu._foilPreferred.SetActive_SeparatorLine(isActive: true);
			menu._foilPreferred.AddChangeCallback(delegate
			{
				DeckCardEditUI.SendConfigUpdateFoilPreferred(menu._foilPreferred.GetValue());
			});
			menu._isPrizePreferred.gameObject.SetActive(value: true);
			menu._isPrizePreferred.SetTitleLabel("絵違いカード優先");
			menu._isPrizePreferred.SetValue(Data.Load.data._userConfig.IsPrizePreferred);
			menu._isPrizePreferred.SetActive_SeparatorLine(isActive: true);
			menu._isPrizePreferred.AddChangeCallback(delegate
			{
				DeckCardEditUI.SendConfigUpdatePrizePreferred(menu._isPrizePreferred.GetValue());
			});
		}
		dialogBase.SetObj(menu.gameObject);
		if (conventionDeckList != null)
		{
			Vector3 localPosition = menu.transform.localPosition;
			localPosition.y = -70f;
			menu.transform.localPosition = localPosition;
			menu._centerSeparatorLine.gameObject.SetActive(value: false);
		}
		DeckCreateMenuUI component = menu.GetComponent<DeckCreateMenuUI>();
		component.SetParentDialog(dialogBase);
		component._format = format;
		component._conventionDeckList = conventionDeckList;
		component._formatBehavior = FormatBehaviorManager.Create(format, conventionDeckList);
		component._onStartChangeViewScene = onStartChangeViewScene;
	}

	private void OnSelectFinally()
	{
		DeckCardEditUI.CurrentDeckName = null;
		if (_parentDialog != null)
		{
			_parentDialog.CloseWithoutSelect();
			_parentDialog = null;
		}
	}

	private void Start()
	{
		UIEventListener.Get(m_btnCreateNew.gameObject).onClick = OnClickCreateNew;
		UIEventListener.Get(m_btnCopy.gameObject).onClick = OnClickCopy;
		UIEventListener.Get(m_btnDeckCode.gameObject).onClick = OnClickDeckCode;
		UIEventListener.Get(m_btnAutoDeck.gameObject).onClick = OnClickAutoDeck;
		UIEventListener.Get(_btnCamera.gameObject).onClick = OnClickFromCamera;
		UIEventListener.Get(_btnLibrary.gameObject).onClick = OnClickFromLibrary;
	}

	private void SetParentDialog(DialogBase dialog)
	{
		_parentDialog = dialog;
	}

	private void OnClickCreateNew(GameObject g)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList());
		ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam);
		OnSelectFinally();
	}

	private void OnClickCopy(GameObject g)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		Format format = _format;
		if (format == Format.Crossover)
		{
			format = Format.All;
		}
		DeckInfoTask task = new DeckInfoTask();
		task.SetParameterForCopySrcGet(Format.All, format);
		UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
		{
			DeckGroupListData deckGroupListData = task.DeckGroupListData;
			if (!_formatBehavior.UseSubClass)
			{
				deckGroupListData.RemoveUseSubClassDeckList();
			}
			if (_format != Format.MyRotation)
			{
				deckGroupListData.RemoveFormat(Format.MyRotation);
			}
			deckGroupListData.ForceVisiblePreRotation(Prerelease.Status != Prerelease.eStatus.NONE);
			Format value = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT);
			DeckSelectUIDialog.Create(Data.SystemText.Get("Card_0109"), deckGroupListData, value, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, isVisibleCreateNew: false, returnDeckSelect, new DeckSelectUI.InitOptions
			{
				OnUpdateDeckUICustomize = OnUpdateDeckUIForConvention
			}).SetPanelDepth(12);
			_parentDialog.Close();
		}));
	}

	private void OnUpdateDeckUIForConvention(DeckUI deckUI)
	{
		if (_conventionDeckList == null)
		{
			return;
		}
		if (!deckUI.Deck.IsUsable(canUseNonPossessionCard: true))
		{
			deckUI.SetSelectable(isSelectable: false);
			return;
		}
		bool flag = _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckClassID());
		if (_formatBehavior.UseSubClass && _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckSubClassID()))
		{
			flag = true;
		}
		if (flag)
		{
			deckUI.SetTextCenterLabe(Data.SystemText.Get("RoomBattle_0085"));
			deckUI.SetSelectable(isSelectable: false);
		}
	}

	private void OnClickDeckCode(GameObject g)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		DialogBase nameEditDialog = InputDialog.Create(16, 16, UIInput.KeyboardType.EmailAddress);
		nameEditDialog.InputAreaObjs.labels[2].text = Data.SystemText.Get("Card_0110");
		nameEditDialog.InputAreaObjs.labels[3].text = "";
		nameEditDialog.SetTitleLabel(Data.SystemText.Get("Card_0111"));
		if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.QuestSelectionPage))
		{
			AllLabelColorChanger.ChangeAllLabel(nameEditDialog.InputAreaObjs.gameObject);
		}
		Action method_btn = delegate
		{
			string text = nameEditDialog.InputAreaObjs.labels[0].text;
			GetDeckDataFromCodeTask getDeckDataFromCodeTask = new GetDeckDataFromCodeTask();
			getDeckDataFromCodeTask.SetParameter(text);
			UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(getDeckDataFromCodeTask, OnSuccessDeckCodeInfo, OnFailedDeckCodeInfo, OnFailedDeckCodeInfo, encrypt: false));
		};
		nameEditDialog.SetButtonDelegate(method_btn);
		nameEditDialog.SetPanelDepth(2000);
		nameEditDialog.SetButtonDisable(isEnableOK: true);
		UIInput deckCodeInput = nameEditDialog.GetComponentInChildren<UIInput>();
		if (deckCodeInput != null)
		{
			deckCodeInput.onChange.Add(new EventDelegate(delegate
			{
				nameEditDialog.SetButtonDisable(deckCodeInput.value.Length < 4);
			}));
		}
		_parentDialog.Close();
	}

	private void OnClickAutoDeck(GameObject g)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.AUTO_DECK_CREATE))
		{
			ButtonMaintenance();
			return;
		}
		bool canUseNonPossessionCard = _conventionDeckList == null;
		DeckCardEditUI.SetCreateAutoParameter(_format, canUseNonPossessionCard);
		ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList());
		ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam);
		OnSelectFinally();
	}

	private void OnClickFromCamera(GameObject g)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE))
		{
			ButtonMaintenance();
			return;
		}
		GameObject qrCameraObject = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefab/UI/QrCamera"));
		QrCamera qrCamera = qrCameraObject.GetComponent<QrCamera>();
		UIButton backButton = qrCamera.backButton;
		qrCamera.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo);
		UIManager.GetInstance().createInSceneCenterLoading();
		UIManager.GetInstance().StartCoroutine(qrCamera.StartQRCamera(qrCameraObject, _formatBehavior.CardMasterId, delegate
		{
			_parentDialog.Close();
			UIManager.GetInstance().closeInSceneCenterLoading();
			backButton.onClick.Add(new EventDelegate(delegate
			{
				GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL);
				qrCamera.StopQRCamera();
				UnityEngine.Object.Destroy(qrCameraObject);
			}));
		}, delegate
		{
			qrCamera.StopQRCamera();
			UnityEngine.Object.Destroy(qrCameraObject);
			FailedToStartQRCamera();
			UIManager.GetInstance().closeInSceneCenterLoading();
			_parentDialog.Close();
		}));
	}

	private void OnClickFromLibrary(GameObject g)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE))
		{
			ButtonMaintenance();
			return;
		}
		GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefab/UI/QrCamera"));
		QrCamera component = gameObject.GetComponent<QrCamera>();
		component.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo);
		component.StartGetQRCodeFromImageFile(gameObject, _formatBehavior.CardMasterId);
		UnityEngine.Object.Destroy(gameObject);
		_parentDialog.Close();
	}

	private void FailedToStartQRCamera()
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0270"));
		dialogBase.SetPanelDepth(2000);
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.OnClose = delegate
		{
			OnSelectFinally();
		};
	}

	private void ButtonMaintenance()
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0266"));
		dialogBase.SetPanelDepth(2000);
		dialogBase.SetSize(DialogBase.Size.M);
	}

	private DialogBase CreateDeckCopyDialog(DialogBase dialogDeckList, DeckData deck)
	{
		bool flag = _formatBehavior.UseSubClass && FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass;
		if (_format == Format.MyRotation)
		{
			if (deck.Format == Format.MyRotation)
			{
				return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck);
			}
			return DeckCopyDialog.CreateDeckCopyDialogForMyRotation(_deckCopyDialogPrefab, deck);
		}
		if (flag)
		{
			return DeckCopyDialog.CreateDeckCopyDialogUseSubClass(_useSubClassDeckCopyDialogPrefab, deck);
		}
		return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck);
	}

	private void returnDeckSelect(DialogBase dialogDeckList, DeckData deck)
	{
		DialogBase dialog = CreateDeckCopyDialog(dialogDeckList, deck);
		dialog.onPushButton1 = delegate
		{
			if (!_formatBehavior.UseSubClass)
			{
				OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
			}
			else if (FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS))
			{
				OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
			}
			else
			{
				OnSelectSubClassFromDeckCopy(dialog, dialogDeckList, deck);
			}
		};
		dialog.SetPanelDepth(100);
	}

	private void OnSelectSubClassFromDeckCopy(DialogBase dialog, DialogBase dialogDeckList, DeckData deck)
	{
		dialog.Close();
		SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId)
		{
			deck.SetDeckSubClassID(classId);
			OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
		});
	}

	private void OnChangeViewSceneFromDeckCopy(DialogBase dialogDeckList, DeckData deck)
	{
		bool isCopySubClass = FormatBehaviorManager.Create(deck.Format, _conventionDeckList).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS);
		MyRotationInfo myRotationInfo = null;
		if (_format == Format.MyRotation)
		{
			myRotationInfo = ((deck.Format != Format.MyRotation) ? deck.GetMyRotationInfoFromCardList() : Data.MyRotationAllInfo.Get(deck.MyRotationId));
		}
		DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: false, isCopySubClass, _conventionDeckList, myRotationInfo);
		dialogDeckList.CloseWithoutSelect();
		ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
		OnSelectFinally();
	}

	private void OnSuccessDeckCodeInfo(NetworkTask.ResultCode errorcode)
	{
		OnSuccessCodeDeckInfo(DeckCopyCodeType.DeckCode);
	}

	private void OnSuccessQRCodeDeckInfo()
	{
		OnSuccessCodeDeckInfo(DeckCopyCodeType.QRCode);
	}

	private void OnSuccessCodeDeckInfo(DeckCopyCodeType copyCodeType)
	{
		bool flag = false;
		SetCodeCopyDeckParam(copyCodeType, out var clanId, out var subClanId, out var isSubClassSet, out var cardIds, out var myRotationInfo);
		if (_conventionDeckList != null)
		{
			List<int> conventionDeckClassList = _conventionDeckList.GetConventionDeckClassList();
			for (int i = 0; i < conventionDeckClassList.Count; i++)
			{
				if (conventionDeckClassList[i] == clanId)
				{
					flag = true;
					break;
				}
			}
			if (_formatBehavior.UseSubClass)
			{
				for (int j = 0; j < conventionDeckClassList.Count; j++)
				{
					if (conventionDeckClassList[j] == subClanId)
					{
						flag = true;
						break;
					}
				}
			}
		}
		if (isDeckcodeIncludingNonExistentCard(cardIds))
		{
			string title = Data.SystemText.Get("Card_0196");
			string text = Data.SystemText.Get("Card_0197");
			CreateErrorDialog(title, text).OnClose = delegate
			{
				OnSelectFinally();
			};
		}
		else if (flag)
		{
			string title2 = Data.SystemText.Get("ErrorHeader_10002");
			string text2 = Data.SystemText.Get("Arena_0067");
			if (_formatBehavior.UseSubClass)
			{
				text2 = Data.SystemText.Get("Arena_0141");
			}
			CreateErrorDialog(title2, text2).OnClose = delegate
			{
				OnSelectFinally();
			};
		}
		else if (!_formatBehavior.UseSubClass && isSubClassSet)
		{
			string title3 = Data.SystemText.Get("Card_0196");
			string text3 = "";
			switch (copyCodeType)
			{
			case DeckCopyCodeType.QRCode:
				text3 = Data.SystemText.Get("Card_0285");
				break;
			case DeckCopyCodeType.DeckCode:
				text3 = Data.SystemText.Get("Card_0295");
				break;
			}
			CreateErrorDialog(title3, text3).OnClose = delegate
			{
				OnSelectFinally();
			};
		}
		else if (myRotationInfo != null && _format != Format.MyRotation)
		{
			string title4 = Data.SystemText.Get("Card_0196");
			string text4 = "";
			switch (copyCodeType)
			{
			case DeckCopyCodeType.QRCode:
				text4 = Data.SystemText.Get("MyRotation_ID_17");
				break;
			case DeckCopyCodeType.DeckCode:
				text4 = Data.SystemText.Get("MyRotation_ID_18");
				break;
			}
			CreateErrorDialog(title4, text4).OnClose = delegate
			{
				OnSelectFinally();
			};
		}
		else
		{
			DeckData deck = CreateDeckFromCopyCode(clanId, subClanId, isSubClassSet, cardIds, myRotationInfo);
			if (_formatBehavior.UseSubClass && !isSubClassSet)
			{
				OnCreateDeckFromCodeSelectSubClass(deck);
			}
			else
			{
				OnCreateDeckFromCode(deck);
			}
		}
	}

	private void SetCodeCopyDeckParam(DeckCopyCodeType deckCopyCodeTypeout, out int clanId, out int subClanId, out bool isSubClassSet, out int[] cardIds, out MyRotationInfo myRotationInfo)
	{
		clanId = 10;
		subClanId = 10;
		isSubClassSet = false;
		cardIds = null;
		myRotationInfo = null;
		switch (deckCopyCodeTypeout)
		{
		case DeckCopyCodeType.QRCode:
			clanId = (int)QRCodeUtility.deckDataFromQRCode.ClanId;
			subClanId = (int)QRCodeUtility.deckDataFromQRCode.SubClanId;
			isSubClassSet = QRCodeUtility.deckDataFromQRCode.IsSubClassSet;
			cardIds = QRCodeUtility.deckDataFromQRCode.CardIds;
			myRotationInfo = QRCodeUtility.deckDataFromQRCode.MyRotationInfo;
			break;
		case DeckCopyCodeType.DeckCode:
			clanId = Data.DeckDataFromDeckCode.ClanId;
			subClanId = Data.DeckDataFromDeckCode.SubClanId;
			isSubClassSet = Data.DeckDataFromDeckCode.IsSubClanSet;
			cardIds = Data.DeckDataFromDeckCode.CardIds;
			if (Data.DeckDataFromDeckCode.MyRotationId != null)
			{
				myRotationInfo = Data.MyRotationAllInfo.Get(Data.DeckDataFromDeckCode.MyRotationId);
			}
			break;
		}
	}

	private DeckData CreateDeckFromCopyCode(int clanId, int subClanId, bool isSubClassSet, int[] cardIds, MyRotationInfo myRotationInfo)
	{
		DeckData deckData = new DeckData(_format);
		deckData.SetDeckClassID(clanId);
		if (isSubClassSet)
		{
			deckData.SetDeckSubClassID(subClanId);
		}
		deckData.SetDeckName("");
		deckData.SetDeckSleeveID(3000011L);
		deckData.SetDeckIsComplete(isComplete: true);
		deckData.SetCardIdList(cardIds.ToList());
		if (myRotationInfo != null)
		{
			deckData.MyRotationId = myRotationInfo.Id;
		}
		return deckData;
	}

	private DialogBase CreateErrorDialog(string title, string text)
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
		dialogBase.SetPanelDepth(2000);
		dialogBase.SetTitleLabel(title);
		dialogBase.SetText(text);
		dialogBase.SetSize(DialogBase.Size.M);
		return dialogBase;
	}

	private void OnFailedQRCodeDeckInfo(string message)
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(message);
		dialogBase.SetPanelDepth(2000);
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.OnClose = delegate
		{
			OnSelectFinally();
		};
	}

	private void OnCreateDeckFromCode(DeckData deck)
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
		dialogBase.SetPanelDepth(2000);
		dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0142"));
		dialogBase.SetText(Data.SystemText.Get("Card_0115"));
		if (_format == Format.MyRotation && Data.MyRotationAllInfo.Get(deck.MyRotationId) == null)
		{
			MyRotationInfo myRotationInfoFromCardList = deck.GetMyRotationInfoFromCardList();
			deck.MyRotationId = myRotationInfoFromCardList.Id;
		}
		dialogBase.OnCloseStart = delegate
		{
			DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: true, _conventionDeckList);
			ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
			OnSelectFinally();
		};
	}

	private void OnCreateDeckFromCodeSelectSubClass(DeckData deck)
	{
		SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId)
		{
			deck.SetDeckSubClassID(classId);
			DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: false, _conventionDeckList);
			ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
			OnSelectFinally();
		});
	}

	private bool isDeckcodeIncludingNonExistentCard(int[] targetDeckCardIds)
	{
		List<int> allCardIds = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetAllCardIds();
		int num = targetDeckCardIds.Length;
		for (int i = 0; i < num; i++)
		{
			int item = targetDeckCardIds[i];
			if (!allCardIds.Contains(item))
			{
				return true;
			}
		}
		return false;
	}

	private void OnFailedDeckCodeInfo(NetworkTask.ResultCode errorcode)
	{
		OnSelectFinally();
	}

	private void OnFailedDeckCodeInfo(int errorcode)
	{
		OnSelectFinally();
	}

	private List<int> GetConventionUsedClassIdList()
	{
		List<int> result = new List<int>();
		if (_conventionDeckList == null)
		{
			return result;
		}
		return _conventionDeckList.GetConventionDeckClassList();
	}

	private void ChangeViewScene(UIManager.ViewScene viewScene, object sceneParam)
	{
		_onStartChangeViewScene.Call();
		if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Battle))
		{
			GameMgr.GetIns().GetBattleCtrl().BattleEnd(viewScene, null, null, sceneParam);
		}
		else
		{
			UIManager.GetInstance().ChangeViewScene(viewScene, null, sceneParam);
		}
	}
}
