Exemplo n.º 1
0
        public static bool HasSfxOn()
        {
            var appReader = new ApplicationDataReader <AudioData>();
            var data      = appReader.LoadData(audioDataFilePath);

            return(data.isSfxOn);
        }
Exemplo n.º 2
0
        public static void SaveNewScore(int score)
        {
            var appReader     = new ApplicationDataReader <HighScoreData>();
            var highScoreData = appReader.LoadData(highScoreDataFilePath);

            if (highScoreData != null)
            {
                var scores = highScoreData.GetScores();

                for (int i = 0; i < scores.Length; i++)
                {
                    if (score > scores[i])
                    {
                        scores[i] = score;
                        break;
                    }
                }

                highScoreData.SetScores(scores.OrderByDescending(x => x).ToArray());
            }
            else
            {
                var scores = new int[10];
                scores[0]     = score;
                highScoreData = new HighScoreData();
                highScoreData.SetScores(scores);
            }

            appReader.SaveData(highScoreData, highScoreDataFilePath);
        }
Exemplo n.º 3
0
        public static void SetSfx(bool sfxStatus)
        {
            var appReader = new ApplicationDataReader <AudioData>();
            var data      = appReader.LoadData(audioDataFilePath);

            data.isSfxOn = sfxStatus;
            appReader.SaveData(data, audioDataFilePath);
        }
Exemplo n.º 4
0
        public static void SetMusic(bool musicStatus)
        {
            var appReader = new ApplicationDataReader <AudioData>();
            var data      = appReader.LoadData(audioDataFilePath);

            data.isMusicOn = musicStatus;
            appReader.SaveData(data, audioDataFilePath);
        }
Exemplo n.º 5
0
        public static void SavePlayerStatus(PlayerStatusData playerStatusData = null)
        {
            var appDataReader = new ApplicationDataReader <PlayerStatusData>();

            if (playerStatusData == null)
            {
                playerStatusData = appDataReader.LoadData(playerDataFilePath);
            }
            appDataReader.SaveDataAsync(playerStatusData, playerDataFilePath);
        }
Exemplo n.º 6
0
        public RatingRequest GetLastRequestData()
        {
            var appReader   = new ApplicationDataReader <RatingRequest>();
            var requestData = appReader.LoadData(ratingRequestDataFilePath);

            if (requestData == null)
            {
                requestData = new RatingRequest();
            }

            return(requestData);
        }
        public static void SaveTimeExperience(float timeExperience)
        {
            var appReader = new ApplicationDataReader <PlayerExperienceData>();
            var data      = appReader.LoadData(playerDataFilePath);

            if (data == null)
            {
                data = new PlayerExperienceData();
            }
            data.InsertGameDuration(timeExperience);
            appReader.SaveDataAsync(data, playerDataFilePath);
        }
Exemplo n.º 8
0
        public static PlayerStatusData LoadPlayerStatus()
        {
            var appDataReader = new ApplicationDataReader <PlayerStatusData>();

            if (!HasPlayerDataFile())
            {
                PlayerStatusData playerData = CreateInitialPlayerStatus(appDataReader);
                _playerDataInstance = playerData;
                return(_playerDataInstance);
            }

            if (_playerDataInstance == null)
            {
                _playerDataInstance = appDataReader.LoadData(playerDataFilePath);
            }

            return(_playerDataInstance);
        }
Exemplo n.º 9
0
        public static bool HasAudioData()
        {
            var appReader = new ApplicationDataReader <AudioData>();

            return(appReader.LoadData(audioDataFilePath) != null);
        }
Exemplo n.º 10
0
        public static int GetHighestScore()
        {
            var appReader = new ApplicationDataReader <HighScoreData>();

            return(appReader.LoadData(highScoreDataFilePath).GetHighestScore());
        }
        public static PlayerExperienceData LoadTimeExperience()
        {
            var appReader = new ApplicationDataReader <PlayerExperienceData>();

            return(appReader.LoadData(playerDataFilePath));
        }