public void CallLogin() { LoginSave.SaveMailLogin(accountMail.text); dialogWindow.SetActive(true); //dialogText.enabled = true; dialogText.text = controller.lc.GetLocalizedValue("dialog_login"); StartCoroutine(Login()); }
public void SaveLogin(LoginSave Info) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/login.dat"); bf.Serialize(file, Info); file.Close(); }
void Start() { userInput.text = Register.username; //if coming from successful Register, username field displays choosen username LoginSave Info = new LoginSave(); Info = LoadLogin(); userInput.text = Info.username; passwordInput.text = Info.password; }
// Start is called before the first frame update void Start() { accountPassword.inputType = InputField.InputType.Password; accountMail.text = LoginSave.LoadMailLogin(); submitButton.onClick.AddListener(CallLogin); registerButton.onClick.AddListener(GoToRegistrationScreen); PhotonNetwork.AuthValues = new AuthenticationValues("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"); exitButton.onClick.AddListener(AskForExit); dialogButtonBtn.onClick.AddListener(ConfirmationDialogBox); offlineRoomButton.onClick.AddListener(AskForOffline); }
public KeyLoginBuilder FromString(string json) { LoginSave save = JsonSerializer.Deserialize <LoginSave>(json); if (save.Type != "Key") { throw new Exception($"Unknown token types '{save.Type}' expected type 'Key'"); } Tokens = JsonSerializer.Deserialize <List <KeyTokenSave> >(save.Data); return(this); }
public LoginSave LoadLogin() { //check if login save file exist if (File.Exists(Application.persistentDataPath + "/login.dat")) //true, insest username and password { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/login.dat", FileMode.Open); LoginSave LoginSaved = (LoginSave)bf.Deserialize(file); file.Close(); return(LoginSaved); } else //false do nothing { Debug.Log(string.Format("Login file doesn't exist at path: {0}{1}", Application.persistentDataPath, "/login.dat")); return(null); } }
IEnumerator WaitForRequest(WWW www, string passw) { yield return(www); if (www.error == null) //connection is good and string recieved from server { //Debug.Log("Connection good."); string text = Regex.Replace(www.text, @"\s", ""); //strip www.text of any whitespace //Debug.Log(text); if (text == "1") { Debug.Log("Username not found."); //give login error ErrorText.text = "Username or password incorrect."; } if (text == "2") { Debug.Log("Password incorrect."); //give login error ErrorText.text = "Username or password incorrect."; } else { Debug.Log("Logged In"); //display welcome ErrorText.text = "Welcome, " + username; //yield return new WaitForSeconds(2); parsePlayerInfo(text); LoginSave Info = new LoginSave(); Info.username = Player.playername; Info.password = passw; SaveLogin(Info); goToOverworld(); // proceed to Overworld } } else { Debug.Log("Connection error."); } }