/// <summary> /// Called when the script is being destroyed. /// </summary> private void OnDestroy() { BSEvents.menuSceneActive -= UpdateScoreTracker; ToDB.SaveProfiles(); ToDB.SaveTracked(); Plugin.Log?.Debug($"{name}: OnDestroy()"); if (Instance == this) { Instance = null; // This MonoBehaviour is being destroyed, so set the static instance property to null. } }
public static void GetScoreSaberData(string _ScoreSaberID) { string _url = "https://new.scoresaber.com/api/player/" + _ScoreSaberID + "/basic"; string _json = new WebClient().DownloadString(_url); var _newProfile = JsonConvert.DeserializeObject <Classes.Profile>(_json); var _newProfile2 = _newProfile.playerInfo; _newProfile2.compare = true; _newProfile2.tracked = true; ScoreTrackerController.profileList.Add(_newProfile2); ScoreTrackerController.trackedList.Add(new Classes.Tracked(_newProfile2.timestampu, _newProfile2.playerId, _newProfile2.playerName, _newProfile2.pp, _newProfile2.rank, _newProfile2.countryRank, _newProfile2.country, _newProfile2.timestamp)); ToDB.SaveProfiles(); ToDB.SaveTracked(); }