diff --git a/PCK-Studio/Controls/BoxEditorControl.Designer.cs b/PCK-Studio/Controls/BoxEditorControl.Designer.cs new file mode 100644 index 00000000..eb60c040 --- /dev/null +++ b/PCK-Studio/Controls/BoxEditorControl.Designer.cs @@ -0,0 +1,444 @@ +namespace PckStudio.Controls +{ + partial class BoxEditorControl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.parentLabel = new MetroFramework.Controls.MetroLabel(); + this.positionLabel = new MetroFramework.Controls.MetroLabel(); + this.sizeLabel = new MetroFramework.Controls.MetroLabel(); + this.uvLabel = new MetroFramework.Controls.MetroLabel(); + this.inflationLabel = new MetroFramework.Controls.MetroLabel(); + this.toolTip = new MetroFramework.Components.MetroToolTip(); + this.parentComboBox = new MetroFramework.Controls.MetroComboBox(); + this.PosXUpDown = new System.Windows.Forms.NumericUpDown(); + this.PosYUpDown = new System.Windows.Forms.NumericUpDown(); + this.PosZUpDown = new System.Windows.Forms.NumericUpDown(); + this.SizeZUpDown = new System.Windows.Forms.NumericUpDown(); + this.SizeYUpDown = new System.Windows.Forms.NumericUpDown(); + this.SizeXUpDown = new System.Windows.Forms.NumericUpDown(); + this.uvYUpDown = new System.Windows.Forms.NumericUpDown(); + this.uvXUpDown = new System.Windows.Forms.NumericUpDown(); + this.helmetCheckBox = new MetroFramework.Controls.MetroCheckBox(); + this.mirrorCheckBox = new MetroFramework.Controls.MetroCheckBox(); + this.inflationUpDown = new System.Windows.Forms.NumericUpDown(); + this.chestplateCheckBox = new MetroFramework.Controls.MetroCheckBox(); + this.leggingsCheckBox = new MetroFramework.Controls.MetroCheckBox(); + this.bootsCheckBox = new MetroFramework.Controls.MetroCheckBox(); + ((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).BeginInit(); + this.SuspendLayout(); + // + // parentLabel + // + this.parentLabel.AutoSize = true; + this.parentLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.parentLabel.Location = new System.Drawing.Point(47, 55); + this.parentLabel.Name = "parentLabel"; + this.parentLabel.Size = new System.Drawing.Size(50, 25); + this.parentLabel.TabIndex = 2; + this.parentLabel.Text = "Type:"; + this.parentLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // positionLabel + // + this.positionLabel.AutoSize = true; + this.positionLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.positionLabel.Location = new System.Drawing.Point(22, 84); + this.positionLabel.Name = "positionLabel"; + this.positionLabel.Size = new System.Drawing.Size(75, 25); + this.positionLabel.TabIndex = 4; + this.positionLabel.Text = "Position:"; + this.positionLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // sizeLabel + // + this.sizeLabel.AutoSize = true; + this.sizeLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.sizeLabel.Location = new System.Drawing.Point(51, 109); + this.sizeLabel.Name = "sizeLabel"; + this.sizeLabel.Size = new System.Drawing.Size(46, 25); + this.sizeLabel.TabIndex = 22; + this.sizeLabel.Text = "Size:"; + this.sizeLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // uvLabel + // + this.uvLabel.AutoSize = true; + this.uvLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.uvLabel.Location = new System.Drawing.Point(58, 135); + this.uvLabel.Name = "uvLabel"; + this.uvLabel.Size = new System.Drawing.Size(39, 25); + this.uvLabel.TabIndex = 26; + this.uvLabel.Text = "UV:"; + this.uvLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // inflationLabel + // + this.inflationLabel.AutoSize = true; + this.inflationLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.inflationLabel.Location = new System.Drawing.Point(42, 165); + this.inflationLabel.Name = "inflationLabel"; + this.inflationLabel.Size = new System.Drawing.Size(55, 25); + this.inflationLabel.TabIndex = 31; + this.inflationLabel.Text = "Scale:"; + this.inflationLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // toolTip + // + this.toolTip.StripAmpersands = true; + this.toolTip.Style = MetroFramework.MetroColorStyle.Blue; + this.toolTip.StyleManager = null; + this.toolTip.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // parentComboBox + // + this.parentComboBox.FormattingEnabled = true; + this.parentComboBox.ItemHeight = 23; + this.parentComboBox.Items.AddRange(new object[] { + "HEAD", + "BODY", + "ARM0", + "ARM1", + "LEG0", + "LEG1", + "HEADWEAR", + "JACKET", + "SLEEVE0", + "SLEEVE1", + "PANTS0", + "PANTS1", + "WAIST", + "LEGGING0", + "LEGGING1", + "SOCK0", + "SOCK1", + "BOOT0", + "BOOT1", + "ARMARMOR1", + "ARMARMOR0", + "BODYARMOR", + "BELT"}); + this.parentComboBox.Location = new System.Drawing.Point(103, 51); + this.parentComboBox.Name = "parentComboBox"; + this.parentComboBox.Size = new System.Drawing.Size(163, 29); + this.parentComboBox.TabIndex = 3; + this.parentComboBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.parentComboBox.UseSelectable = true; + // + // PosXUpDown + // + this.PosXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.PosXUpDown.DecimalPlaces = 3; + this.PosXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.PosXUpDown.Location = new System.Drawing.Point(103, 86); + this.PosXUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.PosXUpDown.Minimum = new decimal(new int[] { + 9999, + 0, + 0, + -2147483648}); + this.PosXUpDown.Name = "PosXUpDown"; + this.PosXUpDown.Size = new System.Drawing.Size(73, 20); + this.PosXUpDown.TabIndex = 19; + // + // PosYUpDown + // + this.PosYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.PosYUpDown.DecimalPlaces = 3; + this.PosYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.PosYUpDown.Location = new System.Drawing.Point(182, 86); + this.PosYUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.PosYUpDown.Minimum = new decimal(new int[] { + 9999, + 0, + 0, + -2147483648}); + this.PosYUpDown.Name = "PosYUpDown"; + this.PosYUpDown.Size = new System.Drawing.Size(73, 20); + this.PosYUpDown.TabIndex = 20; + // + // PosZUpDown + // + this.PosZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.PosZUpDown.DecimalPlaces = 3; + this.PosZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.PosZUpDown.Location = new System.Drawing.Point(261, 86); + this.PosZUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.PosZUpDown.Minimum = new decimal(new int[] { + 9999, + 0, + 0, + -2147483648}); + this.PosZUpDown.Name = "PosZUpDown"; + this.PosZUpDown.Size = new System.Drawing.Size(73, 20); + this.PosZUpDown.TabIndex = 21; + // + // SizeZUpDown + // + this.SizeZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.SizeZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.SizeZUpDown.Location = new System.Drawing.Point(261, 111); + this.SizeZUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.SizeZUpDown.Name = "SizeZUpDown"; + this.SizeZUpDown.Size = new System.Drawing.Size(73, 20); + this.SizeZUpDown.TabIndex = 25; + // + // SizeYUpDown + // + this.SizeYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.SizeYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.SizeYUpDown.Location = new System.Drawing.Point(182, 111); + this.SizeYUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.SizeYUpDown.Name = "SizeYUpDown"; + this.SizeYUpDown.Size = new System.Drawing.Size(73, 20); + this.SizeYUpDown.TabIndex = 24; + // + // SizeXUpDown + // + this.SizeXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.SizeXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.SizeXUpDown.Location = new System.Drawing.Point(103, 111); + this.SizeXUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.SizeXUpDown.Name = "SizeXUpDown"; + this.SizeXUpDown.Size = new System.Drawing.Size(73, 20); + this.SizeXUpDown.TabIndex = 23; + // + // uvYUpDown + // + this.uvYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.uvYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.uvYUpDown.Location = new System.Drawing.Point(182, 137); + this.uvYUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.uvYUpDown.Minimum = new decimal(new int[] { + 9999, + 0, + 0, + -2147483648}); + this.uvYUpDown.Name = "uvYUpDown"; + this.uvYUpDown.Size = new System.Drawing.Size(73, 20); + this.uvYUpDown.TabIndex = 28; + // + // uvXUpDown + // + this.uvXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.uvXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.uvXUpDown.Location = new System.Drawing.Point(103, 137); + this.uvXUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.uvXUpDown.Minimum = new decimal(new int[] { + 9999, + 0, + 0, + -2147483648}); + this.uvXUpDown.Name = "uvXUpDown"; + this.uvXUpDown.Size = new System.Drawing.Size(73, 20); + this.uvXUpDown.TabIndex = 27; + // + // helmetCheckBox + // + this.helmetCheckBox.AutoSize = true; + this.helmetCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; + this.helmetCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; + this.helmetCheckBox.Location = new System.Drawing.Point(340, 84); + this.helmetCheckBox.Name = "helmetCheckBox"; + this.helmetCheckBox.Size = new System.Drawing.Size(160, 25); + this.helmetCheckBox.TabIndex = 29; + this.helmetCheckBox.Text = "Mask with helmet"; + this.helmetCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.helmetCheckBox.UseSelectable = true; + // + // mirrorCheckBox + // + this.mirrorCheckBox.AutoSize = true; + this.mirrorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; + this.mirrorCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; + this.mirrorCheckBox.Location = new System.Drawing.Point(340, 58); + this.mirrorCheckBox.Name = "mirrorCheckBox"; + this.mirrorCheckBox.Size = new System.Drawing.Size(133, 25); + this.mirrorCheckBox.TabIndex = 30; + this.mirrorCheckBox.Text = "Mirror Texture"; + this.mirrorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.mirrorCheckBox.UseSelectable = true; + // + // inflationUpDown + // + this.inflationUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); + this.inflationUpDown.DecimalPlaces = 3; + this.inflationUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); + this.inflationUpDown.Location = new System.Drawing.Point(103, 167); + this.inflationUpDown.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.inflationUpDown.Name = "inflationUpDown"; + this.inflationUpDown.Size = new System.Drawing.Size(73, 20); + this.inflationUpDown.TabIndex = 32; + // + // chestplateCheckBox + // + this.chestplateCheckBox.AutoSize = true; + this.chestplateCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; + this.chestplateCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; + this.chestplateCheckBox.Location = new System.Drawing.Point(340, 109); + this.chestplateCheckBox.Name = "chestplateCheckBox"; + this.chestplateCheckBox.Size = new System.Drawing.Size(184, 25); + this.chestplateCheckBox.TabIndex = 33; + this.chestplateCheckBox.Text = "Mask with chestplate"; + this.chestplateCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.chestplateCheckBox.UseSelectable = true; + // + // leggingsCheckBox + // + this.leggingsCheckBox.AutoSize = true; + this.leggingsCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; + this.leggingsCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; + this.leggingsCheckBox.Location = new System.Drawing.Point(340, 135); + this.leggingsCheckBox.Name = "leggingsCheckBox"; + this.leggingsCheckBox.Size = new System.Drawing.Size(172, 25); + this.leggingsCheckBox.TabIndex = 34; + this.leggingsCheckBox.Text = "Mask with leggings"; + this.leggingsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.leggingsCheckBox.UseSelectable = true; + // + // bootsCheckBox + // + this.bootsCheckBox.AutoSize = true; + this.bootsCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; + this.bootsCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; + this.bootsCheckBox.Location = new System.Drawing.Point(340, 161); + this.bootsCheckBox.Name = "bootsCheckBox"; + this.bootsCheckBox.Size = new System.Drawing.Size(150, 25); + this.bootsCheckBox.TabIndex = 35; + this.bootsCheckBox.Text = "Mask with boots"; + this.bootsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.bootsCheckBox.UseSelectable = true; + // + // BoxEditorControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + this.Controls.Add(this.bootsCheckBox); + this.Controls.Add(this.leggingsCheckBox); + this.Controls.Add(this.chestplateCheckBox); + this.Controls.Add(this.inflationUpDown); + this.Controls.Add(this.uvYUpDown); + this.Controls.Add(this.uvXUpDown); + this.Controls.Add(this.SizeZUpDown); + this.Controls.Add(this.SizeYUpDown); + this.Controls.Add(this.SizeXUpDown); + this.Controls.Add(this.PosZUpDown); + this.Controls.Add(this.PosYUpDown); + this.Controls.Add(this.PosXUpDown); + this.Controls.Add(this.inflationLabel); + this.Controls.Add(this.parentComboBox); + this.Controls.Add(this.mirrorCheckBox); + this.Controls.Add(this.helmetCheckBox); + this.Controls.Add(this.uvLabel); + this.Controls.Add(this.sizeLabel); + this.Controls.Add(this.positionLabel); + this.Controls.Add(this.parentLabel); + this.Name = "BoxEditorControl"; + this.Size = new System.Drawing.Size(540, 220); + ((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private MetroFramework.Components.MetroToolTip toolTip; + private MetroFramework.Controls.MetroComboBox parentComboBox; + private System.Windows.Forms.NumericUpDown PosXUpDown; + private System.Windows.Forms.NumericUpDown PosYUpDown; + private System.Windows.Forms.NumericUpDown PosZUpDown; + private System.Windows.Forms.NumericUpDown SizeZUpDown; + private System.Windows.Forms.NumericUpDown SizeYUpDown; + private System.Windows.Forms.NumericUpDown SizeXUpDown; + private System.Windows.Forms.NumericUpDown uvYUpDown; + private System.Windows.Forms.NumericUpDown uvXUpDown; + private MetroFramework.Controls.MetroCheckBox helmetCheckBox; + private MetroFramework.Controls.MetroCheckBox mirrorCheckBox; + private System.Windows.Forms.NumericUpDown inflationUpDown; + private MetroFramework.Controls.MetroCheckBox chestplateCheckBox; + private MetroFramework.Controls.MetroCheckBox leggingsCheckBox; + private MetroFramework.Controls.MetroCheckBox bootsCheckBox; + private MetroFramework.Controls.MetroLabel parentLabel; + private MetroFramework.Controls.MetroLabel positionLabel; + private MetroFramework.Controls.MetroLabel sizeLabel; + private MetroFramework.Controls.MetroLabel uvLabel; + private MetroFramework.Controls.MetroLabel inflationLabel; + } +} \ No newline at end of file diff --git a/PCK-Studio/Controls/BoxEditorControl.cs b/PCK-Studio/Controls/BoxEditorControl.cs new file mode 100644 index 00000000..bc434168 --- /dev/null +++ b/PCK-Studio/Controls/BoxEditorControl.cs @@ -0,0 +1,126 @@ +using OpenTK; +using PckStudio.Core.Skin; +using PckStudio.Properties; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; + +namespace PckStudio.Controls +{ + internal partial class BoxEditorControl : UserControl + { + public event EventHandler BoxChanged; + + private SkinBOX result; + private int boxVersion = 0; + + public BoxEditorControl(SkinBOX box, int xmlVersion) + : this(xmlVersion) + { + SetBOX(box); + } + + public BoxEditorControl() + :this(0) + { + + } + + public BoxEditorControl(int xmlVersion = 0) + { + InitializeComponent(); + SetBOXVersion(xmlVersion); + parentComboBox.SelectedIndexChanged += this.HandleBoxChanged; + PosXUpDown.ValueChanged += this.HandleBoxChanged; + PosYUpDown.ValueChanged += this.HandleBoxChanged; + PosZUpDown.ValueChanged += this.HandleBoxChanged; + SizeXUpDown.ValueChanged += this.HandleBoxChanged; + SizeYUpDown.ValueChanged += this.HandleBoxChanged; + SizeZUpDown.ValueChanged += this.HandleBoxChanged; + uvXUpDown.ValueChanged += this.HandleBoxChanged; + uvYUpDown.ValueChanged += this.HandleBoxChanged; + helmetCheckBox.CheckedChanged += this.HandleBoxChanged; + chestplateCheckBox.CheckedChanged += this.HandleBoxChanged; + leggingsCheckBox.CheckedChanged += this.HandleBoxChanged; + bootsCheckBox.CheckedChanged += this.HandleBoxChanged; + mirrorCheckBox.CheckedChanged += this.HandleBoxChanged; + inflationUpDown.ValueChanged += this.HandleBoxChanged; + } + + public void SetBOXVersion(int xmlVersion) + { + boxVersion = xmlVersion; + Debug.WriteLine(xmlVersion); + inflationUpDown.Enabled = boxVersion == 3; + } + + public void SetBOX(SkinBOX box) + { + if (string.IsNullOrEmpty(box.Type) || !parentComboBox.Items.Contains(box.Type)) + { + throw new Exception("Failed to parse BOX value"); + } + + parentComboBox.SelectedItem = parentComboBox.Items[parentComboBox.Items.IndexOf(box.Type)]; + PosXUpDown.Value = (decimal)box.Pos.X; + PosYUpDown.Value = (decimal)box.Pos.Y; + PosZUpDown.Value = (decimal)box.Pos.Z; + SizeXUpDown.Value = (decimal)box.Size.X; + SizeYUpDown.Value = (decimal)box.Size.Y; + SizeZUpDown.Value = (decimal)box.Size.Z; + uvXUpDown.Value = (decimal)box.UV.X; + uvYUpDown.Value = (decimal)box.UV.Y; + helmetCheckBox.Checked = (box.ArmorMaskFlags & 1) != 0; + chestplateCheckBox.Checked = (box.ArmorMaskFlags & 2) != 0; + leggingsCheckBox.Checked = (box.ArmorMaskFlags & 4) != 0; + bootsCheckBox.Checked = (box.ArmorMaskFlags & 8) != 0; + mirrorCheckBox.Checked = box.Mirror; + inflationUpDown.Value = (decimal)box.Scale; + } + + public SkinBOX GetBOX() + { + int mask = 0; + + if (helmetCheckBox.Checked) mask |= 1; + if (chestplateCheckBox.Checked) mask |= 2; + if (leggingsCheckBox.Checked) mask |= 4; + if (bootsCheckBox.Checked) mask |= 8; + + result = SkinBOX.FromString( + $"{parentComboBox.SelectedItem} " + + $"{PosXUpDown.Value} {PosYUpDown.Value} {PosZUpDown.Value} " + + $"{SizeXUpDown.Value} {SizeYUpDown.Value} {SizeZUpDown.Value} " + + $"{uvXUpDown.Value} {uvYUpDown.Value} " + + $"{mask} " + + $"{Convert.ToInt32(mirrorCheckBox.Checked)} " + + $"{inflationUpDown.Value}"); + + return result; + } + + private void HandleBoxChanged(object sender, EventArgs e) + { + // we'll explain this in a minute + this.OnBoxChanged(EventArgs.Empty); + } + + protected virtual void OnBoxChanged(EventArgs e) + { + EventHandler handler = this.BoxChanged; + if (handler != null) + { + handler(this, e); + } + } + } +} diff --git a/PCK-Studio/Controls/BoxEditorControl.resx b/PCK-Studio/Controls/BoxEditorControl.resx new file mode 100644 index 00000000..8766f298 --- /dev/null +++ b/PCK-Studio/Controls/BoxEditorControl.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/BoxEditor.Designer.cs b/PCK-Studio/Forms/Editor/BoxEditor.Designer.cs index f231fc2e..14cfedb8 100644 --- a/PCK-Studio/Forms/Editor/BoxEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/BoxEditor.Designer.cs @@ -28,100 +28,12 @@ /// private void InitializeComponent() { - MetroFramework.Controls.MetroLabel parentLabel; - MetroFramework.Controls.MetroLabel positionLabel; - MetroFramework.Controls.MetroLabel sizeLabel; - MetroFramework.Controls.MetroLabel uvLabel; - MetroFramework.Controls.MetroLabel inflationLabel; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BoxEditor)); this.closeButton = new MetroFramework.Controls.MetroButton(); this.toolTip = new MetroFramework.Components.MetroToolTip(); - this.parentComboBox = new MetroFramework.Controls.MetroComboBox(); - this.PosXUpDown = new System.Windows.Forms.NumericUpDown(); - this.PosYUpDown = new System.Windows.Forms.NumericUpDown(); - this.PosZUpDown = new System.Windows.Forms.NumericUpDown(); - this.SizeZUpDown = new System.Windows.Forms.NumericUpDown(); - this.SizeYUpDown = new System.Windows.Forms.NumericUpDown(); - this.SizeXUpDown = new System.Windows.Forms.NumericUpDown(); - this.uvYUpDown = new System.Windows.Forms.NumericUpDown(); - this.uvXUpDown = new System.Windows.Forms.NumericUpDown(); - this.helmetCheckBox = new MetroFramework.Controls.MetroCheckBox(); - this.mirrorCheckBox = new MetroFramework.Controls.MetroCheckBox(); - this.inflationUpDown = new System.Windows.Forms.NumericUpDown(); - this.chestplateCheckBox = new MetroFramework.Controls.MetroCheckBox(); - this.leggingsCheckBox = new MetroFramework.Controls.MetroCheckBox(); - this.bootsCheckBox = new MetroFramework.Controls.MetroCheckBox(); - parentLabel = new MetroFramework.Controls.MetroLabel(); - positionLabel = new MetroFramework.Controls.MetroLabel(); - sizeLabel = new MetroFramework.Controls.MetroLabel(); - uvLabel = new MetroFramework.Controls.MetroLabel(); - inflationLabel = new MetroFramework.Controls.MetroLabel(); - ((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).BeginInit(); + this.boxEditorControl1 = new PckStudio.Controls.BoxEditorControl(); this.SuspendLayout(); // - // parentLabel - // - parentLabel.AutoSize = true; - parentLabel.FontSize = MetroFramework.MetroLabelSize.Tall; - parentLabel.Location = new System.Drawing.Point(47, 55); - parentLabel.Name = "parentLabel"; - parentLabel.Size = new System.Drawing.Size(50, 25); - parentLabel.TabIndex = 2; - parentLabel.Text = "Type:"; - parentLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // positionLabel - // - positionLabel.AutoSize = true; - positionLabel.FontSize = MetroFramework.MetroLabelSize.Tall; - positionLabel.Location = new System.Drawing.Point(22, 84); - positionLabel.Name = "positionLabel"; - positionLabel.Size = new System.Drawing.Size(75, 25); - positionLabel.TabIndex = 4; - positionLabel.Text = "Position:"; - positionLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // sizeLabel - // - sizeLabel.AutoSize = true; - sizeLabel.FontSize = MetroFramework.MetroLabelSize.Tall; - sizeLabel.Location = new System.Drawing.Point(51, 109); - sizeLabel.Name = "sizeLabel"; - sizeLabel.Size = new System.Drawing.Size(46, 25); - sizeLabel.TabIndex = 22; - sizeLabel.Text = "Size:"; - sizeLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // uvLabel - // - uvLabel.AutoSize = true; - uvLabel.FontSize = MetroFramework.MetroLabelSize.Tall; - uvLabel.Location = new System.Drawing.Point(58, 135); - uvLabel.Name = "uvLabel"; - uvLabel.Size = new System.Drawing.Size(39, 25); - uvLabel.TabIndex = 26; - uvLabel.Text = "UV:"; - uvLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // inflationLabel - // - inflationLabel.AutoSize = true; - inflationLabel.FontSize = MetroFramework.MetroLabelSize.Tall; - inflationLabel.Location = new System.Drawing.Point(42, 165); - inflationLabel.Name = "inflationLabel"; - inflationLabel.Size = new System.Drawing.Size(55, 25); - inflationLabel.TabIndex = 31; - inflationLabel.Text = "Scale:"; - inflationLabel.Theme = MetroFramework.MetroThemeStyle.Dark; - // // closeButton // this.closeButton.Location = new System.Drawing.Point(207, 187); @@ -140,287 +52,21 @@ this.toolTip.StyleManager = null; this.toolTip.Theme = MetroFramework.MetroThemeStyle.Dark; // - // parentComboBox + // boxEditorControl1 // - this.parentComboBox.FormattingEnabled = true; - this.parentComboBox.ItemHeight = 23; - this.parentComboBox.Items.AddRange(new object[] { - "HEAD", - "BODY", - "ARM0", - "ARM1", - "LEG0", - "LEG1", - "HEADWEAR", - "JACKET", - "SLEEVE0", - "SLEEVE1", - "PANTS0", - "PANTS1", - "WAIST", - "LEGGING0", - "LEGGING1", - "SOCK0", - "SOCK1", - "BOOT0", - "BOOT1", - "ARMARMOR1", - "ARMARMOR0", - "BODYARMOR", - "BELT"}); - this.parentComboBox.Location = new System.Drawing.Point(103, 51); - this.parentComboBox.Name = "parentComboBox"; - this.parentComboBox.Size = new System.Drawing.Size(163, 29); - this.parentComboBox.TabIndex = 3; - this.parentComboBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.parentComboBox.UseSelectable = true; - // - // PosXUpDown - // - this.PosXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.PosXUpDown.DecimalPlaces = 3; - this.PosXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.PosXUpDown.Location = new System.Drawing.Point(103, 86); - this.PosXUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.PosXUpDown.Minimum = new decimal(new int[] { - 9999, - 0, - 0, - -2147483648}); - this.PosXUpDown.Name = "PosXUpDown"; - this.PosXUpDown.Size = new System.Drawing.Size(73, 20); - this.PosXUpDown.TabIndex = 19; - // - // PosYUpDown - // - this.PosYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.PosYUpDown.DecimalPlaces = 3; - this.PosYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.PosYUpDown.Location = new System.Drawing.Point(182, 86); - this.PosYUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.PosYUpDown.Minimum = new decimal(new int[] { - 9999, - 0, - 0, - -2147483648}); - this.PosYUpDown.Name = "PosYUpDown"; - this.PosYUpDown.Size = new System.Drawing.Size(73, 20); - this.PosYUpDown.TabIndex = 20; - // - // PosZUpDown - // - this.PosZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.PosZUpDown.DecimalPlaces = 3; - this.PosZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.PosZUpDown.Location = new System.Drawing.Point(261, 86); - this.PosZUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.PosZUpDown.Minimum = new decimal(new int[] { - 9999, - 0, - 0, - -2147483648}); - this.PosZUpDown.Name = "PosZUpDown"; - this.PosZUpDown.Size = new System.Drawing.Size(73, 20); - this.PosZUpDown.TabIndex = 21; - // - // SizeZUpDown - // - this.SizeZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.SizeZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.SizeZUpDown.Location = new System.Drawing.Point(261, 111); - this.SizeZUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.SizeZUpDown.Name = "SizeZUpDown"; - this.SizeZUpDown.Size = new System.Drawing.Size(73, 20); - this.SizeZUpDown.TabIndex = 25; - // - // SizeYUpDown - // - this.SizeYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.SizeYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.SizeYUpDown.Location = new System.Drawing.Point(182, 111); - this.SizeYUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.SizeYUpDown.Name = "SizeYUpDown"; - this.SizeYUpDown.Size = new System.Drawing.Size(73, 20); - this.SizeYUpDown.TabIndex = 24; - // - // SizeXUpDown - // - this.SizeXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.SizeXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.SizeXUpDown.Location = new System.Drawing.Point(103, 111); - this.SizeXUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.SizeXUpDown.Name = "SizeXUpDown"; - this.SizeXUpDown.Size = new System.Drawing.Size(73, 20); - this.SizeXUpDown.TabIndex = 23; - // - // uvYUpDown - // - this.uvYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.uvYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.uvYUpDown.Location = new System.Drawing.Point(182, 137); - this.uvYUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.uvYUpDown.Minimum = new decimal(new int[] { - 9999, - 0, - 0, - -2147483648}); - this.uvYUpDown.Name = "uvYUpDown"; - this.uvYUpDown.Size = new System.Drawing.Size(73, 20); - this.uvYUpDown.TabIndex = 28; - // - // uvXUpDown - // - this.uvXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.uvXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.uvXUpDown.Location = new System.Drawing.Point(103, 137); - this.uvXUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.uvXUpDown.Minimum = new decimal(new int[] { - 9999, - 0, - 0, - -2147483648}); - this.uvXUpDown.Name = "uvXUpDown"; - this.uvXUpDown.Size = new System.Drawing.Size(73, 20); - this.uvXUpDown.TabIndex = 27; - // - // helmetCheckBox - // - this.helmetCheckBox.AutoSize = true; - this.helmetCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; - this.helmetCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; - this.helmetCheckBox.Location = new System.Drawing.Point(340, 84); - this.helmetCheckBox.Name = "helmetCheckBox"; - this.helmetCheckBox.Size = new System.Drawing.Size(160, 25); - this.helmetCheckBox.TabIndex = 29; - this.helmetCheckBox.Text = "Mask with helmet"; - this.helmetCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.helmetCheckBox.UseSelectable = true; - // - // mirrorCheckBox - // - this.mirrorCheckBox.AutoSize = true; - this.mirrorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; - this.mirrorCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; - this.mirrorCheckBox.Location = new System.Drawing.Point(340, 58); - this.mirrorCheckBox.Name = "mirrorCheckBox"; - this.mirrorCheckBox.Size = new System.Drawing.Size(133, 25); - this.mirrorCheckBox.TabIndex = 30; - this.mirrorCheckBox.Text = "Mirror Texture"; - this.mirrorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.mirrorCheckBox.UseSelectable = true; - // - // inflationUpDown - // - this.inflationUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17))))); - this.inflationUpDown.DecimalPlaces = 3; - this.inflationUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.inflationUpDown.Location = new System.Drawing.Point(103, 167); - this.inflationUpDown.Maximum = new decimal(new int[] { - 9999, - 0, - 0, - 0}); - this.inflationUpDown.Name = "inflationUpDown"; - this.inflationUpDown.Size = new System.Drawing.Size(73, 20); - this.inflationUpDown.TabIndex = 32; - // - // chestplateCheckBox - // - this.chestplateCheckBox.AutoSize = true; - this.chestplateCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; - this.chestplateCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; - this.chestplateCheckBox.Location = new System.Drawing.Point(340, 109); - this.chestplateCheckBox.Name = "chestplateCheckBox"; - this.chestplateCheckBox.Size = new System.Drawing.Size(184, 25); - this.chestplateCheckBox.TabIndex = 33; - this.chestplateCheckBox.Text = "Mask with chestplate"; - this.chestplateCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.chestplateCheckBox.UseSelectable = true; - // - // leggingsCheckBox - // - this.leggingsCheckBox.AutoSize = true; - this.leggingsCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; - this.leggingsCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; - this.leggingsCheckBox.Location = new System.Drawing.Point(340, 135); - this.leggingsCheckBox.Name = "leggingsCheckBox"; - this.leggingsCheckBox.Size = new System.Drawing.Size(172, 25); - this.leggingsCheckBox.TabIndex = 34; - this.leggingsCheckBox.Text = "Mask with leggings"; - this.leggingsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.leggingsCheckBox.UseSelectable = true; - // - // bootsCheckBox - // - this.bootsCheckBox.AutoSize = true; - this.bootsCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall; - this.bootsCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light; - this.bootsCheckBox.Location = new System.Drawing.Point(340, 161); - this.bootsCheckBox.Name = "bootsCheckBox"; - this.bootsCheckBox.Size = new System.Drawing.Size(150, 25); - this.bootsCheckBox.TabIndex = 35; - this.bootsCheckBox.Text = "Mask with boots"; - this.bootsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.bootsCheckBox.UseSelectable = true; + this.boxEditorControl1.BackColor = System.Drawing.Color.Transparent; + this.boxEditorControl1.Location = new System.Drawing.Point(0, 0); + this.boxEditorControl1.Name = "boxEditorControl1"; + this.boxEditorControl1.Size = new System.Drawing.Size(540, 220); + this.boxEditorControl1.TabIndex = 2; // // BoxEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(540, 220); - this.Controls.Add(this.bootsCheckBox); - this.Controls.Add(this.leggingsCheckBox); - this.Controls.Add(this.chestplateCheckBox); - this.Controls.Add(this.inflationUpDown); - this.Controls.Add(this.uvYUpDown); - this.Controls.Add(this.uvXUpDown); - this.Controls.Add(this.SizeZUpDown); - this.Controls.Add(this.SizeYUpDown); - this.Controls.Add(this.SizeXUpDown); - this.Controls.Add(this.PosZUpDown); - this.Controls.Add(this.PosYUpDown); - this.Controls.Add(this.PosXUpDown); - this.Controls.Add(inflationLabel); - this.Controls.Add(this.parentComboBox); - this.Controls.Add(this.mirrorCheckBox); - this.Controls.Add(this.helmetCheckBox); - this.Controls.Add(uvLabel); - this.Controls.Add(sizeLabel); - this.Controls.Add(positionLabel); - this.Controls.Add(parentLabel); this.Controls.Add(this.closeButton); + this.Controls.Add(this.boxEditorControl1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(540, 554); @@ -433,37 +79,13 @@ this.Text = "BOX Editor"; this.Theme = MetroFramework.MetroThemeStyle.Dark; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BoxEditor_FormClosing); - ((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).EndInit(); this.ResumeLayout(false); - this.PerformLayout(); } #endregion private MetroFramework.Controls.MetroButton closeButton; private MetroFramework.Components.MetroToolTip toolTip; - private MetroFramework.Controls.MetroComboBox parentComboBox; - private System.Windows.Forms.NumericUpDown PosXUpDown; - private System.Windows.Forms.NumericUpDown PosYUpDown; - private System.Windows.Forms.NumericUpDown PosZUpDown; - private System.Windows.Forms.NumericUpDown SizeZUpDown; - private System.Windows.Forms.NumericUpDown SizeYUpDown; - private System.Windows.Forms.NumericUpDown SizeXUpDown; - private System.Windows.Forms.NumericUpDown uvYUpDown; - private System.Windows.Forms.NumericUpDown uvXUpDown; - private MetroFramework.Controls.MetroCheckBox helmetCheckBox; - private MetroFramework.Controls.MetroCheckBox mirrorCheckBox; - private System.Windows.Forms.NumericUpDown inflationUpDown; - private MetroFramework.Controls.MetroCheckBox chestplateCheckBox; - private MetroFramework.Controls.MetroCheckBox leggingsCheckBox; - private MetroFramework.Controls.MetroCheckBox bootsCheckBox; + private Controls.BoxEditorControl boxEditorControl1; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/BoxEditor.cs b/PCK-Studio/Forms/Editor/BoxEditor.cs index 8fa56498..28e0fbe8 100644 --- a/PCK-Studio/Forms/Editor/BoxEditor.cs +++ b/PCK-Studio/Forms/Editor/BoxEditor.cs @@ -19,50 +19,13 @@ namespace PckStudio.Forms.Editor public BoxEditor(SkinBOX box, int xmlVersion) { InitializeComponent(); - - if (string.IsNullOrEmpty(box.Type) || !parentComboBox.Items.Contains(box.Type)) - { - throw new Exception("Failed to parse BOX value"); - } - - closeButton.Visible = !Settings.Default.AutoSaveChanges; - - inflationUpDown.Enabled = xmlVersion == 3; - - parentComboBox.SelectedItem = parentComboBox.Items[parentComboBox.Items.IndexOf(box.Type)]; - PosXUpDown.Value = (decimal)box.Pos.X; - PosYUpDown.Value = (decimal)box.Pos.Y; - PosZUpDown.Value = (decimal)box.Pos.Z; - SizeXUpDown.Value = (decimal)box.Size.X; - SizeYUpDown.Value = (decimal)box.Size.Y; - SizeZUpDown.Value = (decimal)box.Size.Z; - uvXUpDown.Value = (decimal)box.UV.X; - uvYUpDown.Value = (decimal)box.UV.Y; - helmetCheckBox.Checked = (box.ArmorMaskFlags & 1) != 0; - chestplateCheckBox.Checked = (box.ArmorMaskFlags & 2) != 0; - leggingsCheckBox.Checked = (box.ArmorMaskFlags & 4) != 0; - bootsCheckBox.Checked = (box.ArmorMaskFlags & 8) != 0; - mirrorCheckBox.Checked = box.Mirror; - inflationUpDown.Value = (decimal)box.Scale; - } + boxEditorControl1.SetBOXVersion(xmlVersion); + boxEditorControl1.SetBOX(box); + } private void saveButton_Click(object sender, EventArgs e) { - int mask = 0; - - if (helmetCheckBox.Checked) mask |= 1; - if (chestplateCheckBox.Checked) mask |= 2; - if (leggingsCheckBox.Checked) mask |= 4; - if (bootsCheckBox.Checked) mask |= 8; - - result = SkinBOX.FromString( - $"{parentComboBox.SelectedItem} " + - $"{PosXUpDown.Value} {PosYUpDown.Value} {PosZUpDown.Value} " + - $"{SizeXUpDown.Value} {SizeYUpDown.Value} {SizeZUpDown.Value} " + - $"{uvXUpDown.Value} {uvYUpDown.Value} " + - $"{mask} " + - $"{Convert.ToInt32(mirrorCheckBox.Checked)} " + - $"{inflationUpDown.Value}"); + result = boxEditorControl1.GetBOX(); DialogResult = DialogResult.OK; } diff --git a/PCK-Studio/Forms/Editor/BoxEditor.resx b/PCK-Studio/Forms/Editor/BoxEditor.resx index 01c3d1a0..332737e0 100644 --- a/PCK-Studio/Forms/Editor/BoxEditor.resx +++ b/PCK-Studio/Forms/Editor/BoxEditor.resx @@ -117,21 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - - - False - - - False - - - False - - - False - 17, 17 diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 4a8c4fdd..42c09491 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -137,6 +137,12 @@ + + UserControl + + + BoxEditorControl.cs + Component @@ -396,6 +402,9 @@ + + BoxEditorControl.cs + PckEditor.cs