Пример #1
0
    public void FaceBookLogin()
    {
        GetMethods.GetUserId(email, (id) => {
            if (id != "0")             // The user exits in the data base

            // Verify if an Update is necessary.
            {
                UpdateMethods.UpdateUsersDatabase(id, userName, age, AppManeger.instance.userGender.ToString(), (result) => {
                    Debug.Log(string.Format("Update {0}", result));
                });

                string fileName = string.Format("Prefs_{0}", AppManeger.instance.userID);

                //GetMethods.GetUserPrefs(id, (prefsResult) => {PrefsResult(prefsResult);}); // Check if the user are in the Prefs Database

                if (SaveLoadData.FileExits(fileName))                 // If exit

                {
                    SaveLoadData.Load(fileName, SaveLoadData.DataType.UserPrefs); // load from device
                    GoToCheersPanel();                                            // Means the user has everyting setted;
                }
                else
                {
                    GetMethods.GetUserPrefs(id, (prefsResult) => { PrefsResult(prefsResult); });                   // Check if the user are in the Prefs Database
                }
            }
            else                // User don't exit in the data base

            {
                PostMethods.InsertUserIntoUsersDatabase(userName, age, email, gender, (result) => {
                    InsertUserResult(result);
                });
            }
        });
    }