Example #1
0
        public override void LoadGame(Game game, Overlord overlord, XmlNode root)
        {
            XmlNode vars = root ["CustomVars"];

            UniqueList <string> existing = new UniqueList <string> ("Duplicate custom var {{}}");

            for (var i = 0; i < vars.ChildNodes.Count; i++)
            {
                XmlNode v = vars.ChildNodes [i];
                XmlAttributeCollection attrs = v.Attributes;
                string name = attrs ["name"].Value;

                existing.Add(name);

                CustomVar customVar = null;

                if (v.Name == "CustomArrayVar")
                {
                    string [] values = attrs ["values"].Value.Split(',');
                    customVar = new CustomArrayVar(name, values);
                }
                else
                {
                    string value = attrs ["value"].Value;
                    customVar = new CustomSingleVar(name, value);
                }

                game.CustomVars.Add(customVar);
            }
        }
        public override CustomVar Clone()
        {
            CustomSingleVar clone = (CustomSingleVar)base.Clone();

            clone.Value = this.Value;
            return(clone);
        }