Exemplo n.º 1
0
        public void onLevelEnded(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onLevelEnded with message: " + message);

            Level level = (Level)SoomlaLevelUp.GetWorld(message);

            LevelUpEvents.OnLevelEnded(level);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Retrieves this instance of <c>SoomlaLevelUp</c>. Used when initializing SoomlaLevelUp.
 /// </summary>
 /// <returns>This instance of <c>SoomlaLevelUp</c>.</returns>
 static SoomlaLevelUp Instance()
 {
     if (instance == null)
     {
         instance = new SoomlaLevelUp();
     }
     return(instance);
 }
Exemplo n.º 3
0
        public void onWorldAssignedReward(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onWorldAssignedReward with message: " + message);

            World world = SoomlaLevelUp.GetWorld(message);

            LevelUpEvents.OnWorldAssignedReward(world);
        }
Exemplo n.º 4
0
        public void onGateClosed(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGateClosed with message: " + message);

            Gate gate = SoomlaLevelUp.GetGate(message);

            LevelUpEvents.OnGateClosed(gate);
        }
Exemplo n.º 5
0
        public void onScoreRecordChanged(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onScoreRecordChanged with message: " + message);

            Score score = SoomlaLevelUp.GetScore(message);

            LevelUpEvents.OnScoreRecordChanged(score);
        }
Exemplo n.º 6
0
        public void onMissionCompletionRevoked(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMissionCompletionRevoked with message: " + message);

            Mission mission = SoomlaLevelUp.GetMission(message);

            LevelUpEvents.OnMissionCompletionRevoked(mission);
        }
        /// <summary>
        /// Checks if this <c>Gate</c> meets its criteria for opening, by checking if this <c>Gate</c>'s
        /// associated <c>Score</c> has reached the desired record.
        /// </summary>
        /// <returns>If the <c>Gate</c> can be opened returns <c>true</c>; otherwise <c>false</c>.</returns>
        protected override bool canOpenInner()
        {
            Score score = SoomlaLevelUp.GetScore(AssociatedScoreId);

            if (score == null)
            {
                SoomlaUtils.LogError(TAG, "(canOpenInner) couldn't find score with scoreId: " + AssociatedScoreId);
                return(false);
            }
            return(score.HasRecordReached(DesiredRecord));
        }
Exemplo n.º 8
0
        public void onLastCompletedInnerWorldChanged(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onLastCompletedInnerWorldChanged with message: " + message);

            JSONObject eventJSON = new JSONObject(message);

            string worldId      = eventJSON["worldId"].str;
            string innerWorldId = eventJSON["innerWorldId"].str;

            World world = SoomlaLevelUp.GetWorld(worldId);

            LevelUpEvents.OnLastCompletedInnerWorldChanged(world, innerWorldId);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Retrieves this instance of <c>SoomlaLevelUp</c>. Used when initializing SoomlaLevelUp.
 /// </summary>
 /// <returns>This instance of <c>SoomlaLevelUp</c>.</returns>
 static SoomlaLevelUp Instance()
 {
     if (instance == null) {
         instance = new SoomlaLevelUp();
     }
     return instance;
 }
        /// <summary>
        /// Checks if this <c>Gate</c> meets its criteria for opening, by checking that the
        /// associated world is not null and has been completed.
        /// </summary>
        /// <returns>If this <c>World</c> can be opened returns <c>true</c>; otherwise <c>false</c>.</returns>
        protected override bool canOpenInner()
        {
            World world = SoomlaLevelUp.GetWorld(AssociatedWorldId);

            return(world != null && world.IsCompleted());
        }