using System;
using Cpp2IlInjected;
using UnityEngine;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;

// Token: 0x02000244 RID: 580
[Token(Token = "0x2000244")]
public class UISettingsAudio : UIValueBindingBase
{
	// Token: 0x06001662 RID: 5730 RVA: 0x00033AC0 File Offset: 0x00031CC0
	[Token(Token = "0x6001662")]
	[Address(RVA = "0x189DDE0", Offset = "0x189CBE0", VA = "0x18189DDE0", Slot = "11")]
	public override void Init(CanvasGroup mainCanvasGroup, Action cancelHandler, Text title)
	{
		UIValueBindingHandler uivalueBindingHandler4;
		Action<int> action4;
		string[] array4;
		for (;;)
		{
			base.Init(mainCanvasGroup, cancelHandler, title);
			UIValueBindingHandler uivalueBindingHandler = this.topHandlers[0];
			Action<int> action = new Action(this.OnWholeVolumeValueChanged);
			string[] array = new string[11];
			if ("0" == 0 || array != 0)
			{
				array[0] = "0";
				if ("1" == 0 || "1" != 0)
				{
					array[1] = "1";
					if ("2" == 0 || "2" != 0)
					{
						array[2] = "2";
						if ("3" == 0 || "3" != 0)
						{
							array[3] = "3";
							if ("4" == 0 || "4" != 0)
							{
								array[4] = "4";
								if ("5" == 0 || "5" != 0)
								{
									array[5] = "5";
									if ("6" == 0 || "6" != 0)
									{
										array[6] = "6";
										if ("7" == 0 || "7" != 0)
										{
											array[7] = "7";
											if ("8" == 0 || "8" != 0)
											{
												array[8] = "8";
												if ("9" == 0 || "9" != 0)
												{
													array[9] = "9";
													if ("10" == 0 || "10" != 0)
													{
														array[10] = "10";
														uivalueBindingHandler.Init(action, array);
														UIValueBindingHandler uivalueBindingHandler2 = this.topHandlers[1];
														Action<int> action2 = new Action(this.OnBgmVolumeValueChanged);
														string[] array2 = new string[11];
														if ("0" == 0 || array2 != 0)
														{
															array2[0] = "0";
															if ("1" == 0 || "1" != 0)
															{
																array2[1] = "1";
																if ("2" == 0 || "2" != 0)
																{
																	array2[2] = "2";
																	if ("3" == 0 || "3" != 0)
																	{
																		array2[3] = "3";
																		if ("4" == 0 || "4" != 0)
																		{
																			array2[4] = "4";
																			if ("5" == 0 || "5" != 0)
																			{
																				array2[5] = "5";
																				if ("6" == 0 || "6" != 0)
																				{
																					array2[6] = "6";
																					if ("7" == 0 || "7" != 0)
																					{
																						array2[7] = "7";
																						if ("8" == 0 || "8" != 0)
																						{
																							array2[8] = "8";
																							if ("9" == 0 || "9" != 0)
																							{
																								array2[9] = "9";
																								if ("10" == 0 || "10" != 0)
																								{
																									array2[10] = "10";
																									uivalueBindingHandler2.Init(action2, array2);
																									UIValueBindingHandler uivalueBindingHandler3 = this.topHandlers[2];
																									Action<int> action3 = new Action(this.OnSfxVolumeValueChanged);
																									string[] array3 = new string[11];
																									if ("0" == 0 || array3 != 0)
																									{
																										array3[0] = "0";
																										if ("1" == 0 || "1" != 0)
																										{
																											array3[1] = "1";
																											if ("2" == 0 || "2" != 0)
																											{
																												array3[2] = "2";
																												if ("3" == 0 || "3" != 0)
																												{
																													array3[3] = "3";
																													if ("4" == 0 || "4" != 0)
																													{
																														array3[4] = "4";
																														if ("5" == 0 || "5" != 0)
																														{
																															array3[5] = "5";
																															if ("6" == 0 || "6" != 0)
																															{
																																array3[6] = "6";
																																if ("7" == 0 || "7" != 0)
																																{
																																	array3[7] = "7";
																																	if ("8" == 0 || "8" != 0)
																																	{
																																		array3[8] = "8";
																																		if ("9" == 0 || "9" != 0)
																																		{
																																			array3[9] = "9";
																																			if ("10" == 0 || "10" != 0)
																																			{
																																				array3[10] = "10";
																																				uivalueBindingHandler3.Init(action3, array3);
																																				uivalueBindingHandler4 = this.topHandlers[3];
																																				action4 = new Action(this.OnVoiceVolumeValueChanged);
																																				array4 = new string[11];
																																				if ("0" == 0 || array4 != 0)
																																				{
																																					array4[0] = "0";
																																					if ("1" == 0 || "1" != 0)
																																					{
																																						array4[1] = "1";
																																						if ("2" == 0 || "2" != 0)
																																						{
																																							array4[2] = "2";
																																							if ("3" == 0 || "3" != 0)
																																							{
																																								array4[3] = "3";
																																								if ("4" == 0 || "4" != 0)
																																								{
																																									array4[4] = "4";
																																									if ("5" == 0 || "5" != 0)
																																									{
																																										array4[5] = "5";
																																										if ("6" == 0 || "6" != 0)
																																										{
																																											array4[6] = "6";
																																											if ("7" == 0 || "7" != 0)
																																											{
																																												array4[7] = "7";
																																												if ("8" == 0 || "8" != 0)
																																												{
																																													array4[8] = "8";
																																													if ("9" == 0 || "9" != 0)
																																													{
																																														array4[9] = "9";
																																														if ("10" == 0 || "10" != 0)
																																														{
																																															break;
																																														}
																																													}
																																												}
																																											}
																																										}
																																									}
																																								}
																																							}
																																						}
																																					}
																																				}
																																			}
																																		}
																																	}
																																}
																															}
																														}
																													}
																												}
																											}
																										}
																									}
																								}
																							}
																						}
																					}
																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		array4[10] = "10";
		uivalueBindingHandler4.Init(action4, array4);
		UIValueBindingHandler[] topHandlers = this.topHandlers;
		base.InitHandlers(topHandlers);
	}

	// Token: 0x06001663 RID: 5731 RVA: 0x00034110 File Offset: 0x00032310
	[Token(Token = "0x6001663")]
	[Address(RVA = "0x189F710", Offset = "0x189E510", VA = "0x18189F710")]
	private void OnWholeVolumeValueChanged(int value)
	{
		VolumeSettings volumeSettings = Game.Config.volumeSettings;
		int num = 0;
		int num2 = Mathf.Clamp(value, num, 10);
		volumeSettings.wholeVolume = num2;
		Game.EmitVolumeSettingsChangedEvent();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x06001664 RID: 5732 RVA: 0x00034154 File Offset: 0x00032354
	[Token(Token = "0x6001664")]
	[Address(RVA = "0x189F560", Offset = "0x189E360", VA = "0x18189F560")]
	private void OnBgmVolumeValueChanged(int value)
	{
		VolumeSettings volumeSettings = Game.Config.volumeSettings;
		int num = 0;
		int num2 = Mathf.Clamp(value, num, 10);
		volumeSettings.ambienceVolume = num2;
		Game.EmitVolumeSettingsChangedEvent();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x06001665 RID: 5733 RVA: 0x00034198 File Offset: 0x00032398
	[Token(Token = "0x6001665")]
	[Address(RVA = "0x189F5F0", Offset = "0x189E3F0", VA = "0x18189F5F0")]
	private void OnSfxVolumeValueChanged(int value)
	{
		VolumeSettings volumeSettings = Game.Config.volumeSettings;
		int num = 0;
		int num2 = Mathf.Clamp(value, num, 10);
		volumeSettings.sfxVolume = num2;
		Game.EmitVolumeSettingsChangedEvent();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x06001666 RID: 5734 RVA: 0x000341DC File Offset: 0x000323DC
	[Token(Token = "0x6001666")]
	[Address(RVA = "0x189F680", Offset = "0x189E480", VA = "0x18189F680")]
	private void OnVoiceVolumeValueChanged(int value)
	{
		VolumeSettings volumeSettings = Game.Config.volumeSettings;
		int num = 0;
		int num2 = Mathf.Clamp(value, num, 10);
		volumeSettings.voiceVolume = num2;
		Game.EmitVolumeSettingsChangedEvent();
		Game.PlayHandlerSE(UIHandlerSFX.Voice);
	}

	// Token: 0x06001667 RID: 5735 RVA: 0x00034220 File Offset: 0x00032420
	[Token(Token = "0x6001667")]
	[Address(RVA = "0x189DB20", Offset = "0x189C920", VA = "0x18189DB20", Slot = "23")]
	protected override ValueType[] GetConfigValues()
	{
		ValueType[] array;
		int num;
		for (;;)
		{
			array = new ValueType[4];
			num = Game.Config.volumeSettings.wholeVolume;
			if (num == 0 || num != 0)
			{
				array[0] = num;
				int ambienceVolume = Game.Config.volumeSettings.ambienceVolume;
				num = ambienceVolume;
				if (ambienceVolume == 0 || ambienceVolume != 0)
				{
					array[1] = num;
					int sfxVolume = Game.Config.volumeSettings.sfxVolume;
					num = sfxVolume;
					if (sfxVolume == 0 || sfxVolume != 0)
					{
						array[2] = num;
						int voiceVolume = Game.Config.volumeSettings.voiceVolume;
						num = voiceVolume;
						if (voiceVolume == 0 || voiceVolume != 0)
						{
							break;
						}
					}
				}
			}
		}
		array[3] = num;
		return array;
	}

	// Token: 0x06001668 RID: 5736 RVA: 0x000342DC File Offset: 0x000324DC
	[Token(Token = "0x6001668")]
	[Address(RVA = "0x189F8B0", Offset = "0x189E6B0", VA = "0x18189F8B0", Slot = "24")]
	protected override void UpdateTopHandlers()
	{
		UIValueBindingHandler uivalueBindingHandler = this.topHandlers[0];
		int wholeVolume = Game.Config.volumeSettings.wholeVolume;
		uivalueBindingHandler.UpdatePointer(wholeVolume);
		UIValueBindingHandler uivalueBindingHandler2 = this.topHandlers[1];
		int ambienceVolume = Game.Config.volumeSettings.ambienceVolume;
		uivalueBindingHandler2.UpdatePointer(ambienceVolume);
		UIValueBindingHandler uivalueBindingHandler3 = this.topHandlers[2];
		int sfxVolume = Game.Config.volumeSettings.sfxVolume;
		uivalueBindingHandler3.UpdatePointer(sfxVolume);
		UIValueBindingHandler uivalueBindingHandler4 = this.topHandlers[3];
		int voiceVolume = Game.Config.volumeSettings.voiceVolume;
		uivalueBindingHandler4.UpdatePointer(voiceVolume);
	}

	// Token: 0x06001669 RID: 5737 RVA: 0x00034394 File Offset: 0x00032594
	[Token(Token = "0x6001669")]
	[Address(RVA = "0x189F290", Offset = "0x189E090", VA = "0x18189F290", Slot = "20")]
	public override void Localize(LocalizationData data)
	{
		string text = data.systemText.GetText(93);
		this.titleText = text;
		UIValueBindingHandler[] topHandlers = this.topHandlers;
		GameTextData systemText = data.systemText;
		UIValueBindingHandler uivalueBindingHandler = topHandlers[0];
		string text2 = systemText.GetText(116);
		uivalueBindingHandler.UpdateLabelText(text2);
		UIValueBindingHandler[] topHandlers2 = this.topHandlers;
		GameTextData systemText2 = data.systemText;
		UIValueBindingHandler uivalueBindingHandler2 = topHandlers2[1];
		string text3 = systemText2.GetText(117);
		uivalueBindingHandler2.UpdateLabelText(text3);
		UIValueBindingHandler[] topHandlers3 = this.topHandlers;
		GameTextData systemText3 = data.systemText;
		UIValueBindingHandler uivalueBindingHandler3 = topHandlers3[2];
		string text4 = systemText3.GetText(118);
		uivalueBindingHandler3.UpdateLabelText(text4);
		UIValueBindingHandler[] topHandlers4 = this.topHandlers;
		GameTextData systemText4 = data.systemText;
		UIValueBindingHandler uivalueBindingHandler4 = topHandlers4[3];
		string text5 = systemText4.GetText(119);
		uivalueBindingHandler4.UpdateLabelText(text5);
		GameTextData systemText5 = data.systemText;
		UILabelHandler resetHandler = this.resetHandler;
		string text6 = systemText5.GetText(15);
		resetHandler.SetLabel(text6);
		GameTextData systemText6 = data.systemText;
		UILabelHandler backHandler = this.backHandler;
		string text7 = systemText6.GetText(12);
		backHandler.SetLabel(text7);
		UIValueBindingHandler[] topHandlers5 = this.topHandlers;
		int num = 0;
		int length = topHandlers5.Length;
		if (num < length)
		{
			UIValueBindingHandler uivalueBindingHandler5 = topHandlers5[num];
			GameFontPack fontPack = data.fontPack;
			uivalueBindingHandler5.UpdateFont(fontPack);
			num++;
		}
		GameFontPack fontPack2 = data.fontPack;
		UILabelHandler resetHandler2 = this.resetHandler;
		Font medium = fontPack2.medium;
		resetHandler2.SetFont(medium);
		GameFontPack fontPack3 = data.fontPack;
		UILabelHandler backHandler2 = this.backHandler;
		Font medium2 = fontPack3.medium;
		backHandler2.SetFont(medium2);
	}

	// Token: 0x0600166A RID: 5738 RVA: 0x00034538 File Offset: 0x00032738
	[Token(Token = "0x600166A")]
	[Address(RVA = "0x189F7A0", Offset = "0x189E5A0", VA = "0x18189F7A0", Slot = "22")]
	protected override void PlayHandlerMoveSE()
	{
		if (this.navigator.currentHandler.index != 3)
		{
			base.PlayHandlerMoveSE();
			return;
		}
		Game.PlayHandlerSE(UIHandlerSFX.Voice);
	}

	// Token: 0x0600166B RID: 5739 RVA: 0x0003456C File Offset: 0x0003276C
	[Token(Token = "0x600166B")]
	[Address(RVA = "0x189F820", Offset = "0x189E620", VA = "0x18189F820", Slot = "25")]
	protected override void SetDefault()
	{
		VolumeSettings volumeSettings = Game.Config.volumeSettings.SetDefault();
		Game.EmitVolumeSettingsChangedEvent();
		((ISavedState)this).StaticDisposeCurrentState();
	}

	// Token: 0x0600166C RID: 5740 RVA: 0x000345A0 File Offset: 0x000327A0
	[Token(Token = "0x600166C")]
	[Address(RVA = "0x384B20", Offset = "0x383920", VA = "0x180384B20")]
	public UISettingsAudio()
	{
	}

	// Token: 0x04002122 RID: 8482
	[Token(Token = "0x4002122")]
	private const int VOICE_HANDLER_INDEX = 3;
}
