using System; using UnityEngine; using GamecraftModdingAPI.Utility; namespace GamecraftModdingAPI.App { /// /// The Gamecraft application that is running this code right now. /// public class Client { // extensible engine protected static AppEngine appEngine = new AppEngine(); /// /// An event that fires whenever the main menu is loaded. /// public static event EventHandler EnterMenu { add => appEngine.EnterMenu += value; remove => appEngine.EnterMenu -= value; } /// /// An event that fire whenever the main menu is exited. /// public static event EventHandler ExitMenu { add => appEngine.ExitMenu += value; remove => appEngine.ExitMenu -= value; } /// /// Gamecraft build version string. /// Usually this is in the form YYYY.mm.DD.HH.MM.SS /// /// The version. public string Version { get => Application.version; } /// /// Unity version string. /// /// The unity version. public string UnityVersion { get => Application.unityVersion; } /// /// Game saves currently visible in the menu. /// These take a second to completely populate after the EnterMenu event fires. /// /// My games. public Game[] MyGames { get { if (!appEngine.IsInMenu) return new Game[0]; return appEngine.GetMyGames(); } } /// /// Whether Gamecraft is in the Main Menu /// /// true if in menu; false when loading or in a game. public bool InMenu { get => appEngine.IsInMenu; } internal static void Init() { MenuEngineManager.AddMenuEngine(appEngine); } } }