using Cute;
using UnityEngine;
using Wizard;

public class MatchingIPv6Toggle : MonoBehaviour
{
	[SerializeField]
	private UIToggle _networkLineChangeToggle;

	private const string TOGGLE_PATH = "UI/layoutParts/MatchingIPv6Toggle";

	public static void AddMatchingIPv6Toggle(DialogBase dialog)
	{
		MatchingIPv6Toggle matchingIPv6Toggle = Object.Instantiate(Toolbox.ResourcesManager.LoadObject<MatchingIPv6Toggle>("UI/layoutParts/MatchingIPv6Toggle", isServerResources: false));
		dialog.SetObj(matchingIPv6Toggle.gameObject);
		matchingIPv6Toggle.SettingToggle();
	}

	public void SettingToggle()
	{
		_networkLineChangeToggle.onChange.Add(new EventDelegate(OnClickToggle));
		_networkLineChangeToggle.value = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_IPV6);
	}

	private void OnClickToggle()
	{
		PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SELECT_IPV6, _networkLineChangeToggle.value);
		GameMgr.GetIns().GetSoundMgr().PlaySe(_networkLineChangeToggle.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF);
	}
}
