예제 #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);
            }
        }
예제 #2
0
        public override CustomVar Clone()
        {
            CustomArrayVar clone = (CustomArrayVar)base.Clone();

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