Ejemplo n.º 1
0
        public void PerformTest()
        {
            GameDefinition   game    = Core.Prometheus.Instance.GetGameDefinitionByGameID("halopc");
            TagEditorControl te      = new TagEditorControl();
            ILibrary         library = game.GlobalTagLibrary;
            Pool             pool    = Core.Prometheus.Instance.Pool;

            pool.RegisterProject(game.GameID, library);

            string tagName = "vehicle";
            string tagPath = "vehicles\\warthog\\mp_warthog.vehicle";
            Type   tagType = game.TypeTable.LocateEntryByName(tagName).TagType;
            Tag    tag     = pool.Open("<" + game.GameID + ">p:\\" + tagPath, tagType, true);

            te.Dock = DockStyle.Fill;
            te.Create(game, "vehi", tag);
            ControlHierarchy.Visualize(te, Application.StartupPath + "\\heirarchy.xml");

            Form frm = new Form();

            frm.Size = new Size(400, 600);
            frm.Controls.Add(te);
            frm.ShowDialog();
            pool.DisposeOfTag(ref tag);
            pool.ResetProject();
        }
Ejemplo n.º 2
0
        private void btnTestTagEditorGUI_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();

                // Load the XML Tag Definition
                //ofd.Filter = "Antenna Tag Definition|antenna.xml";
                ofd.Filter = "XML Tag Definition|*.xml";
                if (ofd.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                string      tdfFilename   = ofd.FileName;
                XmlDocument tagDefinition = new XmlDocument();
                tagDefinition.Load(tdfFilename);

                // Load the tag data
                string      tagDataFilename = @"vehicles\warthog\warthog antenna.antenna";
                TagFileName testTagFileName = new TagFileName(
                    tagDataFilename, MapfileVersion.HALOPC, TagSource.Archive);
                TagBase testTag = new TagBase();
                testTag.LoadTagBuffer(testTagFileName);
                BinaryReader br      = new BinaryReader(testTag.Stream);
                Antenna      antenna = new Antenna();
                antenna.Read(br);
                antenna.ReadChildData(br);

                Form test = new Form();
                test.Size = new Size(640, 480);
                TagEditorControl tagEditor = new TagEditorControl();
                tagEditor.Dock = DockStyle.Top;

                tagEditor.Create(tagDefinition, antenna);

                test.Controls.Add(tagEditor);
                test.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }