Super Knight : Enter the Dungeon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class ToggleState : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Toggle toggle;
|
|
|
|
|
public string key;
|
|
|
|
|
[Space(10)]
|
|
|
|
|
[Header("최초 설정 시 상태")]
|
|
|
|
|
public bool INIT_SETTING = false;
|
|
|
|
|
|
|
|
|
|
bool INIT = false;
|
|
|
|
|
private void Initialized()
|
|
|
|
|
{
|
|
|
|
|
if (INIT)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
INIT = true;
|
|
|
|
|
if (PlayerPrefs.HasKey($"{key}"))
|
|
|
|
|
{
|
|
|
|
|
toggle.isOn = bool.Parse(PlayerPrefs.GetString($"{key}"));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
toggle.isOn = INIT_SETTING;
|
|
|
|
|
OnChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
Initialized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnChanged()
|
|
|
|
|
{
|
|
|
|
|
PlayerPrefs.SetString($"{key}", $"{toggle.isOn}");
|
|
|
|
|
PlayerPrefs.Save();
|
|
|
|
|
}
|
|
|
|
|
public bool StateGet()
|
|
|
|
|
{
|
|
|
|
|
Initialized();
|
|
|
|
|
|
|
|
|
|
return toggle.isOn;
|
|
|
|
|
}
|
|
|
|
|
}
|