Exemple #1
0
 private void NotifyInnerWorldFirstCompleted(World innerWorld)
 {
     if (innerWorld != null)
     {
         WorldStorage.SetLastCompletedInnerWorld(this, innerWorld.ID);
     }
 }
Exemple #2
0
        /// <summary>
        /// Initializes the specified <c>InitialWorld</c> and rewards.
        /// </summary>
        /// <param name="initialWorld">Initial world.</param>
        public static void Initialize(World initialWorld)
        {
            InitialWorld = initialWorld;

            save();

            WorldStorage.InitLevelUp();
        }
Exemple #3
0
 public void SetCompleted(bool completed, bool recursive)
 {
     if (recursive)
     {
         foreach (World world in InnerWorldsMap.Values)
         {
             world.SetCompleted(completed, true);
         }
     }
     WorldStorage.SetCompleted(this, completed);
 }
Exemple #4
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);
                    }
                }
            }
        }
Exemple #5
0
        public void SetCompleted(bool completed, bool recursive)
        {
            if (recursive)
            {
                foreach (World world in InnerWorldsMap.Values)
                {
                    world.SetCompleted(completed, true);
                }
            }

            // keep current completed state
            bool alreadyCompleted = IsCompleted();

            WorldStorage.SetCompleted(this, completed);

            if (!alreadyCompleted && completed && (ParentWorld != null))
            {
                ParentWorld.NotifyInnerWorldFirstCompleted(this);
            }
        }
Exemple #6
0
        /** Reward Association **/

        /// <summary>
        /// Assigns the given reward to this <c>World</c>.
        /// </summary>
        /// <param name="reward">Reward to assign.</param>
        public void AssignReward(Reward reward)
        {
            String olderReward = GetAssignedRewardId();

            if (!string.IsNullOrEmpty(olderReward))
            {
                Reward oldReward = SoomlaLevelUp.GetReward(olderReward);
                if (oldReward != null)
                {
                    oldReward.Take();
                }
            }

            // We have to make sure the assigned reward can be assigned unlimited times.
            // There's no real reason why it won't be.
            if (reward.Schedule.ActivationLimit > 0)
            {
                reward.Schedule.ActivationLimit = 0;
            }

            reward.Give();
            WorldStorage.SetReward(this, reward.ID);
        }
Exemple #7
0
 /// <summary>
 /// Gets the last completed inner world ID.
 /// </summary>
 /// <returns>The last completed inner world ID.</returns>
 public string GetLastCompletedInnerWorld()
 {
     return(WorldStorage.GetLastCompletedInnerWorld(this));
 }
Exemple #8
0
 /// <summary>
 /// Retrieves the assigned reward ID.
 /// </summary>
 /// <returns>The assigned reward ID.</returns>
 public String GetAssignedRewardId()
 {
     return(WorldStorage.GetAssignedReward(this));
 }
Exemple #9
0
        /** Completion **/

        /// <summary>
        /// Determines whether this <c>World</c> is completed.
        /// </summary>
        /// <returns><c>true</c> if this instance is completed; otherwise, <c>false</c>.</returns>
        public bool IsCompleted()
        {
            return(WorldStorage.IsCompleted(this));
        }