Example #1
0
    public bool Save(bool skipSteam = false, TrackerManagerPrefs overrideP = null)
    {
        TrackerManagerPrefs 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));
    }
Example #2
0
    public bool Load()
    {
        TrackerManagerPrefs fileP  = FileLoad();
        TrackerManagerPrefs steamP = SteamLoad();

        bool res = false;

        bool skipSteam        = false;
        TrackerManagerPrefs p = new TrackerManagerPrefs();

        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);
    }
Example #3
0
 public void Reset()
 {
     prefs = new TrackerManagerPrefs();
     Save();
     Load();
 }