private void SuccesLogin(WWW www) { ServerController.onSuccessHandler -= SuccesLogin; ServerController.onSuccessHandler = null; Models.user = JsonUtility.FromJson <Garage>(www.text); Debug.Log(www.text); Debug.Log(Models.user.user); LoginPage.SetActive(false); GlobalParameters.isLogined = true; if (isSaveble) { SaveModelController.SaweUserData(); } if (!PlayerPrefs.HasKey("google")) { PlayerPrefs.SetInt("google", 0); var auth = new UnityGoogleDrive.Data.File() { Name = "authointification" }; GoogleDriveFiles.Create(auth).Send(); } CallMessage cmsg = new CallMessage(); cmsg.from = Models.user.user; cmsg.to = SystemInfo.deviceUniqueIdentifier; cmsg.comand = "login"; WEbSocketController.GetInstance.SendMessage(JsonUtility.ToJson(cmsg)); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Start() { if (GlobalParameters.isLogined) { LoginPage.SetActive(false); } else { if (SaveModelController.LoadUserData()) { LogIn(false); } } }
private void SuccesLogin(WWW www) { Models.user = JsonUtility.FromJson <UserModel>(www.text); LoginPage.SetActive(false); GlobalParameters.isLogined = true; if (isSaveble) { SaveModelController.SaweUserData(); } ServerController.onSuccessHandler -= SuccesLogin; CallMessage cmsg = new CallMessage(); cmsg.from = Models.user.user; cmsg.to = SystemInfo.deviceUniqueIdentifier; cmsg.comand = "login"; WEbSocketController.GetInstance.SendMessage(JsonUtility.ToJson(cmsg)); }