コード例 #1
0
        public sealed override LoadResult LoadFromXml(XmlNodeRef xml, LoadContext context)
        {
            _startLog     = xml.getAttr("_startLog");
            _successLog   = xml.getAttr("_successLog");
            _failureLog   = xml.getAttr("_failureLog");
            _interruptLog = xml.getAttr("_interruptLog");

            return(OnLoadFromXml(xml, context));
        }
コード例 #2
0
        /// <summary>
        /// Read property values from the given xml node and apply them to the given managed entity instance. Used when handling entities loaded from xml files (e.g. levels/layers).
        /// </summary>
        /// <param name="managedEntity">Managed entity instance.</param>
        /// <param name="xml">Entity xml node (only the 'Properties' child-node is relevant).</param>
        public void SetXMLProperties(BaseEntity managedEntity, XmlNodeRef xml)
        {
            int nChildren = xml.getChildCount();

            for (int i = 0; i < nChildren; i++)
            {
                XmlNodeRef child = xml.getChild(i);
                if (String.Equals(child.getTag(), "Properties", StringComparison.InvariantCultureIgnoreCase))
                {
                    foreach (EntityProperty prop in _properties)
                    {
                        if (!child.haveAttr(prop.EngineInfo.name))
                        {
                            continue;
                        }

                        prop.Set(managedEntity, child.getAttr(prop.EngineInfo.name));
                    }
                }
            }
        }