using System;
using System.Collections;
using System.Collections.Generic;
using Cute;
using LitJson;
using UnityEngine;
using Wizard;
using Wizard.Bingo;
using Wizard.Lottery;
using Wizard.UI.Dialog;

public abstract class MyPageBannerBase : MonoBehaviour
{
	public class BannerInfo
	{
		public string ImageName;

		public string Click;

		public string Status;

		public List<string> ImagePaths;

		public float _changeTime = 5f;

		public bool NeedBadge;

		public GameObject BannerGameObject { get; set; }

		public override bool Equals(object obj)
		{
			if (obj == null || GetType() != obj.GetType())
			{
				return false;
			}
			BannerInfo bannerInfo = obj as BannerInfo;
			if (ImageName == bannerInfo.ImageName && Click == bannerInfo.Click && Status == bannerInfo.Status && _changeTime == bannerInfo._changeTime && NeedBadge == bannerInfo.NeedBadge)
			{
				return true;
			}
			return false;
		}

		public override int GetHashCode()
		{
			return ImageName.GetHashCode() ^ Click.GetHashCode() ^ Status.GetHashCode();
		}

		public void Parse(JsonData json)
		{
			ImageName = json["image_name"].ToString();
			Click = json["click"].ToString();
			Status = json["status"].ToString();
			if (json.Keys.Contains("image_paths") && json["image_paths"] != null && json["image_paths"].Count != 0)
			{
				ImagePaths = new List<string>();
				JsonData jsonData = json["image_paths"];
				for (int i = 0; i < jsonData.Count; i++)
				{
					ImagePaths.Add(jsonData[i].ToString());
				}
			}
			if (json.Keys.Contains("change_time"))
			{
				_changeTime = (float)json["change_time"].ToDouble();
			}
			if (json.Keys.Contains("has_reward"))
			{
				NeedBadge = json["has_reward"].ToInt() == 1;
			}
		}
	}

	[SerializeField]
	private BannerDialog _prefabDialogMypageBanner;

	[SerializeField]
	private GameObject _deckIntroductionPrefab;

	[SerializeField]
	protected GameObject _bannerImagePrefab;

	protected List<BannerInfo> _bannerList;

	private List<string> _loadAssetList;

	private bool _isActive = true;

	private bool _isCreateEnd;

	private bool _isCreate;

	private Coroutine _createCoroutine;

	private const int BANNER_IMAGE_DEPTH = 5;

	public bool IsCreateEnd => _isCreateEnd;

	public bool _isFirstTips { private get; set; }

	public bool IsEnableBanner
	{
		get
		{
			if (_bannerList == null || _bannerList.Count == 0)
			{
				return false;
			}
			return true;
		}
	}

	protected abstract IEnumerator CreateBannerImage();

	public void CreateMyPageBanner()
	{
		if (!_isCreate)
		{
			_createCoroutine = UIManager.GetInstance().StartCoroutine(CreateBanner());
			_isCreate = true;
		}
	}

	private IEnumerator CreateBanner()
	{
		yield return CreateBannerImage();
		_isCreateEnd = true;
		_createCoroutine = null;
		if (IsEnableBanner && _bannerList.Count > 0)
		{
			SetActive(_isActive);
		}
	}

	private void Start()
	{
		_loadAssetList = new List<string>();
	}

	public void Show()
	{
		if (!_isFirstTips)
		{
			base.gameObject.SetActive(value: true);
		}
	}

	public void Hide()
	{
		if (!_isFirstTips)
		{
			base.gameObject.SetActive(value: false);
		}
	}

	public void SetActive(bool inActive)
	{
		_isActive = inActive;
		if (_isCreateEnd)
		{
			if (!IsEnableBanner)
			{
				base.gameObject.SetActive(value: false);
				_isActive = false;
			}
			else
			{
				base.gameObject.SetActive(inActive);
				_isActive = inActive;
			}
		}
		else
		{
			_isActive = inActive;
		}
	}

	protected IEnumerator LoadBannerImage()
	{
		if (IsEnableBanner)
		{
			_loadAssetList = new List<string>();
			List<string> loadImagePath = new List<string>();
			for (int i = 0; i < _bannerList.Count; i++)
			{
				loadImagePath.Add(Toolbox.ResourcesManager.GetAssetTypePath(_bannerList[i].ImageName, ResourcesManager.AssetLoadPathType.UiDownLoad));
			}
			yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadImagePath, null));
			_loadAssetList.AddRange(loadImagePath);
		}
	}

	public static void SceneChangeBySetting(string click, string status)
	{
		switch (click)
		{
		case "announce":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(status);
			return;
		case "colosseum":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			OpenColosseumRound();
			return;
		case "dialog_text":
			OnClickDialogText(status);
			return;
		case "lottery":
			OnClickIncentiveCampaign(int.Parse(status));
			return;
		case "beginner_mission":
			OnClickBeginnerMission();
			return;
		case "webview":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			UIManager.GetInstance().WebViewHelper.OpenWebviewWithPageId(status);
			return;
		case "webview_limited":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			UIManager.GetInstance().WebViewHelper.OpenWebViewDirectly(status, isLimited: true);
			return;
		case "battle_pass_buy":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			BattlePassPurchaseDialog.Create();
			return;
		case "browser":
			OnClickOpenBrowser(status);
			return;
		case "data_link":
			MyPageOtherButtons.CreateDataLinkDialog();
			return;
		case "account_link":
			MyPageOtherButtons.CreateDialogAccountLink();
			return;
		case "mypage_battle":
			if (MyPageMenu.Instance != null)
			{
				GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
				MyPageMenu.Instance.ChangeMenu(2);
			}
			return;
		case "mypage_deck":
			if (MyPageMenu.Instance != null)
			{
				GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
				MyPageMenu.Instance.ChangeMenu(4);
				MyPageMenu.Instance.GoToCardDeck();
			}
			return;
		case "competition":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			OnClickCompetitionBanner();
			return;
		case "bingo":
			OnClickBingoEvent();
			return;
		case "upgrade_treasure_box_cp_dialog":
			OnClickTreasureBoxCpDialog();
			return;
		case "red_ether":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.RedEtherCampaignLobby);
			return;
		case "ts_rotation_deck":
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			DeckListUI.ChangeSceneToDeckList(Format.Rotation);
			return;
		case "account_transition_with_two":
			StartTransititonTask();
			return;
		case "crystal":
			return;
		case "special_crystal":
			return;
		}
		if (click.StartsWith("speed_challenge"))
		{
			HandleSpeedChallenge(click, status);
		}
		else if (SceneTransition.TransitionData.HasTransitionData(click))
		{
			SceneTransition.TransitionData transitionData = new SceneTransition.TransitionData(click);
			if (int.TryParse(status, out var result))
			{
				transitionData.Status = result;
			}
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			SceneTransition.ChangeScene(transitionData, null);
		}
	}

	private static void OnClickOpenBrowser(string url)
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		SystemText systemText = Data.SystemText;
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn);
		dialogBase.SetButtonText(systemText.Get("Dia_Web_001_Button"), systemText.Get("Common_0005"));
		dialogBase.SetText(systemText.Get("Common_0208"));
		dialogBase.onPushButton1 = delegate
		{
			BrowserURL.Open(url);
		};
	}

	protected void InitializeEventHandler(GameObject go, BannerInfo bannerInfo)
	{
		UITexture component = go.GetComponent<UITexture>();
		component.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(bannerInfo.ImageName, ResourcesManager.AssetLoadPathType.UiDownLoad, isfetch: true));
		component.depth = 5;
		_ = Data.SystemText;
		string click = bannerInfo.Click;
		if (click == "dialog_info")
		{
			UIEventListener.Get(go).onClick = delegate
			{
				OnClickDialogInfo(bannerInfo);
			};
		}
		else if (click == "dialog")
		{
			UIEventListener.Get(go).onClick = delegate
			{
				OnClickDialog(bannerInfo);
			};
		}
		else if (click == "deck_intro_rotation")
		{
			UIEventListener.Get(go).onClick = delegate
			{
				OnClickDeckIntroduction(bannerInfo.Status, Format.Rotation);
			};
		}
		else if (click == "deck_intro_unlimited")
		{
			UIEventListener.Get(go).onClick = delegate
			{
				OnClickDeckIntroduction(bannerInfo.Status, Format.Unlimited);
			};
		}
		else
		{
			UIEventListener.Get(go).onClick = delegate
			{
				SceneChangeBySetting(click, bannerInfo.Status);
			};
		}
	}

	private static void HandleSpeedChallenge(string kind, string status)
	{
		SystemText systemText = Data.SystemText;
		if (kind == "speed_challenge")
		{
			SceneChangeBySetting("mypage_battle", status);
			return;
		}
		if (kind == "speed_challenge_clear")
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
			dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
			dialogBase.SetTitleLabel(systemText.Get("SpeedChallenge_0001"));
			dialogBase.SetSize(DialogBase.Size.M);
			GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallenge")) as GameObject;
			dialogBase.SetObj(gameObject);
			DialogSpeedChallenge component = gameObject.GetComponent<DialogSpeedChallenge>();
			string text = systemText.Get("SpeedChallenge_0003");
			if (Data.MyPage.data.SpeedChallengeInfo != null)
			{
				string arg = ConvertTime.ToLocal(Data.MyPage.data.SpeedChallengeInfo.Announce, ConvertTime.FORMAT.TIME_DATE_LONG_SPECIAL);
				text = string.Format(text, arg);
			}
			component.SetText(text);
			component.SetTexture("banner_000764");
			return;
		}
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose();
		dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
		dialogBase2.SetTitleLabel(systemText.Get("SpeedChallenge_0001"));
		dialogBase2.SetSize(DialogBase.Size.M);
		GameObject gameObject2 = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallengeResult")) as GameObject;
		dialogBase2.SetObj(gameObject2);
		DialogSpeedChallengeResult component2 = gameObject2.GetComponent<DialogSpeedChallengeResult>();
		if (kind == "speed_challenge_lottery")
		{
			component2.SetRankText(systemText.Get("Mission_0055"));
		}
		else
		{
			component2.SetRankWithNumber(int.Parse(status));
		}
		if (Data.MyPage.data.SpeedChallengeInfo == null)
		{
			return;
		}
		if (Data.MyPage.data.SpeedChallengeInfo.Message != null)
		{
			if (kind == "speed_challenge_lottery")
			{
				component2.SetText(Data.MyPage.data.SpeedChallengeInfo.Message);
			}
			else
			{
				component2.SetText(string.Format(Data.MyPage.data.SpeedChallengeInfo.Message, status));
			}
		}
		if (Data.MyPage.data.SpeedChallengeInfo.ApplyUrl != null)
		{
			component2.SetUrl(Data.MyPage.data.SpeedChallengeInfo.ApplyUrl);
		}
	}

	private static void OpenColosseumRound()
	{
		ColosseumEntryInfoTask task = new ColosseumEntryInfoTask();
		UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoConnectSuccess));
	}

	private static void ColosseumEntryInfoConnectSuccess(NetworkTask.ResultCode error)
	{
		bool flag = false;
		if (Data.ArenaData.ColosseumData.IsTwoPickRule)
		{
			if (Data.ArenaData.ColosseumData.isJoin)
			{
				flag = true;
			}
		}
		else if (Data.ArenaData.ColosseumData.isJoin && Data.ArenaData.ColosseumData.IsDeckEntry)
		{
			flag = true;
		}
		if (flag)
		{
			ChangeScene(UIManager.ViewScene.Colosseum);
			return;
		}
		MyPageMenu.Instance.GoToColosseum(isColosseumTask: false);
		MyPageMenu.Instance.ChangeMenu(3, isCutCardMotion: true);
	}

	private static void OnClickCompetitionBanner()
	{
		UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(new CompetitionCheckPeriodTask(), delegate
		{
			GoToCompetition();
		}));
	}

	private static void GoToCompetition()
	{
		ArenaCompetition competitionData = Data.ArenaData.CompetitionData;
		if (competitionData == null)
		{
			return;
		}
		if (competitionData.Rule == ArenaColosseum.eRule.TwoPick)
		{
			if (competitionData.IsCompletedTwoPickDeck > 0)
			{
				ChangeScene(UIManager.ViewScene.CompetitionLobby);
				return;
			}
			if (competitionData.EntryStatus == ArenaCompetition.EntryStatusType.NotRegistDeck || competitionData.EntryStatus == ArenaCompetition.EntryStatusType.InBattle)
			{
				ChangeScene(UIManager.ViewScene.Competition2Pick);
				return;
			}
		}
		else if (competitionData.IsInFreeBattleRegistDeck)
		{
			ChangeScene(UIManager.ViewScene.CompetitionLobby);
			return;
		}
		MyPageMenu.Instance.GoToCompetition();
		MyPageMenu.Instance.ChangeMenu(3, isCutCardMotion: true);
	}

	private void OnClickDeckIntroduction(string status, Format format)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		int seriesId = int.Parse(status);
		DeckIntroduction.Create(_deckIntroductionPrefab, MyPageMenu.Instance.HomeMenu.ContentsRoot, seriesId, format);
	}

	private static void OnClickTreasureBoxCpDialog()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
		TreasureBoxCpDialog.CreateDialog();
	}

	private static void OnClickIncentiveCampaign(int no)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		LotteryPage.ChangeSceneLotteryPage(no);
	}

	private static void OnClickBingoEvent()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		BingoPage.ChangeSceneBingoPage();
	}

	private static void OnClickBeginnerMission()
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		ChangeScene(UIManager.ViewScene.BeginnerMission);
	}

	private static void ChangeScene(UIManager.ViewScene scene)
	{
		if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle)
		{
			GameMgr.GetIns().GetBattleCtrl().BattleEnd(scene);
		}
		else
		{
			UIManager.GetInstance().ChangeViewScene(scene);
		}
	}

	private void OnClickDialogInfo(BannerInfo bannerInfo)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		List<string> listBannerName = bannerInfo.ImagePaths;
		List<string> listImagePaths = new List<string>();
		for (int i = 0; i < listBannerName.Count; i++)
		{
			listImagePaths.Add(Toolbox.ResourcesManager.GetAssetTypePath(listBannerName[i], ResourcesManager.AssetLoadPathType.UiDownLoadInfo));
		}
		Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupAsync(listImagePaths, delegate
		{
			DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
			dialogBase.SetSize(DialogBase.Size.M);
			dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0036"));
			dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
			dialogBase.SetPanelDepth(0);
			dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate
			{
				Toolbox.ResourcesManager.RemoveAssetGroup(listImagePaths);
			});
			BannerDialog bannerDialog = UnityEngine.Object.Instantiate(_prefabDialogMypageBanner);
			dialogBase.SetObj(bannerDialog.gameObject);
			List<Texture> list = new List<Texture>();
			for (int num = 0; num < listBannerName.Count; num++)
			{
				list.Add(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(listBannerName[num], ResourcesManager.AssetLoadPathType.UiDownLoadInfo, isfetch: true)) as Texture);
			}
			bannerDialog.Init(list, null, null);
		});
	}

	private void OnClickDialog(BannerInfo bannerInfo)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		VoteDataTask voteDataTask = new VoteDataTask();
		int voteId = int.Parse(bannerInfo.Status);
		voteDataTask.SetParameter(voteId);
		StartCoroutine(Toolbox.NetworkManager.Connect(voteDataTask, delegate
		{
			DialogBase dialog = UIManager.GetInstance().CreateDialogClose(isSystem: true);
			dialog.SetSize(DialogBase.Size.M);
			dialog.SetTitleLabel(Data.VoteInfo.title_text);
			dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
			dialog.SetFadeButtonEnabled(flag: true);
			if (Data.VoteInfo.is_vote)
			{
				dialog.SetText(string.Format(Data.VoteInfo.after_content_text, Data.VoteInfo.vote_name));
			}
			else
			{
				GameMgr.GetIns().GetPrefabMgr().Load("UI/layoutParts/Dialog/DialogWinnerPost");
				GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().Get("UI/layoutParts/Dialog/DialogWinnerPost");
				GameObject gameObject2 = gameObject.GetComponent<NguiObjs>().objs[1];
				Action OnFinishPost = delegate
				{
					dialog.Close();
					DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
					dialogBase.SetSize(DialogBase.Size.S);
					dialogBase.SetPanelDepth(0);
					dialogBase.SetTitleLabel(Data.VoteInfo.title_text);
					dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
					dialogBase.SetFadeButtonEnabled(flag: true);
					dialogBase.SetText(Data.SystemText.Get("Dia_Vote_002"));
				};
				gameObject = NGUITools.AddChild(dialog.gameObject, gameObject);
				NguiObjs component = gameObject.GetComponent<NguiObjs>();
				GameObject gameObject3 = component.objs[0];
				component.labels[0].text = Data.VoteInfo.before_content_text;
				foreach (KeyValuePair<int, string> item in Data.VoteInfo.vote_target_list)
				{
					GameObject postButton = UnityEngine.Object.Instantiate(gameObject2);
					NguiObjs component2 = postButton.GetComponent<NguiObjs>();
					postButton.transform.parent = gameObject3.transform;
					postButton.transform.localScale = gameObject2.transform.localScale;
					postButton.name = item.Key.ToString();
					component2.labels[0].text = item.Value;
					postButton.gameObject.SetActive(value: true);
					component2.buttons[0].onClick.Add(new EventDelegate(delegate
					{
						OnSelectPost(voteId, postButton, OnFinishPost);
					}));
				}
				gameObject3.GetComponent<UIScrollView>().ResetPosition();
			}
		}));
	}

	private static void OnClickDialogText(string status)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		SystemText systemText = Data.SystemText;
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
		dialogBase.SetSize(DialogBase.Size.XL);
		if (!(status == "netease"))
		{
			return;
		}
		dialogBase.SetTitleLabel(systemText.Get("Account_0111"));
		dialogBase.SetText(systemText.Get("Account_0112"));
		dialogBase.onPushButton1 = delegate
		{
			GetDataTranslateTask task = new GetDataTranslateTask();
			UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
			{
				NtDataTranslateManager instance = NtDataTranslateManager.GetInstance();
				if (instance.isTranslate)
				{
					instance.ShowRebind();
				}
				else
				{
					instance.HongKongMacaoUserConfirm();
				}
			}));
		};
		dialogBase.SetOnClickUrl();
	}

	private static void OnClickLegendCrystal(string status)
	{
		GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
		SpecialCrystalDialog.SetDefaultOpenPage(status);
		SpecialCrystalDialog.Create(UIManager.GetInstance().LegendCrystalBuyDialogPrefab, null, null, null);
	}

	private void OnSelectPost(int voteId, GameObject cardObject, Action callback)
	{
		int voteTargetId = int.Parse(cardObject.name);
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true);
		dialogBase.SetSize(DialogBase.Size.S);
		dialogBase.SetTitleLabel(Data.VoteInfo.title_text);
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
		dialogBase.SetFadeButtonEnabled(flag: true);
		dialogBase.SetPanelDepth(2000);
		dialogBase.SetText(string.Format(Data.SystemText.Get("Dia_Vote_001"), Data.VoteInfo.vote_target_list[voteTargetId]));
		dialogBase.onPushButton1 = delegate
		{
			VoteTask voteTask = new VoteTask();
			voteTask.SetParameter(voteId, voteTargetId);
			StartCoroutine(Toolbox.NetworkManager.Connect(voteTask, delegate
			{
				callback.Call();
			}));
		};
	}

	private static void StartTransititonTask()
	{
		TransitionInfoTask task = new TransitionInfoTask();
		UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
		{
			switch (task.Status)
			{
			case 0:
				CreateTransitionDialog();
				break;
			case 1:
				CreateDeleteCodeDialog();
				break;
			case 2:
				CreateCheckTransitionDialog();
				break;
			}
		}));
	}

	private static void CreateTransitionDialog()
	{
		TransitionDialog.Create(CompletePublishCode);
	}

	private static void CompletePublishCode()
	{
		TransitionPublishTask task = new TransitionPublishTask();
		UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
		{
			TransitionPublishDialog.Create(task.Password);
		}));
	}

	private static void CreateDeleteCodeDialog()
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		SystemText systemText = Data.SystemText;
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
		dialogBase.SetButtonText(systemText.Get("BeyondHandover_0013"), systemText.Get("Common_0005"));
		dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001"));
		dialogBase.SetText(systemText.Get("BeyondHandover_0010"));
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.SetButtonDelegate(new EventDelegate(delegate
		{
			DeleteCode();
		}));
	}

	private static void DeleteCode()
	{
		TransitionDeleteTask task = new TransitionDeleteTask();
		UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
		{
			CreateTransitionDialog();
		}));
	}

	private static void CreateCheckTransitionDialog()
	{
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		SystemText systemText = Data.SystemText;
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
		dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001"));
		dialogBase.SetText(systemText.Get("BeyondHandover_0011"));
		dialogBase.SetSize(DialogBase.Size.M);
	}

	protected void OnDestroy()
	{
		if (_loadAssetList != null && _loadAssetList.Count != 0)
		{
			Toolbox.ResourcesManager.RemoveAssetGroup(_loadAssetList);
		}
		if (_createCoroutine != null)
		{
			UIManager.GetInstance().StopCoroutine(_createCoroutine);
		}
	}
}
