void LoadPlayerProgress() { gameLaunchCounter = AEDatabase.HasKey("gameLaunchCounter") ? AEDatabase.GetInt("gameLaunchCounter") : 0; rateWindowVisible = AEDatabase.HasKey("rateWindowVisible") ? AEDatabase.GetBool("rateWindowVisible") : false; standardAchievements = new List <string>(AEDatabase.GetStringArray("standardAchievements")); incrementalAchievements = new List <string>(AEDatabase.GetStringArray("incrementalAchievements")); gameLaunchCounter++; gameDataLoaded = true; }
void Start() { volume = 0.4f; soundsMuted = AEDatabase.HasKey("soundsMuted") ? AEDatabase.GetBool("soundsMuted") : false; musicMuted = AEDatabase.HasKey("musicMuted") ? AEDatabase.GetBool("musicMuted") : false; sounds.volume = volume; sounds.mute = soundsMuted; music.volume = volume; music.mute = musicMuted; }
IEnumerator TryLoginWhenInternet() { gameInstalled = AEDatabase.HasKey("gameInstalled") ? AEDatabase.GetBool("gameInstalled") : false; if (gameInstalled) { Debug.Log("game installed load locally"); if (!gameLaunched) { gameLaunched = true; LoadPlayerProgress(); } while (!gameCanBeLoaded) { yield return(null); } if (!userSignedIn && internetAvailable) { Social.localUser.Authenticate((bool succes) => { if (succes) { userSignedIn = true; Debug.Log("user logged"); UnlockOfflineAchievements(); } else { Debug.Log("user not logged"); userSignedIn = false; } }); } else if (userSignedIn) { UnlockOfflineAchievements(); } } else { while (!gameCanBeLoaded) { yield return(null); } if (internetAvailable) { Debug.Log("trying to login"); if (!userSignedIn) { Social.localUser.Authenticate((bool succes) => { if (succes) { userSignedIn = true; Debug.Log("user logged"); UnlockOfflineAchievements(); if (!gameLaunched) { gameLaunched = true; LoadGameFromCloud(); } gameInstalled = true; } else { Debug.Log("user not logged"); userSignedIn = false; if (!gameLaunched) { gameLaunched = true; LoadPlayerProgress(); } gameInstalled = true; } }); } else { Debug.Log("user already logged"); UnlockOfflineAchievements(); if (!gameLaunched) { gameLaunched = true; LoadPlayerProgress(); } gameInstalled = true; } } else { Debug.Log("no internet"); if (!gameLaunched) { gameLaunched = true; LoadPlayerProgress(); } gameInstalled = true; } } }
void LoadGameSettings() { soundsMuted = AEDatabase.HasKey("soundsMuted") ? AEDatabase.GetBool("soundsMuted") : false; musicMuted = AEDatabase.HasKey("musicMuted") ? AEDatabase.GetBool("musicMuted") : false; }