public bool Save(bool skipSteam = false, TurnSignalPrefs overrideP = null) { TurnSignalPrefs p; if (overrideP != null) { p = overrideP; } else { p = prefs; } p.lastEditTime = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; string text = JsonUtility.ToJson(prefs, true); string fullP = _filePath + _fileName; Debug.Log("Writing Local Prefs!"); File.WriteAllText(fullP, text); if (!skipSteam) { SteamSave(); } return(File.Exists(fullP)); }
public bool Load() { TurnSignalPrefs fileP = FileLoad(); TurnSignalPrefs steamP = SteamLoad(); bool res = false; bool skipSteam = false; TurnSignalPrefs p = new TurnSignalPrefs(); if (fileP != null && steamP != null) { if (fileP.lastEditTime >= steamP.lastEditTime) { p = fileP; } else { p = steamP; skipSteam = true; } res = true; } else if (fileP == null && steamP != null) { p = steamP; skipSteam = true; res = true; } else if (fileP != null && steamP == null) { p = fileP; res = true; } prefs = p; Save(skipSteam); return(res); }
public void Reset() { prefs = new TurnSignalPrefs(); Save(); Load(); }