Esempio n. 1
0
        /// <summary>
        /// Method for retrieving the game storage - results of the questionnaire
        /// </summary>
        /// <returns> Dictionary containing the group as key and the value of the questionnaire, is possible - null otherwise </returns>
        internal Dictionary <string, double> getQuestionnaireResultFromGameStorage()
        {
            StorageLocations       storageLocation = StorageLocations.Local;
            GameStorageClientAsset gameStorage     = getGameStorageAsset();

            String model = "PlayerProfilingAsset_" + ((PlayerProfilingAssetSettings)getPPA().Settings).PlayerId + "_" + getQuestionnaireData().id;

            Boolean isStructureRestored = gameStorage.LoadStructure(model, storageLocation, SerializingFormat.Xml);
            Boolean isDataRestored      = gameStorage.LoadData(model, StorageLocations.Local, SerializingFormat.Xml);

            if (isStructureRestored && isDataRestored)
            {
                loggingPPA("Questionnaire results were restored from local file.");
                Dictionary <string, double> results = new Dictionary <string, double>();
                foreach (Node node in storage[model].Children)
                {
                    results.Add(node.Name, (double)node.Value);
                }
                questionnaireResults = results;
                return(results);
            }
            else
            {
                loggingPPA("Questionnaire results could not be restored from local file!");
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Method for returning the game storage asset instance.
        /// </summary>
        /// <returns>Instance of the game storage asset</returns>
        internal GameStorageClientAsset getGameStorageAsset()
        {
            if (storage == null)
            {
                storage        = new GameStorageClientAsset();
                storage.Bridge = AssetManager.Instance.Bridge;

                String model = "PlayerProfilingAsset_" + ((PlayerProfilingAssetSettings)getPPA().Settings).PlayerId + "_" + getQuestionnaireData().id;
                storage.AddModel(model);
            }
            return(storage);
        }
Esempio n. 3
0
        /// <summary>
        /// Method for storing data via game storage
        /// </summary>
        /// <param name="results"> Dictionary containing the group as key and the value of the questionnaire </returns>
        internal void storeQuestionnaireResultViaGameStorage(Dictionary <string, double> results)
        {
            StorageLocations       storageLocation = StorageLocations.Local;
            GameStorageClientAsset gameStorage     = getGameStorageAsset();

            String model = "PlayerProfilingAsset_" + ((PlayerProfilingAssetSettings)getPPA().Settings).PlayerId + "_" + getQuestionnaireData().id;

            foreach (String group in results.Keys)
            {
                gameStorage[model].AddChild(group, storageLocation).Value = results[group];
            }


            gameStorage.SaveStructure(model, storageLocation, SerializingFormat.Xml);
            gameStorage.SaveData(model, storageLocation, SerializingFormat.Xml);
        }