using System;
using System.Collections;
using System.Collections.Generic;
using Cute;
using UnityEngine;
using Wizard.Battle.View.Vfx;
using Wizard.Dialog.Setting;

namespace Wizard;

public class OptionSettingWindow : SettingBase
{
	private enum Category
	{
		SOUND_VISUAL,
		BATTLE,
		STAGE,
		OTHER
	}

	public enum Shortcut
	{
		Off,
		RightClick,
		DoubleClick,
		MiddleClick
	}

	public enum ShortcutDetail
	{
		RightClick,
		MiddleClick,
		LongPress,
		Auto,
		DoubleClick
	}

	[SerializeField]
	private GameObject _soundVisualRoot;

	[SerializeField]
	private GameObject _battleRoot;

	[SerializeField]
	private GameObject _stageRoot;

	[SerializeField]
	private GameObject _otherRoot;

	[SerializeField]
	private UIButton _buttonSoundVisualForBattleScene;

	[SerializeField]
	private UIButton _buttonBattleForBattleScene;

	[SerializeField]
	private UIButton _buttonSoundVisualForRoomScene;

	[SerializeField]
	private UIButton _buttonBattleForRoomScene;

	[SerializeField]
	private UIButton _buttonOtherForRoomScene;

	[SerializeField]
	private UIButton _buttonSoundVisual;

	[SerializeField]
	private UIButton _buttonBattle;

	[SerializeField]
	private UIButton _buttonStage;

	[SerializeField]
	private UIButton _buttonOther;

	[SerializeField]
	private GameObject _battleSceneRoot;

	[SerializeField]
	private GameObject _normalSceneRoot;

	[SerializeField]
	private GameObject _roomSceneRoot;

	[SerializeField]
	private BattleStageChoiceWindow _activeStageSelectWindow;

	private Category _currentCategory;

	private readonly List<string> _resolutions = new List<string>
	{
		"1024×768", "1280×720", "1280×800", "1280×960", "1360×768", "1600×900", "1600×1200", "1680×1050", "1920×1080", "1920×1200",
		"2560×1440", "3840×2160"
	};

	private const int RES_MAX_WIDTH = 3840;

	private float _wantedScreenWidth = Screen.width;

	private float _wantedScreenHeight = Screen.height;

	private static List<string> _battleDetailSizes = new List<string> { "100%", "90%", "80%", "70%", "60%", "50%" };

	private static Shortcut? _shortcutPlay;

	private static Shortcut? _shortcutEvolution;

	private static ShortcutDetail? _shortcutDetail;

	private List<string> _mouseShortcuts = new List<string> { "OtherConfig_0042", "OtherConfig_0043", "OtherConfig_0044", "OtherConfig_0052" };

	private List<string> _mouseShortcutsDetail = new List<string> { "OtherConfig_0043", "OtherConfig_0052", "OtherConfig_0053", "OtherConfig_0054" };

	private bool _startInvitationFriendRoom;

	private bool _startInvitationInBattle;

	private bool _startInvitationInOffline;

	private bool _startReceivedFriendApply;

	private const float STAGE_SELECT_LABEL_POSITION_X = -5f;

	private const float STAGE_SELECT_SPRITE_POSITION_X = 205f;

	public static Shortcut ShortcutPlay
	{
		get
		{
			if (!_shortcutPlay.HasValue)
			{
				_shortcutPlay = (Shortcut)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_PLAY);
			}
			return _shortcutPlay.Value;
		}
		private set
		{
			PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_PLAY, (int)value);
			_shortcutPlay = value;
		}
	}

	public static Shortcut ShortcutEvolution
	{
		get
		{
			if (!_shortcutEvolution.HasValue)
			{
				_shortcutEvolution = (Shortcut)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_EVOLUTION);
			}
			return _shortcutEvolution.Value;
		}
		private set
		{
			PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_EVOLUTION, (int)value);
			_shortcutEvolution = value;
		}
	}

	public static ShortcutDetail ShortcutDetailPanel
	{
		get
		{
			if (!_shortcutDetail.HasValue)
			{
				_shortcutDetail = (ShortcutDetail)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_DETAIL);
			}
			return _shortcutDetail.Value;
		}
		private set
		{
			PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_DETAIL, (int)value);
			_shortcutDetail = value;
		}
	}

	private UIButton BattleButton
	{
		get
		{
			if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle)
			{
				return _buttonBattleForBattleScene;
			}
			if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room)
			{
				return _buttonBattleForRoomScene;
			}
			return _buttonBattle;
		}
	}

	private UIButton StageButton => _buttonStage;

	private UIButton SoundVisualButton
	{
		get
		{
			if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle)
			{
				return _buttonSoundVisualForBattleScene;
			}
			if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room)
			{
				return _buttonSoundVisualForRoomScene;
			}
			return _buttonSoundVisual;
		}
	}

	private UIButton OtherButton
	{
		get
		{
			if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room)
			{
				return _buttonOtherForRoomScene;
			}
			return _buttonOther;
		}
	}

	public override void Create()
	{
		base.Create();
		CreateSoundItem();
		CreateBattleItem();
		CreateStageItem();
		CreateOtherItem();
		ChangeCategory(Category.SOUND_VISUAL, playSE: false);
		SoundVisualButton.onClick.Add(new EventDelegate(delegate
		{
			ChangeCategory(Category.SOUND_VISUAL, playSE: true);
		}));
		BattleButton.onClick.Add(new EventDelegate(delegate
		{
			ChangeCategory(Category.BATTLE, playSE: true);
		}));
		StageButton.onClick.Add(new EventDelegate(delegate
		{
			ChangeCategory(Category.STAGE, playSE: true);
		}));
		OtherButton.onClick.Add(new EventDelegate(delegate
		{
			ChangeCategory(Category.OTHER, playSE: true);
		}));
		bool num = UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle;
		_battleSceneRoot.SetActive(value: false);
		_normalSceneRoot.SetActive(value: false);
		_roomSceneRoot.SetActive(value: false);
		if (num)
		{
			_battleSceneRoot.SetActive(value: true);
		}
		else if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room)
		{
			_roomSceneRoot.SetActive(value: true);
		}
		else
		{
			_normalSceneRoot.SetActive(value: true);
		}
		_startInvitationFriendRoom = Data.Load.data._userConfig.ReceivedInvite;
		_startInvitationInBattle = Data.Load.data._userConfig.ReceivedInviteInBattle;
		_startInvitationInOffline = Data.Load.data._userConfig.ReceivedInviteInOffline;
		_startReceivedFriendApply = Data.Load.data._userConfig.ReceivedFriendApply;
	}

	private void CreateSoundItem()
	{
		CreateSoundItem(_soundVisualRoot);
		CreateToggle_PlayMusicInBackground(isDispSeparatorLine: true);
		CreateSelectResolution(isDispSeparatorLine: true);
		CreateToggle_Fullscreen(isDispSeparatorLine: true);
		CreateSelect_Fps(isDispSeparatorLine: true);
		bool isDispSeparatorLine = false;
		CreateToggle_MovieSubtitles(isDispSeparatorLine, _soundVisualRoot);
	}

	private void CreateBattleItem()
	{
		bool flag = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Battle;
		bool flag2 = !flag;
		bool flag3 = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Room;
		CreateBattleDetailPanelSize(isDispSeparatorLine: true);
		CreateToggleBattleLightEffect(isDispSeparatorLine: true);
		if (flag)
		{
			CreateToggle_FoilCardAnimation(isDispSeparatorLine: true);
		}
		CreateToggle_LeaderAnimation(isDispSeparatorLine: true);
		if (flag)
		{
			CreateToggle_OpponentShowDefaultSkin(isDispSeparatorLine: true);
		}
		CreateToggle_TurnEndConfirm(isDispSeparatorLine: true);
		bool flag4 = Data.MyPageNotifications.data.RoomRule.NormalRuleFormatList.Contains(Format.Avatar);
		if ((Data.CurrentFormat == Format.Avatar && flag2) || (flag4 && flag))
		{
			CreateToggle_TurnEndWithoutUsingHeroSkillConfirm(isDispSeparatorLine: true);
		}
		CreateToggle_EvolveConfirm(isDispSeparatorLine: true);
		CreateToggle_FusionCardPlayConfirm(isDispSeparatorLine: true);
		CreateToggle_FixedUseCostInfo(isDispSeparatorLine: true);
		CreateToggle_ShowSideLog(isDispSeparatorLine: true);
		CreateToggle_OpponentMessageDisplay(isDispSeparatorLine: true);
		if (flag && flag3)
		{
			CreateToggle_Wss(isDispSeparatorLine: true);
			CreateToggle_Ipv6(isDispSeparatorLine: true);
		}
		CreateMouseControl(isDispSeparatorLine: true);
		CreateMouseShortcutPlay(isDispSeparatorLine: false);
		CreateMouseShortcutEvolution(isDispSeparatorLine: false);
		CreateMouseShortcutDetail(isDispSeparatorLine: false);
		if (Prediction._isFeatureEnabled)
		{
			CreateToggle_PredictionIconDisplay(isDispSeparatorLine: true);
		}
	}

	private void CreateStageItem()
	{
		CreateToggleUseSimpleRoom(isDispSeparatorLine: true);
		CreateToggle_UseStageSwitch(isDispSeparatorLine: true);
		CreateButtonBattleStageSelect(isDispSeparatorLine: true);
		UpdateStageSettingView();
	}

	private ItemToggle CreateToggleUseSimpleRoom(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SIMPLE_STAGE, isDispSeparatorLine, _stageRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0022"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SIMPLE_STAGE));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SIMPLE_STAGE, item.GetValue());
			UpdateStageSettingView();
		});
		return item;
	}

	private ItemToggle CreateToggle_UseStageSwitch(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.USE_STAGE_SELECT, isDispSeparatorLine, _stageRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0078"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.USE_OFF_STAGE));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.USE_OFF_STAGE, item.GetValue());
			bool toGrey = !item.GetValue();
			if ((FindItem(ID.SIMPLE_STAGE) as ItemToggle).GetValue())
			{
				toGrey = true;
			}
			(FindItem(ID.STAGE_SELECT) as ItemButton).SetToGrey(toGrey);
		});
		return item;
	}

	private ItemButton CreateButtonBattleStageSelect(bool isDispSeparatorLine)
	{
		ItemButton itemButton = CreateButton(ID.STAGE_SELECT, isDispSeparatorLine, _stageRoot);
		itemButton.SetSpriteName("btn_common_02_m_off", isMakePixelPerfect: true, isCollisionResize: true);
		itemButton.SetSpriteNameOnPress("btn_common_02_m_on");
		itemButton.SetLabelPos(new Vector3(-5f, 0f, 0f));
		itemButton.SetSpritePos(new Vector3(205f, 0f, 0f));
		SystemText systemText = Data.SystemText;
		itemButton.SetValue(systemText.Get("Dia_StageChoice_001"));
		itemButton.SetSubLabelPos(new Vector3(-180f, 0f, 0f));
		itemButton.SetSubLabelText(systemText.Get("OtherConfig_0075"));
		itemButton.AddChangeCallback(delegate
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
			CreateStageChoiceWindow();
		});
		return itemButton;
	}

	private void UpdateStageSettingView()
	{
		ItemToggle itemToggle = FindItem(ID.SIMPLE_STAGE) as ItemToggle;
		if (itemToggle != null)
		{
			bool flag = itemToggle.GetValue();
			ItemToggle obj = FindItem(ID.USE_STAGE_SELECT) as ItemToggle;
			obj.SetLabelLooks(!flag);
			obj.SetToggleLooks(!flag);
			if (!obj.GetValue())
			{
				flag = true;
			}
			(FindItem(ID.STAGE_SELECT) as ItemButton).SetToGrey(flag);
		}
	}

	private void CreateStageChoiceWindow()
	{
		BattleStageChoiceWindow stageChoice = UnityEngine.Object.Instantiate(_activeStageSelectWindow);
		StartCoroutine(stageChoice.LoadResource(delegate
		{
			SystemText systemText = Data.SystemText;
			DialogBase stageSelectDialog = UIManager.GetInstance().CreateDialogClose();
			stageSelectDialog.SetSize(DialogBase.Size.XL);
			bool isAllOff = false;
			BattleStageChoiceWindow battleStageChoiceWindow = stageChoice;
			battleStageChoiceWindow.OnAllOff = (Action<bool>)Delegate.Combine(battleStageChoiceWindow.OnAllOff, (Action<bool>)delegate(bool alloff)
			{
				isAllOff = alloff;
				stageSelectDialog.SetButtonDisable(alloff);
			});
			stageChoice.Initialize();
			stageSelectDialog.SetObj(stageChoice.gameObject);
			stageSelectDialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
			stageSelectDialog.SetTitleLabel(systemText.Get("Dia_StageChoice_001"));
			_dialogObject.gameObject.SetActive(value: false);
			_dialogObject.backView.SetActive(value: false);
			DialogBase dialogBase = stageSelectDialog;
			dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate
			{
				stageChoice.SaveSetting();
			});
			DialogBase dialogBase2 = stageSelectDialog;
			dialogBase2.OnClose = (Action)Delegate.Combine(dialogBase2.OnClose, (Action)delegate
			{
				_dialogObject.gameObject.SetActive(value: true);
				_dialogObject.backView.SetActive(value: true);
			});
		}));
	}

	private ItemToggle CreateToggle_UseCollaborationSound(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.COLLABORATION_SOUND, isDispSeparatorLine, _stageRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0077"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.COLLABORATION_SOUND));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.COLLABORATION_SOUND, item.GetValue());
		});
		return item;
	}

	private void CreateOtherItem()
	{
		bool num = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Battle;
		bool flag = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Room;
		if (num && flag)
		{
			CreateToggle_PurchaseAlert(isDispSeparatorLine: true);
		}
		if (num)
		{
			CreateToggle_InvitationFriendRoom(isDispSeparatorLine: true);
			CreateToggle_InvitationInBattle(isDispSeparatorLine: true);
			CreateToggleReceivedFriendApply(isDispSeparatorLine: true);
		}
		CreateToggleShowBattlePassResult(isDispSeparatorLine: true);
		CreateSelect_ShowQrCode(isDispSeparatorLine: false);
	}

	protected override void OnDestroy()
	{
		base.OnDestroy();
		if (_startInvitationFriendRoom != Data.Load.data._userConfig.ReceivedInvite || _startInvitationInBattle != Data.Load.data._userConfig.ReceivedInviteInBattle || _startInvitationInOffline != Data.Load.data._userConfig.ReceivedInviteInOffline || _startReceivedFriendApply != Data.Load.data._userConfig.ReceivedFriendApply)
		{
			InviteConfigUpdateTask inviteConfigUpdateTask = new InviteConfigUpdateTask();
			inviteConfigUpdateTask.SetParameter(Data.Load.data._userConfig.ReceivedInvite, Data.Load.data._userConfig.ReceivedInviteInBattle, Data.Load.data._userConfig.ReceivedInviteInOffline, Data.Load.data._userConfig.ReceivedFriendApply);
			UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(inviteConfigUpdateTask));
		}
	}

	private void ChangeCategory(Category category, bool playSE)
	{
		if (playSE && category != _currentCategory)
		{
			GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON);
		}
		_currentCategory = category;
		ResetScroll();
		_soundVisualRoot.gameObject.SetActive(category == Category.SOUND_VISUAL);
		_battleRoot.gameObject.SetActive(category == Category.BATTLE);
		_stageRoot.gameObject.SetActive(category == Category.STAGE);
		_otherRoot.gameObject.SetActive(category == Category.OTHER);
		RenameBtnSprite(SoundVisualButton, category == Category.SOUND_VISUAL);
		RenameBtnSprite(BattleButton, category == Category.BATTLE);
		RenameBtnSprite(StageButton, category == Category.STAGE);
		RenameBtnSprite(OtherButton, category == Category.OTHER);
	}

	private void RenameBtnSprite(UIButton button, bool isEnable)
	{
		button.normalSprite = RenameSpriteString(button.normalSprite, isEnable);
	}

	private string RenameSpriteString(string str, bool isEnable)
	{
		string oldValue = (isEnable ? "_off" : "_on");
		string newValue = (isEnable ? "_on" : "_off");
		return str.Replace(oldValue, newValue);
	}

	private ItemToggle CreateToggle_InvitationInBattle(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.INVITATION_IN_BATTLE, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0038"));
		item.SetValue(Data.Load.data._userConfig.ReceivedInviteInBattle);
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		item.SetButtonEnable(isEnable: false);
		item.AddChangeCallback(delegate
		{
			Data.Load.data._userConfig.ReceivedInviteInBattle = item.GetValue();
		});
		return item;
	}

	private ItemToggle CreateToggleShowBattlePassResult(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.BATTLE_PASS_SHOW_RESULT, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("BattlePass_0011"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.BATTLE_PASS_SHOW_RESULT));
		item.SetButtonEnable(isEnable: false);
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.BATTLE_PASS_SHOW_RESULT, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_InvitationInOffline(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.INVITATION_IN_OFFLINE, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0039"));
		item.SetValue(Data.Load.data._userConfig.ReceivedInviteInOffline);
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		item.SetButtonEnable(isEnable: false);
		item.AddChangeCallback(delegate
		{
			Data.Load.data._userConfig.ReceivedInviteInOffline = item.GetValue();
		});
		return item;
	}

	private ItemToggle CreateToggleReceivedFriendApply(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.RECEIVED_FRIEND_APPLY, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0068"));
		item.SetValue(Data.Load.data._userConfig.ReceivedFriendApply);
		item.AddChangeCallback(delegate
		{
			Data.Load.data._userConfig.ReceivedFriendApply = item.GetValue();
		});
		return item;
	}

	private ItemToggle CreateToggle_PurchaseAlert(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.PURCHASE_ALERT, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0065"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PURCHASE_ALERT));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.PURCHASE_ALERT, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_Wss(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SELECT_WSS, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0060"));
		bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_WSS);
		item.SetValue(isSetting);
		item.AddChangeCallback(delegate
		{
			if (isSetting != item.GetValue())
			{
				isSetting = item.GetValue();
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SELECT_WSS, item.GetValue());
				CustomPreference.SetOptionalNodeSceme();
				LocalLog.AccumulateSettingLog();
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_Ipv6(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SELECT_IPV6, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0083"));
		bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_IPV6);
		item.SetValue(isSetting);
		item.AddChangeCallback(delegate
		{
			if (isSetting != item.GetValue())
			{
				isSetting = item.GetValue();
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SELECT_IPV6, item.GetValue());
			}
		});
		return item;
	}

	private ItemToggle CreateSelect_Fps(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.FPS, isDispSeparatorLine, _soundVisualRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0045"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FRAMERATE));
		item.AddChangeCallback(delegate
		{
			bool value = item.GetValue();
			int frameRate = (Application.targetFrameRate = (value ? 60 : 30));
			Toolbox.QualityManager.SetFrameRate(frameRate);
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.FRAMERATE, value);
		});
		return item;
	}

	private ItemToggle CreateSelect_ShowQrCode(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.QRCode, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0081"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOWQRCODE));
		item.AddChangeCallback(delegate
		{
			bool value = item.GetValue();
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOWQRCODE, value);
		});
		return item;
	}

	private ItemToggle CreateToggle_InvitationFriendRoom(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.INVITATION_FRIEND_ROOM, isDispSeparatorLine, _otherRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0037"));
		item.SetValue(Data.Load.data._userConfig.ReceivedInvite);
		item.AddChangeCallback(delegate
		{
			Data.Load.data._userConfig.ReceivedInvite = item.GetValue();
			SetRelationFriendRoomToggleLook(item);
		});
		SetRelationFriendRoomToggleLook(item);
		return item;
	}

	private void SetRelationFriendRoomToggleLook(ItemToggle friendRoomToggle)
	{
		_SetItemToggleLooks(ID.INVITATION_IN_BATTLE, friendRoomToggle.GetValue());
		_SetItemToggleLooks(ID.INVITATION_IN_OFFLINE, friendRoomToggle.GetValue());
	}

	private ItemToggle CreateToggle_LeaderAnimation(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.LEADER_ANIMATION_DISPLAY, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0031"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION, item.GetValue());
			if (ToolboxGame.UIManager.IsCurrentScene(UIManager.ViewScene.Battle))
			{
				bool isAnimation = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION);
				BattleManagerBase.GetIns().VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate
				{
					((ClassBattleCardBase)BattleManagerBase.GetIns().BattlePlayer.Class).ClassBattleCardView.ClassCharacter.SetAnimationEnable(isAnimation);
					((ClassBattleCardBase)BattleManagerBase.GetIns().BattleEnemy.Class).ClassBattleCardView.ClassCharacter.SetAnimationEnable(isAnimation);
				}));
			}
		});
		return item;
	}

	private ItemToggle CreateToggleBattleLightEffect(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.BATTLE_EFFECT_DISPLAY, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0010"));
		bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT);
		item.SetValue(isSetting);
		item.AddChangeCallback(delegate
		{
			if (isSetting != item.GetValue())
			{
				isSetting = item.GetValue();
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT, item.GetValue());
				LocalLog.AccumulateSettingLog();
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_FoilCardAnimation(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SHOW_FOIL_CARD_ANIMATION, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0067"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_FOIL_CARD_ANIMATION));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_FOIL_CARD_ANIMATION, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_TurnEndConfirm(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.TURN_END_CONFIRM, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0004"));
		bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_TURN_END);
		item.SetValue(isSetting);
		item.AddChangeCallback(delegate
		{
			if (isSetting != item.GetValue())
			{
				isSetting = item.GetValue();
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.CONFIRM_TURN_END, item.GetValue());
				LocalLog.AccumulateSettingLog();
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_TurnEndWithoutUsingHeroSkillConfirm(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.TURN_END_WITHOUT_USING_HERO_SKILL_CONFIRM, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0084"));
		bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_TURN_END_WITHOUT_USING_HERO_SKILL);
		item.SetValue(isSetting);
		item.AddChangeCallback(delegate
		{
			if (isSetting != item.GetValue())
			{
				isSetting = item.GetValue();
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.CONFIRM_TURN_END_WITHOUT_USING_HERO_SKILL, item.GetValue());
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_EvolveConfirm(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.EVOLVE_CONFIRM, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0025"));
		bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_EVOLVE);
		item.SetValue(isSetting);
		item.AddChangeCallback(delegate
		{
			if (isSetting != item.GetValue())
			{
				isSetting = item.GetValue();
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.CONFIRM_EVOLVE, item.GetValue());
				LocalLog.AccumulateSettingLog();
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_FusionCardPlayConfirm(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SHOW_FUSION_CARD_PLAY_DIALOG, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0072"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_FUSION_CARD_PLAY_DIALOG));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_FUSION_CARD_PLAY_DIALOG, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_FixedUseCostInfo(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.FIXEDUSE_COST_INFO, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0059"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FIXEDUSE_COST_INFO));
		item.AddChangeCallback(delegate
		{
			if (item.GetValue() != PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FIXEDUSE_COST_INFO))
			{
				PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.FIXEDUSE_COST_INFO, item.GetValue());
				BattleManagerBase ins = BattleManagerBase.GetIns();
				if (ins != null)
				{
					if (ins.BattlePlayer != null)
					{
						ins.BattlePlayer.ApplyFixedUseCostInfo();
					}
					if (ins.BattleEnemy != null)
					{
						ins.BattleEnemy.ApplyFixedUseCostInfo();
					}
				}
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_OpponentMessageDisplay(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.OPPONENT_MESSAGE_DISPLAY, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0005"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_OpponentShowDefaultSkin(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.OPPONENT_SHOW_DEFAULT_SKIN, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0066"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OPPONENT_DEFAULT_SKIN));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_OPPONENT_DEFAULT_SKIN, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_ShowPanelAlways(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SHOW_PANEL_ALWAYS, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0061"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_PANEL_ALWAYS));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_PANEL_ALWAYS, item.GetValue());
			BattleManagerBase ins = BattleManagerBase.GetIns();
			if (ins != null)
			{
				ClassInformationUIController classInformationUIController = ins.BattlePlayer.ClassInformationUIController;
				ClassInformationUIController classInformationUIController2 = ins.BattleEnemy.ClassInformationUIController;
				if (!ins.IsMulliganEnd && GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsAINetwork)
				{
					classInformationUIController.SetClassInformationUiPosition(isPlayer: true);
					classInformationUIController2.SetClassInformationUiPosition(isPlayer: false);
				}
				else
				{
					ins.BattlePlayer.StatusPanelControl.ShowStatusPanelOnBattle();
					ins.BattleEnemy.StatusPanelControl.ShowStatusPanelOnBattle();
					classInformationUIController.UpdateStatusPanelOnBattle(isPlayer: true);
					classInformationUIController2.UpdateStatusPanelOnBattle(isPlayer: false);
				}
			}
		});
		return item;
	}

	private ItemToggle CreateToggle_ShowSideLog(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.SHOW_SIDE_LOG, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0062"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_SIDE_LOG));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_SIDE_LOG, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_PredictionIconDisplay(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.PREDICTION_ICONS_DISPLAY, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0028"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_PREDICTION_ICONS));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_PREDICTION_ICONS, item.GetValue());
		});
		return item;
	}

	private ItemToggle CreateToggle_PlayMusicInBackground(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.PLAY_SOUND_IN_BG, isDispSeparatorLine, _soundVisualRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0036"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PLAY_SOUND_IN_BACKGROUND));
		item.AddChangeCallback(delegate
		{
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.PLAY_SOUND_IN_BACKGROUND, item.GetValue());
		});
		return item;
	}

	private ItemSelect CreateSelectResolution(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemSelect item = CreateSelect(ID.RESOLUTION, isDispSeparatorLine, _soundVisualRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0034"));
		string[] array = _resolutions[0].Split('×');
		int num = int.Parse(array[0]);
		int num2 = int.Parse(array[1]);
		int num3 = num;
		int num4 = num2;
		Display[] displays = Display.displays;
		foreach (Display display in displays)
		{
			if (display.systemWidth > display.systemHeight)
			{
				num3 = Mathf.Max(num3, display.systemWidth);
				num4 = Mathf.Max(num4, display.systemHeight);
			}
			else
			{
				num3 = Mathf.Max(num3, display.systemWidth);
				num4 = Mathf.Max(num4, display.systemWidth);
			}
		}
		List<string> list = new List<string>();
		foreach (string resolution in _resolutions)
		{
			string[] array2 = resolution.Split('×');
			int num5 = int.Parse(array2[0]);
			int num6 = int.Parse(array2[1]);
			if (num5 <= num3 && num6 <= num4)
			{
				list.Add(resolution);
			}
		}
		item.SetPossibleResolutionValues(list, resizeListSprite: true);
		string resolutionValue = Screen.width + "×" + Screen.height;
		item.SetResolutionValue(resolutionValue);
		_wantedScreenWidth = Screen.width;
		_wantedScreenHeight = Screen.height;
		item.AddChangeCallback(delegate
		{
			string[] array3 = item.GetValue().Split('×');
			float num7 = int.Parse(array3[0]);
			float num8 = int.Parse(array3[1]);
			_wantedScreenWidth = num7;
			_wantedScreenHeight = num8;
			WindowResize.SetResolution((int)num7, (int)num8);
		});
		return item;
	}

	private ItemToggle CreateToggle_Fullscreen(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.FULLSCREEN, isDispSeparatorLine, _soundVisualRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0035"));
		item.SetValue(Screen.fullScreen);
		item.AddChangeCallback(delegate
		{
			bool value = item.GetValue();
			if (value != Screen.fullScreen)
			{
				Toolbox.QualityManager.ChangeResolution(Screen.width, Screen.height, value);
			}
		});
		return item;
	}

	private ItemToggle CreateMouseControl(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.MOUSE_CONTROL, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0040"));
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.MOUSE_CONTROL));
		item.AddChangeCallback(delegate
		{
			bool value = item.GetValue();
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.MOUSE_CONTROL, value);
			InputMgr.MouseControl = value;
			(FindItem(ID.MOUSE_SHORTCUT_PLAY) as ItemSelect).SetToGrey(!value);
			(FindItem(ID.MOUSE_SHORTCUT_EVOLUTION) as ItemSelect).SetToGrey(!value);
			(FindItem(ID.MOUSE_SHORTCUT_DETAIL) as ItemSelect).SetToGrey(!value);
		});
		return item;
	}

	private ItemSelect CreateMouseShortcutPlay(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemSelect item = CreateSelect(ID.MOUSE_SHORTCUT_PLAY, isDispSeparatorLine, _battleRoot);
		item._isOpenDirectionUp = true;
		item.SetTitleLabel(systemText.Get("OtherConfig_0049"));
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		SetShortcut(item);
		item.SetValue(item.PossibleValues[(int)ShortcutPlay]);
		item.AddChangeCallback(delegate
		{
			string value = item.GetValue();
			int num = 0;
			for (num = 0; num < item.PossibleValues.Count && !(value == item.PossibleValues[num]); num++)
			{
			}
			ShortcutPlay = (Shortcut)num;
			ItemSelect shortcutDetail = FindItem(ID.MOUSE_SHORTCUT_DETAIL) as ItemSelect;
			SetShortcutDetail(shortcutDetail);
		});
		return item;
	}

	private ItemSelect CreateMouseShortcutEvolution(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemSelect item = CreateSelect(ID.MOUSE_SHORTCUT_EVOLUTION, isDispSeparatorLine, _battleRoot);
		item._isOpenDirectionUp = true;
		item.SetTitleLabel(systemText.Get("OtherConfig_0050"));
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		SetShortcut(item);
		item.SetValue(item.PossibleValues[(int)ShortcutEvolution]);
		item.AddChangeCallback(delegate
		{
			string value = item.GetValue();
			int num = 0;
			for (num = 0; num < item.PossibleValues.Count && !(value == item.PossibleValues[num]); num++)
			{
			}
			ShortcutEvolution = (Shortcut)num;
			ItemSelect shortcutDetail = FindItem(ID.MOUSE_SHORTCUT_DETAIL) as ItemSelect;
			SetShortcutDetail(shortcutDetail);
		});
		return item;
	}

	private ItemSelect CreateBattleDetailPanelSize(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemSelect item = CreateSelect(ID.BATTLE_DETAIL_PANEL_SIZE, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0055"));
		item.SetPossibleValues(_battleDetailSizes, resizeListSprite: true);
		item.SetValue(_battleDetailSizes[PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_DETAIL_PANEL_SIZE)]);
		item.AddChangeCallback(delegate
		{
			string value = item.GetValue();
			int value2 = 0;
			for (int i = 0; i < _battleDetailSizes.Count; i++)
			{
				value2 = i;
				if (value == _battleDetailSizes[i])
				{
					break;
				}
			}
			PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_DETAIL_PANEL_SIZE, value2);
			UIManager instance = UIManager.GetInstance();
			if (instance != null && instance.GetCurrentScene() == UIManager.ViewScene.Battle && BattleManagerBase.GetIns() != null)
			{
				DetailMgr detailMgr = BattleManagerBase.GetIns().DetailMgr;
				detailMgr.DetailPanelControl.SetSize(GetBattleDetailPanelSizePercent());
				detailMgr.SubDetailPanelControl.SetSize(GetBattleDetailPanelSizePercent());
			}
		});
		return item;
	}

	private ItemSelect CreateMouseShortcutDetail(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemSelect item = CreateSelect(ID.MOUSE_SHORTCUT_DETAIL, isDispSeparatorLine, _battleRoot);
		item._isOpenDirectionUp = true;
		item.SetTitleLabel(systemText.Get("OtherConfig_0051"));
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		SetShortcutDetail(item);
		item.SetValue(item.PossibleValues[(int)ShortcutDetailPanel]);
		item.AddChangeCallback(delegate
		{
			string value = item.GetValue();
			int num = 0;
			for (num = 0; num < item.PossibleValues.Count && !(value == item.PossibleValues[num]); num++)
			{
			}
			ShortcutDetailPanel = (ShortcutDetail)num;
			ItemSelect shortcut = FindItem(ID.MOUSE_SHORTCUT_PLAY) as ItemSelect;
			SetShortcut(shortcut);
			ItemSelect shortcut2 = FindItem(ID.MOUSE_SHORTCUT_EVOLUTION) as ItemSelect;
			SetShortcut(shortcut2);
		});
		return item;
	}

	private void SetShortcut(ItemSelect item)
	{
		item.SetPossibleValues(_mouseShortcuts, resizeListSprite: true, (string t) => Data.SystemText.Get(t));
		if (ShortcutDetailPanel == ShortcutDetail.RightClick)
		{
			if (item.name == ID.MOUSE_SHORTCUT_PLAY.ToString() && ShortcutPlay == Shortcut.RightClick)
			{
				ShortcutPlay = Shortcut.Off;
				item.SetValue(item.PossibleValues[0]);
			}
			else if (item.name == ID.MOUSE_SHORTCUT_EVOLUTION.ToString() && ShortcutEvolution == Shortcut.RightClick)
			{
				ShortcutEvolution = Shortcut.Off;
				item.SetValue(item.PossibleValues[0]);
			}
		}
		if (ShortcutDetailPanel == ShortcutDetail.MiddleClick)
		{
			if (item.name == ID.MOUSE_SHORTCUT_PLAY.ToString() && ShortcutPlay == Shortcut.MiddleClick)
			{
				ShortcutPlay = Shortcut.Off;
				item.SetValue(item.PossibleValues[0]);
			}
			else if (item.name == ID.MOUSE_SHORTCUT_EVOLUTION.ToString() && ShortcutEvolution == Shortcut.MiddleClick)
			{
				ShortcutEvolution = Shortcut.Off;
				item.SetValue(item.PossibleValues[0]);
			}
		}
		if (ShortcutDetailPanel == ShortcutDetail.DoubleClick)
		{
			if (item.name == ID.MOUSE_SHORTCUT_PLAY.ToString() && ShortcutPlay == Shortcut.DoubleClick)
			{
				ShortcutPlay = Shortcut.Off;
				item.SetValue(item.PossibleValues[0]);
			}
			else if (item.name == ID.MOUSE_SHORTCUT_EVOLUTION.ToString() && ShortcutEvolution == Shortcut.DoubleClick)
			{
				ShortcutEvolution = Shortcut.Off;
				item.SetValue(item.PossibleValues[0]);
			}
		}
	}

	private void SetShortcutDetail(ItemSelect item)
	{
		item.SetPossibleValues(_mouseShortcutsDetail, resizeListSprite: true, (string t) => Data.SystemText.Get(t));
		int index = item.PossibleValues.Count - 1;
		if ((ShortcutPlay == Shortcut.RightClick || ShortcutEvolution == Shortcut.RightClick) && ShortcutDetailPanel == ShortcutDetail.RightClick)
		{
			ShortcutDetailPanel = ShortcutDetail.Auto;
			item.SetValue(item.PossibleValues[index]);
		}
		if ((ShortcutPlay == Shortcut.MiddleClick || ShortcutEvolution == Shortcut.MiddleClick) && ShortcutDetailPanel == ShortcutDetail.MiddleClick)
		{
			ShortcutDetailPanel = ShortcutDetail.Auto;
			item.SetValue(item.PossibleValues[index]);
		}
	}

	private ItemToggle CreateKeyboardControl(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.KEYBOARD_CONTROL, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0056"));
		bool value = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.KEYBOARD_CONTROL);
		item.SetValue(value: true);
		item.AddChangeCallback(delegate
		{
			bool value2 = item.GetValue();
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.KEYBOARD_CONTROL, value2);
			ItemToggle obj = FindItem(ID.KEYBOARD_SHORTCUT_EVOLUTION) as ItemToggle;
			obj.SetLabelLooks(value2);
			obj.SetToggleLooks(value2);
			obj.SetButtonEnable(value2);
			obj.SetToggleEnable(value2);
			ItemToggle obj2 = FindItem(ID.KEYBOARD_SHORTCUT_SPACE) as ItemToggle;
			obj2.SetToggleLooks(value2);
			obj2.SetLabelLooks(value2);
			obj2.SetButtonEnable(value2);
			obj2.SetToggleEnable(value2);
			InputMgr.KeyboardControl = value2;
		});
		StartCoroutine(InitializeKeyboardControlToggle(item, value));
		return item;
	}

	private IEnumerator InitializeKeyboardControlToggle(ItemToggle item, bool value)
	{
		yield return null;
		item.SetValue(value);
	}

	private ItemToggle CreateKeyboardShortcutEvolution(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.KEYBOARD_SHORTCUT_EVOLUTION, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0057"));
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_EVOLUTION));
		item.AddChangeCallback(delegate
		{
			bool value = item.GetValue();
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_EVOLUTION, value);
			InputMgr.KeyboardControlEvolution = value;
		});
		return item;
	}

	private ItemToggle CreateKeyboardShortcutSpace(bool isDispSeparatorLine)
	{
		SystemText systemText = Data.SystemText;
		ItemToggle item = CreateToggle(ID.KEYBOARD_SHORTCUT_SPACE, isDispSeparatorLine, _battleRoot);
		item.SetTitleLabel(systemText.Get("OtherConfig_0058"));
		item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS);
		item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_SPACE));
		item.AddChangeCallback(delegate
		{
			bool value = item.GetValue();
			PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_SPACE, value);
			InputMgr.KeyboardControlSpace = value;
		});
		return item;
	}

	public static int GetBattleDetailPanelSizePercent()
	{
		string text = _battleDetailSizes[PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_DETAIL_PANEL_SIZE)];
		return int.Parse(text.Remove(text.Length - 1));
	}
}
