diff options
| author | Michael <[email protected]> | 2017-05-06 19:24:57 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-06 19:25:05 -0400 |
| commit | d0d193bb1b869697d633d7ccac35179241f8e981 (patch) | |
| tree | 6f6dcbe27d5342fe5b6172a62f13f6e081c4744c /ShiftOS_TheReturn/LoginManager.cs | |
| parent | b82dfc16ed72b710893d7dc0510bd40a5d3a9a07 (diff) | |
| download | shiftos_thereturn-d0d193bb1b869697d633d7ccac35179241f8e981.tar.gz shiftos_thereturn-d0d193bb1b869697d633d7ccac35179241f8e981.tar.bz2 shiftos_thereturn-d0d193bb1b869697d633d7ccac35179241f8e981.zip | |
GUI-based login screen with skinning!
Diffstat (limited to 'ShiftOS_TheReturn/LoginManager.cs')
| -rw-r--r-- | ShiftOS_TheReturn/LoginManager.cs | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/LoginManager.cs b/ShiftOS_TheReturn/LoginManager.cs new file mode 100644 index 0000000..d326f2c --- /dev/null +++ b/ShiftOS_TheReturn/LoginManager.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Objects; + +namespace ShiftOS.Engine +{ + public static class LoginManager + { + private static ILoginFrontend _login = null; + + public static void Init(ILoginFrontend login) + { + _login = login; + } + + public static void PromptForLogin() + { + _login.LoginComplete += (user) => + { + LoginComplete?.Invoke(user); + }; + _login.Login(); + } + + public static bool ShouldUseGUILogin + { + get + { + if (_login == null) + return false; + return _login.UseGUILogin; + } + } + + public static event Action<ClientSave> LoginComplete; + } + + /// <summary> + /// Interface for GUI-based logins. + /// </summary> + public interface ILoginFrontend + { + /// <summary> + /// When implemented, shows the login UI. + /// </summary> + void Login(); + + /// <summary> + /// Gets whether the ShiftOS engine should use a GUI-based login system or the default one. + /// </summary> + bool UseGUILogin { get; } + + + /// <summary> + /// Occurs when the login is complete. + /// </summary> + event Action<ClientSave> LoginComplete; + + + + } +} |
