mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-27 09:35:39 +00:00
Merge branch 'main' of https://github.com/PhoenixARC/-PCK-Studio
This commit is contained in:
@@ -415,21 +415,14 @@ namespace PckStudio.Controls
|
||||
}
|
||||
}
|
||||
|
||||
private PckFile.FileData CreateNewAudioFile(bool isLittle)
|
||||
private static PckFile.FileData CreateNewAudioFile(bool isLittle)
|
||||
{
|
||||
PckAudioFile audioPck = new PckAudioFile();
|
||||
audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Overworld);
|
||||
audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Nether);
|
||||
audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.End);
|
||||
PckFile.FileData pckFileData = _pck.CreateNewFile("audio.pck", PckFile.FileData.FileType.AudioFile, () =>
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var writer = new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
}
|
||||
});
|
||||
PckFile.FileData pckFileData = new PckFile.FileData("audio.pck", PckFile.FileData.FileType.AudioFile);
|
||||
pckFileData.SetData(new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
return pckFileData;
|
||||
}
|
||||
|
||||
@@ -778,9 +771,9 @@ namespace PckStudio.Controls
|
||||
|
||||
var file = CreateNewAudioFile(LittleEndianCheckBox.Checked);
|
||||
AudioEditor diag = new AudioEditor(file, LittleEndianCheckBox.Checked);
|
||||
if (diag.ShowDialog(this) != DialogResult.OK)
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
_pck.Files.Remove(file); // delete file if not saved
|
||||
_pck.Files.Add(file);
|
||||
}
|
||||
diag.Dispose();
|
||||
BuildMainTreeView();
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace PckStudio.Extensions
|
||||
{
|
||||
internal static class EnumerableExtensions
|
||||
{
|
||||
public static IEnumerable<(int index, T type)>enumerate<T>(this IEnumerable<T> array)
|
||||
public static IEnumerable<(int index, T value)>enumerate<T>(this IEnumerable<T> array)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var item in array)
|
||||
|
||||
@@ -45,30 +45,26 @@ namespace PckStudio.Extensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an image array by reading in horizontal order
|
||||
/// Creates an IEnumerable by reading in horizontal order
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="size">Size of individual image inside of <paramref name="source"/></param>
|
||||
internal static IEnumerable<Image> CreateImageList(this Image source, Size size)
|
||||
/// <param name="source">this image</param>
|
||||
/// <param name="scalar">Indecates width and height of image sub section</param>
|
||||
/// <returns><see cref="IEnumerable{Image}"/> of type <see cref="Image"/></returns>
|
||||
internal static IEnumerable<Image> SplitHorizontal(this Image source, int scalar)
|
||||
{
|
||||
return source.CreateImageList(size, ImageLayoutDirection.Horizontal);
|
||||
return source.Split(scalar, ImageLayoutDirection.Horizontal);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> CreateImageList(this Image source, int scalar)
|
||||
internal static IEnumerable<Image> Split(this Image source, int scalar, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
return source.CreateImageList(scalar, ImageLayoutDirection.Horizontal);
|
||||
return Split(source, new Size(scalar, scalar), layoutDirection);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> CreateImageList(this Image source, int scalar, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
return CreateImageList(source, new Size(scalar, scalar), layoutDirection);
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> CreateImageList(this Image source, Size size, ImageLayoutDirection imageLayout)
|
||||
internal static IEnumerable<Image> Split(this Image source, Size size, ImageLayoutDirection imageLayout)
|
||||
{
|
||||
int rowCount = source.Width / size.Width;
|
||||
int columnCount = source.Height / size.Height;
|
||||
Debug.WriteLine($"{nameof(source.Size)}={source.Size}, {nameof(size)}={size}, {columnCount} {rowCount}");
|
||||
Debug.WriteLine($"Image size: {source.Size}, Area size: {size}, col num: {columnCount}, row num: {rowCount}");
|
||||
for (int i = 0; i < columnCount * rowCount; i++)
|
||||
{
|
||||
int row = Math.DivRem(i, rowCount, out int column);
|
||||
@@ -80,7 +76,7 @@ namespace PckStudio.Extensions
|
||||
yield break;
|
||||
}
|
||||
|
||||
internal static IEnumerable<Image> CreateImageList(this Image source, ImageLayoutDirection layoutDirection)
|
||||
internal static IEnumerable<Image> Split(this Image source, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
for (int i = 0; i < source.Height / source.Width; i++)
|
||||
{
|
||||
@@ -90,7 +86,7 @@ namespace PckStudio.Extensions
|
||||
yield break;
|
||||
}
|
||||
|
||||
internal static Image CombineImages(this IList<Image> sources, ImageLayoutDirection layoutDirection)
|
||||
internal static Image Combine(this IList<Image> sources, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
Size imageSize = CalculateImageSize(sources, layoutDirection);
|
||||
var image = new Bitmap(imageSize.Width, imageSize.Height);
|
||||
|
||||
91
PCK-Studio/Extensions/PckFileDataExtensions.cs
Normal file
91
PCK-Studio/Extensions/PckFileDataExtensions.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal static class PckFileDataExtensions
|
||||
{
|
||||
private const string MipMap = "MipMapLevel";
|
||||
|
||||
internal static Image GetTexture(this PckFile.FileData file)
|
||||
{
|
||||
if (file.Filetype != PckFile.FileData.FileType.SkinFile &&
|
||||
file.Filetype != PckFile.FileData.FileType.CapeFile &&
|
||||
file.Filetype != PckFile.FileData.FileType.TextureFile)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
Image image = null;
|
||||
using (var stream = new MemoryStream(file.Data))
|
||||
{
|
||||
try
|
||||
{
|
||||
image = Image.FromStream(stream);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
internal static void SetData(this PckFile.FileData file, IDataFormatWriter writer)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
writer.WriteToStream(stream);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetData(this PckFile.FileData file, Image image, ImageFormat imageFormat)
|
||||
{
|
||||
if (file.Filetype != PckFile.FileData.FileType.SkinFile &&
|
||||
file.Filetype != PckFile.FileData.FileType.CapeFile &&
|
||||
file.Filetype != PckFile.FileData.FileType.TextureFile)
|
||||
{
|
||||
Debug.WriteLine($"{file.Filename} can't contain image data");
|
||||
return;
|
||||
}
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
image.Save(stream, imageFormat);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsMipmappedFile(this PckFile.FileData file)
|
||||
{
|
||||
// We only want to test the file name itself. ex: "terrainMipMapLevel2"
|
||||
string name = Path.GetFileNameWithoutExtension(file.Filename);
|
||||
|
||||
// check if last character is a digit (0-9). If not return false
|
||||
if (!char.IsDigit(name[name.Length - 1]))
|
||||
return false;
|
||||
|
||||
// If string does not end with MipMapLevel, then it's not MipMapped
|
||||
if (!name.Remove(name.Length - 1, 1).EndsWith(MipMap))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static string GetNormalPath(this PckFile.FileData file)
|
||||
{
|
||||
if (!file.IsMipmappedFile())
|
||||
return file.Filename;
|
||||
string ext = Path.GetExtension(file.Filename);
|
||||
return file.Filename.Remove(file.Filename.Length - (MipMap.Length + 1) - ext.Length) + ext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,34 +5,26 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal static class PckFileExtensions
|
||||
{
|
||||
private const string MipMap = "MipMapLevel";
|
||||
|
||||
internal static bool IsMipmappedFile(this PckFile.FileData file)
|
||||
internal static PckFile.FileData CreateNewFileIf(this PckFile pck, bool condition, string filename, PckFile.FileData.FileType filetype, IDataFormatWriter writer)
|
||||
{
|
||||
// We only want to test the file name itself. ex: "terrainMipMapLevel2"
|
||||
string name = Path.GetFileNameWithoutExtension(file.Filename);
|
||||
|
||||
// check if last character is a digit (0-9). If not return false
|
||||
if (!char.IsDigit(name[name.Length - 1]))
|
||||
return false;
|
||||
|
||||
// If string does not end with MipMapLevel, then it's not MipMapped
|
||||
if (!name.Remove(name.Length - 1, 1).EndsWith(MipMap))
|
||||
return false;
|
||||
return true;
|
||||
if (condition)
|
||||
{
|
||||
return pck.CreateNewFile(filename, filetype, writer);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static string GetNormalPath(this PckFile.FileData file)
|
||||
internal static PckFile.FileData CreateNewFile(this PckFile pck, string filename, PckFile.FileData.FileType filetype, IDataFormatWriter writer)
|
||||
{
|
||||
if (!file.IsMipmappedFile())
|
||||
return file.Filename;
|
||||
string ext = Path.GetExtension(file.Filename);
|
||||
return file.Filename.Remove(file.Filename.Length - (MipMap.Length + 1) - ext.Length) + ext;
|
||||
var file = pck.CreateNewFile(filename, filetype);
|
||||
file.SetData(writer);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Helper;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
@@ -24,8 +23,8 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
public ChangeTile()
|
||||
{
|
||||
InitializeComponent();
|
||||
treeViewBlocks.ImageList = AnimationResources.BlockImageList;
|
||||
treeViewItems.ImageList = AnimationResources.ItemImageList;
|
||||
treeViewBlocks.ImageList = Tiles.BlockImageList;
|
||||
treeViewItems.ImageList = Tiles.ItemImageList;
|
||||
InitializeTreeviews();
|
||||
}
|
||||
|
||||
@@ -53,8 +52,8 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
{
|
||||
List<JsonTileInfo> textureInfos = key switch
|
||||
{
|
||||
"blocks" => AnimationResources.BlockTileInfos,
|
||||
"items" => AnimationResources.ItemTileInfos,
|
||||
"blocks" => Tiles.BlockTileInfos,
|
||||
"items" => Tiles.ItemTileInfos,
|
||||
_ => throw new InvalidOperationException(key)
|
||||
};
|
||||
Profiler.Start();
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
namespace PckStudio.Forms.Additional_Popups.Audio
|
||||
{
|
||||
partial class creditsEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(creditsEditor));
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.metroLabel1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
resources.ApplyResources(this.button1, "button1");
|
||||
this.button1.ForeColor = System.Drawing.Color.White;
|
||||
this.button1.Name = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
resources.ApplyResources(this.richTextBox1, "richTextBox1");
|
||||
this.richTextBox1.BackColor = System.Drawing.SystemColors.WindowFrame;
|
||||
this.richTextBox1.ForeColor = System.Drawing.SystemColors.Window;
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
//
|
||||
// metroLabel1
|
||||
//
|
||||
resources.ApplyResources(this.metroLabel1, "metroLabel1");
|
||||
this.metroLabel1.Name = "metroLabel1";
|
||||
this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// creditsEditor
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.metroLabel1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "creditsEditor";
|
||||
this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow;
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel1;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
// Audio Editor by MattNL
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups.Audio
|
||||
{
|
||||
public partial class creditsEditor : MetroFramework.Forms.MetroForm
|
||||
{
|
||||
public string Credits => richTextBox1.Text;
|
||||
public creditsEditor(string cred)
|
||||
{
|
||||
InitializeComponent();
|
||||
richTextBox1.Text = cred;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -29,11 +29,12 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CreateTexturePackPrompt));
|
||||
this.TextLabel = new System.Windows.Forms.Label();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.TextLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.OKButton = new MetroFramework.Controls.MetroButton();
|
||||
this.InputTextBox = new MetroFramework.Controls.MetroTextBox();
|
||||
this.resolutionComboBox = new MetroFramework.Controls.MetroComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.createSkinsPckCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TextLabel
|
||||
@@ -41,13 +42,14 @@
|
||||
resources.ApplyResources(this.TextLabel, "TextLabel");
|
||||
this.TextLabel.ForeColor = System.Drawing.Color.White;
|
||||
this.TextLabel.Name = "TextLabel";
|
||||
this.TextLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// OKButton
|
||||
//
|
||||
resources.ApplyResources(this.OKButton, "OKButton");
|
||||
this.OKButton.ForeColor = System.Drawing.Color.White;
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.UseVisualStyleBackColor = true;
|
||||
this.OKButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.OKButton.UseSelectable = true;
|
||||
this.OKButton.Click += new System.EventHandler(this.OKBtn_Click);
|
||||
//
|
||||
// InputTextBox
|
||||
@@ -105,12 +107,22 @@
|
||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label1.ForeColor = System.Drawing.Color.White;
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// CreateTexturePack
|
||||
// createSkinsPckCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.createSkinsPckCheckBox, "createSkinsPckCheckBox");
|
||||
this.createSkinsPckCheckBox.Name = "createSkinsPckCheckBox";
|
||||
this.createSkinsPckCheckBox.Style = MetroFramework.MetroColorStyle.White;
|
||||
this.createSkinsPckCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.createSkinsPckCheckBox.UseSelectable = true;
|
||||
//
|
||||
// CreateTexturePackPrompt
|
||||
//
|
||||
this.AcceptButton = this.OKButton;
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.createSkinsPckCheckBox);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.resolutionComboBox);
|
||||
this.Controls.Add(this.InputTextBox);
|
||||
@@ -118,7 +130,7 @@
|
||||
this.Controls.Add(this.TextLabel);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CreateTexturePack";
|
||||
this.Name = "CreateTexturePackPrompt";
|
||||
this.Resizable = false;
|
||||
this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow;
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
@@ -129,10 +141,11 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
public System.Windows.Forms.Button OKButton;
|
||||
public System.Windows.Forms.Label TextLabel;
|
||||
public MetroFramework.Controls.MetroButton OKButton;
|
||||
public MetroFramework.Controls.MetroLabel TextLabel;
|
||||
private MetroFramework.Controls.MetroTextBox InputTextBox;
|
||||
private MetroFramework.Controls.MetroComboBox resolutionComboBox;
|
||||
public System.Windows.Forms.Label label1;
|
||||
}
|
||||
public MetroFramework.Controls.MetroLabel label1;
|
||||
private MetroFramework.Controls.MetroCheckBox createSkinsPckCheckBox;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ namespace PckStudio
|
||||
/// <summary>
|
||||
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
|
||||
/// </summary>
|
||||
public bool CreateSkinsPck => createSkinsPckCheckBox.Checked;
|
||||
public string PackName => InputTextBox.Text;
|
||||
public string PackRes => resolutionComboBox.Text;
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<value>19, 17</value>
|
||||
</data>
|
||||
<data name="TextLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>35, 13</value>
|
||||
<value>45, 19</value>
|
||||
</data>
|
||||
<data name="TextLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
@@ -141,20 +141,16 @@
|
||||
<value>TextLabel</value>
|
||||
</data>
|
||||
<data name=">>TextLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>TextLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>TextLabel.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="OKButton.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||
<value>Flat</value>
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="OKButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>101, 74</value>
|
||||
<value>166, 74</value>
|
||||
</data>
|
||||
<data name="OKButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
@@ -169,14 +165,15 @@
|
||||
<value>OKButton</value>
|
||||
</data>
|
||||
<data name=">>OKButton.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>OKButton.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>OKButton.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="resource.Image" type="System.Resources.ResXNullRef, System.Windows.Forms">
|
||||
<value />
|
||||
</data>
|
||||
@@ -193,7 +190,7 @@
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="InputTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>60, 12</value>
|
||||
<value>76, 13</value>
|
||||
</data>
|
||||
<data name="InputTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>165, 23</value>
|
||||
@@ -211,7 +208,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>InputTextBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="resolutionComboBox.ItemHeight" type="System.Int32, mscorlib">
|
||||
<value>23</value>
|
||||
@@ -244,7 +241,7 @@
|
||||
<value>x128</value>
|
||||
</data>
|
||||
<data name="resolutionComboBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>60, 39</value>
|
||||
<value>76, 40</value>
|
||||
</data>
|
||||
<data name="resolutionComboBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>165, 29</value>
|
||||
@@ -262,19 +259,16 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>resolutionComboBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 48</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>57, 13</value>
|
||||
<value>69, 19</value>
|
||||
</data>
|
||||
<data name="label1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
@@ -289,12 +283,39 @@
|
||||
<value>label1</value>
|
||||
</data>
|
||||
<data name=">>label1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>label1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="createSkinsPckCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="createSkinsPckCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>19, 77</value>
|
||||
</data>
|
||||
<data name="createSkinsPckCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>109, 15</value>
|
||||
</data>
|
||||
<data name="createSkinsPckCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="createSkinsPckCheckBox.Text" xml:space="preserve">
|
||||
<value>Create Skins.pck</value>
|
||||
</data>
|
||||
<data name=">>createSkinsPckCheckBox.Name" xml:space="preserve">
|
||||
<value>createSkinsPckCheckBox</value>
|
||||
</data>
|
||||
<data name=">>createSkinsPckCheckBox.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroCheckBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>createSkinsPckCheckBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>createSkinsPckCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
@@ -2816,7 +2837,7 @@
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>CreateTexturePack</value>
|
||||
<value>CreateTexturePackPrompt</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PckStudio.Forms.Utilities
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
partial class AppSettingsForm
|
||||
{
|
||||
@@ -10,7 +10,7 @@ using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
public partial class AppSettingsForm : MetroForm
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PckStudio
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
partial class CreditsForm
|
||||
{
|
||||
@@ -139,6 +139,7 @@
|
||||
this.buildLabel.Text = "Build Information";
|
||||
this.buildLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
this.buildLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buildLabel.WrapToLine = true;
|
||||
//
|
||||
// CreditsForm
|
||||
//
|
||||
@@ -3,7 +3,7 @@ using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Internal;
|
||||
|
||||
namespace PckStudio
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
public partial class CreditsForm : MetroForm
|
||||
{
|
||||
@@ -11,9 +11,9 @@ namespace PckStudio
|
||||
{
|
||||
InitializeComponent();
|
||||
#if BETA
|
||||
buildLabel.Text = $"[Beta] {ApplicationBuildInfo.BetaBuildVersion}@{CommitInfo.BranchName}";
|
||||
buildLabel.Text = $"Build Config: Beta\nBuild Version: {ApplicationBuildInfo.BetaBuildVersion}\n Branch: {CommitInfo.BranchName}";
|
||||
#elif DEBUG
|
||||
buildLabel.Text = $"[Debug] {CommitInfo.BranchName}@{CommitInfo.CommitHash}";
|
||||
buildLabel.Text = $"Build Config: Debug\nBranch: {CommitInfo.BranchName}\nCommit Id: {CommitInfo.CommitHash}";
|
||||
#else
|
||||
buildLabel.Text = string.Empty;
|
||||
#endif
|
||||
@@ -80,9 +80,8 @@ namespace PckStudio.Forms.Editor
|
||||
currentAnimation = new Animation(Array.Empty<Image>());
|
||||
if (animationFile is not null && animationFile.Size > 0)
|
||||
{
|
||||
using MemoryStream textureMem = new MemoryStream(animationFile.Data);
|
||||
var texture = new Bitmap(textureMem);
|
||||
var frameTextures = texture.CreateImageList(ImageLayoutDirection.Vertical);
|
||||
var texture = animationFile.GetTexture();
|
||||
var frameTextures = texture.Split(ImageLayoutDirection.Vertical);
|
||||
currentAnimation = animationFile.Properties.HasProperty("ANIM")
|
||||
? new Animation(frameTextures, animationFile.Properties.GetPropertyValue("ANIM"))
|
||||
: new Animation(frameTextures, string.Empty);
|
||||
@@ -163,12 +162,8 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
string anim = currentAnimation.BuildAnim();
|
||||
animationFile.Properties.SetProperty("ANIM", anim);
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var texture = currentAnimation.BuildTexture();
|
||||
texture.Save(stream, ImageFormat.Png);
|
||||
animationFile.SetData(stream.ToArray());
|
||||
}
|
||||
var texture = currentAnimation.BuildTexture();
|
||||
animationFile.SetData(texture, ImageFormat.Png);
|
||||
animationFile.Filename = $"res/textures/{currentAnimation.CategoryString}/{TileName}.png";
|
||||
DialogResult = DialogResult.OK;
|
||||
return;
|
||||
@@ -329,7 +324,7 @@ namespace PckStudio.Forms.Editor
|
||||
MessageBox.Show(textureFile + " was not found", "Texture not found");
|
||||
return;
|
||||
}
|
||||
var textures = Image.FromFile(textureFile).CreateImageList(ImageLayoutDirection.Vertical);
|
||||
var textures = Image.FromFile(textureFile).Split(ImageLayoutDirection.Vertical);
|
||||
var new_animation = new Animation(textures);
|
||||
new_animation.Category = currentAnimation.Category;
|
||||
try
|
||||
@@ -405,8 +400,8 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
var textureInfos = currentAnimation.Category switch
|
||||
{
|
||||
Animation.AnimationCategory.Blocks => AnimationResources.BlockTileInfos,
|
||||
Animation.AnimationCategory.Items => AnimationResources.ItemTileInfos,
|
||||
Animation.AnimationCategory.Blocks => Tiles.BlockTileInfos,
|
||||
Animation.AnimationCategory.Items => Tiles.ItemTileInfos,
|
||||
_ => throw new ArgumentOutOfRangeException(currentAnimation.Category.ToString())
|
||||
};
|
||||
|
||||
@@ -527,7 +522,7 @@ namespace PckStudio.Forms.Editor
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
Image img = Image.FromFile(ofd.FileName);
|
||||
var textures = img.CreateImageList(ImageLayoutDirection.Vertical);
|
||||
var textures = img.Split(ImageLayoutDirection.Vertical);
|
||||
currentAnimation = new Animation(textures, string.Empty);
|
||||
LoadAnimationTreeView();
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ using OMI.Formats.Pck;
|
||||
|
||||
using PckStudio.FileFormats;
|
||||
using PckStudio.IO.PckAudio;
|
||||
using PckStudio.Forms.Additional_Popups.Audio;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.API.Miles;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
// Audio Editor by MattNL and Miku-666
|
||||
|
||||
@@ -410,12 +410,7 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var writer = new PckAudioFileWriter(audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
audioPCK.SetData(stream.ToArray());
|
||||
}
|
||||
audioPCK.SetData(new PckAudioFileWriter(audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
@@ -433,14 +428,6 @@ namespace PckStudio.Forms.Editor
|
||||
"You can edit the credits for the PCK in the Credits editor! No more managing credit IDs!\n\n", "Help");
|
||||
}
|
||||
|
||||
private void creditsEditorToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var credits = audioFile.GetCreditsString();
|
||||
using (creditsEditor prompt = new creditsEditor(credits))
|
||||
if (prompt.ShowDialog() == DialogResult.OK)
|
||||
audioFile.SetCredits(prompt.Credits.Split('\n'));
|
||||
}
|
||||
|
||||
private void deleteUnusedBINKAsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("This will delete all unused BINKA songs in the Data directory. This cannot be undone. Are you sure you want to continue?", "Warning", MessageBoxButtons.YesNo);
|
||||
|
||||
@@ -13,6 +13,7 @@ using OMI.Workers.Behaviour;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -254,32 +255,27 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
behaviourFile = new BehaviourFile();
|
||||
foreach (TreeNode node in treeView1.Nodes)
|
||||
{
|
||||
behaviourFile = new BehaviourFile();
|
||||
|
||||
foreach (TreeNode node in treeView1.Nodes)
|
||||
if(node.Tag is BehaviourFile.RiderPositionOverride entry)
|
||||
{
|
||||
if(node.Tag is BehaviourFile.RiderPositionOverride entry)
|
||||
entry.overrides.Clear();
|
||||
Console.WriteLine();
|
||||
foreach (TreeNode overrideNode in node.Nodes)
|
||||
{
|
||||
entry.overrides.Clear();
|
||||
Console.WriteLine();
|
||||
foreach (TreeNode overrideNode in node.Nodes)
|
||||
if(overrideNode.Tag is BehaviourFile.RiderPositionOverride.PositionOverride overrideEntry)
|
||||
{
|
||||
if(overrideNode.Tag is BehaviourFile.RiderPositionOverride.PositionOverride overrideEntry)
|
||||
{
|
||||
entry.overrides.Add(overrideEntry);
|
||||
}
|
||||
entry.overrides.Add(overrideEntry);
|
||||
}
|
||||
|
||||
behaviourFile.entries.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
var writer = new BehavioursWriter(behaviourFile);
|
||||
writer.WriteToStream(stream);
|
||||
_file.SetData(stream.ToArray());
|
||||
behaviourFile.entries.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
_file.SetData(new BehavioursWriter(behaviourFile));
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using MetroFramework.Forms;
|
||||
using OMI.Formats.Color;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Color;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
@@ -240,12 +241,9 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
}
|
||||
}
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var writer = new COLFileWriter(colourfile);
|
||||
writer.WriteToStream(stream);
|
||||
_file.SetData(stream.ToArray());
|
||||
}
|
||||
|
||||
_file.SetData(new COLFileWriter(colourfile));
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ using OMI.Formats.Pck;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.ToolboxItems;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -266,12 +267,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
try
|
||||
{
|
||||
var writer = new GameRuleFileWriter(
|
||||
_file,
|
||||
compressionLevel,
|
||||
compressionType);
|
||||
writer.WriteToStream(stream);
|
||||
_pckfile?.SetData(stream.ToArray());
|
||||
_pckfile?.SetData(new GameRuleFileWriter(_file, compressionLevel, compressionType));
|
||||
DialogResult = DialogResult.OK;
|
||||
MessageBox.Show("Saved!");
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using OMI.Formats.Languages;
|
||||
using OMI.Workers.Language;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -144,12 +145,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var writer = new LOCFileWriter(currentLoc, 2);
|
||||
writer.WriteToStream(ms);
|
||||
_file.SetData(ms.ToArray());
|
||||
}
|
||||
_file.SetData(new LOCFileWriter(currentLoc, 2));
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ using OMI.Formats.Pck;
|
||||
using OMI.Formats.Material;
|
||||
using OMI.Workers.Material;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -114,22 +115,18 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
materialFile = new MaterialContainer();
|
||||
|
||||
foreach (TreeNode node in treeView1.Nodes)
|
||||
{
|
||||
materialFile = new MaterialContainer();
|
||||
|
||||
foreach (TreeNode node in treeView1.Nodes)
|
||||
if(node.Tag is MaterialContainer.Material entry)
|
||||
{
|
||||
if(node.Tag is MaterialContainer.Material entry)
|
||||
{
|
||||
materialFile.Add(entry);
|
||||
}
|
||||
materialFile.Add(entry);
|
||||
}
|
||||
|
||||
var writer = new MaterialFileWriter(materialFile);
|
||||
writer.WriteToStream(stream);
|
||||
_file.SetData(stream.ToArray());
|
||||
}
|
||||
|
||||
_file.SetData(new MaterialFileWriter(materialFile));
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,15 +90,15 @@ namespace PckStudio.Forms.Editor
|
||||
_columnCount = atlas.Height / areaSize.Height;
|
||||
(var tileInfos, _atlasType) = Path.GetFileNameWithoutExtension(path) switch
|
||||
{
|
||||
"terrain" => (AnimationResources.BlockTileInfos, "blocks"),
|
||||
"items" => (AnimationResources.ItemTileInfos, "items"),
|
||||
"terrain" => (Tiles.BlockTileInfos, "blocks"),
|
||||
"items" => (Tiles.ItemTileInfos, "items"),
|
||||
_ => (null, null),
|
||||
};
|
||||
originalPictureBox.Image = atlas;
|
||||
var images = atlas.CreateImageList(_areaSize, _imageLayout);
|
||||
var images = atlas.Split(_areaSize, _imageLayout);
|
||||
|
||||
var tiles = images.enumerate().Select(
|
||||
v => new AtlasTile(v.index, GetAtlasArea(v.index, _rowCount, _columnCount, _areaSize, _imageLayout), tileInfos.IndexInRange(v.index) ? tileInfos[v.index] : null, v.type)
|
||||
p => new AtlasTile(p.index, GetAtlasArea(p.index, _rowCount, _columnCount, _areaSize, _imageLayout), tileInfos.IndexInRange(p.index) ? tileInfos[p.index] : null, p.value)
|
||||
);
|
||||
_tiles = new List<AtlasTile>(tiles);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
using var ms = new MemoryStream(animationFile.Data);
|
||||
var img = Image.FromStream(ms);
|
||||
var textures = img.CreateImageList(ImageLayoutDirection.Vertical);
|
||||
var textures = img.Split(ImageLayoutDirection.Vertical);
|
||||
var animation = new Internal.Animation(textures, animationFile.Properties.GetPropertyValue("ANIM"));
|
||||
selectTilePictureBox.Start(animation);
|
||||
return;
|
||||
|
||||
@@ -38,22 +38,21 @@
|
||||
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuCape = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.replaceToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buttonDone = new System.Windows.Forms.Button();
|
||||
this.buttonModelGen = new System.Windows.Forms.Button();
|
||||
this.buttonCape = new System.Windows.Forms.Button();
|
||||
this.buttonSkin = new System.Windows.Forms.Button();
|
||||
this.buttonDone = new MetroFramework.Controls.MetroButton();
|
||||
this.buttonModelGen = new MetroFramework.Controls.MetroButton();
|
||||
this.buttonCape = new MetroFramework.Controls.MetroButton();
|
||||
this.buttonSkin = new MetroFramework.Controls.MetroButton();
|
||||
this.displayBox = new System.Windows.Forms.PictureBox();
|
||||
this.radioAUTO = new System.Windows.Forms.RadioButton();
|
||||
this.radioLOCAL = new System.Windows.Forms.RadioButton();
|
||||
this.labelSelectTexture = new System.Windows.Forms.Label();
|
||||
this.radioSERVER = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonAuto = new MetroFramework.Controls.MetroRadioButton();
|
||||
this.radioButtonManual = new MetroFramework.Controls.MetroRadioButton();
|
||||
this.textSkinID = new MetroFramework.Controls.MetroTextBox();
|
||||
this.textSkinName = new MetroFramework.Controls.MetroTextBox();
|
||||
this.textThemeName = new MetroFramework.Controls.MetroTextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.buttonAnimGen = new System.Windows.Forms.Button();
|
||||
this.labelSelectTexture = new MetroFramework.Controls.MetroLabel();
|
||||
this.capeLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.buttonAnimGen = new MetroFramework.Controls.MetroButton();
|
||||
this.capePictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
this.skinPictureBoxTexture = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
this.skinPictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
label3 = new System.Windows.Forms.Label();
|
||||
label2 = new System.Windows.Forms.Label();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
@@ -61,7 +60,7 @@
|
||||
this.contextMenuCape.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.displayBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.capePictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.skinPictureBoxTexture)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.skinPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label3
|
||||
@@ -111,36 +110,39 @@
|
||||
//
|
||||
resources.ApplyResources(this.replaceToolStripMenuItem1, "replaceToolStripMenuItem1");
|
||||
this.replaceToolStripMenuItem1.Name = "replaceToolStripMenuItem1";
|
||||
this.replaceToolStripMenuItem1.Click += new System.EventHandler(this.capePictureBox_Click);
|
||||
//
|
||||
// buttonDone
|
||||
//
|
||||
resources.ApplyResources(this.buttonDone, "buttonDone");
|
||||
this.buttonDone.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonDone.Name = "buttonDone";
|
||||
this.buttonDone.UseVisualStyleBackColor = true;
|
||||
this.buttonDone.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonDone.UseSelectable = true;
|
||||
this.buttonDone.Click += new System.EventHandler(this.CreateButton_Click);
|
||||
//
|
||||
// buttonModelGen
|
||||
//
|
||||
resources.ApplyResources(this.buttonModelGen, "buttonModelGen");
|
||||
this.buttonModelGen.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonModelGen.Name = "buttonModelGen";
|
||||
this.buttonModelGen.UseVisualStyleBackColor = true;
|
||||
this.buttonModelGen.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonModelGen.UseSelectable = true;
|
||||
this.buttonModelGen.Click += new System.EventHandler(this.CreateCustomModel_Click);
|
||||
//
|
||||
// buttonCape
|
||||
//
|
||||
this.buttonCape.BackgroundImage = global::PckStudio.Properties.Resources.HamburgerMenuIcon;
|
||||
resources.ApplyResources(this.buttonCape, "buttonCape");
|
||||
this.buttonCape.Name = "buttonCape";
|
||||
this.buttonCape.UseVisualStyleBackColor = true;
|
||||
this.buttonCape.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonCape.UseSelectable = true;
|
||||
this.buttonCape.Click += new System.EventHandler(this.buttonCape_Click);
|
||||
//
|
||||
// buttonSkin
|
||||
//
|
||||
this.buttonSkin.BackgroundImage = global::PckStudio.Properties.Resources.HamburgerMenuIcon;
|
||||
resources.ApplyResources(this.buttonSkin, "buttonSkin");
|
||||
this.buttonSkin.Name = "buttonSkin";
|
||||
this.buttonSkin.UseVisualStyleBackColor = true;
|
||||
this.buttonSkin.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonSkin.UseSelectable = true;
|
||||
this.buttonSkin.Click += new System.EventHandler(this.buttonSkin_Click);
|
||||
//
|
||||
// displayBox
|
||||
@@ -150,37 +152,25 @@
|
||||
this.displayBox.Name = "displayBox";
|
||||
this.displayBox.TabStop = false;
|
||||
//
|
||||
// radioAUTO
|
||||
// radioButtonAuto
|
||||
//
|
||||
resources.ApplyResources(this.radioAUTO, "radioAUTO");
|
||||
this.radioAUTO.ForeColor = System.Drawing.Color.White;
|
||||
this.radioAUTO.Name = "radioAUTO";
|
||||
this.radioAUTO.UseVisualStyleBackColor = true;
|
||||
this.radioAUTO.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
|
||||
resources.ApplyResources(this.radioButtonAuto, "radioButtonAuto");
|
||||
this.radioButtonAuto.Name = "radioButtonAuto";
|
||||
this.radioButtonAuto.Style = MetroFramework.MetroColorStyle.White;
|
||||
this.radioButtonAuto.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.radioButtonAuto.UseSelectable = true;
|
||||
this.radioButtonAuto.CheckedChanged += new System.EventHandler(this.radioButtonAuto_CheckedChanged);
|
||||
//
|
||||
// radioLOCAL
|
||||
// radioButtonManual
|
||||
//
|
||||
resources.ApplyResources(this.radioLOCAL, "radioLOCAL");
|
||||
this.radioLOCAL.Checked = true;
|
||||
this.radioLOCAL.ForeColor = System.Drawing.Color.White;
|
||||
this.radioLOCAL.Name = "radioLOCAL";
|
||||
this.radioLOCAL.TabStop = true;
|
||||
this.radioLOCAL.UseVisualStyleBackColor = true;
|
||||
this.radioLOCAL.CheckedChanged += new System.EventHandler(this.radioLOCAL_CheckedChanged);
|
||||
//
|
||||
// labelSelectTexture
|
||||
//
|
||||
resources.ApplyResources(this.labelSelectTexture, "labelSelectTexture");
|
||||
this.labelSelectTexture.ForeColor = System.Drawing.Color.White;
|
||||
this.labelSelectTexture.Name = "labelSelectTexture";
|
||||
//
|
||||
// radioSERVER
|
||||
//
|
||||
resources.ApplyResources(this.radioSERVER, "radioSERVER");
|
||||
this.radioSERVER.ForeColor = System.Drawing.Color.White;
|
||||
this.radioSERVER.Name = "radioSERVER";
|
||||
this.radioSERVER.UseVisualStyleBackColor = true;
|
||||
this.radioSERVER.CheckedChanged += new System.EventHandler(this.radioSERVER_CheckedChanged);
|
||||
resources.ApplyResources(this.radioButtonManual, "radioButtonManual");
|
||||
this.radioButtonManual.Checked = true;
|
||||
this.radioButtonManual.Name = "radioButtonManual";
|
||||
this.radioButtonManual.Style = MetroFramework.MetroColorStyle.White;
|
||||
this.radioButtonManual.TabStop = true;
|
||||
this.radioButtonManual.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.radioButtonManual.UseSelectable = true;
|
||||
this.radioButtonManual.CheckedChanged += new System.EventHandler(this.radioButtonManual_CheckedChanged);
|
||||
//
|
||||
// textSkinID
|
||||
//
|
||||
@@ -200,7 +190,7 @@
|
||||
this.textSkinID.ForeColor = System.Drawing.Color.White;
|
||||
this.textSkinID.Lines = new string[0];
|
||||
resources.ApplyResources(this.textSkinID, "textSkinID");
|
||||
this.textSkinID.MaxLength = 32767;
|
||||
this.textSkinID.MaxLength = 8;
|
||||
this.textSkinID.Name = "textSkinID";
|
||||
this.textSkinID.PasswordChar = '\0';
|
||||
this.textSkinID.ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||
@@ -276,72 +266,77 @@
|
||||
this.textThemeName.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
|
||||
this.textThemeName.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
|
||||
//
|
||||
// label4
|
||||
// labelSelectTexture
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.ForeColor = System.Drawing.Color.White;
|
||||
this.label4.Name = "label4";
|
||||
resources.ApplyResources(this.labelSelectTexture, "labelSelectTexture");
|
||||
this.labelSelectTexture.Name = "labelSelectTexture";
|
||||
this.labelSelectTexture.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// capeLabel
|
||||
//
|
||||
resources.ApplyResources(this.capeLabel, "capeLabel");
|
||||
this.capeLabel.Name = "capeLabel";
|
||||
this.capeLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// buttonAnimGen
|
||||
//
|
||||
resources.ApplyResources(this.buttonAnimGen, "buttonAnimGen");
|
||||
this.buttonAnimGen.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonAnimGen.Name = "buttonAnimGen";
|
||||
this.buttonAnimGen.UseVisualStyleBackColor = true;
|
||||
this.buttonAnimGen.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonAnimGen.UseSelectable = true;
|
||||
this.buttonAnimGen.Click += new System.EventHandler(this.buttonAnimGen_Click);
|
||||
//
|
||||
// capePictureBox
|
||||
//
|
||||
resources.ApplyResources(this.capePictureBox, "capePictureBox");
|
||||
this.capePictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.capePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.capePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.capePictureBox.Name = "capePictureBox";
|
||||
this.capePictureBox.TabStop = false;
|
||||
this.capePictureBox.Click += new System.EventHandler(this.capePictureBox_Click);
|
||||
this.capePictureBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.capePictureBox_MouseClick);
|
||||
//
|
||||
// skinPictureBoxTexture
|
||||
// skinPictureBox
|
||||
//
|
||||
resources.ApplyResources(this.skinPictureBoxTexture, "skinPictureBoxTexture");
|
||||
this.skinPictureBoxTexture.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.skinPictureBoxTexture.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.skinPictureBoxTexture.Name = "skinPictureBoxTexture";
|
||||
this.skinPictureBoxTexture.TabStop = false;
|
||||
this.skinPictureBoxTexture.Click += new System.EventHandler(this.skinPictureBoxTexture_Click);
|
||||
resources.ApplyResources(this.skinPictureBox, "skinPictureBox");
|
||||
this.skinPictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.skinPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.skinPictureBox.Name = "skinPictureBox";
|
||||
this.skinPictureBox.TabStop = false;
|
||||
this.skinPictureBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.skinPictureBox_MouseClick);
|
||||
//
|
||||
// addNewSkin
|
||||
// AddNewSkin
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.buttonAnimGen);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.capeLabel);
|
||||
this.Controls.Add(this.textThemeName);
|
||||
this.Controls.Add(this.textSkinName);
|
||||
this.Controls.Add(this.textSkinID);
|
||||
this.Controls.Add(this.radioSERVER);
|
||||
this.Controls.Add(this.labelSelectTexture);
|
||||
this.Controls.Add(this.radioLOCAL);
|
||||
this.Controls.Add(this.radioAUTO);
|
||||
this.Controls.Add(this.radioButtonManual);
|
||||
this.Controls.Add(this.radioButtonAuto);
|
||||
this.Controls.Add(this.buttonDone);
|
||||
this.Controls.Add(this.buttonModelGen);
|
||||
this.Controls.Add(this.buttonCape);
|
||||
this.Controls.Add(this.buttonSkin);
|
||||
this.Controls.Add(this.capePictureBox);
|
||||
this.Controls.Add(this.skinPictureBoxTexture);
|
||||
this.Controls.Add(this.skinPictureBox);
|
||||
this.Controls.Add(this.displayBox);
|
||||
this.Controls.Add(label3);
|
||||
this.Controls.Add(label2);
|
||||
this.Controls.Add(label1);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "addNewSkin";
|
||||
this.Name = "AddNewSkin";
|
||||
this.Resizable = false;
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.Load += new System.EventHandler(this.addnewskin_Load);
|
||||
this.Load += new System.EventHandler(this.AddNewSkin_Load);
|
||||
this.contextMenuSkin.ResumeLayout(false);
|
||||
this.contextMenuCape.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.displayBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.capePictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.skinPictureBoxTexture)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.skinPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -353,21 +348,20 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuCape;
|
||||
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem1;
|
||||
private System.Windows.Forms.Button buttonDone;
|
||||
private System.Windows.Forms.Button buttonModelGen;
|
||||
private System.Windows.Forms.Button buttonCape;
|
||||
private System.Windows.Forms.Button buttonSkin;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox capePictureBox;
|
||||
private MetroFramework.Controls.MetroButton buttonDone;
|
||||
private MetroFramework.Controls.MetroButton buttonModelGen;
|
||||
private MetroFramework.Controls.MetroButton buttonCape;
|
||||
private MetroFramework.Controls.MetroButton buttonSkin;
|
||||
private System.Windows.Forms.PictureBox displayBox;
|
||||
private System.Windows.Forms.RadioButton radioAUTO;
|
||||
private System.Windows.Forms.RadioButton radioLOCAL;
|
||||
private System.Windows.Forms.RadioButton radioSERVER;
|
||||
private MetroFramework.Controls.MetroRadioButton radioButtonAuto;
|
||||
private MetroFramework.Controls.MetroRadioButton radioButtonManual;
|
||||
private MetroFramework.Controls.MetroTextBox textSkinID;
|
||||
private MetroFramework.Controls.MetroTextBox textSkinName;
|
||||
private MetroFramework.Controls.MetroTextBox textThemeName;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox skinPictureBoxTexture;
|
||||
private System.Windows.Forms.Button buttonAnimGen;
|
||||
private System.Windows.Forms.Label labelSelectTexture;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox skinPictureBox;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox capePictureBox;
|
||||
private MetroFramework.Controls.MetroButton buttonAnimGen;
|
||||
private MetroFramework.Controls.MetroLabel labelSelectTexture;
|
||||
private MetroFramework.Controls.MetroLabel capeLabel;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using PckStudio.Forms.Editor;
|
||||
using PckStudio.IO._3DST;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Extensions;
|
||||
|
||||
namespace PckStudio.Popups
|
||||
{
|
||||
@@ -18,12 +19,13 @@ namespace PckStudio.Popups
|
||||
{
|
||||
public PckFile.FileData SkinFile => skin;
|
||||
public PckFile.FileData CapeFile => cape;
|
||||
public bool HasCape { get; private set; } = false;
|
||||
public bool HasCape => cape is not null;
|
||||
|
||||
private LOCFile currentLoc;
|
||||
private PckFile.FileData skin = new PckFile.FileData("dlcskinXYXYXYXY", PckFile.FileData.FileType.SkinFile);
|
||||
private PckFile.FileData cape = new PckFile.FileData("dlccapeXYXYXYXY", PckFile.FileData.FileType.CapeFile);
|
||||
private PckFile.FileData cape;
|
||||
private SkinANIM anim = new SkinANIM();
|
||||
private Random rng = new Random();
|
||||
|
||||
private eSkinType skinType;
|
||||
|
||||
@@ -45,8 +47,7 @@ namespace PckStudio.Popups
|
||||
|
||||
private void CheckImage(Image img)
|
||||
{
|
||||
//Checks image dimensions and sets things accordingly
|
||||
switch (img.Height) // 64x64
|
||||
switch (img.Height)
|
||||
{
|
||||
case 64:
|
||||
anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64, true);
|
||||
@@ -64,7 +65,7 @@ namespace PckStudio.Popups
|
||||
anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64, true);
|
||||
MessageBox.Show("64x64 HD Skin Detected");
|
||||
skinType = eSkinType._64x64HD;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
if (img.Height == img.Width / 2)
|
||||
@@ -72,7 +73,7 @@ namespace PckStudio.Popups
|
||||
anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64 | SkinAnimFlag.SLIM_MODEL, false);
|
||||
MessageBox.Show("64x32 HD Skin Detected");
|
||||
skinType = eSkinType._64x32HD;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
MessageBox.Show("Not a Valid Skin File");
|
||||
@@ -80,17 +81,22 @@ namespace PckStudio.Popups
|
||||
return;
|
||||
}
|
||||
|
||||
skinPictureBoxTexture.Image = img;
|
||||
skinPictureBox.Image = img;
|
||||
capePictureBox.Visible = true;
|
||||
buttonCape.Visible = true;
|
||||
capeLabel.Visible = true;
|
||||
buttonDone.Enabled = true;
|
||||
buttonAnimGen.Enabled = true;
|
||||
labelSelectTexture.Visible = false;
|
||||
}
|
||||
|
||||
private void DrawModel()
|
||||
{
|
||||
bool isSlim = anim.GetFlag(SkinAnimFlag.SLIM_MODEL);
|
||||
Pen outlineColor = Pens.Black;
|
||||
Pen outlineColor = Pens.LightGray;
|
||||
Brush fillColor = Brushes.Gray;
|
||||
using (Graphics g = Graphics.FromImage(displayBox.Image))
|
||||
Image previewTexture = new Bitmap(displayBox.Width, displayBox.Height);
|
||||
using (Graphics g = Graphics.FromImage(previewTexture))
|
||||
{
|
||||
if(!anim.GetFlag(SkinAnimFlag.HEAD_DISABLED))
|
||||
{
|
||||
@@ -129,22 +135,22 @@ namespace PckStudio.Popups
|
||||
g.FillRectangle(fillColor, 91, 116, 19, 59);
|
||||
}
|
||||
}
|
||||
displayBox.Invalidate();
|
||||
displayBox.Image = previewTexture;
|
||||
}
|
||||
|
||||
private void addnewskin_Load(object sender, EventArgs e)
|
||||
private void AddNewSkin_Load(object sender, EventArgs e)
|
||||
{
|
||||
DrawModel();
|
||||
}
|
||||
|
||||
private void buttonSkin_Click(object sender, EventArgs e)
|
||||
{
|
||||
contextMenuSkin.Show(ActiveForm.Location.X + buttonSkin.Location.X + 2, ActiveForm.Location.Y + buttonSkin.Location.Y + 23);
|
||||
contextMenuSkin.Show(Location.X + buttonSkin.Location.X + 2, Location.Y + buttonSkin.Location.Y + buttonSkin.Size.Height);
|
||||
}
|
||||
|
||||
private void buttonCape_Click(object sender, EventArgs e)
|
||||
{
|
||||
contextMenuCape.Show(ActiveForm.Location.X + buttonCape.Location.X + 2, ActiveForm.Location.Y + buttonCape.Location.Y + 23);
|
||||
contextMenuCape.Show(Location.X + buttonCape.Location.X + 2, Location.Y + buttonCape.Location.Y + buttonCape.Size.Height);
|
||||
}
|
||||
|
||||
private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -156,28 +162,73 @@ namespace PckStudio.Popups
|
||||
}
|
||||
}
|
||||
|
||||
private void capePictureBox_Click(object sender, EventArgs e)
|
||||
private void skinPictureBox_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left && e.Button != MouseButtons.Right)
|
||||
return;
|
||||
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
contextMenuSkin.Show(
|
||||
x: Location.X + skinPictureBox.Location.X,
|
||||
y: Location.Y + skinPictureBox.Location.Y + skinPictureBox.Size.Height
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "PNG Files|*.png";
|
||||
ofd.Filter = "Skin File|*.png|3DS Texture|*.3dst";
|
||||
ofd.Title = "Select a Skin Texture File";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (ofd.FileName.EndsWith(".3dst"))
|
||||
{
|
||||
using (var fs = File.OpenRead(ofd.FileName))
|
||||
{
|
||||
var reader = new _3DSTextureReader();
|
||||
CheckImage(reader.FromStream(fs));
|
||||
}
|
||||
textSkinName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
|
||||
return;
|
||||
}
|
||||
CheckImage(Image.FromFile(ofd.FileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void capePictureBox_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left && e.Button != MouseButtons.Right)
|
||||
return;
|
||||
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
contextMenuCape.Show(
|
||||
x: Location.X + capePictureBox.Location.X,
|
||||
y: Location.Y + capePictureBox.Location.Y + capePictureBox.Size.Height
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
using (var ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "Cape File|*.png";
|
||||
ofd.Title = "Select a PNG File";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var img = Image.FromFile(ofd.FileName);
|
||||
if (img.Width == img.Height * 2)
|
||||
{
|
||||
HasCape = true;
|
||||
capePictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
capePictureBox.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
capePictureBox.Image = Image.FromFile(ofd.FileName);
|
||||
cape.SetData(File.ReadAllBytes(ofd.FileName));
|
||||
contextMenuCape.Items[0].Text = "Replace";
|
||||
}
|
||||
else
|
||||
if (img.RawFormat != ImageFormat.Png && img.Width != img.Height * 2)
|
||||
{
|
||||
MessageBox.Show("Not a Valid Cape File");
|
||||
return;
|
||||
}
|
||||
capePictureBox.Image = Image.FromFile(ofd.FileName);
|
||||
cape ??= new PckFile.FileData("dlccapeXYXYXYXY", PckFile.FileData.FileType.CapeFile);
|
||||
cape.SetData(File.ReadAllBytes(ofd.FileName));
|
||||
contextMenuCape.Items[0].Text = "Replace";
|
||||
capeLabel.Visible = false;
|
||||
contextMenuCape.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -207,33 +258,10 @@ namespace PckStudio.Popups
|
||||
|
||||
if (HasCape)
|
||||
{
|
||||
try
|
||||
{
|
||||
cape.Filename = $"dlccape{skinId}.png";
|
||||
skin.Properties.Add("CAPEPATH", cape.Filename);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MessageBox.Show("Cape could not be added.");
|
||||
}
|
||||
cape.Filename = $"dlccape{skinId}.png";
|
||||
skin.Properties.Add("CAPEPATH", cape.Filename);
|
||||
}
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
skinPictureBoxTexture.Image.Save(stream, ImageFormat.Png);
|
||||
skin.SetData(stream.ToArray());
|
||||
}
|
||||
|
||||
//if (generatedModel != null)
|
||||
//{
|
||||
// foreach (var item in generatedModel)
|
||||
// {
|
||||
// skin.properties.Add(item);
|
||||
// }
|
||||
|
||||
// generatedModel.Clear();
|
||||
//}
|
||||
|
||||
|
||||
skin.SetData(skinPictureBox.Image, ImageFormat.Png);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
@@ -250,11 +278,9 @@ namespace PckStudio.Popups
|
||||
if (MessageBox.Show("Create your own custom skin model?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
using var ms = new MemoryStream();
|
||||
Resources.classic_template.Save(ms, ImageFormat.Png);
|
||||
skin.SetData(ms.ToArray());
|
||||
skin.SetData(Resources.classic_template, ImageFormat.Png);
|
||||
|
||||
generateModel generate = new generateModel(skin);
|
||||
using generateModel generate = new generateModel(skin);
|
||||
|
||||
if (generate.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@@ -263,63 +289,25 @@ namespace PckStudio.Popups
|
||||
labelSelectTexture.Visible = false;
|
||||
if (skinType != eSkinType._64x64 && skinType != eSkinType._64x64HD)
|
||||
{
|
||||
buttonSkin.Location = new Point(buttonSkin.Location.X - skinPictureBoxTexture.Width, buttonSkin.Location.Y);
|
||||
buttonSkin.Location = new Point(buttonSkin.Location.X - skinPictureBox.Width, buttonSkin.Location.Y);
|
||||
skinType = eSkinType._64x64;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void radioButton1_CheckedChanged(object sender, EventArgs e)
|
||||
private void radioButtonAuto_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (radioAUTO.Checked)
|
||||
if (radioButtonAuto.Checked)
|
||||
{
|
||||
try
|
||||
{
|
||||
Random random = new Random();
|
||||
int num = random.Next(100000, 99999999);
|
||||
textSkinID.Text = num.ToString();
|
||||
textSkinID.Enabled = false;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
int num = rng.Next(100000, 99999999);
|
||||
textSkinID.Text = num.ToString();
|
||||
textSkinID.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void radioLOCAL_CheckedChanged(object sender, EventArgs e)
|
||||
private void radioButtonManual_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
textSkinID.Enabled = radioLOCAL.Checked;
|
||||
}
|
||||
|
||||
private void skinPictureBoxTexture_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "PNG Files|*.png|3DS Texture|*.3dst";
|
||||
ofd.Title = "Select a Skin Texture File";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (ofd.FileName.EndsWith(".3dst"))
|
||||
{
|
||||
using (var fs = File.OpenRead(ofd.FileName))
|
||||
{
|
||||
var reader = new _3DSTextureReader();
|
||||
CheckImage(reader.FromStream(fs));
|
||||
textSkinName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
CheckImage(Image.FromFile(ofd.FileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void radioSERVER_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (radioSERVER.Checked)
|
||||
{
|
||||
}
|
||||
textSkinID.Enabled = radioButtonManual.Checked;
|
||||
}
|
||||
|
||||
private void buttonAnimGen_Click(object sender, EventArgs e)
|
||||
@@ -331,5 +319,5 @@ namespace PckStudio.Popups
|
||||
DrawModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label3.ZOrder" xml:space="preserve">
|
||||
<value>18</value>
|
||||
<value>17</value>
|
||||
</data>
|
||||
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
@@ -184,7 +184,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label2.ZOrder" xml:space="preserve">
|
||||
<value>19</value>
|
||||
<value>18</value>
|
||||
</data>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
@@ -217,7 +217,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>20</value>
|
||||
<value>19</value>
|
||||
</data>
|
||||
<data name="textTheme.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>102, 78</value>
|
||||
@@ -291,12 +291,6 @@
|
||||
<data name="buttonDone.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="buttonDone.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||
<value>Flat</value>
|
||||
</data>
|
||||
<data name="buttonDone.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="buttonDone.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>394, 260</value>
|
||||
</data>
|
||||
@@ -313,19 +307,13 @@
|
||||
<value>buttonDone</value>
|
||||
</data>
|
||||
<data name=">>buttonDone.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>buttonDone.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonDone.ZOrder" xml:space="preserve">
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="buttonModelGen.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||
<value>Flat</value>
|
||||
</data>
|
||||
<data name="buttonModelGen.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="buttonModelGen.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>14, 259</value>
|
||||
@@ -343,24 +331,16 @@
|
||||
<value>buttonModelGen</value>
|
||||
</data>
|
||||
<data name=">>buttonModelGen.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>buttonModelGen.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonModelGen.ZOrder" xml:space="preserve">
|
||||
<value>12</value>
|
||||
<value>11</value>
|
||||
</data>
|
||||
<data name="buttonCape.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAAA2SURBVDhPY/j/
|
||||
/z8DEIAIkjFY7/AxgCxAVRegSBCLB5cBZAGqugBFglg8iAygBGMVJB7/ZwAAaXFatLhxTd8AAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonCape.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
<data name="buttonCape.BackgroundImageLayout" type="System.Windows.Forms.ImageLayout, System.Windows.Forms">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name="buttonCape.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>443, 212</value>
|
||||
@@ -371,28 +351,23 @@
|
||||
<data name="buttonCape.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>111</value>
|
||||
</data>
|
||||
<data name="buttonCape.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>buttonCape.Name" xml:space="preserve">
|
||||
<value>buttonCape</value>
|
||||
</data>
|
||||
<data name=">>buttonCape.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>buttonCape.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonCape.ZOrder" xml:space="preserve">
|
||||
<value>13</value>
|
||||
<value>12</value>
|
||||
</data>
|
||||
<data name="buttonSkin.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAAA2SURBVDhPY/j/
|
||||
/z8DEIAIkjFY7/AxgCxAVRegSBCLB5cBZAGqugBFglg8iAygBGMVJB7/ZwAAaXFatLhxTd8AAAAASUVO
|
||||
RK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="buttonSkin.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
<data name="buttonSkin.BackgroundImageLayout" type="System.Windows.Forms.ImageLayout, System.Windows.Forms">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name="buttonSkin.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>351, 212</value>
|
||||
@@ -407,13 +382,13 @@
|
||||
<value>buttonSkin</value>
|
||||
</data>
|
||||
<data name=">>buttonSkin.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>buttonSkin.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonSkin.ZOrder" xml:space="preserve">
|
||||
<value>14</value>
|
||||
<value>13</value>
|
||||
</data>
|
||||
<data name="displayBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
@@ -437,140 +412,62 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>displayBox.ZOrder" xml:space="preserve">
|
||||
<value>17</value>
|
||||
<value>16</value>
|
||||
</data>
|
||||
<data name="radioAUTO.AutoSize" type="System.Boolean, mscorlib">
|
||||
<data name="radioButtonAuto.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="radioAUTO.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="radioAUTO.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="radioButtonAuto.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>388, 51</value>
|
||||
</data>
|
||||
<data name="radioAUTO.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>81, 17</value>
|
||||
<data name="radioButtonAuto.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 15</value>
|
||||
</data>
|
||||
<data name="radioAUTO.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="radioButtonAuto.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>117</value>
|
||||
</data>
|
||||
<data name="radioAUTO.Text" xml:space="preserve">
|
||||
<value>AUTO-GEN</value>
|
||||
<data name="radioButtonAuto.Text" xml:space="preserve">
|
||||
<value>Auto-Gen</value>
|
||||
</data>
|
||||
<data name=">>radioAUTO.Name" xml:space="preserve">
|
||||
<value>radioAUTO</value>
|
||||
<data name=">>radioButtonAuto.Name" xml:space="preserve">
|
||||
<value>radioButtonAuto</value>
|
||||
</data>
|
||||
<data name=">>radioAUTO.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<data name=">>radioButtonAuto.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroRadioButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>radioAUTO.Parent" xml:space="preserve">
|
||||
<data name=">>radioButtonAuto.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>radioAUTO.ZOrder" xml:space="preserve">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="radioLOCAL.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="radioLOCAL.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="radioLOCAL.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>388, 71</value>
|
||||
</data>
|
||||
<data name="radioLOCAL.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>59, 17</value>
|
||||
</data>
|
||||
<data name="radioLOCAL.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>118</value>
|
||||
</data>
|
||||
<data name="radioLOCAL.Text" xml:space="preserve">
|
||||
<value>LOCAL</value>
|
||||
</data>
|
||||
<data name=">>radioLOCAL.Name" xml:space="preserve">
|
||||
<value>radioLOCAL</value>
|
||||
</data>
|
||||
<data name=">>radioLOCAL.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>radioLOCAL.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>radioLOCAL.ZOrder" xml:space="preserve">
|
||||
<data name=">>radioButtonAuto.ZOrder" xml:space="preserve">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.AutoSize" type="System.Boolean, mscorlib">
|
||||
<data name="radioButtonManual.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
<data name="radioButtonManual.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>388, 71</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Microsoft Sans Serif, 8.25pt, style=Underline</value>
|
||||
<data name="radioButtonManual.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>63, 15</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
<data name="radioButtonManual.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>118</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>308, 186</value>
|
||||
<data name="radioButtonManual.Text" xml:space="preserve">
|
||||
<value>Manual</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>50, 13</value>
|
||||
<data name=">>radioButtonManual.Name" xml:space="preserve">
|
||||
<value>radioButtonManual</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>119</value>
|
||||
<data name=">>radioButtonManual.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroRadioButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name="labelSelectTexture.Text" xml:space="preserve">
|
||||
<value>Add Skin</value>
|
||||
</data>
|
||||
<data name=">>labelSelectTexture.Name" xml:space="preserve">
|
||||
<value>labelSelectTexture</value>
|
||||
</data>
|
||||
<data name=">>labelSelectTexture.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>labelSelectTexture.Parent" xml:space="preserve">
|
||||
<data name=">>radioButtonManual.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>labelSelectTexture.ZOrder" xml:space="preserve">
|
||||
<data name=">>radioButtonManual.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="radioSERVER.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="radioSERVER.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="radioSERVER.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="radioSERVER.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>388, 28</value>
|
||||
</data>
|
||||
<data name="radioSERVER.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>69, 17</value>
|
||||
</data>
|
||||
<data name="radioSERVER.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>120</value>
|
||||
</data>
|
||||
<data name="radioSERVER.Text" xml:space="preserve">
|
||||
<value>SERVER</value>
|
||||
</data>
|
||||
<data name="radioSERVER.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>radioSERVER.Name" xml:space="preserve">
|
||||
<value>radioSERVER</value>
|
||||
</data>
|
||||
<data name=">>radioSERVER.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>radioSERVER.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>radioSERVER.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="resource.Image" type="System.Resources.ResXNullRef, System.Windows.Forms">
|
||||
<value />
|
||||
</data>
|
||||
@@ -688,47 +585,77 @@
|
||||
<data name=">>textThemeName.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
|
||||
<data name="labelSelectTexture.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="label4.Enabled" type="System.Boolean, mscorlib">
|
||||
<data name="labelSelectTexture.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="label4.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Microsoft Sans Serif, 8.25pt, style=Underline</value>
|
||||
<data name="labelSelectTexture.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>303, 185</value>
|
||||
</data>
|
||||
<data name="label4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
<data name="labelSelectTexture.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>61, 19</value>
|
||||
</data>
|
||||
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>400, 186</value>
|
||||
<data name="labelSelectTexture.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>119</value>
|
||||
</data>
|
||||
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>54, 13</value>
|
||||
<data name="labelSelectTexture.Text" xml:space="preserve">
|
||||
<value>Add Skin</value>
|
||||
</data>
|
||||
<data name="label4.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>124</value>
|
||||
<data name="labelSelectTexture.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name="label4.Text" xml:space="preserve">
|
||||
<value>Add Cape</value>
|
||||
<data name=">>labelSelectTexture.Name" xml:space="preserve">
|
||||
<value>labelSelectTexture</value>
|
||||
</data>
|
||||
<data name=">>label4.Name" xml:space="preserve">
|
||||
<value>label4</value>
|
||||
<data name=">>labelSelectTexture.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>label4.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>label4.Parent" xml:space="preserve">
|
||||
<data name=">>labelSelectTexture.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>label4.ZOrder" xml:space="preserve">
|
||||
<data name=">>labelSelectTexture.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="capeLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="capeLabel.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="capeLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>391, 186</value>
|
||||
</data>
|
||||
<data name="capeLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>69, 19</value>
|
||||
</data>
|
||||
<data name="capeLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>124</value>
|
||||
</data>
|
||||
<data name="capeLabel.Text" xml:space="preserve">
|
||||
<value>Add Cape</value>
|
||||
</data>
|
||||
<data name="capeLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleCenter</value>
|
||||
</data>
|
||||
<data name="capeLabel.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>capeLabel.Name" xml:space="preserve">
|
||||
<value>capeLabel</value>
|
||||
</data>
|
||||
<data name=">>capeLabel.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>capeLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>capeLabel.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="buttonAnimGen.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||
<value>Flat</value>
|
||||
</data>
|
||||
<data name="buttonAnimGen.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
<data name="buttonAnimGen.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="buttonAnimGen.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>108, 259</value>
|
||||
@@ -746,7 +673,7 @@
|
||||
<value>buttonAnimGen</value>
|
||||
</data>
|
||||
<data name=">>buttonAnimGen.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>buttonAnimGen.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
@@ -766,50 +693,56 @@
|
||||
<data name="capePictureBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>82, 82</value>
|
||||
</data>
|
||||
<data name="capePictureBox.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>StretchImage</value>
|
||||
</data>
|
||||
<data name="capePictureBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>109</value>
|
||||
</data>
|
||||
<data name="capePictureBox.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>capePictureBox.Name" xml:space="preserve">
|
||||
<value>capePictureBox</value>
|
||||
</data>
|
||||
<data name=">>capePictureBox.Type" xml:space="preserve">
|
||||
<value>PckStudio.PictureBoxWithInterpolationMode, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>PckStudio.ToolboxItems.InterpolationPictureBox, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>capePictureBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>capePictureBox.ZOrder" xml:space="preserve">
|
||||
<value>15</value>
|
||||
<value>14</value>
|
||||
</data>
|
||||
<data name="skinPictureBoxTexture.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<data name="skinPictureBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="skinPictureBoxTexture.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<data name="skinPictureBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="skinPictureBoxTexture.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<data name="skinPictureBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>292, 152</value>
|
||||
</data>
|
||||
<data name="skinPictureBoxTexture.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<data name="skinPictureBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>82, 82</value>
|
||||
</data>
|
||||
<data name="skinPictureBoxTexture.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<data name="skinPictureBox.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>Zoom</value>
|
||||
</data>
|
||||
<data name="skinPictureBoxTexture.TabIndex" type="System.Int32, mscorlib">
|
||||
<data name="skinPictureBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>108</value>
|
||||
</data>
|
||||
<data name=">>skinPictureBoxTexture.Name" xml:space="preserve">
|
||||
<value>skinPictureBoxTexture</value>
|
||||
<data name=">>skinPictureBox.Name" xml:space="preserve">
|
||||
<value>skinPictureBox</value>
|
||||
</data>
|
||||
<data name=">>skinPictureBoxTexture.Type" xml:space="preserve">
|
||||
<value>PckStudio.PictureBoxWithInterpolationMode, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<data name=">>skinPictureBox.Type" xml:space="preserve">
|
||||
<value>PckStudio.ToolboxItems.InterpolationPictureBox, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>skinPictureBoxTexture.Parent" xml:space="preserve">
|
||||
<data name=">>skinPictureBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>skinPictureBoxTexture.ZOrder" xml:space="preserve">
|
||||
<value>16</value>
|
||||
<data name=">>skinPictureBox.ZOrder" xml:space="preserve">
|
||||
<value>15</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
@@ -3348,7 +3281,7 @@
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>addNewSkin</value>
|
||||
<value>AddNewSkin</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using OMI;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Pck;
|
||||
using PckStudio.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -56,12 +57,7 @@ namespace PckStudio.Popups
|
||||
using var ms = new MemoryStream(file.Data);
|
||||
PckFile subPCK = reader.FromStream(ms);
|
||||
applyBulkProperties(subPCK.Files, index);
|
||||
var writer = new PckFileWriter(subPCK, _endianness);
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
writer.WriteToStream(stream);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
file.SetData(new PckFileWriter(subPCK, _endianness));
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
|
||||
@@ -545,32 +545,29 @@ namespace PckStudio.Forms
|
||||
|
||||
private void GenerateUVTextureMap()
|
||||
{
|
||||
if (generateTextureCheckBox.Checked)
|
||||
Random rng = new Random();
|
||||
using (Graphics graphics = Graphics.FromImage(uvPictureBox.Image))
|
||||
{
|
||||
Random rng = new Random();
|
||||
using (Graphics graphics = Graphics.FromImage(uvPictureBox.Image))
|
||||
graphics.ApplyConfig(_graphicsConfig);
|
||||
foreach (var part in modelBoxes)
|
||||
{
|
||||
graphics.ApplyConfig(_graphicsConfig);
|
||||
foreach (var part in modelBoxes)
|
||||
{
|
||||
float width = part.Size.X * 2;
|
||||
float height = part.Size.Y * 2;
|
||||
float length = part.Size.Z * 2;
|
||||
float u = part.UV.X * 2;
|
||||
float v = part.UV.Y * 2;
|
||||
int argb = rng.Next(-16777216, -1); // 0xFF000000 - 0xFFFFFFFF
|
||||
var color = Color.FromArgb(argb);
|
||||
Brush brush = new SolidBrush(color);
|
||||
graphics.FillRectangle(brush, u + length, v, width, length);
|
||||
graphics.FillRectangle(brush, u + length + width, v, width, length);
|
||||
graphics.FillRectangle(brush, u, length + v, length, height);
|
||||
graphics.FillRectangle(brush, u + length, v + length, width, height);
|
||||
graphics.FillRectangle(brush, u + length + width, v + length, width, height);
|
||||
graphics.FillRectangle(brush, u + length + width * 2, v + length, length, height);
|
||||
}
|
||||
float width = part.Size.X * 2;
|
||||
float height = part.Size.Y * 2;
|
||||
float length = part.Size.Z * 2;
|
||||
float u = part.UV.X * 2;
|
||||
float v = part.UV.Y * 2;
|
||||
int argb = rng.Next(-16777216, -1); // 0xFF000000 - 0xFFFFFFFF
|
||||
var color = Color.FromArgb(argb);
|
||||
Brush brush = new SolidBrush(color);
|
||||
graphics.FillRectangle(brush, u + length, v, width, length);
|
||||
graphics.FillRectangle(brush, u + length + width, v, width, length);
|
||||
graphics.FillRectangle(brush, u, length + v, length, height);
|
||||
graphics.FillRectangle(brush, u + length, v + length, width, height);
|
||||
graphics.FillRectangle(brush, u + length + width, v + length, width, height);
|
||||
graphics.FillRectangle(brush, u + length + width * 2, v + length, length, height);
|
||||
}
|
||||
uvPictureBox.Invalidate();
|
||||
}
|
||||
uvPictureBox.Invalidate();
|
||||
}
|
||||
|
||||
// Checks and sets Z layering
|
||||
@@ -1205,28 +1202,24 @@ namespace PckStudio.Forms
|
||||
if (MessageBox.Show("Import custom model project file? Your current work will be lost!", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes && openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
listViewBoxes.Items.Clear();
|
||||
string str1 = File.ReadAllText(openFileDialog.FileName);
|
||||
|
||||
modelBoxes.Clear();
|
||||
List<string> lines = str1.Split(new[] { "\n\r", "\n" }, StringSplitOptions.None).ToList();
|
||||
if (string.IsNullOrEmpty(lines[lines.Count - 1]))
|
||||
lines.RemoveAt(lines.Count - 1);
|
||||
for (int i = 0; i < lines.Count; i += 11)
|
||||
StreamReader reader = new StreamReader(openFileDialog.FileName);
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
string name = lines[0 + i];
|
||||
string parent = lines[1 + i];
|
||||
float PosX = float.Parse(lines[3 + i]);
|
||||
float PosY = float.Parse(lines[4 + i]);
|
||||
float PosZ = float.Parse(lines[5 + i]);
|
||||
float SizeX = float.Parse(lines[6 + i]);
|
||||
float SizeY = float.Parse(lines[7 + i]);
|
||||
float SizeZ = float.Parse(lines[8 + i]);
|
||||
float UvX = float.Parse(lines[9 + i]);
|
||||
float UvY = float.Parse(lines[10 + i]);
|
||||
|
||||
// CSM doesn't support armor, mirror, or scale values as far as I know of - May
|
||||
modelBoxes.Add(SkinBOX.FromString($"{parent} {PosX} {PosY} {PosZ} {SizeX} {SizeY} {SizeZ} {UvX} {UvY} {false} {false} {0}"));
|
||||
reader.ReadLine();
|
||||
string part = reader.ReadLine();
|
||||
reader.ReadLine();
|
||||
var PosX = reader.ReadLine();
|
||||
var PosY = reader.ReadLine();
|
||||
var PosZ = reader.ReadLine();
|
||||
var SizeX = reader.ReadLine();
|
||||
var SizeY = reader.ReadLine();
|
||||
var SizeZ = reader.ReadLine();
|
||||
var UvX = reader.ReadLine();
|
||||
var UvY = reader.ReadLine();
|
||||
modelBoxes.Add(SkinBOX.FromString($"{part} {PosX} {PosY} {PosZ} {SizeX} {SizeY} {SizeZ} {UvX} {UvY}"));
|
||||
}
|
||||
|
||||
}
|
||||
comboParent.Enabled = true;
|
||||
UpdateListView();
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
namespace PckStudio.Helper
|
||||
{
|
||||
public static class AnimationResources
|
||||
{
|
||||
|
||||
private static JsonTiles _jsonData;
|
||||
internal static JsonTiles JsonTileData => _jsonData ??= JsonConvert.DeserializeObject<JsonTiles>(Resources.tileData);
|
||||
|
||||
internal static List<JsonTileInfo> ItemTileInfos => JsonTileData.Items;
|
||||
|
||||
internal static List<JsonTileInfo> BlockTileInfos => JsonTileData.Blocks;
|
||||
|
||||
private static Image[] _itemImages;
|
||||
public static Image[] ItemImages => _itemImages ??= Resources.items_sheet.CreateImageList(16).ToArray();
|
||||
|
||||
private static Image[] _blockImages;
|
||||
public static Image[] BlockImages => _blockImages ??= Resources.terrain_sheet.CreateImageList(16).ToArray();
|
||||
|
||||
private static ImageList _itemImageList;
|
||||
public static ImageList ItemImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_itemImageList is null)
|
||||
{
|
||||
_itemImageList = new ImageList();
|
||||
_itemImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_itemImageList.Images.AddRange(ItemImages);
|
||||
}
|
||||
return _itemImageList;
|
||||
}
|
||||
}
|
||||
|
||||
private static ImageList _blockImageList;
|
||||
public static ImageList BlockImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_blockImageList is null)
|
||||
{
|
||||
_blockImageList = new ImageList();
|
||||
_blockImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_blockImageList.Images.AddRange(BlockImages);
|
||||
}
|
||||
return _blockImageList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace PckStudio.Internal
|
||||
if (textures[0].Width != textures[0].Height)
|
||||
throw new Exception("Invalid size");
|
||||
|
||||
return textures.CombineImages(ImageLayoutDirection.Vertical);
|
||||
return textures.Combine(ImageLayoutDirection.Vertical);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using PckStudio.Classes.Misc;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Extensions;
|
||||
using System.Globalization;
|
||||
using PckStudio.Helper;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
@@ -22,11 +22,11 @@ namespace PckStudio.Internal
|
||||
Profiler.Configure(Debug.Listeners[0]);
|
||||
Profiler.Start();
|
||||
{
|
||||
_entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray();
|
||||
_entityImages ??= Resources.entities_sheet.SplitHorizontal(32).ToArray();
|
||||
DataCacher ??= new FileCacher(Program.AppDataCache);
|
||||
_ = AnimationResources.JsonTileData;
|
||||
_ = AnimationResources.ItemImageList;
|
||||
_ = AnimationResources.BlockImageList;
|
||||
_ = Tiles.JsonTileData;
|
||||
_ = Tiles.ItemImageList;
|
||||
_ = Tiles.BlockImageList;
|
||||
SettingsManager.Initialize();
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
{
|
||||
@@ -14,4 +18,50 @@ namespace PckStudio.Internal.Json
|
||||
[JsonProperty("items")]
|
||||
public List<JsonTileInfo> Items { get; set; }
|
||||
}
|
||||
|
||||
internal static class Tiles
|
||||
{
|
||||
private static JsonTiles _jsonData;
|
||||
internal static JsonTiles JsonTileData => _jsonData ??= JsonConvert.DeserializeObject<JsonTiles>(Resources.tileData);
|
||||
|
||||
internal static List<JsonTileInfo> ItemTileInfos => JsonTileData.Items;
|
||||
|
||||
internal static List<JsonTileInfo> BlockTileInfos => JsonTileData.Blocks;
|
||||
|
||||
private static Image[] _itemImages;
|
||||
public static Image[] ItemImages => _itemImages ??= Resources.items_sheet.SplitHorizontal(16).ToArray();
|
||||
|
||||
private static Image[] _blockImages;
|
||||
public static Image[] BlockImages => _blockImages ??= Resources.terrain_sheet.SplitHorizontal(16).ToArray();
|
||||
|
||||
private static ImageList _itemImageList;
|
||||
public static ImageList ItemImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_itemImageList is null)
|
||||
{
|
||||
_itemImageList = new ImageList();
|
||||
_itemImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_itemImageList.Images.AddRange(ItemImages);
|
||||
}
|
||||
return _itemImageList;
|
||||
}
|
||||
}
|
||||
|
||||
private static ImageList _blockImageList;
|
||||
public static ImageList BlockImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_blockImageList is null)
|
||||
{
|
||||
_blockImageList = new ImageList();
|
||||
_blockImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_blockImageList.Images.AddRange(BlockImages);
|
||||
}
|
||||
return _blockImageList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ using OMI.Workers.Language;
|
||||
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Forms.Utilities;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
@@ -31,7 +30,6 @@ using PckStudio.Internal;
|
||||
using PckStudio.Features;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Popups;
|
||||
using PckStudio.API.Miles;
|
||||
using PckStudio.Classes.Utils;
|
||||
using PckStudio.Helper;
|
||||
using PckStudio.Controls;
|
||||
@@ -175,78 +173,49 @@ namespace PckStudio
|
||||
|
||||
private PckFile InitializePack(int packId, int packVersion, string packName, bool createSkinsPCK)
|
||||
{
|
||||
var newPck = new PckFile(3);
|
||||
var pack = new PckFile(3);
|
||||
|
||||
var zeroFile = newPck.CreateNewFile("0", PckFile.FileData.FileType.InfoFile);
|
||||
var zeroFile = pack.CreateNewFile("0", PckFile.FileData.FileType.InfoFile);
|
||||
zeroFile.Properties.Add("PACKID", packId.ToString());
|
||||
zeroFile.Properties.Add("PACKVERSION", packVersion.ToString());
|
||||
|
||||
var loc = newPck.CreateNewFile("localisation.loc", PckFile.FileData.FileType.LocalisationFile, () =>
|
||||
{
|
||||
var locFile = new LOCFile();
|
||||
locFile.InitializeDefault(packName);
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new LOCFileWriter(locFile, 2);
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
});
|
||||
var locFile = new LOCFile();
|
||||
locFile.InitializeDefault(packName);
|
||||
pack.CreateNewFile("localisation.loc", PckFile.FileData.FileType.LocalisationFile, new LOCFileWriter(locFile, 2));
|
||||
|
||||
if (createSkinsPCK)
|
||||
{
|
||||
PckFile.FileData skinsPCKFile = newPck.CreateNewFile("Skins.pck", PckFile.FileData.FileType.SkinDataFile, () =>
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new PckFileWriter(new PckFile(3, true),
|
||||
Settings.Default.UseLittleEndianAsDefault
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
});
|
||||
}
|
||||
return newPck;
|
||||
PckFile.FileData skinsPCKFile = pack.CreateNewFileIf(createSkinsPCK, "Skins.pck", PckFile.FileData.FileType.SkinDataFile, new PckFileWriter(new PckFile(3, true),
|
||||
Settings.Default.UseLittleEndianAsDefault
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian));
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
private PckFile InitializeTexturePack(int packId, int packVersion, string packName, string res, bool createSkinsPCK = false)
|
||||
private PckFile InitializeTexturePack(int packId, int packVersion, string packName, string res, bool createSkinsPCK)
|
||||
{
|
||||
var newPck = InitializePack(packId, packVersion, packName, createSkinsPCK);
|
||||
var texturepackInfo = newPck.CreateNewFile($"{res}/{res}Info.pck", PckFile.FileData.FileType.TexturePackInfoFile,
|
||||
() =>
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
var writer = new PckFileWriter(new PckFile(3),
|
||||
Settings.Default.UseLittleEndianAsDefault
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(ms);
|
||||
return ms.ToArray();
|
||||
});
|
||||
var pack = InitializePack(packId, packVersion, packName, createSkinsPCK);
|
||||
PckFile infoPCK = new PckFile(3);
|
||||
|
||||
var icon = infoPCK.CreateNewFile("icon.png", PckFile.FileData.FileType.TextureFile);
|
||||
icon.SetData(Resources.TexturePackIcon, ImageFormat.Png);
|
||||
|
||||
var comparison = infoPCK.CreateNewFile("comparison.png", PckFile.FileData.FileType.TextureFile);
|
||||
comparison.SetData(Resources.Comparison, ImageFormat.Png);
|
||||
|
||||
var texturepackInfo = pack.CreateNewFile($"{res}/{res}Info.pck", PckFile.FileData.FileType.TexturePackInfoFile);
|
||||
|
||||
texturepackInfo.Properties.Add("PACKID", "0");
|
||||
texturepackInfo.Properties.Add("DATAPATH", $"{res}Data.pck");
|
||||
|
||||
PckFile infoPCK = new PckFile(3);
|
||||
texturepackInfo.SetData(new PckFileWriter(infoPCK, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var icon = infoPCK.CreateNewFile("icon.png", PckFile.FileData.FileType.TextureFile);
|
||||
Resources.TexturePackIcon.Save(ms, ImageFormat.Png);
|
||||
icon.SetData(ms.ToArray());
|
||||
}
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var comparison = infoPCK.CreateNewFile("comparison.png", PckFile.FileData.FileType.TextureFile);
|
||||
Resources.Comparison.Save(ms, ImageFormat.Png);
|
||||
comparison.SetData(ms.ToArray());
|
||||
}
|
||||
|
||||
return newPck;
|
||||
return pack;
|
||||
}
|
||||
|
||||
private PckFile InitializeMashUpPack(int packId, int packVersion, string packName, string res)
|
||||
{
|
||||
var newPck = InitializeTexturePack(packId, packVersion, packName, res, true);
|
||||
var gameRuleFile = newPck.CreateNewFile("GameRules.grf", PckFile.FileData.FileType.GameRulesFile);
|
||||
var pack = InitializeTexturePack(packId, packVersion, packName, res, true);
|
||||
var gameRuleFile = pack.CreateNewFile("GameRules.grf", PckFile.FileData.FileType.GameRulesFile);
|
||||
var grfFile = new GameRuleFile();
|
||||
grfFile.AddRule("MapOptions",
|
||||
new KeyValuePair<string, string>("seed", "0"),
|
||||
@@ -268,7 +237,7 @@ namespace PckStudio
|
||||
writer.WriteToStream(stream);
|
||||
gameRuleFile.SetData(stream.ToArray());
|
||||
}
|
||||
return newPck;
|
||||
return pack;
|
||||
}
|
||||
|
||||
private void skinPackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -287,7 +256,7 @@ namespace PckStudio
|
||||
var packPrompt = new CreateTexturePackPrompt();
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes);
|
||||
var currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes, packPrompt.CreateSkinsPck);
|
||||
AddEditorPage(currentPCK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Extensions\PckFileDataExtensions.cs" />
|
||||
<Compile Include="ToolboxItems\BlendPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -164,10 +165,10 @@
|
||||
<Compile Include="Forms\Additional-Popups\NumericPrompt.Designer.cs">
|
||||
<DependentUpon>NumericPrompt.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\AppSettingsForm.cs">
|
||||
<Compile Include="Forms\AppSettingsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\AppSettingsForm.Designer.cs">
|
||||
<Compile Include="Forms\AppSettingsForm.Designer.cs">
|
||||
<DependentUpon>AppSettingsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Internal\ApplicationBuildInfo.cs" />
|
||||
@@ -324,12 +325,6 @@
|
||||
<Compile Include="Forms\Additional-Popups\Animation\SetBulkSpeed.Designer.cs">
|
||||
<DependentUpon>SetBulkSpeed.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Additional-Popups\Audio\creditsEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Additional-Popups\Audio\creditsEditor.Designer.cs">
|
||||
<DependentUpon>creditsEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Additional-Popups\ItemSelectionPopUp.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -374,7 +369,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Helper\MaterialResources.cs" />
|
||||
<Compile Include="Helper\BehaviourResources.cs" />
|
||||
<Compile Include="Helper\AnimationResources.cs" />
|
||||
<Compile Include="Forms\Editor\BoxEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -455,10 +449,10 @@
|
||||
</Compile>
|
||||
<Compile Include="PckNodeSorter.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\CreditsForm.cs">
|
||||
<Compile Include="Forms\CreditsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Additional-Popups\CreditsForm.Designer.cs">
|
||||
<Compile Include="Forms\CreditsForm.Designer.cs">
|
||||
<DependentUpon>CreditsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -521,10 +515,6 @@
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\Animation\SetBulkSpeed.resx">
|
||||
<DependentUpon>SetBulkSpeed.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\Audio\creditsEditor.resx">
|
||||
<DependentUpon>creditsEditor.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\ItemSelectionPopUp.resx">
|
||||
<DependentUpon>ItemSelectionPopUp.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
@@ -566,7 +556,7 @@
|
||||
<EmbeddedResource Include="Forms\Editor\ANIMEditor.resx">
|
||||
<DependentUpon>ANIMEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Utilities\AppSettingsForm.resx">
|
||||
<EmbeddedResource Include="Forms\AppSettingsForm.resx">
|
||||
<DependentUpon>AppSettingsForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
@@ -619,7 +609,7 @@
|
||||
<EmbeddedResource Include="Forms\Utilities\TextureConverterUtility.resx">
|
||||
<DependentUpon>TextureConverterUtility.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\CreditsForm.resx">
|
||||
<EmbeddedResource Include="Forms\CreditsForm.resx">
|
||||
<DependentUpon>CreditsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
|
||||
Reference in New Issue
Block a user