Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public FighterPage()
        {
            InitializeComponent();

            _propertyGrid              = new MXPropertyGrid();
            _propertyGrid.Visible      = false;
            _propertyGrid.Dock         = DockStyle.Fill;
            _propertyGrid.PropertySort = PropertySort.Categorized;
            panel1.Controls.Add(_propertyGrid);

            _itemEditor         = new ItemEditor();
            _itemEditor.Visible = false;
            _itemEditor.Dock    = DockStyle.Fill;
            panel1.Controls.Add(_itemEditor);

            _costumeEditor         = new MXCostumeEditor();
            _costumeEditor.Visible = false;
            _costumeEditor.Dock    = DockStyle.Fill;
            panel1.Controls.Add(_costumeEditor);

            _copyMoveLogic           = new MXButton();
            _copyMoveLogic.Text      = "Copy Move Logic Struct to Clipboard";
            _copyMoveLogic.ForeColor = Color.White;
            _copyMoveLogic.Height    = 24;
            _copyMoveLogic.Visible   = false;
            _copyMoveLogic.Dock      = DockStyle.Top;
            _copyMoveLogic.Click    += CopyMoveLogic;
            _copyMoveLogic.Font      = new Font("Microsoft Sans Serif", 12f, FontStyle.Regular);
            panel1.Controls.Add(_copyMoveLogic);

            fighterListBox.DataSource = MEX.Fighters;
            buttonGeneralTab.PerformClick();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public FighterPage()
        {
            InitializeComponent();

            _propertyGrid              = new MXPropertyGrid();
            _propertyGrid.Visible      = false;
            _propertyGrid.Dock         = DockStyle.Fill;
            _propertyGrid.PropertySort = PropertySort.Categorized;
            panel1.Controls.Add(_propertyGrid);

            _itemEditor         = new ItemEditor();
            _itemEditor.Visible = false;
            _itemEditor.Dock    = DockStyle.Fill;
            panel1.Controls.Add(_itemEditor);

            _costumeEditor         = new MXCostumeEditor();
            _costumeEditor.Visible = false;
            _costumeEditor.Dock    = DockStyle.Fill;
            panel1.Controls.Add(_costumeEditor);

            _copyMoveLogic           = new MXButton();
            _copyMoveLogic.Text      = "Copy Move Logic Struct to Clipboard";
            _copyMoveLogic.ForeColor = Color.White;
            _copyMoveLogic.Height    = 24;
            _copyMoveLogic.Visible   = false;
            _copyMoveLogic.Dock      = DockStyle.Top;
            _copyMoveLogic.Click    += CopyMoveLogic;
            _copyMoveLogic.Font      = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular);
            panel1.Controls.Add(_copyMoveLogic);



            _importBoneYml           = new MXButton();
            _importBoneYml.Text      = "Import Bone YAML";
            _importBoneYml.ForeColor = Color.White;
            _importBoneYml.Height    = 24;
            _importBoneYml.Visible   = false;
            _importBoneYml.Dock      = DockStyle.Top;
            _importBoneYml.Click    += (sender, args) =>
            {
                if (fighterListBox.SelectedItem is MEXFighter fighter &&
                    _propertyGrid.SelectedObject is SBM_BoneLookupTable bones)
                {
                    using (OpenFileDialog d = new OpenFileDialog())
                    {
                        d.Filter = ApplicationSettings.YAMLFilter;
                        if (d.ShowDialog() == DialogResult.OK)
                        {
                            var serializer = new DeserializerBuilder()
                                             .WithNamingConvention(CamelCaseNamingConvention.Instance)
                                             .WithTypeInspector(inspector => new MEXTypeInspector(inspector))
                                             .Build();

                            using (StreamReader r = new StreamReader(d.FileName))
                            {
                                fighter.BoneTable            = serializer.Deserialize <SBM_BoneLookupTable>(r.ReadToEnd());
                                _propertyGrid.SelectedObject = fighter.BoneTable;
                            }
                        }
                    }
                }
            };
            _importBoneYml.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular);
            panel1.Controls.Add(_importBoneYml);

            _exportBoneYml           = new MXButton();
            _exportBoneYml.Text      = "Export Bone YAML";
            _exportBoneYml.ForeColor = Color.White;
            _exportBoneYml.Height    = 24;
            _exportBoneYml.Visible   = false;
            _exportBoneYml.Dock      = DockStyle.Top;
            _exportBoneYml.Click    += (sender, args) =>
            {
                if (_propertyGrid.SelectedObject is SBM_BoneLookupTable bones)
                {
                    using (SaveFileDialog d = new SaveFileDialog())
                    {
                        d.Filter = ApplicationSettings.YAMLFilter;
                        if (d.ShowDialog() == DialogResult.OK)
                        {
                            var serializer = new SerializerBuilder()
                                             .WithNamingConvention(CamelCaseNamingConvention.Instance)
                                             .WithTypeInspector(inspector => new MEXTypeInspector(inspector))
                                             .Build();

                            File.WriteAllText(d.FileName, serializer.Serialize(bones));
                        }
                    }
                }
            };
            _exportBoneYml.Font = new Font("Microsoft Sans Serif", 10f, FontStyle.Regular);
            panel1.Controls.Add(_exportBoneYml);


            fighterListBox.DataSource = MEX.Fighters;
            buttonGeneralTab.PerformClick();
        }