private void NotifyInnerWorldFirstCompleted(World innerWorld) { if (innerWorld != null) { WorldStorage.SetLastCompletedInnerWorld(this, innerWorld.ID); } }
/// <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(); }
public void SetCompleted(bool completed, bool recursive) { if (recursive) { foreach (World world in InnerWorldsMap.Values) { world.SetCompleted(completed, true); } } WorldStorage.SetCompleted(this, completed); }
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); } } } }
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); } }
/** 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); }
/// <summary> /// Gets the last completed inner world ID. /// </summary> /// <returns>The last completed inner world ID.</returns> public string GetLastCompletedInnerWorld() { return(WorldStorage.GetLastCompletedInnerWorld(this)); }
/// <summary> /// Retrieves the assigned reward ID. /// </summary> /// <returns>The assigned reward ID.</returns> public String GetAssignedRewardId() { return(WorldStorage.GetAssignedReward(this)); }
/** 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)); }