91 lines
2.7 KiB
C#
91 lines
2.7 KiB
C#
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
/// <summary>
|
|
/// StartScreen scene manager
|
|
/// </summary>
|
|
public class MainMenuScreen : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// Reference to the enter animation scene playable director
|
|
/// </summary>
|
|
public PlayableDirector directorEnterFromBoot;
|
|
|
|
/// <summary>
|
|
/// Reference to the enter animation scene playable director
|
|
/// </summary>
|
|
public PlayableDirector directorEnterFromCourseMenu;
|
|
|
|
/// <summary>
|
|
/// Reference to the enter animation scene playable director
|
|
/// </summary>
|
|
public PlayableDirector directorEnterFromListMinigames;
|
|
|
|
/// <summary>
|
|
/// Reference to the enter animation scene playable director
|
|
/// </summary>
|
|
public PlayableDirector directorEnterFromSettings;
|
|
|
|
/// <summary>
|
|
/// Check on load whether a user is already present,
|
|
/// if not load the UserCreationScreen scene so the user can create a new account
|
|
/// </summary>
|
|
void Awake()
|
|
{
|
|
if (!File.Exists(PersistentDataController.PATH) || UserList.GetUsers().Count <= 0)
|
|
{
|
|
UserCreationScreen.canGoBack = false;
|
|
SystemController.GetInstance().LoadNextScene("Accounts/Scenes/UserCreationScreen");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Start is called before the first frame update
|
|
/// </summary>
|
|
void Start()
|
|
{
|
|
var sys = SystemController.GetInstance();
|
|
if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/Boot"))
|
|
directorEnterFromBoot.Play();
|
|
else if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/CoursesMenuScreen"))
|
|
directorEnterFromCourseMenu.Play();
|
|
else if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/ListMinigamesScreen"))
|
|
directorEnterFromListMinigames.Play();
|
|
else if (sys.previousScene == SystemController.GetSceneIndex("Common/Scenes/SettingsScreen"))
|
|
directorEnterFromSettings.Play();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Quit the application
|
|
/// </summary>
|
|
public void QuitApplication()
|
|
{
|
|
Application.Quit();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Load the `CoursesMenuScreen` scene
|
|
/// </summary>
|
|
public void GotoCourses()
|
|
{
|
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/CoursesMenuScreen");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Load the `ListMinigamesScreen` scene
|
|
/// </summary>
|
|
public void GotoMinigames()
|
|
{
|
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/ListMinigamesScreen");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Load the `SettingsScreen` scene
|
|
/// </summary>
|
|
public void GotoSettings()
|
|
{
|
|
SystemController.GetInstance().LoadNextScene("Common/Scenes/SettingsScreen");
|
|
}
|
|
}
|