예제 #1
0
 private void NotifyInnerWorldFirstCompleted(World innerWorld)
 {
     if (innerWorld != null)
     {
         WorldStorage.SetLastCompletedInnerWorld(this, innerWorld.ID);
     }
 }
예제 #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();
        }
예제 #3
0
파일: World.cs 프로젝트: makezi/shape-clash
 public void SetCompleted(bool completed, bool recursive)
 {
     if (recursive)
     {
         foreach (World world in InnerWorldsMap.Values)
         {
             world.SetCompleted(completed, true);
         }
     }
     WorldStorage.SetCompleted(this, completed);
 }
예제 #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);
                    }
                }
            }
        }
예제 #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);
            }
        }
예제 #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);
        }
예제 #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));
 }
예제 #8
0
 /// <summary>
 /// Retrieves the assigned reward ID.
 /// </summary>
 /// <returns>The assigned reward ID.</returns>
 public String GetAssignedRewardId()
 {
     return(WorldStorage.GetAssignedReward(this));
 }
예제 #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));
        }