示例#1
0
文件: GameDef.cs 项目: clavalle/OCTGN
        private static GameDef LoadFromXml(XElement xml, PackagePart part)
        {
            if (xml.Name != Defs.XmlnsOctgn + "game")
            {
                throw new InvalidFormatException("The root document element must be <game>.");
            }

            return(new GameDef
            {
                Id = xml.Attr <Guid>("id"),
                Name = xml.Attr <string>("name"),
                Version = xml.Attr <Version>("version"),
                OctgnVersion = xml.Attr <Version>("octgnVersion"),
                MarkerSize = xml.Attr <int>("markersize"),
                CardsRevertToOriginalOnGroupChange = xml.Attr <bool>("cardsRevertToOriginalOnGroupChange"),
                CardDefinition = CardDef.LoadFromXml(xml.Child("card"), part),
                DeckDefinition = DeckDef.LoadFromXml(xml.Child("deck")),
                SharedDeckDefinition = DeckDef.LoadFromXml(xml.Child("sharedDeck")),
                TableDefinition = GroupDef.LoadFromXml(xml.Child("table"), part, 0),
                PlayerDefinition = PlayerDef.LoadFromXml(xml.Child("player"), part),
                GlobalDefinition = SharedDef.LoadFromXml(xml.Child("shared"), part),
                GlobalVariables = GlobalVariableDef.LoadAllFromXml(xml.Child("globalvariables")),
                Variables = VariableDef.LoadAllFromXml(xml.Child("variables")),
                Scripts = ScriptDef.LoadAllFromXml(xml.Child("scripts"), part),
                Fonts = FontDef.LoadAllFromXml(xml.Child("fonts"), part),
                Icons = IconDef.LoadAllFromXml(xml.Child("iconreplacements"), part)
            });
        }
示例#2
0
        internal static PlayerDef LoadFromXml(XElement xml, PackagePart part)
        {
            var res = new PlayerDef
            {
                IndicatorsFormat = xml.Attr <string>("summary"),
                Hand             = GroupDef.LoadFromXml(xml.Child("hand"), part, 0),
                GlobalVariables  = GlobalVariableDef.LoadAllFromXml(xml)
            };

            res.LoadBaseXml(xml, part);
            return(res);
        }