Example #1
0
        /// <summary>
        /// Saves the current <c>Score</c> (and record if reached) and resets the score
        /// to its initial value. Use this method for example when a user restarts a
        /// level with a fresh score of 0.
        /// </summary>
        /// <param name="save">If set to <c>true</c> save.</param>
        public void Reset(bool save)
        {
            if (save)
            {
                ScoreStorage.SetLatestScore(this, _tempScore);

                double record = ScoreStorage.GetRecordScore(this);
                if (HasTempReached(record))
                {
                    ScoreStorage.SetRecordScore(this, _tempScore);
                    _scoreRecordReachedSent = false;
                }

                performSaveActions();
            }

            SetTempScore(StartValue);
        }
Example #2
0
        void ClearCurrentState()
        {
            List <String> allKeys = KeyValueStorage.GetEncryptedKeys();

            if (allKeys != null)
            {
                foreach (string key in allKeys)
                {
                    if (key.StartsWith(GateStorage.getKeyGatePrefix()) ||
                        key.StartsWith(LevelStorage.getKeyLevelPrefix()) ||
                        key.StartsWith(MissionStorage.getKeyMissionPrefix()) ||
                        key.StartsWith(ScoreStorage.getKeyScorePrefix()) ||
                        key.StartsWith(WorldStorage.getKeyWorldPrefix()))
                    {
                        KeyValueStorage.DeleteKeyValue(key);
                    }
                }
            }
        }
Example #3
0
        /// <summary>
        /// Determines if this <c>Score</c> has reached a record value of the given <c>scoreVal</c>.
        /// </summary>
        /// <returns>If this score has reached the given record returns <c>true</c>;
        /// otherwise <c>false</c>.</returns>
        /// <param name="scoreVal">numeric score value.</param>
        public bool HasRecordReached(double scoreVal)
        {
            double record = ScoreStorage.GetRecordScore(this);

            return(HasScoreReached(record, scoreVal));
        }