コード例 #1
0
ファイル: Main.cs プロジェクト: Mochongli/T4A11
		public override void Deserialize(WriteDictionary data, GameReader.LoadMode mode)
		{
			var keys = PropertyHelper.Settings.Keys.ToList();
			foreach (var key in keys)
			{
				PropertyHelper.SetProperty(PropertyHelper.Settings, key, data.Get(key, PropertyHelper.GetProperty(PropertyHelper.Settings, key)));
			}
		}
コード例 #2
0
        public override WriteDictionary Serialize(GameReader.LoadMode mode)
        {
            var data = new WriteDictionary();

            foreach (var Pair in PropertyHelper.Settings)
            {
                data[Pair.Key] = PropertyHelper.GetProperty(PropertyHelper.Settings, Pair.Key);
            }

            return(data);
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: limbodiyu/T3A10
        //This file is called when a save game is loaded, if there is any data relevant to this ACTIVE mod
        //Note that this function is called very early in the loading process, so all save game data might not be initialized yet
        public override void Deserialize(WriteDictionary data, GameReader.LoadMode mode)
        {
            //The WriteDictionary Get function tries to fetch a value from the dictionary
            //but will return a default value if the key is not present
            //In this case MaxFloor is returned if the "Floor" key is not present
            var keys = PropertyHelper.Settings.Keys.ToList();

            foreach (var key in keys)
            {
                PropertyHelper.Settings[key] = data.Get(key, PropertyHelper.Settings[key]);
            }
            //Note that we are not saving this value to the settings file, as this is save file specific
            //This way the player can have a default value for all new games, and a value for specific saves
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: limbodiyu/T3A10
        public override WriteDictionary Serialize(GameReader.LoadMode mode)
        {
            //The WriteDictionary is a simple dictionary the game uses to save data to a file
            //Note that the type saved needs to be a value type or have an empty contructor
            //You can safely save arrays, lists, hashsets and dictionaries
            //In this case we are saving a 32 bit integer, which is a value type

            var data = new WriteDictionary();

            foreach (var Pair in PropertyHelper.Settings)
            {
                data[Pair.Key] = Pair.Value;
            }
            return(data);
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: Trawis/T4A11
        public override void Deserialize(WriteDictionary data, GameReader.LoadMode mode)
        {
            var settings = Helpers.Settings.Keys.ToList();

            foreach (var setting in settings)
            {
                Helpers.SetProperty(Helpers.Settings, setting, data.Get(setting, Helpers.GetProperty(Helpers.Settings, setting)));
            }

            var stores = Helpers.Stores.Keys.ToList();

            foreach (var store in stores)
            {
                Helpers.SetProperty(Helpers.Stores, store, data.Get(store, Helpers.GetProperty(Helpers.Stores, store)));
            }
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: Trawis/T4A11
        public override WriteDictionary Serialize(GameReader.LoadMode mode)
        {
            var data = new WriteDictionary();

            foreach (var setting in Helpers.Settings)
            {
                data[setting.Key] = Helpers.GetProperty(Helpers.Settings, setting.Key);
            }

            foreach (var store in Helpers.Stores)
            {
                data[store.Key] = Helpers.GetProperty(Helpers.Stores, store.Key);
            }

            return(data);
        }