Exemplo n.º 1
0
        protected virtual bool ReadSaveHistory(string saveDataKey)
        {
            var historyData = string.Empty;

#if UNITY_WEBPLAYER || UNITY_WEBGL
            historyData = PlayerPrefs.GetString(saveDataKey);
#else
            var fullFilePath = GetFullFilePath(saveDataKey);
            if (System.IO.File.Exists(fullFilePath))
            {
                historyData = System.IO.File.ReadAllText(fullFilePath);
            }
#endif//UNITY_WEBPLAYER
            if (!string.IsNullOrEmpty(historyData))
            {
                var tempSaveHistory = JsonUtility.FromJson <SaveHistory>(historyData);
                if (tempSaveHistory != null)
                {
                    saveHistory = tempSaveHistory;
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        protected virtual bool ReadSaveHistory(string saveDataKey)
        {
            var historyData = PlayerPrefs.GetString(saveDataKey);
            if (!string.IsNullOrEmpty(historyData))
            {
                var tempSaveHistory = JsonUtility.FromJson<SaveHistory>(historyData);
                if (tempSaveHistory != null)
                {
                    saveHistory = tempSaveHistory;
                    return true;
                }
            }

            return false;
        }
Exemplo n.º 3
0
        protected virtual bool ReadSaveHistory(string saveDataKey)
        {
            var historyData = PlayerPrefs.GetString(saveDataKey);

            if (!string.IsNullOrEmpty(historyData))
            {
                var tempSaveHistory = JsonUtility.FromJson <SaveHistory>(historyData);
                if (tempSaveHistory != null)
                {
                    saveHistory = tempSaveHistory;
                    return(true);
                }
            }

            return(false);
        }