using System;
using System.Collections;
using UnityEngine;
using Wizard;

public class VideoHostingUtil : SingletonMonoBehaviour<VideoHostingUtil>
{
	public enum Option
	{
		EnemyNameDisplay,
		RecordPauseInMenu,
		UseRecordingFaceCamera,
		UseRecordingMicrophone,
		UsePublishingFaceCamera,
		UsePublishingMicrophone,
		NicoNicoNotificationAgreement,
		AutoPauseRecording,
		AutoPausePublishing,
		AutoStopRecording,
		IsPublishing,
		IsRecording,
		Max
	}

	public enum HUDScene
	{
		Title = 0,
		Home = 1,
		Battle = 2,
		BattleResult = 3,
		RoomMatchRobby = 4,
		Default = 1
	}

	private enum RecordingAutoStopStatus
	{
		Null,
		Active,
		Pause
	}

	public const int FACECAMERAWINDOW_WIDTH_DEFAULT = 72;

	public const int FACECAMERAWINDOW_HEIGHT_DEFAULT = 72;

	public const float FACECAMERAWINDOW_WIDTH_MIN = 72f;

	public const float FACECAMERAWINDOW_WIDTH_MAX = 400f;

	public const float FACECAMERAWINDOW_HEIGHT_MIN = 72f;

	public const float FACECAMERAWINDOW_HEIGHT_MAX = 400f;

	private const int TAGRECORDING_EDITABLE_CAPACITY = 2;

	private const int TAGRECORDING_UNEDITABLE_CAPACITY = 2;

	private const int TAGPUBLISHING_UNEDITABLE_CAPACITY = 3;

	public const int VIDEOHOSTING_DIALOG_OVERLAY_DEPTH = 5000;

	public const int VIDEOHOSTING_DIALOG_OVERLAY_DEPTH_AUTOSTOP = 5010;

	private const int NICONICODIALOG_BUTTON_NICONICO = 0;

	private const int NICONICODIALOG_BUTTON_NICONAMA = 1;

	private const int NICONICODIALOG_BUTTON_AGREE = 2;

	private const int NICONICODIALOG_LABEL_NICONICO = 0;

	private const int NICONICODIALOG_LABEL_NICONAMA = 1;

	private const int NICONICODIALOG_LABEL_AGREE = 2;

	private const int NICONICODIALOG_LABEL_DIALOGBODY = 3;

	private const int NICONICODIALOG_TOGGLE_AGREE = 0;

	public const int VIDEOHOSTING_OPTION_DEFAULT = 1;

	private const int ERROR_DIALOG_DEPTH_OFFSET = 5;

	private const int ERROR_DIALOG_MAX = 100;

	private const float DELAY_UPLOAD_SEC = 0.3f;

	private const float DELAY_UPLOAD_RETURN_MUTE_SEC = 1f;

	private const float RECORD_AUTOSTOP_SEC_BUFFER = 10f;

	private const float RECORD_AUTOSTOP_SEC = 1510f;

	private bool _isRecordModeEnable;

	private bool _isPublishModeEnable;

	private HUDScene _HUDScene = HUDScene.Home;

	[SerializeField]
	private GameObject _niconicoNotifcation;

	private double _autoStopTimer;

	private RecordingAutoStopStatus _autoStopStatus;

	public static int GetFaceCameraWindowXDefault()
	{
		UIManager uIManager = UIManager.GetInstance();
		if (null == uIManager)
		{
			return 0;
		}
		if (null == uIManager.getCamera() || null == uIManager.GetVideoHostingHUD())
		{
			return 0;
		}
		return (int)uIManager.getCamera().WorldToScreenPoint(uIManager.GetVideoHostingHUD().GetFaceCameraWindowLocator().position).x;
	}

	public static int GetFaceCameraWindowYDefault()
	{
		UIManager uIManager = UIManager.GetInstance();
		if (null == uIManager)
		{
			return Screen.height;
		}
		if (null == uIManager.getCamera() || null == uIManager.GetVideoHostingHUD())
		{
			return Screen.height;
		}
		return (int)uIManager.getCamera().WorldToScreenPoint(uIManager.GetVideoHostingHUD().GetFaceCameraWindowLocator().position).y;
	}

	private void Update()
	{
		_UpdateRecordingAutoStopTimer();
	}

	public static bool GetRecordModeEnable()
	{
		return SingletonMonoBehaviour<VideoHostingUtil>.instance._isRecordModeEnable;
	}

	public static void SetRecordModeEnable(bool isEnable)
	{
		SingletonMonoBehaviour<VideoHostingUtil>.instance._isRecordModeEnable = isEnable;
	}

	public static bool GetPublishModeEnable()
	{
		return SingletonMonoBehaviour<VideoHostingUtil>.instance._isPublishModeEnable;
	}

	public static void SetPublishModeEnable(bool isEnable)
	{
		SingletonMonoBehaviour<VideoHostingUtil>.instance._isPublishModeEnable = isEnable;
	}

	public static bool GetOptionFlagFromPlayerPrefs(Option option)
	{
		if (option < Option.EnemyNameDisplay || option >= Option.Max)
		{
			return false;
		}
		int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_FLAGS);
		return (value & (1 << (int)option)) != 0;
	}

	public static void SetOptionFlagFromPlayerPrefs(Option option, bool enable)
	{
		if (option >= Option.EnemyNameDisplay && option < Option.Max)
		{
			int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_FLAGS);
			value = ((!enable) ? (value & ~(1 << (int)option)) : (value | (1 << (int)option)));
			PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.VIDEOHOSTING_FLAGS, value);
		}
	}

	public static string GetVideoHostingVersion()
	{
		return PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_VERSION);
	}

	public static void SetVideoHostingVersion(string version)
	{
		PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.VIDEOHOSTING_VERSION, version);
	}

	public static void CreateVideoHostingSetting()
	{
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording() || SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising())
		{
			CreateDialogInvalidOperation();
		}
		else
		{
			UIManager.GetInstance().CreateVideoHostingSettingRoot().SetTitleLabel(GetVideoHostingSettingTitle());
		}
	}

	public static void CreateNicoNicoNotification()
	{
		SystemText systemText = Data.SystemText;
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetSize(DialogBase.Size.M);
		dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
		dialogBase.SetTitleLabel(systemText.Get("VideoHosting_0037"));
		dialogBase.SetButtonText(systemText.Get("Common_0004"), systemText.Get("Common_0005"));
		GameObject gameObject = UnityEngine.Object.Instantiate(SingletonMonoBehaviour<VideoHostingUtil>.instance._niconicoNotifcation);
		dialogBase.SetObj(gameObject);
		gameObject.GetComponent<VideoHostingNicoNicoNotification>().SetParent(dialogBase);
	}

	public static string GetVideoHostingSettingTitle()
	{
		return Data.SystemText.Get("VideoHosting_0001");
	}

	public static void CheckVideoHostingAndShowAchievement(Action cbAchievement)
	{
		cbAchievement();
	}

	public static void CheckVideoHostingAndExecAction(Action cbClose)
	{
		bool flag = SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising() && !SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublishingPause();
		bool flag2 = SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording() && !SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecordingPause();
		if (flag || flag2)
		{
			SystemText systemText = Data.SystemText;
			DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
			dialogBase.SetSize(DialogBase.Size.S);
			dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
			dialogBase.SetTitleLabel(systemText.Get("Common_0021"));
			dialogBase.SetButtonText(systemText.Get("Common_0004"));
			dialogBase.SetPanelDepth(5000);
			dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, cbClose);
			if (flag)
			{
				dialogBase.SetText(systemText.Get("VideoHosting_0069"));
			}
			else
			{
				dialogBase.SetText(systemText.Get("VideoHosting_0077"));
			}
		}
		else
		{
			cbClose();
		}
	}

	private static void _OverrideSoundMute()
	{
		GameMgr.GetIns().GetSoundMgr().AllMute(isMute: true);
	}

	private static void _ReturnSoundMute()
	{
		GameMgr.GetIns().GetSoundMgr().AllMute(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE));
	}

	public static void UploadRecordingAndSoundMute()
	{
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.HasRecordedData() && !SingletonMonoBehaviour<VideoHostingManager>.instance.IsUploading())
		{
			_OverrideSoundMute();
			SingletonMonoBehaviour<VideoHostingManager>.instance.UploadRecording();
		}
		else
		{
			CreateDialogNotHasRecordedData();
		}
	}

	private static void _DelayUpload()
	{
		UIManager.GetInstance().closeInSceneCenterLoading();
		UploadRecordingAndSoundMute();
	}

	public static void CheckAndCreateHUD(HUDScene scene)
	{
		if (GetRecordModeEnable())
		{
			UIManager.GetInstance().CreateVideoHostingHUD(VideoHostingHUD.HUDMode.Recording);
			SetHUDScene(scene);
		}
		else if (GetPublishModeEnable())
		{
			UIManager.GetInstance().CreateVideoHostingHUD(VideoHostingHUD.HUDMode.Publishing);
			SetHUDScene(scene);
		}
		else
		{
			UIManager.GetInstance().DestroyVideoHostingHUD();
		}
	}

	public static void SetHUDScene(HUDScene scene)
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (null == videoHostingHUD)
		{
			return;
		}
		bool pushEnablePlay = false;
		bool pushEnableSetting = false;
		int controlButtonLayer = VideoHostingHUD.CONTROLBUTTON_LAYER_DEFAULT;
		switch (scene)
		{
		case HUDScene.Home:
			if (GetRecordModeEnable())
			{
				pushEnablePlay = true;
				pushEnableSetting = true;
			}
			else if (GetPublishModeEnable())
			{
				pushEnablePlay = true;
				pushEnableSetting = true;
			}
			break;
		case HUDScene.Battle:
			if (GetRecordModeEnable())
			{
				pushEnablePlay = true;
				pushEnableSetting = true;
			}
			else if (GetPublishModeEnable())
			{
				pushEnablePlay = false;
				pushEnableSetting = true;
			}
			controlButtonLayer = VideoHostingHUD.CONTROLBUTTON_LAYER_BATTLE;
			break;
		case HUDScene.BattleResult:
			if (GetRecordModeEnable())
			{
				pushEnablePlay = true;
				pushEnableSetting = true;
			}
			else if (GetPublishModeEnable())
			{
				pushEnablePlay = false;
				pushEnableSetting = true;
			}
			break;
		case HUDScene.RoomMatchRobby:
			if (GetRecordModeEnable())
			{
				pushEnablePlay = true;
				pushEnableSetting = true;
			}
			else if (GetPublishModeEnable())
			{
				pushEnablePlay = false;
				pushEnableSetting = true;
			}
			break;
		case HUDScene.Title:
			if (GetRecordModeEnable())
			{
				pushEnablePlay = false;
				pushEnableSetting = false;
			}
			else if (GetPublishModeEnable())
			{
				pushEnablePlay = false;
				pushEnableSetting = false;
			}
			break;
		}
		SingletonMonoBehaviour<VideoHostingUtil>.instance._HUDScene = scene;
		videoHostingHUD.SetPushEnablePlay(pushEnablePlay);
		videoHostingHUD.SetPushEnableSetting(pushEnableSetting);
		videoHostingHUD.SetControlButtonLayer(controlButtonLayer);
	}

	public static HUDScene GetHUDScene()
	{
		return SingletonMonoBehaviour<VideoHostingUtil>.instance._HUDScene;
	}

	public static bool CheckHUDSceneUploadEnable(HUDScene scene)
	{
		if (scene == HUDScene.Battle || scene == HUDScene.BattleResult || scene == HUDScene.RoomMatchRobby)
		{
			return false;
		}
		return true;
	}

	public static void FaceCameraAdjustSwitch()
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (!(null == videoHostingHUD))
		{
			if (GetPublishModeEnable() && SingletonMonoBehaviour<VideoHostingManager>.instance.GetPublishingFaceCameraEnable())
			{
				videoHostingHUD.InitFaceCameraAdjust();
				videoHostingHUD.SetFaceCameraAdjustSwitchEnable(isEnable: true);
			}
			else
			{
				videoHostingHUD.SetFaceCameraAdjustSwitchEnable(isEnable: false);
			}
		}
	}

	private static IEnumerator _InitHUDForPublishing()
	{
		VideoHostingHUD vhHUD = UIManager.GetInstance().GetVideoHostingHUD();
		while (!vhHUD.GetInitialized())
		{
			yield return null;
		}
		UIManager.GetInstance().GetVideoHostingHUD().OnStartPublishing();
		FaceCameraAdjustSwitch();
	}

	public static bool IsAutoPauseRecording()
	{
		return GetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording);
	}

	public static bool IsAutoStopRecording()
	{
		return GetOptionFlagFromPlayerPrefs(Option.AutoStopRecording);
	}

	public static bool IsAutoPausePublishing()
	{
		return GetOptionFlagFromPlayerPrefs(Option.AutoPausePublishing);
	}

	public static void AutoPausePublishing(bool isSave)
	{
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising() && !SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublishingPause())
		{
			SingletonMonoBehaviour<VideoHostingManager>.instance.PausePublishing();
			if (isSave)
			{
				SetOptionFlagFromPlayerPrefs(Option.AutoPausePublishing, enable: true);
			}
		}
	}

	public static void AutoPauseRecording(bool isSave)
	{
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording() && !SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecordingPause())
		{
			SingletonMonoBehaviour<VideoHostingManager>.instance.PauseRecording();
			if (isSave)
			{
				SetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording, enable: true);
			}
		}
	}

	public static void AutoStopRecording(bool isSave)
	{
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording())
		{
			SingletonMonoBehaviour<VideoHostingManager>.instance.StopRecording();
			if (isSave)
			{
				SetOptionFlagFromPlayerPrefs(Option.AutoStopRecording, enable: true);
			}
		}
	}

	public static void AutoResumePublishing()
	{
		if (IsAutoPausePublishing())
		{
			if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublishingPause())
			{
				SingletonMonoBehaviour<VideoHostingManager>.instance.ResumePublishing();
			}
			SetOptionFlagFromPlayerPrefs(Option.AutoPausePublishing, enable: false);
		}
	}

	public static void AutoResumeRecording()
	{
		if (IsAutoPauseRecording())
		{
			if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecordingPause())
			{
				SingletonMonoBehaviour<VideoHostingManager>.instance.ResumeRecording();
			}
			SetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording, enable: false);
		}
	}

	private void _UpdateRecordingAutoStopTimer()
	{
		if (RecordingAutoStopStatus.Active != _autoStopStatus)
		{
			return;
		}
		_autoStopTimer -= Time.deltaTime;
		if (_autoStopTimer < 0.0)
		{
			VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
			if (null != videoHostingHUD)
			{
				videoHostingHUD.CloseSettingMenuDialog();
			}
			CreateDialogStopRecording(CheckHUDSceneUploadEnable(GetHUDScene()), isTimeOut: true);
			SingletonMonoBehaviour<VideoHostingManager>.instance.StopRecording();
			_StopRecordingAutoStopTimer();
		}
	}

	private void _StartRecordingAutoStopTimer(float sec)
	{
		_StopRecordingAutoStopTimer();
		_autoStopStatus = RecordingAutoStopStatus.Active;
		_autoStopTimer = sec;
	}

	private void _StopRecordingAutoStopTimer()
	{
		_autoStopStatus = RecordingAutoStopStatus.Null;
		_autoStopTimer = 0.0;
	}

	private void _PauseRecordingAutoStopTimer()
	{
		if (RecordingAutoStopStatus.Active == _autoStopStatus)
		{
			_autoStopStatus = RecordingAutoStopStatus.Pause;
		}
	}

	private void _ResumeRecordingAutoStopTimer()
	{
		if (RecordingAutoStopStatus.Pause == _autoStopStatus)
		{
			_autoStopStatus = RecordingAutoStopStatus.Active;
		}
	}

	public static string GetUserNameHidden(string userName)
	{
		if ((GetRecordModeEnable() || GetPublishModeEnable()) && !GetOptionFlagFromPlayerPrefs(Option.EnemyNameDisplay))
		{
			userName = Data.SystemText.Get("VideoHosting_0046");
		}
		return userName;
	}

	public static string GetUserIDHidden(string userID)
	{
		if (GetRecordModeEnable() || GetPublishModeEnable())
		{
			userID = Data.SystemText.Get("VideoHosting_0081");
		}
		return userID;
	}

	public static void OnStartRecording()
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (null != videoHostingHUD)
		{
			videoHostingHUD.OnStartRecording();
		}
		SetOptionFlagFromPlayerPrefs(Option.IsRecording, enable: true);
	}

	public static void OnFinishRecording()
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (null != videoHostingHUD)
		{
			videoHostingHUD.OnFinishRecording();
		}
		SetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording, enable: false);
		SetOptionFlagFromPlayerPrefs(Option.IsRecording, enable: false);
	}

	public static void OnPauseRecording()
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (null != videoHostingHUD)
		{
			videoHostingHUD.OnPauseRecording();
		}
	}

	public static void OnResumeRecording()
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (null != videoHostingHUD)
		{
			videoHostingHUD.OnResumeRecording();
		}
	}

	public static void OnStartUploadRecording()
	{
	}

	public static void OnFinishUploadRecording(string strVideoId, string strUrl)
	{
	}

	public static void OnCameraStartedSession()
	{
		FaceCameraAdjustSwitch();
	}

	public static void OnCameraStoppedSession()
	{
		VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD();
		if (null != videoHostingHUD)
		{
			videoHostingHUD.EndFaceCameraAdjust();
			videoHostingHUD.SetFaceCameraAdjustSwitchEnable(isEnable: false);
		}
	}

	public static void OnSoftwareReset()
	{
		AutoPausePublishing(isSave: true);
		AutoStopRecording(isSave: true);
		SingletonMonoBehaviour<VideoHostingManager>.instance.SetRecordingFaceCameraMicrophoneStatus(isEnableCamera: false, isEnableMicrophone: false);
		SingletonMonoBehaviour<VideoHostingManager>.instance.SetPublishingFaceCameraMicrophoneStatus(isEnableCamera: false, isEnableMicrophone: false);
	}

	private static DialogBase _CreateVideoHostingDialogCommon(string strKeyTitle, string strKeyText)
	{
		return _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, strKeyTitle, strKeyText, "", "");
	}

	private static DialogBase _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout layout, string strKeyTitle, string strKeyText, string strKeyButton1, string strKeyButton2)
	{
		SystemText systemText = Data.SystemText;
		DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
		dialogBase.SetSize(DialogBase.Size.S);
		dialogBase.SetButtonLayout(layout);
		dialogBase.SetTitleLabel(systemText.Get(strKeyTitle));
		dialogBase.SetText(systemText.Get(strKeyText));
		if (!string.IsNullOrEmpty(strKeyButton1) && !string.IsNullOrEmpty(strKeyButton2))
		{
			dialogBase.SetButtonText(systemText.Get(strKeyButton1), systemText.Get(strKeyButton2));
		}
		else if (!string.IsNullOrEmpty(strKeyButton1))
		{
			dialogBase.SetButtonText(systemText.Get(strKeyButton1));
		}
		dialogBase.SetPanelDepth(5000);
		return dialogBase;
	}

	public static void CreateDialogNotHasRecordedData()
	{
		_CreateVideoHostingDialogCommon("Common_0021", "VideoHosting_0075");
	}

	public static void CreateDialogStopRecording(bool isUseUploadButton, bool isTimeOut)
	{
		if (isUseUploadButton)
		{
			string strKeyText = (isTimeOut ? "VideoHosting_0049" : "VideoHosting_0051");
			string strKeyButton = "VideoHosting_0021";
			DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.BlueBtn_CancelBtn, "Common_0021", strKeyText, "Common_0004", strKeyButton);
			dialogBase.onPushButton2 = (Action)Delegate.Combine(dialogBase.onPushButton2, (Action)delegate
			{
				SingletonMonoBehaviour<VideoHostingUtil>.instance.StartCoroutine(Timer.DelayMethod(0.3f, _DelayUpload));
			});
			dialogBase.SetPanelDepth(5010);
		}
		else
		{
			string strKeyText2 = (isTimeOut ? "VideoHosting_0024" : "VideoHosting_0050");
			_CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", strKeyText2, "Common_0004", "").SetPanelDepth(5010);
		}
	}

	private static void _CreateDialogStopPublishing(bool isTimeOut)
	{
		string text = "";
		text = ((!isTimeOut) ? "VideoHosting_0040" : "VideoHosting_0039");
		_CreateVideoHostingDialogCommon("Common_0021", text);
	}

	public static void CreateDialogNotSupported()
	{
		_CreateVideoHostingDialogCommon("Error_0001", "VideoHosting_0080");
	}

	public static void CreateDialogInvalidOperation()
	{
		string strKeyText = "";
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising())
		{
			strKeyText = "VideoHosting_0067";
		}
		else if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording())
		{
			strKeyText = "VideoHosting_0068";
		}
		_CreateVideoHostingDialogCommon("Common_0021", strKeyText);
	}

	public static void CreateDialogPrivacyAccount()
	{
		string strKeyText = "";
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising())
		{
			strKeyText = "VideoHosting_0057";
		}
		else if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording())
		{
			strKeyText = "VideoHosting_0056";
		}
		_CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", strKeyText, "Common_0004", "");
	}

	public static void CreateDialogAchievementEnter()
	{
		string strKeyText = "";
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising())
		{
			strKeyText = "VideoHosting_0072";
		}
		else if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording())
		{
			strKeyText = "VideoHosting_0068";
		}
		_CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", strKeyText, "Common_0004", "");
	}

	public static void CreateDialogPrivacyBuyCrystalEnter(Action cbPushOK)
	{
		DialogBase dialogBase = null;
		if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsPublising())
		{
			string strKeyTitle = "VideoHosting_0078";
			string strKeyText = "VideoHosting_0054";
			string strKeyButton = "VideoHosting_0063";
			dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.BlueBtn_CancelBtn, strKeyTitle, strKeyText, strKeyButton, "");
			DialogBase dialogBase2 = dialogBase;
			dialogBase2.onPushButton1 = (Action)Delegate.Combine(dialogBase2.onPushButton1, (Action)delegate
			{
				AutoPausePublishing(isSave: true);
			});
		}
		else if (SingletonMonoBehaviour<VideoHostingManager>.instance.IsRecording())
		{
			string strKeyTitle2 = "VideoHosting_0079";
			string strKeyText2 = "VideoHosting_0052";
			string strKeyButton2 = "VideoHosting_0048";
			dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.BlueBtn_CancelBtn, strKeyTitle2, strKeyText2, strKeyButton2, "");
			DialogBase dialogBase3 = dialogBase;
			dialogBase3.onPushButton1 = (Action)Delegate.Combine(dialogBase3.onPushButton1, (Action)delegate
			{
				AutoStopRecording(isSave: false);
			});
		}
		if (!(null == dialogBase) && cbPushOK != null)
		{
			DialogBase dialogBase4 = dialogBase;
			dialogBase4.onPushButton1 = (Action)Delegate.Combine(dialogBase4.onPushButton1, cbPushOK);
		}
	}

	public static void CreateDialogPrivacyBuyCrystalExit()
	{
		DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", "VideoHosting_0055", "Common_0004", "");
		dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, new Action(AutoResumePublishing));
	}

	public static void CreateDialogPrivacyAutoStopRecordingTitle(Action cbPushOK)
	{
		DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", "VideoHosting_0066", "Common_0004", "");
		dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, cbPushOK);
	}

	public static void CreateDialogPrivacyAutoPausePublishingTitle(Action cbPushOK)
	{
		DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", "VideoHosting_0065", "Common_0004", "");
		dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, cbPushOK);
	}
}
