Beispiel #1
0
        private List <string> getRestrictionTypeFlags(exitRestrictions value)
        {
            List <string> list = new List <string>();

            foreach (Enum restriction in Enum.GetValues(typeof(exitRestrictions)))
            {
                if (value.HasFlag(restriction))
                {
                    list.Add(Enum.GetName(typeof(exitRestrictions), restriction));
                }
            }
            return(list);
        }
Beispiel #2
0
        public void LoadXml(XmlNode node, Room room)
        {
            Owner = room;
            Area  = room.Area;

            Name        = node["Name"].InnerText;
            Description = node["Description"].InnerText;
            DoorLabel   = node["DoorDescription"].InnerText;
            roomName    = node["Room"].InnerText;
            areaName    = node["Area"].InnerText;
            Visible     = Convert.ToBoolean(node["Visible"].InnerText);
            Breakable   = Convert.ToBoolean(node["Breakable"].InnerText);
            ExitType    = (exitType)Enum.Parse(typeof(exitType), node["ExitType"].InnerText);

            var lockNode = node.SelectSingleNode("Lock");

            if (lockNode != null)
            {
                LockType = new lockType();
                XmlNodeList locks = node["Lock"].SelectNodes("LockType");
                foreach (XmlNode locktype in locks)
                {
                    LockType |= (lockType)Enum.Parse(typeof(lockType), locktype.InnerText);
                }
            }

            var doorNode = node.SelectSingleNode("Door");

            if (doorNode != null)
            {
                DoorType = new doorType();
                XmlNodeList doors = node["Door"].SelectNodes("DoorType");
                foreach (XmlNode doortype in doors)
                {
                    DoorType |= (doorType)Enum.Parse(typeof(doorType), doortype.InnerText);
                }
            }

            var restrictionNode = node.SelectSingleNode("Restrictions");

            if (restrictionNode != null)
            {
                Restrictions = new exitRestrictions();
                XmlNodeList restrictions = node["Restrictions"].SelectNodes("Restriction");
                foreach (XmlNode restriction in restrictions)
                {
                    Restrictions |= (exitRestrictions)Enum.Parse(typeof(exitRestrictions), restriction.InnerText);
                }
            }
        }
Beispiel #3
0
 private List<string> getRestrictionTypeFlags(exitRestrictions value)
 {
     List<string> list = new List<string>();
     foreach (Enum restriction in Enum.GetValues(typeof(exitRestrictions))) {
         if (value.HasFlag(restriction)) {
             list.Add(Enum.GetName(typeof(exitRestrictions), restriction));
         }
     }
     return list;
 }
Beispiel #4
0
        public void LoadXml(XmlNode node, Room room)
        {
            Owner = room;
            Area = room.Area;

            Name = node["Name"].InnerText;
            Description = node["Description"].InnerText;
            DoorLabel = node["DoorDescription"].InnerText;
            roomName = node["Room"].InnerText;
            areaName = node["Area"].InnerText;
            Visible = Convert.ToBoolean(node["Visible"].InnerText);
            Breakable = Convert.ToBoolean(node["Breakable"].InnerText);
            ExitType = (exitType)Enum.Parse(typeof(exitType), node["ExitType"].InnerText);

            var lockNode = node.SelectSingleNode("Lock");
            if (lockNode != null) {
                LockType = new lockType();
                XmlNodeList locks = node["Lock"].SelectNodes("LockType");
                foreach (XmlNode locktype in locks) {
                    LockType |= (lockType)Enum.Parse(typeof(lockType), locktype.InnerText);
                }
            }

            var doorNode = node.SelectSingleNode("Door");
            if (doorNode != null) {
                DoorType = new doorType();
                XmlNodeList doors = node["Door"].SelectNodes("DoorType");
                foreach (XmlNode doortype in doors) {
                    DoorType |= (doorType)Enum.Parse(typeof(doorType), doortype.InnerText);
                }
            }

            var restrictionNode = node.SelectSingleNode("Restrictions");
            if (restrictionNode != null) {
                Restrictions = new exitRestrictions();
                XmlNodeList restrictions = node["Restrictions"].SelectNodes("Restriction");
                foreach (XmlNode restriction in restrictions) {
                    Restrictions |= (exitRestrictions)Enum.Parse(typeof(exitRestrictions), restriction.InnerText);
                }
            }
        }