40 lines
959 B
C#
40 lines
959 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class MenuController : MonoBehaviour
|
|
{
|
|
public GameObject confirmPanel;
|
|
public void OnPlayClicked()
|
|
{
|
|
if (PlayerPrefs.HasKey("userId"))
|
|
{
|
|
// Sudah pernah isi data → langsung ke pretest atau game
|
|
SceneManager.LoadScene("Pretest");
|
|
}
|
|
else
|
|
{
|
|
// Belum ada data → ke input nama
|
|
SceneManager.LoadScene("InputUser");
|
|
}
|
|
}
|
|
|
|
public void OnChangeUserClicked()
|
|
{
|
|
confirmPanel.SetActive(true); // Tampilkan popup konfirmasi
|
|
}
|
|
|
|
public void OnChangeUserConfirmed()
|
|
{
|
|
PlayerPrefs.DeleteKey("userId");
|
|
PlayerPrefs.Save();
|
|
UnityEngine.SceneManagement.SceneManager.LoadScene("InputUser");
|
|
}
|
|
|
|
public void OnCancelChangeUser()
|
|
{
|
|
confirmPanel.SetActive(false);
|
|
}
|
|
}
|