Ejemplo n.º 1
0
        /// <summary>
        /// Loads the values for all GlobalVariables in the list using the provided keys.
        /// </summary>
        /// <param name="reader">The ISavestateReader used for deserialization.</param>
        public void Load(ISavestateReader reader)
        {
            loading = true;

            try
            {
                reader.PreLoad();
                foreach (var entry in entries)
                {
                    if (entry.key != "")
                    {
                        if (reader.HasKey(entry.key))
                        {
                            try
                            {
                                entry.value.LoadValue(reader, entry.key);
                            }
                            catch (System.NotSupportedException)
                            {
                                Debug.LogError("Trying to load value for a GlobalVariable that does not support it.");
                            }
                            catch
                            {
                                Debug.LogError("Unspecified error while trying to load value for a GlobalVariable.");
                            }
                        }
                    }
                    else
                    {
                        Debug.LogError("Trying to load Savestate with empty key.");
                    }
                }
                reader.PostLoad();
            }
            finally
            {
                loading = false;
            }
        }
Ejemplo n.º 2
0
 public override void LoadValue(ISavestateReader reader, string key)
 {
     value = reader.GetFloat(key);
 }
Ejemplo n.º 3
0
        public override void LoadValue(ISavestateReader reader, string key)
        {
            var arr = reader.GetComposed <float>(key);

            value = new Color(arr[0], arr[1], arr[2], arr[3]);
        }