MemberShip ๊ณ์ ๊ฐ์๋ฅผ ๋๋ฆฌ๊ณ ์ถ์ด์
๊ธฐ์กด์ ์์ด๋์ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ๋ง๋ค์์ง๋ง ํด๊ฒฐ๋์ง ์๋ค์(์ฒ์ ๋ง๋ ์์ด๋๋ ์ญ์ ๋๊ณ ๋ ๋ฒ์งธ ๋ง๋ ์์ด๋๋ง ๋ก๊ทธ์ธ ๋จ)์คํฌ๋ฆฝํธ์ "playerprefs.delete all"๋ ์์ต๋๋ค์ฝ๋์ ๋ฌธ์ ๊ฐ ์๋์ง ํ์ธ ๋ถํ๋๋ฆฝ๋๋ค!using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; // UI ์ค๋ธ์ ํธ ๊ด์ฌ using UnityEngine.SceneManagement; //1.ํ์๊ฐ์
, ๋ก๊ทธ์ธ, ์์ด๋ ์ฐพ๊ธฐ ๊ธฐ๋ฅ ๊ตฌํ //๋ก๊ทธ์ธ ์ฑ๊ณต -> ์บ๋ฆญํฐ ์ ํ ์ฐฝ public class StartManager : MonoBehaviour { //์ ๊ทผ์ ํ ์ง์ ์ //1.public -> ์ธ๋ถ๊ณต๊ฐ //2.private -> ๋ด๋ถ๊ณต๊ฐ //3.protected -> ์์์๊ฒ๋ง ๊ณต๊ฐ //์ ๊ทผ์ ํ์ง์ ์,์๋ฃํ,์๋ณ์; [Header("MemberShip")] public GameObject MemberShip_UI; public Text M_ID_Text; //์์ด๋๋ฅผ ์
๋ ฅํ๋ ํ
์คํธ public Text M_Password_Text; //๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ๋ ํ
์คํธ public Text M_Find_Text; //๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ๋ ํ
์คํธ [Header("Login")] public GameObject Login_UI; public Text I_ID_Text; //์์ด๋๋ฅผ ์
๋ ฅํ๋ ํ
์คํธ public Text I_Password_Text; //๋น๋ฐ๋ฒํธ๋ฅผ ์
๋ ฅํ๋ ํ
์คํธ public GameObject NotLogin_UI; //๋ก๊ทธ์ธ ์คํจ UI public Text NotLogin_Text; //๋ก๊ทธ์ธ ์คํจ ์์ธ ์๋ฆผ [Header("Find")] public GameObject Find_UI; public Text FindText; public GameObject Not_UI_Find; public Text Not_text; public void MebShip_Btn() { PlayerPrefs.SetString("ID", M_ID_Text.text); //์์ด๋ ์
๋ ฅ PlayerPrefs.SetString("Password", M_Password_Text.text); //๋น๋ฐ๋ฒํธ ์
๋ ฅ PlayerPrefs.SetString("Find", M_Find_Text.text); // ํํธ ์
๋ ฅ MemberShip_UI.SetActive(false); //ํ์๊ฐ์
UI ๋นํ์ฑํ } public void Login_Btn() { //1. ์์ด๋ ๋ถ์ผ์น if(PlayerPrefs.GetString("ID") != I_ID_Text.text) { Login_UI.SetActive(false); NotLogin_UI.SetActive(true); NotLogin_Text.text = "์์ด๋๊ฐ ์ผ์นํ์ง ์์ต๋๋ค"; } //2. ๋น๋ฐ๋ฒํธ ๋ถ์ผ์น if (PlayerPrefs.GetString("Password") != I_Password_Text.text) { Login_UI.SetActive(false); NotLogin_UI.SetActive(true); NotLogin_Text.text = "๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค"; } //3. ์์ด๋, ๋น๋ฐ๋ฒํธ ๋ถ์ผ์น if (PlayerPrefs.GetString ("ID") != I_ID_Text.text && PlayerPrefs.GetString("Password") != I_Password_Text.text) { Login_UI.SetActive(false); NotLogin_UI.SetActive(true); NotLogin_Text.text = "์์ด๋์ ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค"; } //4. ๋ก๊ทธ์ธ ์ฑ๊ณต if (PlayerPrefs.GetString("ID") == I_ID_Text.text && PlayerPrefs.GetString("Password") == I_Password_Text.text) { SceneManager.LoadScene("Select"); } //Invoke("ํจ์๋ช
", ์๊ฐ); Invoke("NotLogin_Exit", 2f); } private void NotLogin_Exit() { NotLogin_UI.SetActive(false); } public void FindBtn() { Find_UI.SetActive(false); Not_UI_Find.SetActive(true); if (PlayerPrefs.GetString("Find") == FindText.text) { Not_text.text = PlayerPrefs.GetString("ID")+ "\n" + PlayerPrefs.GetString("Password"); } else { Not_text.text = "์๋ชป๋ ํํธ์
๋๋ค"; } Invoke("Not_UI_Exit", 2f); } private void Not_UI_Exit() { Not_UI_Find.SetActive(false); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { Debug.Log(PlayerPrefs.GetString("ID")); // Get : ๋ด์ฉํ์ธ Debug.Log(PlayerPrefs.GetString("Password")); Debug.Log(PlayerPrefs.GetString("Find")); } }