Пример #1
0
        private void TagCreate(GameDefinition game, string tagClass, Tag tagData)
        {
            gameDefinition = game;
            XmlDocument tagDefinitionDocument = game.GetTagDefinitionDocument(tagClass);

            this.tagData  = tagData;
            tagDefinition = tagDefinitionDocument;

            // Check to see if this is a derived type.
            XmlNode nameNode    = tagDefinitionDocument.SelectSingleNode("//name");
            string  parentClass = nameNode.Attributes["parenttype"].InnerText;

            if ((parentClass != "") && (parentClass != "????"))
            {
                XmlDocument tempDefinitionStorage = tagDefinition;

                TagCreate(game, parentClass, this.tagData);
                tagDefinition = tempDefinitionStorage;
            }

            // Query for the main node.
            mainStructName = nameNode.InnerText;
            XmlNode mainNode = tagDefinition.SelectSingleNode("//struct[@name='" + mainStructName + "']");

            // If it's not there, then this object doesn't match the supplied tag definition.
            if (mainNode == null)
            {
                throw new Exception("'" + mainStructName + "' node was not found in the tag definition.");
            }

            string tabName = mainNode.Attributes["name"].InnerText;

            if (mainNode.Attributes["caption"] != null)
            {
                tabName = mainNode.Attributes["caption"].InnerText;
            }
            CreateTab(tabName);

            TabArguments tabArgs = new TabArguments();

            tabArgs.Game          = game;
            tabArgs.Container     = containers.Pop();
            tabArgs.TagData       = tagData;
            tabArgs.MaxDepth      = GetMaxDepth(mainNode);
            tabArgs.TagClass      = tagClass;
            tabArgs.NameNode      = nameNode;
            tabArgs.MainNode      = mainNode;
            tabArgs.TagDefinition = tagDefinition;

            tabArguments.Add(tabArgs);
        }