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