diff --git a/PCK-Studio/Classes/Utils/ImageUtils.cs b/PCK-Studio/Classes/Utils/ImageUtils.cs new file mode 100644 index 00000000..83b5ad59 --- /dev/null +++ b/PCK-Studio/Classes/Utils/ImageUtils.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Drawing.Drawing2D; +using System.Drawing; +using System.Diagnostics; + +namespace PckStudio.Classes.Utils +{ + internal class ImageUtils + { + public static IEnumerable CreateImageList(Image source, int size) + { + int img_row_count = source.Width / size; + int img_column_count = source.Height / size; + Debug.WriteLine($"{source.Width} {source.Height} {size} {size} {img_column_count} {img_row_count}"); + for (int i = 0; i < img_column_count * img_row_count; i++) + { + int row = i / img_row_count; + int column = i % img_row_count; + Rectangle tileArea = new Rectangle(new Point(column * size, row * size), new Size(size, size)); + Bitmap tileImage = new Bitmap(size, size); + using (Graphics gfx = Graphics.FromImage(tileImage)) + { + gfx.SmoothingMode = SmoothingMode.None; + gfx.InterpolationMode = InterpolationMode.NearestNeighbor; + gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; + + gfx.DrawImage(source, new Rectangle(0, 0, size, size), tileArea, GraphicsUnit.Pixel); + } + yield return tileImage; + } + yield break; + } + } +} diff --git a/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.Designer.cs b/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.Designer.cs new file mode 100644 index 00000000..3fc760c7 --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.Designer.cs @@ -0,0 +1,185 @@ +namespace PckStudio.Forms.Additional_Popups.Behaviours +{ + partial class AddBehaviour + { + /// + /// 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.acceptBtn = new System.Windows.Forms.Button(); + this.CancelBtn = new System.Windows.Forms.Button(); + this.treeViewEntity = new System.Windows.Forms.TreeView(); + this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.metroTextBox1 = new MetroFramework.Controls.MetroTextBox(); + this.metroTabControl1 = new MetroFramework.Controls.MetroTabControl(); + this.Blocks = new System.Windows.Forms.TabPage(); + this.metroTabControl1.SuspendLayout(); + this.Blocks.SuspendLayout(); + this.SuspendLayout(); + // + // acceptBtn + // + this.acceptBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.acceptBtn.ForeColor = System.Drawing.Color.White; + this.acceptBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.acceptBtn.Location = new System.Drawing.Point(92, 196); + this.acceptBtn.Name = "acceptBtn"; + this.acceptBtn.Size = new System.Drawing.Size(75, 23); + this.acceptBtn.TabIndex = 7; + this.acceptBtn.Text = "Add"; + this.acceptBtn.UseVisualStyleBackColor = true; + this.acceptBtn.Click += new System.EventHandler(this.AcceptBtn_Click); + // + // CancelBtn + // + this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.CancelBtn.ForeColor = System.Drawing.Color.White; + this.CancelBtn.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.CancelBtn.Location = new System.Drawing.Point(172, 196); + this.CancelBtn.Name = "CancelBtn"; + this.CancelBtn.Size = new System.Drawing.Size(75, 23); + this.CancelBtn.TabIndex = 13; + this.CancelBtn.Text = "Cancel"; + this.CancelBtn.UseVisualStyleBackColor = true; + this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click); + // + // treeViewEntity + // + this.treeViewEntity.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.treeViewEntity.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeViewEntity.ForeColor = System.Drawing.Color.White; + this.treeViewEntity.Location = new System.Drawing.Point(0, 0); + this.treeViewEntity.Name = "treeViewEntity"; + this.treeViewEntity.Size = new System.Drawing.Size(318, 142); + this.treeViewEntity.TabIndex = 14; + this.treeViewEntity.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViews_AfterSelect); + // + // metroLabel2 + // + this.metroLabel2.AutoSize = true; + this.metroLabel2.Location = new System.Drawing.Point(133, 19); + this.metroLabel2.Name = "metroLabel2"; + this.metroLabel2.Size = new System.Drawing.Size(46, 19); + this.metroLabel2.TabIndex = 16; + this.metroLabel2.Text = "Filter: "; + this.metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // metroTextBox1 + // + // + // + // + this.metroTextBox1.CustomButton.Image = null; + this.metroTextBox1.CustomButton.Location = new System.Drawing.Point(134, 1); + this.metroTextBox1.CustomButton.Name = ""; + this.metroTextBox1.CustomButton.Size = new System.Drawing.Size(21, 21); + this.metroTextBox1.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; + this.metroTextBox1.CustomButton.TabIndex = 1; + this.metroTextBox1.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; + this.metroTextBox1.CustomButton.UseSelectable = true; + this.metroTextBox1.CustomButton.Visible = false; + this.metroTextBox1.Lines = new string[0]; + this.metroTextBox1.Location = new System.Drawing.Point(173, 18); + this.metroTextBox1.MaxLength = 32767; + this.metroTextBox1.Name = "metroTextBox1"; + this.metroTextBox1.PasswordChar = '\0'; + this.metroTextBox1.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.metroTextBox1.SelectedText = ""; + this.metroTextBox1.SelectionLength = 0; + this.metroTextBox1.SelectionStart = 0; + this.metroTextBox1.ShortcutsEnabled = true; + this.metroTextBox1.Size = new System.Drawing.Size(156, 23); + this.metroTextBox1.TabIndex = 17; + this.metroTextBox1.Theme = MetroFramework.MetroThemeStyle.Dark; + this.metroTextBox1.UseSelectable = true; + this.metroTextBox1.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); + this.metroTextBox1.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); + this.metroTextBox1.TextChanged += new System.EventHandler(this.filter_TextChanged); + // + // metroTabControl1 + // + this.metroTabControl1.Controls.Add(this.Blocks); + this.metroTabControl1.Location = new System.Drawing.Point(6, 8); + this.metroTabControl1.Name = "metroTabControl1"; + this.metroTabControl1.SelectedIndex = 0; + this.metroTabControl1.Size = new System.Drawing.Size(326, 184); + this.metroTabControl1.Style = MetroFramework.MetroColorStyle.White; + this.metroTabControl1.TabIndex = 18; + this.metroTabControl1.Theme = MetroFramework.MetroThemeStyle.Dark; + this.metroTabControl1.UseSelectable = true; + // + // Blocks + // + this.Blocks.BackColor = System.Drawing.SystemColors.WindowFrame; + this.Blocks.Controls.Add(this.treeViewEntity); + this.Blocks.Location = new System.Drawing.Point(4, 38); + this.Blocks.Name = "Blocks"; + this.Blocks.Size = new System.Drawing.Size(318, 142); + this.Blocks.TabIndex = 0; + this.Blocks.Text = "Entities"; + // + // AddBehaviour + // + this.AcceptButton = this.acceptBtn; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.CancelBtn; + this.ClientSize = new System.Drawing.Size(338, 228); + this.ControlBox = false; + this.Controls.Add(this.metroTextBox1); + this.Controls.Add(this.metroLabel2); + this.Controls.Add(this.metroTabControl1); + this.Controls.Add(this.CancelBtn); + this.Controls.Add(this.acceptBtn); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AddBehaviour"; + this.Resizable = false; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.metroTabControl1.ResumeLayout(false); + this.Blocks.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + private void MetroTextBox1_TextChanged(object sender, System.EventArgs e) + { + throw new System.NotImplementedException(); + } + + #endregion + private System.Windows.Forms.Button CancelBtn; + private System.Windows.Forms.TreeView treeViewEntity; + private MetroFramework.Controls.MetroLabel metroLabel2; + private MetroFramework.Controls.MetroTextBox metroTextBox1; + private MetroFramework.Controls.MetroTabControl metroTabControl1; + private System.Windows.Forms.TabPage Blocks; + public System.Windows.Forms.Button acceptBtn; + } +} \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.cs b/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.cs new file mode 100644 index 00000000..68932bbc --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using MetroFramework.Forms; +using Newtonsoft.Json.Linq; +using PckStudio.Forms.Utilities; + +namespace PckStudio.Forms.Additional_Popups.Behaviours +{ + public partial class AddBehaviour : MetroForm + { + string selectedEntity = ""; + + public string SelectedEntity => selectedEntity; + + List treeViewEntityCache = new List(); + + public AddBehaviour() + { + InitializeComponent(); + ImageList entities = new ImageList(); + entities.ColorDepth = ColorDepth.Depth32Bit; + entities.ImageSize = new System.Drawing.Size(32, 32); + entities.Images.AddRange(BehaviourUtil.entityImages); + treeViewEntity.ImageList = entities; + + try + { + int i = 0; + + if (BehaviourUtil.entityData["entities"] != null) + { + foreach (JObject content in BehaviourUtil.entityData["entities"].Children()) + { + foreach (JProperty prop in content.Properties()) + { + if (!string.IsNullOrEmpty((string)prop.Value)) + { + TreeNode entityNode = new TreeNode((string)prop.Value) + { + Tag = prop.Name, + ImageIndex = i, + SelectedImageIndex = i, + }; + treeViewEntity.Nodes.Add(entityNode); + treeViewEntityCache.Add(entityNode); + } + i++; + } + } + } + } + catch (Newtonsoft.Json.JsonException j_ex) + { + MessageBox.Show(j_ex.Message, "Error"); + return; + } + } + + private void treeViews_AfterSelect(object sender, TreeViewEventArgs e) + { + if (e.Node.Tag is string entityData) + { + selectedEntity = entityData; + Console.WriteLine(selectedEntity); + } + } + + void filter_TextChanged(object sender, EventArgs e) + { + // Some code in this function is modified code from this StackOverflow answer - MattNL + //https://stackoverflow.com/questions/8260322/filter-a-treeview-with-a-textbox-in-a-c-sharp-winforms-app + + //blocks repainting tree until all objects loaded + treeViewEntity.BeginUpdate(); + treeViewEntity.Nodes.Clear(); + if (!string.IsNullOrEmpty(metroTextBox1.Text)) + { + foreach (TreeNode _node in treeViewEntityCache) + { + if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()) || + (_node.Tag as string).ToLower().Contains(metroTextBox1.Text.ToLower())) + { + treeViewEntity.Nodes.Add((TreeNode)_node.Clone()); + } + } + } + else + { + foreach (TreeNode _node in treeViewEntityCache) + { + treeViewEntity.Nodes.Add((TreeNode)_node.Clone()); + } + } + //enables redrawing tree after all objects have been added + treeViewEntity.EndUpdate(); + } + + private void CancelBtn_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + Close(); + } + + private void AcceptBtn_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(selectedEntity)) CancelBtn_Click(sender, e); + DialogResult = DialogResult.OK; + Close(); + } + } +} diff --git a/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.resx b/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/Behaviours/AddBehaviour.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/BehaviourEditor.Designer.cs b/PCK-Studio/Forms/Editor/BehaviourEditor.Designer.cs index 417438d8..102b60ce 100644 --- a/PCK-Studio/Forms/Editor/BehaviourEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/BehaviourEditor.Designer.cs @@ -66,7 +66,7 @@ this.treeView1.Location = new System.Drawing.Point(20, 84); this.treeView1.Margin = new System.Windows.Forms.Padding(0); this.treeView1.Name = "treeView1"; - this.treeView1.Size = new System.Drawing.Size(128, 176); + this.treeView1.Size = new System.Drawing.Size(186, 176); this.treeView1.TabIndex = 13; this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick); @@ -80,7 +80,7 @@ this.renameToolStripMenuItem, this.removeToolStripMenuItem}); this.metroContextMenu1.Name = "metroContextMenu1"; - this.metroContextMenu1.Size = new System.Drawing.Size(118, 70); + this.metroContextMenu1.Size = new System.Drawing.Size(181, 92); // // addToolStripMenuItem // @@ -88,7 +88,7 @@ this.addNewEntryToolStripMenuItem, this.addNewPositionOverrideToolStripMenuItem}); this.addToolStripMenuItem.Name = "addToolStripMenuItem"; - this.addToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.addToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.addToolStripMenuItem.Text = "Add"; // // addNewEntryToolStripMenuItem @@ -108,14 +108,14 @@ // renameToolStripMenuItem // this.renameToolStripMenuItem.Name = "renameToolStripMenuItem"; - this.renameToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.renameToolStripMenuItem.Text = "Rename"; - this.renameToolStripMenuItem.Click += new System.EventHandler(this.renameToolStripMenuItem_Click); + this.renameToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.renameToolStripMenuItem.Text = "Change"; + this.renameToolStripMenuItem.Click += new System.EventHandler(this.changeToolStripMenuItem_Click); // // removeToolStripMenuItem // this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.removeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.removeToolStripMenuItem.Text = "Remove"; this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); // @@ -128,7 +128,7 @@ this.helpToolStripMenuItem}); this.menuStrip.Location = new System.Drawing.Point(20, 60); this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(274, 24); + this.menuStrip.Size = new System.Drawing.Size(309, 24); this.menuStrip.TabIndex = 14; this.menuStrip.Text = "menuStrip1"; // @@ -145,7 +145,7 @@ // this.saveToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem1.Image"))); this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1"; - this.saveToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem1.Size = new System.Drawing.Size(98, 22); this.saveToolStripMenuItem1.Text = "Save"; this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click); // @@ -160,7 +160,7 @@ // this.flag1Checkbox.AutoSize = true; this.flag1Checkbox.Enabled = false; - this.flag1Checkbox.Location = new System.Drawing.Point(174, 109); + this.flag1Checkbox.Location = new System.Drawing.Point(221, 104); this.flag1Checkbox.Name = "flag1Checkbox"; this.flag1Checkbox.Size = new System.Drawing.Size(96, 15); this.flag1Checkbox.TabIndex = 22; @@ -173,7 +173,7 @@ // this.flag2Checkbox.AutoSize = true; this.flag2Checkbox.Enabled = false; - this.flag2Checkbox.Location = new System.Drawing.Point(174, 141); + this.flag2Checkbox.Location = new System.Drawing.Point(221, 136); this.flag2Checkbox.Name = "flag2Checkbox"; this.flag2Checkbox.Size = new System.Drawing.Size(106, 15); this.flag2Checkbox.TabIndex = 23; @@ -188,7 +188,7 @@ this.zUpDown.DecimalPlaces = 3; this.zUpDown.Enabled = false; this.zUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.zUpDown.Location = new System.Drawing.Point(207, 225); + this.zUpDown.Location = new System.Drawing.Point(254, 220); this.zUpDown.Maximum = new decimal(new int[] { 255, 0, @@ -205,7 +205,7 @@ this.yUpDown.DecimalPlaces = 3; this.yUpDown.Enabled = false; this.yUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.yUpDown.Location = new System.Drawing.Point(207, 199); + this.yUpDown.Location = new System.Drawing.Point(254, 194); this.yUpDown.Maximum = new decimal(new int[] { 255, 0, @@ -219,7 +219,7 @@ // zLabel // this.zLabel.AutoSize = true; - this.zLabel.Location = new System.Drawing.Point(174, 225); + this.zLabel.Location = new System.Drawing.Point(221, 220); this.zLabel.Name = "zLabel"; this.zLabel.Size = new System.Drawing.Size(20, 19); this.zLabel.TabIndex = 25; @@ -229,7 +229,7 @@ // yLabel // this.yLabel.AutoSize = true; - this.yLabel.Location = new System.Drawing.Point(175, 199); + this.yLabel.Location = new System.Drawing.Point(222, 194); this.yLabel.Name = "yLabel"; this.yLabel.Size = new System.Drawing.Size(20, 19); this.yLabel.TabIndex = 24; @@ -242,7 +242,7 @@ this.xUpDown.DecimalPlaces = 3; this.xUpDown.Enabled = false; this.xUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204))))); - this.xUpDown.Location = new System.Drawing.Point(207, 173); + this.xUpDown.Location = new System.Drawing.Point(254, 168); this.xUpDown.Maximum = new decimal(new int[] { 255, 0, @@ -256,7 +256,7 @@ // xLabel // this.xLabel.AutoSize = true; - this.xLabel.Location = new System.Drawing.Point(175, 173); + this.xLabel.Location = new System.Drawing.Point(222, 168); this.xLabel.Name = "xLabel"; this.xLabel.Size = new System.Drawing.Size(20, 19); this.xLabel.TabIndex = 30; @@ -267,7 +267,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(314, 280); + this.ClientSize = new System.Drawing.Size(349, 280); this.Controls.Add(this.xUpDown); this.Controls.Add(this.xLabel); this.Controls.Add(this.zUpDown); diff --git a/PCK-Studio/Forms/Editor/BehaviourEditor.cs b/PCK-Studio/Forms/Editor/BehaviourEditor.cs index e2933188..f19ef875 100644 --- a/PCK-Studio/Forms/Editor/BehaviourEditor.cs +++ b/PCK-Studio/Forms/Editor/BehaviourEditor.cs @@ -1,21 +1,23 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Diagnostics; using System.IO; using System.Linq; using System.Windows.Forms; using MetroFramework.Forms; using PckStudio.Classes.FileTypes; using PckStudio.Classes.IO.Behaviour; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace PckStudio.Forms.Editor { public partial class BehaviourEditor : MetroForm { - // Behaviours File Format research by Miku + // Behaviours File Format research by Miku and MattNL private readonly PCKFile.FileData _file; BehaviourFile behaviourFile; - bool _isLittleEndian = false; void SetUpTree() { @@ -24,6 +26,19 @@ namespace PckStudio.Forms.Editor foreach (var entry in behaviourFile.entries) { TreeNode EntryNode = new TreeNode(entry.name); + + foreach (JObject content in Utilities.BehaviourUtil.entityData["entities"].Children()) + { + var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.name); + if (prop is JProperty) + { + EntryNode.Text = (string)prop.Value; + EntryNode.ImageIndex = Utilities.BehaviourUtil.entityData["entities"].Children().ToList().IndexOf(content); + EntryNode.SelectedImageIndex = EntryNode.ImageIndex; + break; + } + } + EntryNode.Tag = entry; foreach (var posOverride in entry.overrides) @@ -31,6 +46,8 @@ namespace PckStudio.Forms.Editor TreeNode OverrideNode = new TreeNode("Position Override"); OverrideNode.Tag = posOverride; EntryNode.Nodes.Add(OverrideNode); + OverrideNode.ImageIndex = 103; + OverrideNode.SelectedImageIndex = OverrideNode.ImageIndex; } treeView1.Nodes.Add(EntryNode); @@ -48,6 +65,9 @@ namespace PckStudio.Forms.Editor behaviourFile = BehavioursReader.Read(stream); } + treeView1.ImageList = new ImageList(); + Utilities.BehaviourUtil.entityImages.ToList().ForEach(img => treeView1.ImageList.Images.Add(img)); + treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit; SetUpTree(); } @@ -127,16 +147,37 @@ namespace PckStudio.Forms.Editor } } - private void renameToolStripMenuItem_Click(object sender, EventArgs e) + private void changeToolStripMenuItem_Click(object sender, EventArgs e) { + if (treeView1.SelectedNode == null) return; if (!(treeView1.SelectedNode.Tag is BehaviourFile.RiderPositionOverride entry)) return; - using RenamePrompt diag = new RenamePrompt(entry.name); - if (diag.ShowDialog(this) == DialogResult.OK) + var diag = new Additional_Popups.Behaviours.AddBehaviour(); + diag.acceptBtn.Text = "Save"; + + if (diag.ShowDialog() == DialogResult.OK) { - entry.name = diag.NewText; + if (String.IsNullOrEmpty(diag.SelectedEntity)) return; + if (behaviourFile.entries.FindAll(behaviour => behaviour.name == diag.SelectedEntity).Count() > 0) + { + MessageBox.Show(this, "You cannot have two entries for one entity. Please use the \"Add New Position Override\" tool to add multiple overrides for entities", "Error", MessageBoxButtons.OK); + return; + } + + entry.name = diag.SelectedEntity; treeView1.SelectedNode.Tag = entry; - treeView1.SelectedNode.Text = diag.NewText; + + foreach (JObject content in Utilities.BehaviourUtil.entityData["entities"].Children()) + { + var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.name); + if (prop is JProperty) + { + treeView1.SelectedNode.Text = (string)prop.Value; + treeView1.SelectedNode.ImageIndex = Utilities.BehaviourUtil.entityData["entities"].Children().ToList().IndexOf(content); + treeView1.SelectedNode.SelectedImageIndex = treeView1.SelectedNode.ImageIndex; + break; + } + } } } @@ -163,15 +204,26 @@ namespace PckStudio.Forms.Editor private void addNewEntryToolStripMenuItem_Click(object sender, EventArgs e) { - BehaviourFile.RiderPositionOverride NewOverride = new BehaviourFile.RiderPositionOverride("NewRiderOverride"); + var diag = new Additional_Popups.Behaviours.AddBehaviour(); - TreeNode NewOverrideNode = new TreeNode(NewOverride.name); - NewOverrideNode.Tag = NewOverride; - treeView1.Nodes.Add(NewOverrideNode); + if(diag.ShowDialog() == DialogResult.OK) + { + if (String.IsNullOrEmpty(diag.SelectedEntity)) return; + if (behaviourFile.entries.FindAll(behaviour => behaviour.name == diag.SelectedEntity).Count() > 0) + { + MessageBox.Show(this, "You cannot have two entries for one entity. Please use the \"Add New Position Override\" tool to add multiple overrides for entities", "Error", MessageBoxButtons.OK); + return; + } + BehaviourFile.RiderPositionOverride NewOverride = new BehaviourFile.RiderPositionOverride(diag.SelectedEntity); - treeView1.SelectedNode = NewOverrideNode; + TreeNode NewOverrideNode = new TreeNode(NewOverride.name); + NewOverrideNode.Tag = NewOverride; + treeView1.Nodes.Add(NewOverrideNode); - addNewPositionOverrideToolStripMenuItem_Click(sender, e); // adds a Position Override to the new Override + treeView1.SelectedNode = NewOverrideNode; + + addNewPositionOverrideToolStripMenuItem_Click(sender, e); // adds a Position Override to the new Override + } } private void treeView1_KeyDown(object sender, KeyEventArgs e) diff --git a/PCK-Studio/Forms/Utilities/AnimationUtil.cs b/PCK-Studio/Forms/Utilities/AnimationUtil.cs index 9fb2b97a..dd7e6dd4 100644 --- a/PCK-Studio/Forms/Utilities/AnimationUtil.cs +++ b/PCK-Studio/Forms/Utilities/AnimationUtil.cs @@ -7,6 +7,7 @@ using System.Linq; using PckStudio.Properties; using PckStudio.Classes.FileTypes; using System.Drawing.Imaging; +using PckStudio.Classes.Utils; using System.IO; namespace PckStudio.Forms.Utilities @@ -21,7 +22,7 @@ namespace PckStudio.Forms.Utilities { get { if (_tileImages == null) - _tileImages = CreateImageList(Resources.terrain_sheet, 16, 16).Concat(CreateImageList(Resources.items_sheet, 16, 16)).ToArray(); + _tileImages = ImageUtils.CreateImageList(Resources.terrain_sheet, 16).Concat(ImageUtils.CreateImageList(Resources.items_sheet, 16)).ToArray(); return _tileImages; } } @@ -36,30 +37,5 @@ namespace PckStudio.Forms.Utilities } return file; } - - - private static IEnumerable CreateImageList(Image source, int width, int height) - { - int img_row_count = source.Width / width; - int img_column_count = source.Height / height; - for (int i = 0; i < img_column_count * img_row_count; i++) - { - int row = i / width; - int column = i % height; - Rectangle tileArea = new Rectangle(new Point(column * width, row * height), new Size(width, height)); - Bitmap tileImage = new Bitmap(width, height); - using (Graphics gfx = Graphics.FromImage(tileImage)) - { - gfx.SmoothingMode = SmoothingMode.None; - gfx.InterpolationMode = InterpolationMode.NearestNeighbor; - gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; - - gfx.DrawImage(source, new Rectangle(0, 0, width, height), tileArea, GraphicsUnit.Pixel); - } - yield return tileImage; - } - yield break; - } - } } diff --git a/PCK-Studio/Forms/Utilities/BehaviourUtil.cs b/PCK-Studio/Forms/Utilities/BehaviourUtil.cs new file mode 100644 index 00000000..ff3f88a0 --- /dev/null +++ b/PCK-Studio/Forms/Utilities/BehaviourUtil.cs @@ -0,0 +1,42 @@ +using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.Drawing.Drawing2D; +using System.Drawing; +using System.Linq; + +using PckStudio.Properties; +using PckStudio.Classes.FileTypes; +using PckStudio.Classes.IO.Behaviour; +using PckStudio.Classes.Utils; +using System.Diagnostics; +using System.Drawing.Imaging; +using System.IO; + +namespace PckStudio.Forms.Utilities +{ + public static class BehaviourUtil + { + public static readonly JObject entityData = JObject.Parse(Resources.entityBehaviourData); + private static Image[] _entityImages; + public static Image[] entityImages + { + get { + if (_entityImages == null) + _entityImages = ImageUtils.CreateImageList(Resources.entities_sheet, 32).ToArray(); + return _entityImages; + } + } + public static PCKFile.FileData CreateNewBehaviourFile() + { + PCKFile.FileData file = new PCKFile.FileData($"behaviours.bin", PCKFile.FileData.FileType.BehavioursFile); + + using (var stream = new MemoryStream()) + { + BehavioursWriter.Write(stream, new BehaviourFile()); + file.SetData(stream.ToArray()); + } + + return file; + } + } +} diff --git a/PCK-Studio/MainForm.Designer.cs b/PCK-Studio/MainForm.Designer.cs index 9b2acc84..060441a4 100644 --- a/PCK-Studio/MainForm.Designer.cs +++ b/PCK-Studio/MainForm.Designer.cs @@ -124,6 +124,7 @@ this.labelVersion = new MetroFramework.Controls.MetroLabel(); this.ChangelogRichTextBox = new System.Windows.Forms.RichTextBox(); this.editorTab = new MetroFramework.Controls.MetroTabPage(); + this.metroLabel3 = new MetroFramework.Controls.MetroLabel(); this.labelImageSize = new MetroFramework.Controls.MetroLabel(); this.fileEntryCountLabel = new MetroFramework.Controls.MetroLabel(); this.PropertiesTabControl = new MetroFramework.Controls.MetroTabControl(); @@ -137,9 +138,9 @@ this.label11 = new MetroFramework.Controls.MetroLabel(); this.treeViewMain = new System.Windows.Forms.TreeView(); this.imageList = new System.Windows.Forms.ImageList(this.components); - this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox(); - this.metroLabel3 = new MetroFramework.Controls.MetroLabel(); this.pictureBoxImagePreview = new PckStudio.PictureBoxWithInterpolationMode(); + this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox(); + this.behavioursbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuPCKEntries.SuspendLayout(); this.menuStrip.SuspendLayout(); this.contextMenuMetaTree.SuspendLayout(); @@ -177,7 +178,8 @@ this.createAnimatedTextureToolStripMenuItem, this.audiopckToolStripMenuItem, this.colourscolToolStripMenuItem, - this.CreateSkinsPCKToolStripMenuItem1}); + this.CreateSkinsPCKToolStripMenuItem1, + this.behavioursbinToolStripMenuItem}); resources.ApplyResources(this.createToolStripMenuItem, "createToolStripMenuItem"); this.createToolStripMenuItem.Name = "createToolStripMenuItem"; // @@ -201,18 +203,21 @@ // // audiopckToolStripMenuItem // - resources.ApplyResources(this.audiopckToolStripMenuItem, "audiopckToolStripMenuItem"); + this.audiopckToolStripMenuItem.Image = global::PckStudio.Properties.Resources.BINKA_ICON; this.audiopckToolStripMenuItem.Name = "audiopckToolStripMenuItem"; + resources.ApplyResources(this.audiopckToolStripMenuItem, "audiopckToolStripMenuItem"); this.audiopckToolStripMenuItem.Click += new System.EventHandler(this.audiopckToolStripMenuItem_Click); // // colourscolToolStripMenuItem // + this.colourscolToolStripMenuItem.Image = global::PckStudio.Properties.Resources.COL_ICON; this.colourscolToolStripMenuItem.Name = "colourscolToolStripMenuItem"; resources.ApplyResources(this.colourscolToolStripMenuItem, "colourscolToolStripMenuItem"); this.colourscolToolStripMenuItem.Click += new System.EventHandler(this.colourscolToolStripMenuItem_Click); // // CreateSkinsPCKToolStripMenuItem1 // + this.CreateSkinsPCKToolStripMenuItem1.Image = global::PckStudio.Properties.Resources.SKINS_ICON; this.CreateSkinsPCKToolStripMenuItem1.Name = "CreateSkinsPCKToolStripMenuItem1"; resources.ApplyResources(this.CreateSkinsPCKToolStripMenuItem1, "CreateSkinsPCKToolStripMenuItem1"); this.CreateSkinsPCKToolStripMenuItem1.Click += new System.EventHandler(this.CreateSkinsPCKToolStripMenuItem1_Click); @@ -848,6 +853,12 @@ this.editorTab.VerticalScrollbarHighlightOnWheel = false; this.editorTab.VerticalScrollbarSize = 0; // + // metroLabel3 + // + resources.ApplyResources(this.metroLabel3, "metroLabel3"); + this.metroLabel3.Name = "metroLabel3"; + this.metroLabel3.Theme = MetroFramework.MetroThemeStyle.Dark; + // // labelImageSize // resources.ApplyResources(this.labelImageSize, "labelImageSize"); @@ -1010,6 +1021,14 @@ resources.ApplyResources(this.imageList, "imageList"); this.imageList.TransparentColor = System.Drawing.Color.Transparent; // + // pictureBoxImagePreview + // + resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview"); + this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent; + this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; + this.pictureBoxImagePreview.Name = "pictureBoxImagePreview"; + this.pictureBoxImagePreview.TabStop = false; + // // LittleEndianCheckBox // resources.ApplyResources(this.LittleEndianCheckBox, "LittleEndianCheckBox"); @@ -1019,19 +1038,12 @@ this.LittleEndianCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; this.LittleEndianCheckBox.UseSelectable = true; // - // metroLabel3 + // behavioursbinToolStripMenuItem // - resources.ApplyResources(this.metroLabel3, "metroLabel3"); - this.metroLabel3.Name = "metroLabel3"; - this.metroLabel3.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // pictureBoxImagePreview - // - resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview"); - this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent; - this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; - this.pictureBoxImagePreview.Name = "pictureBoxImagePreview"; - this.pictureBoxImagePreview.TabStop = false; + this.behavioursbinToolStripMenuItem.Image = global::PckStudio.Properties.Resources.BEHAVIOURS_ICON; + this.behavioursbinToolStripMenuItem.Name = "behavioursbinToolStripMenuItem"; + resources.ApplyResources(this.behavioursbinToolStripMenuItem, "behavioursbinToolStripMenuItem"); + this.behavioursbinToolStripMenuItem.Click += new System.EventHandler(this.behavioursbinToolStripMenuItem_Click); // // MainForm // @@ -1182,6 +1194,7 @@ private System.Windows.Forms.ToolStripMenuItem editAllEntriesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addFileToolStripMenuItem; private MetroFramework.Controls.MetroLabel metroLabel3; + private System.Windows.Forms.ToolStripMenuItem behavioursbinToolStripMenuItem; } } diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 6f037b4e..619d072f 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -817,7 +817,7 @@ namespace PckStudio TrySetLocFile(locFile); saved = false; - //BuildMainTreeView(); + BuildMainTreeView(); } } @@ -2243,6 +2243,19 @@ namespace PckStudio } return; } + + private void behavioursbinToolStripMenuItem_Click(object sender, EventArgs e) + { + PCKFile.FileData NewBehaviourFile; + if (currentPCK.TryGetFile("behaviours.bin", PCKFile.FileData.FileType.BehavioursFile, out NewBehaviourFile)) + { + MessageBox.Show("A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted"); + return; + } + NewBehaviourFile = BehaviourUtil.CreateNewBehaviourFile(); + currentPCK.Files.Add(NewBehaviourFile); + BuildMainTreeView(); + } } public class PckNodeSorter : System.Collections.IComparer diff --git a/PCK-Studio/MainForm.resx b/PCK-Studio/MainForm.resx index 71a85fa8..5b8b6e3b 100644 --- a/PCK-Studio/MainForm.resx +++ b/PCK-Studio/MainForm.resx @@ -121,29 +121,6 @@ 116, 17 - - 158, 224 - - - contextMenuPCKEntries - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAA3SURBVDhPY/j/ - /z9FGKsgGIsCKWSMTQ0QYxUE45FmALpiYvFwMgAbxqIYG8YqCMajBhCJ/zMAAPGwpV/Xje8RAAAAAElF - TkSuQmCC - - - - 157, 22 - - - Create - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -153,7 +130,7 @@ - 167, 22 + 180, 22 Folder @@ -175,7 +152,7 @@ - 167, 22 + 180, 22 Skin @@ -197,51 +174,48 @@ - 167, 22 + 180, 22 Animated Texture - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAAFlJREFUOE9jIAQ8Fjz4D8JWky+BMVSYeEA1A7SaDoExyQZRzQAol0GhYsd/EIZy - CQOKDSDZyehg1AAyDEja9es/CMOiD5aAoNKEAcUGwDTAEgzJCYc0AxgYAMwrpe0sH8vyAAAAAElFTkSu - QmCC - - - 167, 22 + 180, 22 Audio.pck - 167, 22 + 180, 22 Colours.col - 167, 22 + 180, 22 Skins.pck - + + 180, 22 + + + Behaviours.bin + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAABzSURBVDhPpYzB - DQAhCARp4hr3Txu254WTjYRb9cEmk/BgRjBVHTv85Twmgt77PcJEYIFrhIkAgWOEiSAGthEmgtbaD9fW - mBgpB4xywCgFxiMf5YDdrq3l5wjEjKtzTARMNlydY2IGot2ureVnRjkQmZbICyCi7XU5cfqKAAAAAElF + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAA3SURBVDhPY/j/ + /z9FGKsgGIsCKWSMTQ0QYxUE45FmALpiYvFwMgAbxqIYG8YqCMajBhCJ/zMAAPGwpV/Xje8RAAAAAElF TkSuQmCC - - 157, 22 + + 180, 22 - - Import + + Create @@ -295,11 +269,20 @@ Add File - - 157, 22 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAABzSURBVDhPpYzB + DQAhCARp4hr3Txu254WTjYRb9cEmk/BgRjBVHTv85Twmgt77PcJEYIFrhIkAgWOEiSAGthEmgtbaD9fW + mBgpB4xywCgFxiMf5YDdrq3l5wjEjKtzTARMNlydY2IGot2ureVnRjkQmZbICyCi7XU5cfqKAAAAAElF + TkSuQmCC + - - Export + + 180, 22 + + + Import 186, 22 @@ -307,11 +290,11 @@ Export as 3DS Texture - - 157, 22 + + 180, 22 - - Set File Type + + Export 222, 22 @@ -385,11 +368,11 @@ Entity Materials File (.BIN) - - 157, 22 + + 180, 22 - - Misc. Functions + + Set File Type 210, 22 @@ -409,6 +392,12 @@ Correct Skin Decimals + + 180, 22 + + + Misc. Functions + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -419,13 +408,13 @@ - 157, 22 + 180, 22 Extract - 157, 22 + 180, 22 Clone @@ -438,7 +427,7 @@ - 157, 22 + 180, 22 Rename @@ -454,7 +443,7 @@ - 157, 22 + 180, 22 Replace @@ -469,11 +458,20 @@ - 157, 22 + 180, 22 Delete + + 181, 246 + + + contextMenuPCKEntries + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 17, 17 @@ -488,53 +486,6 @@ None - - 24, 44 - - - 1016, 24 - - - 2 - - - menuStrip1 - - - menuStrip - - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - 37, 20 - - - File - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADuSURBVFhH7ZbB - CsMgEERDbv5A/v83e2jNTmCKGdegJk0heHgUn7vrKBQyxRj/iivJPM9WMTWjc45wJeAwhAghVJEG1nkl - XNkziLCvtteXphFCfQ08nOi+4kvTeFL1NfBQ/BLuefjS9NkAADOwPnpNX14UADBEaV4mNnkygN34Y/1v - AgeWZXll9So2eTLAEVm9ik2a7g1Qgn9t9bvFV/4gAOZdHgB1RPeUEeAZAeBr0d4R4JIACuqI7ikjwDMD - tDACNAfo/Sou0fQ9wGKvoQfO8i61W6SkTXi+XtLLgOwcFSna3It3c+LKO3HlfcRpBa3JBjU5E8DiAAAA - AElFTkSuQmCC - - - - 217, 22 - - - New - 151, 22 @@ -553,6 +504,23 @@ Mash-Up Pack + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADuSURBVFhH7ZbB + CsMgEERDbv5A/v83e2jNTmCKGdegJk0heHgUn7vrKBQyxRj/iivJPM9WMTWjc45wJeAwhAghVJEG1nkl + XNkziLCvtteXphFCfQ08nOi+4kvTeFL1NfBQ/BLuefjS9NkAADOwPnpNX14UADBEaV4mNnkygN34Y/1v + AgeWZXll9So2eTLAEVm9ik2a7g1Qgn9t9bvFV/4gAOZdHgB1RPeUEeAZAeBr0d4R4JIACuqI7ikjwDMD + tDACNAfo/Sou0fQ9wGKvoQfO8i61W6SkTXi+XtLLgOwcFSna3It3c+LKO3HlfcRpBa3JBjU5E8DiAAAA + AElFTkSuQmCC + + + + 217, 22 + + + New + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -671,11 +639,11 @@ False - - 39, 20 + + 37, 20 - - Edit + + File False @@ -721,11 +689,11 @@ Convert to Bedrock - - 44, 20 + + 39, 20 - - Help + + Edit @@ -1267,20 +1235,6 @@ Binka Conversion - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAKdJREFUOE+1 - jzEKwzAQBNUEXKQIBOwifcgTUvkDbt2p9qP0Ev1E31FYkVXOx2FLRRYWi7NnTnZ/z/MxZPY7aguhbZlq - myQafL+ubRINshCwnO0kFqi3HkpwWOf7DkC1RBfvx9slV4ElscqbxBiz9/4nwOBIQjCEUL7FswhwDYAp - JVMiN0oYs/ILiCXRIGHOwVQBoiXsKSgjJdzaBMpQ0g3KEOoG++PcBx9PFJGNjU4vAAAAAElFTkSuQmCC - - - - 181, 22 - - - Tutorials - iVBORw0KGgoAAAANSUhEUgAACOAAAAaoCAYAAAAgNTafAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m @@ -21966,6 +21920,20 @@ How PCKs work + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAKdJREFUOE+1 + jzEKwzAQBNUEXKQIBOwifcgTUvkDbt2p9qP0Ev1E31FYkVXOx2FLRRYWi7NnTnZ/z/MxZPY7aguhbZlq + myQafL+ubRINshCwnO0kFqi3HkpwWOf7DkC1RBfvx9slV4ElscqbxBiz9/4nwOBIQjCEUL7FswhwDYAp + JVMiN0oYs/ILiCXRIGHOwVQBoiXsKSgjJdzaBMpQ0g3KEOoG++PcBx9PFJGNjU4vAAAAAElFTkSuQmCC + + + + 181, 22 + + + Tutorials + iVBORw0KGgoAAAANSUhEUgAABkAAAAZACAYAAAAhDI6nAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -23969,12 +23937,6 @@ FAQ - - 181, 22 - - - Buy a coffee - 253, 22 @@ -23993,6 +23955,12 @@ For MattNL (Other Developer) + + 181, 22 + + + Buy a coffee + 181, 22 @@ -25840,18 +25808,11 @@ Administrative Tools - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAAAuSURBVDhPY/j/ - /z9FGMYgFwwbA8gFcANARpEJho0B5AK4ASCjyATDyQAy8X8GAKAaUNpxMP6IAAAAAElFTkSuQmCC - + + 44, 20 - - 63, 20 - - - More + + Help @@ -28550,11 +28511,18 @@ Join Development Discord - - 47, 20 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAAAuSURBVDhPY/j/ + /z9FGMYgFwwbA8gFcANARpEJho0B5AK4ASCjyATDyQAy8X8GAKAaUNpxMP6IAAAAAElFTkSuQmCC + - - Misc. + + 63, 20 + + + More False @@ -28565,18 +28533,39 @@ Add Custom Pack Icon + + 47, 20 + + + Misc. + + + 24, 44 + + + 1016, 24 + + + 2 + + + menuStrip1 + + + menuStrip + + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + 298, 17 - - 182, 92 - - - contextMenuMetaTree - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -28626,6 +28615,15 @@ Edit All Entries + + 182, 92 + + + contextMenuMetaTree + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + iVBORw0KGgoAAAANSUhEUgAAAbYAAAB7CAYAAAAYCKWuAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -29312,219 +29310,6 @@ 8 - - pckOpen - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - openTab - - - 2 - - - label5 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - openTab - - - 3 - - - labelVersion - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - openTab - - - 4 - - - ChangelogRichTextBox - - - System.Windows.Forms.RichTextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - openTab - - - 5 - - - 4, 38 - - - 18, 30, 20, 5 - - - 1016, 558 - - - 1 - - - openTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - tabControl - - - 0 - - - True - - - None - - - metroLabel3 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 2 - - - labelImageSize - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 3 - - - fileEntryCountLabel - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 4 - - - PropertiesTabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 5 - - - label11 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 6 - - - treeViewMain - - - System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - editorTab - - - 7 - - - pictureBoxImagePreview - - - PckStudio.PictureBoxWithInterpolationMode, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null - - - editorTab - - - 9 - - - 4, 38 - - - 5, 50, 5, 7 - - - 1016, 558 - - - 0 - - - editorTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - tabControl - - - 1 - - - Fill - - - 20, 30 - - - 0, 0, 0, 0 - - - 1024, 600 - - - 0 - - - tabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 4 - None @@ -30635,6 +30420,57 @@ 5 + + 4, 38 + + + 18, 30, 20, 5 + + + 1016, 558 + + + 1 + + + openTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 0 + + + None + + + 9, 28 + + + 326, 19 + + + 0 + + + pckFileLabel + + + metroLabel3 + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 2 + Top, Right @@ -30692,138 +30528,6 @@ Top, Bottom, Right - - MetaTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - PropertiesTabControl - - - 0 - - - 338, 277 - - - 671, 282 - - - 11 - - - PropertiesTabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 5 - - - metroLabel2 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - MetaTab - - - 2 - - - treeMeta - - - System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - MetaTab - - - 3 - - - entryTypeTextBox - - - MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - MetaTab - - - 4 - - - entryDataTextBox - - - MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - MetaTab - - - 5 - - - buttonEdit - - - MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - MetaTab - - - 6 - - - metroLabel1 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - MetaTab - - - 7 - - - 4, 38 - - - 3, 3, 3, 3 - - - 663, 240 - - - 0 - - - Properties - - - MetaTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - PropertiesTabControl - - - 0 - Top, Right @@ -31025,6 +30729,54 @@ 7 + + 4, 38 + + + 3, 3, 3, 3 + + + 663, 240 + + + 0 + + + Properties + + + MetaTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + PropertiesTabControl + + + 0 + + + 338, 277 + + + 671, 282 + + + 11 + + + PropertiesTabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 5 + True @@ -31094,60 +30846,6 @@ 7 - - Top, Right - - - True - - - 866, 49 - - - 167, 15 - - - 21 - - - Open/Save as Vita/PS4 PCK - - - LittleEndianCheckBox - - - MetroFramework.Controls.MetroCheckBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 2 - - - 9, 28 - - - 326, 19 - - - 0 - - - pckFileLabel - - - metroLabel3 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 2 - Top, Right @@ -31181,6 +30879,87 @@ 9 + + 4, 38 + + + 5, 50, 5, 7 + + + 1016, 558 + + + 0 + + + editorTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 1 + + + Fill + + + 20, 30 + + + 0, 0, 0, 0 + + + 1024, 600 + + + 0 + + + tabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 4 + + + Top, Right + + + True + + + 866, 49 + + + 167, 15 + + + 21 + + + Open/Save as Vita/PS4 PCK + + + LittleEndianCheckBox + + + MetroFramework.Controls.MetroCheckBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 2 + True @@ -34215,6 +33994,12 @@ System.Windows.Forms.ImageList, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + behavioursbinToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + MainForm diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 11eda23e..bb9efcd0 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -200,6 +200,7 @@ + @@ -242,6 +243,12 @@ + + Form + + + AddBehaviour.cs + Form @@ -362,6 +369,7 @@ pleaseWait.cs + Form @@ -491,6 +499,9 @@ + + AddBehaviour.cs + AddLanguage.cs @@ -689,6 +700,7 @@ + @@ -750,6 +762,7 @@ + diff --git a/PCK-Studio/Program.cs b/PCK-Studio/Program.cs index 440021b6..a789dc63 100644 --- a/PCK-Studio/Program.cs +++ b/PCK-Studio/Program.cs @@ -11,7 +11,7 @@ namespace PckStudio { // this is to specify which build release this is. This is manually updated for now // TODO: add different chars for different configurations - private const string BuildType = "a"; + private const string BuildType = "b"; private System.Globalization.Calendar BuildCalendar = new System.Globalization.CultureInfo("en-US").Calendar; private DateTime date = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime; diff --git a/PCK-Studio/Properties/Resources.Designer.cs b/PCK-Studio/Properties/Resources.Designer.cs index 25c74ee2..8863fef0 100644 --- a/PCK-Studio/Properties/Resources.Designer.cs +++ b/PCK-Studio/Properties/Resources.Designer.cs @@ -262,6 +262,16 @@ namespace PckStudio.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap entities_sheet { + get { + object obj = ResourceManager.GetObject("entities_sheet", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -272,6 +282,29 @@ namespace PckStudio.Properties { } } + /// + /// Looks up a localized string similar to { + /// "COMMENT": "Entity data research by NessieHax (Miku-666) and MattNL", + /// "entities": [ + /// { "area_effect_cloud": "Area Effect Cloud / Particle" }, + /// { "armor_stand": "Armor Stand" }, + /// { "arrow": "Arrow" }, + /// { "blaze": "Blaze" }, + /// { "boat": "Boat" }, + /// { "cat": "Cat (PS4 EXCLUSIVE)" }, + /// { "cave_spider": "Cave Spider (PS4 EXCLUSIVE)" }, + /// { "chest_minecart": "Chest Minecart" }, + /// { "chicken": "Chicken" }, + /// { "cod": "Cod" }, + /// { "commandblock_minecart": "Command Block Minecart" }, + /// { "cow": [rest of string was truncated]";. + /// + public static string entityBehaviourData { + get { + return ResourceManager.GetString("entityBehaviourData", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PCK-Studio/Properties/Resources.resx b/PCK-Studio/Properties/Resources.resx index 774a3c8b..a95a354e 100644 --- a/PCK-Studio/Properties/Resources.resx +++ b/PCK-Studio/Properties/Resources.resx @@ -328,4 +328,10 @@ ..\Resources\iconImageList\blank.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\entities.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\entityBehaviourData.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file diff --git a/PCK-Studio/Resources/entities.png b/PCK-Studio/Resources/entities.png new file mode 100644 index 00000000..341a84b5 Binary files /dev/null and b/PCK-Studio/Resources/entities.png differ diff --git a/PCK-Studio/Resources/entityBehaviourData.json b/PCK-Studio/Resources/entityBehaviourData.json new file mode 100644 index 00000000..67b2aeff --- /dev/null +++ b/PCK-Studio/Resources/entityBehaviourData.json @@ -0,0 +1,109 @@ +{ + "COMMENT": "Entity data research by NessieHax (Miku-666) and MattNL", + "entities": [ + { "area_effect_cloud": "Area Effect Cloud / Particle" }, + { "armor_stand": "Armor Stand" }, + { "arrow": "Arrow" }, + { "bat": "Bat" }, + { "blaze": "Blaze" }, + { "boat": "Boat" }, + { "cat": "Cat (PS4 EXCLUSIVE)" }, + { "cave_spider": "Cave Spider" }, + { "chest_minecart": "Chest Minecart" }, + { "chicken": "Chicken" }, + { "cod": "Cod" }, + { "commandblock_minecart": "Command Block Minecart" }, + { "cow": "Cow" }, + { "creeper": "Creeper" }, + { "dolphin": "Dolphin" }, + { "donkey": "Donkey" }, + { "dragon_fireball": "Dragon Fireball" }, + { "drowned": "Drowned" }, + { "egg": "Thrown Egg" }, + { "elder_guardian": "Elder Guardian" }, + { "ender_crystal": "End Crystal" }, + { "ender_dragon": "Ender Dragon" }, + { "ender_pearl": "Thrown Ender Pearl" }, + { "enderman": "Enderman" }, + { "endermite": "Endermite" }, + { "evocation_illager": "Evoker" }, + { "evocation_fangs": "Evoker Fangs" }, + { "xp_bottle": "Thrown Experience Bottle" }, + { "xp_orb": "Experience Orb" }, + { "eye_of_ender_signal": "Thrown Eye of Ender" }, + { "falling_block": "Falling Block" }, + { "fireball": "Fireball" }, + { "fireworks_rocket": "Firework Rocket" }, + { "furnace_minecart": "Furnace Minecart" }, + { "ghast": "Ghast" }, + { "giant": "Giant" }, + { "guardian": "Guardian" }, + { "hopper_minecart": "Hopper Minecart" }, + { "horse": "Horse" }, + { "husk": "Husk" }, + { "villager_golem": "Iron Golem" }, + { "item": "Dropped Item" }, + { "item_frame": "Item Frame" }, + { "leash_knot": "Lead Knot" }, + { "llama": "Llama" }, + { "llama_spit": "Llama Spit" }, + { "magma_cube": "Magma Cube" }, + { "minecart": "Minecart" }, + { "mooshroom": "Mooshroom" }, + { "mule": "Mule" }, + { "ocelot": "Ocelot" }, + { "painting": "Painting" }, + { "panda": "Panda (PS4 EXCLUSIVE)" }, + { "parrot": "Parrot" }, + { "phantom": "Phantom" }, + { "pig": "Pig" }, + { "pillager": "Pillager (PS4 EXCLUSIVE)" }, + { "polar_bear": "Polar Bear" }, + { "potion": "Thrown Potion" }, + { "pufferfish": "Pufferfish" }, + { "rabbit": "Rabbit" }, + { "ravager": "Ravager (PS4 EXCLUSIVE)" }, + { "salmon": "Salmon" }, + { "sheep": "Sheep" }, + { "shulker": "Shulker" }, + { "shulker_bullet": "Shulker Bullet" }, + { "silverfish": "Silverfish" }, + { "skeleton": "Skeleton" }, + { "skeleton_horse": "Skeleton Horse" }, + { "slime": "Slime" }, + { "small_fireball": "Small Fireball" }, + { "snowman": "Snow Golem" }, + { "snowball": "Thrown Snowball" }, + { "spawner_minecart": "Spawner Minecart" }, + { "spectral_arrow": "Spectral Arrow" }, + { "spider": "Spider" }, + { "squid": "Squid" }, + { "stray": "Stray" }, + { "tnt": "Primed TNT" }, + { "tnt_minecart": "TNT Minecart" }, + { "trident": "Thrown Trident" }, + { "tropical_fish": "Tropical Fish" }, + { "turtle": "Turtle" }, + { "vex": "Vex" }, + { "villager": "Villager" }, + { "vindication_illager": "Vindicator" }, + { "wandering_trader": "Wandering Trader (PS4 Exclusive)" }, + { "witch": "Witch" }, + { "wither": "Wither" }, + { "wither_skeleton": "Wither Skeleton" }, + { "wither_skull": "Wither Skull" }, + { "wolf": "Wolf" }, + { "zombie": "Zombie" }, + { "zombie_horse": "Zombie Horse" }, + { "zombie_pigman": "Zombie Pigman" }, + { "zombie_villager": "Zombie Villager" }, + { "": "" }, + { "": "" }, + { "": "" }, + { "": "" }, + { "": "" }, + { "": "" }, + { "": "" }, + { "": "" } + ] +}