/// <summary>   Removes the given nonConsumableItem. </summary>
        ///
        /// <param name="nonConsumableItem">    The non consumable item. </param>
        ///
        /// <returns>   true if it succeeds, false if it fails. </returns>
        public bool remove(NonConsumableItem nonConsumableItem)
        {
            SoomlaUtils.LogDebug(TAG, "Removing " + nonConsumableItem.getName());

            String itemId = nonConsumableItem.getItemId();
            String key    = keyNonConsExists(itemId);

            KeyValueStorage.DeleteKeyValue(key);

            return(false);
        }
        private static void setLoggedInForProvider(Provider provider, bool value)
        {
            string key = getLoggedInStorageKeyForProvider(provider);

            if (value)
            {
                KeyValueStorage.SetValue(key, "true");
            }
            else
            {
                KeyValueStorage.DeleteKeyValue(key);
            }
        }
Beispiel #3
0
        /**
         * Removes any upgrade associated with the given VirtualGood.
         *
         * @param good the virtual good to remove the upgrade from
         * @param notify if true post event to bus
         */
        public void removeUpgrades(VirtualGood good, bool notify)
        {
            SoomlaUtils.LogDebug(mTag, "Removing upgrade information from virtual good: " +
                                 good.getName());

            String itemId = good.getItemId();
            String key    = keyGoodUpgrade(itemId);

            KeyValueStorage.DeleteKeyValue(key);

            if (notify)
            {
                BusProvider.Instance.Post(new GoodUpgradeEvent(good, null));
            }
        }
Beispiel #4
0
        protected virtual void _setLastCompletedInnerWorld(World world, string innerWorldId)
        {
            string key = keyLastCompletedInnerWorld(world.ID);

            if (!string.IsNullOrEmpty(innerWorldId))
            {
                KeyValueStorage.SetValue(key, innerWorldId);
            }
            else
            {
                KeyValueStorage.DeleteKeyValue(key);
            }

            // Notify world had inner level complete
            LevelUpEvents.OnLastCompletedInnerWorldChanged(world, innerWorldId);
        }
Beispiel #5
0
        /// <summary>
        /// Assigns the reward with the given reward ID to the given <c>World</c>.
        /// </summary>
        /// <param name="world"><c>World</c> to assign a reward to.</param>
        /// <param name="rewardId">ID of reward to assign.</param>
        protected virtual void _setReward(World world, string rewardId)
        {
            string key = keyReward(world.ID);

            if (!string.IsNullOrEmpty(rewardId))
            {
                KeyValueStorage.SetValue(key, rewardId);
            }
            else
            {
                KeyValueStorage.DeleteKeyValue(key);
            }

            // Notify world was assigned a reward
            LevelUpEvents.OnWorldAssignedReward(world);
        }
Beispiel #6
0
        /// <summary>
        /// Sets the given <c>World</c> as completed if <c>completed</c> is <c>true</c>.
        /// </summary>
        /// <param name="world"><c>World</c> to set as completed.</param>
        /// <param name="completed">If set to <c>true</c> the <c>World</c> will be set
        /// as completed.</param>
        /// <param name="notify">If set to <c>true</c> trigger events.</param>
        protected virtual void _setCompleted(World world, bool completed, bool notify)
        {
            string key = keyWorldCompleted(world.ID);

            if (completed)
            {
                KeyValueStorage.SetValue(key, "yes");

                if (notify)
                {
                    LevelUpEvents.OnWorldCompleted(world);
                }
            }
            else
            {
                KeyValueStorage.DeleteKeyValue(key);
            }
        }
Beispiel #7
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);
                    }
                }
            }
        }
        /** Unity-Editor Functions **/

        /// <summary>
        /// Sets the given <c>Gate</c> as open if <c>open</c> is <c>true.</c>
        /// Otherwise sets as closed.
        /// </summary>
        /// <param name="gate">The <c>Gate</c> to open/close.</param>
        /// <param name="open">If set to <c>true</c> set the <c>Gate</c> to open;
        /// <param name="notify">If set to <c>true</c> trigger event.</param>
        protected virtual void _setOpen(Gate gate, bool open, bool notify)
        {
            string key = keyGateOpen(gate.ID);

            if (open)
            {
                KeyValueStorage.SetValue(key, "yes");


                if (notify)
                {
                    LevelUpEvents.OnGateOpened(gate);
                }
            }
            else
            {
                KeyValueStorage.DeleteKeyValue(key);
            }
        }
Beispiel #9
0
        private static void checkMetadataVersion()
        {
            IsolatedStorageSettings prefs = IsolatedStorageSettings.ApplicationSettings;

            int mt_ver = 0;

            prefs.TryGetValue <int>("MT_VER", out mt_ver);
            int sa_ver_old = -1;

            prefs.TryGetValue <int>("SA_VER_OLD", out sa_ver_old);

            if (mt_ver < StoreConfig.METADATA_VERSION || sa_ver_old < mCurrentAssetsVersion)
            {
                prefs.Add("MT_VER", StoreConfig.METADATA_VERSION);
                prefs.Add("SA_VER_OLD", mCurrentAssetsVersion);
                prefs.Save();

                KeyValueStorage.DeleteKeyValue(keyMetaStoreInfo());
            }
        }
Beispiel #10
0
        /**
         * Helper function for <code>equip</code> and <code>unequip</code> functions.
         */
        private void equipPriv(EquippableVG good, bool equip, bool notify)
        {
            SoomlaUtils.LogDebug(mTag, (!equip ? "unequipping " : "equipping ") + good.getName() + ".");

            String itemId = good.getItemId();
            String key    = keyGoodEquipped(itemId);

            if (equip)
            {
                KeyValueStorage.SetValue(key, "");
                if (notify)
                {
                    BusProvider.Instance.Post(new GoodEquippedEvent(good));
                }
            }
            else
            {
                KeyValueStorage.DeleteKeyValue(key);
                if (notify)
                {
                    BusProvider.Instance.Post(new GoodUnEquippedEvent(good));
                }
            }
        }