/// <summary> /// Set ip endpoint /// </summary> private void Init() { // Initialize AccountsTransport with server endpoint string ip = _testModeLocalhost ? "127.0.0.1" : _accountsServerIp; AccountsTransport.SetIpEndpoint(ip, _accountsServerPort); //StartCoroutine(//todo CheckVersion(LoginServerIp, LoginServerPort)); // login if remember me RememberMe = PlayerPrefs.GetString("RememberMe") == "true"; if (_loginIfRememberMe && RememberMe) { print("Remember me is set. Logging in with last saved player data."); string email = PlayerPrefs.GetString("Email"); string pass = PlayerPrefs.GetString("Password"); string method = PlayerPrefs.GetString("LastLoginMethod"); if (method == "Email") { LoginEmail(email, pass); } } else // open login scene { if (SceneManager.GetActiveScene() != SceneManager.GetSceneByName(_sceneLogin)) { SceneManager.LoadScene(_sceneLogin); } } }
/// <summary> /// Try login withou registration /// </summary> public static void SendAnonLogin(string nickname) { BufferLastLogin(nickname, "", "", AccountData.LoginMethod.Email); XElement body = new XElement( new XElement("Request", //add login data new XElement("Connection", new XElement("ClientVersion", Application.version), new XElement("LoginMethod", "Anonymous"), new XElement("Nickname", nickname) ) ) ); AccountsTransport.Send(body); }
/// <summary> /// try login via email and password /// </summary> public static void SendEmailLogin(string email, string password) { BufferLastLogin("", email, password, AccountData.LoginMethod.Email); XElement body = new XElement( new XElement("Request", //add login data new XElement("Connection", new XElement("ClientVersion", Application.version), new XElement("LoginMethod", "EmailLogin"), new XElement("Email", email), new XElement("Password", password) ) ) ); AccountsTransport.Send(body); }