void OnLoaded(ServerConnect.UserDataInServer dataLoaded) { hiscoresByMissions.Init(); if (Data.Instance.playMode == Data.PlayModes.STORYMODE || Data.Instance.playMode == Data.PlayModes.SURVIVAL) { Data.Instance.events.OnSaveScore += OnSaveScore; } if (dataLoaded != null && dataLoaded.username != "") { logged = true; userID = dataLoaded.userID; username = dataLoaded.username; score = dataLoaded.score; missionUnblockedID_1 = dataLoaded.missionUnblockedID_1; missionUnblockedID_2 = dataLoaded.missionUnblockedID_2; missionUnblockedID_3 = dataLoaded.missionUnblockedID_3; onlyLocal = false; } else { onlyLocal = true; } print("User data loaded: " + userID + " username: "******" logged: " + logged + " onlyLocal: " + onlyLocal); }
void Awake() { if (!mInstance) { mInstance = this; } else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this); if (RESET_ALL_DATA) { PlayerPrefs.DeleteAll(); } #if UNITY_EDITOR path = Application.persistentDataPath + "/"; #else path = Application.persistentDataPath + "/"; #endif serverConnect = GetComponent <ServerConnect>(); avatarImages = GetComponent <AvatarImages>(); hiscoresByMissions = GetComponent <HiscoresByMissions>(); LoadUser(); hiscoresByMissions.Init(); }