mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-28 17:44:51 +00:00
Merge branch 'main' of https://github.com/PhoenixARC/-PCK-Studio
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Drawing.Drawing2D;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
@@ -10,7 +11,6 @@ namespace PckStudio.Classes.Extentions
|
||||
{
|
||||
internal static class ImageExtentions
|
||||
{
|
||||
|
||||
public enum ImageLayoutDirection
|
||||
{
|
||||
Horizontal,
|
||||
@@ -119,5 +119,38 @@ namespace PckStudio.Classes.Extentions
|
||||
|
||||
return new Size(width, heigh);
|
||||
}
|
||||
|
||||
public struct GraphicsConfig
|
||||
{
|
||||
public CompositingMode CompositingMode { get; set; }
|
||||
public CompositingQuality CompositingQuality { get; set; }
|
||||
public InterpolationMode InterpolationMode { get; set; }
|
||||
public SmoothingMode SmoothingMode {get; set; }
|
||||
public PixelOffsetMode PixelOffsetMode { get; set; }
|
||||
}
|
||||
|
||||
public static Image ResizeImage(this Image image, int width, int height, GraphicsConfig graphicsConfig)
|
||||
{
|
||||
var destRect = new Rectangle(0, 0, width, height);
|
||||
var destImage = new Bitmap(width, height);
|
||||
|
||||
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
||||
|
||||
using (var graphics = Graphics.FromImage(destImage))
|
||||
{
|
||||
graphics.CompositingMode = graphicsConfig.CompositingMode;
|
||||
graphics.CompositingQuality = graphicsConfig.CompositingQuality;
|
||||
graphics.InterpolationMode = graphicsConfig.InterpolationMode;
|
||||
graphics.SmoothingMode = graphicsConfig.SmoothingMode;
|
||||
graphics.PixelOffsetMode = graphicsConfig.PixelOffsetMode;
|
||||
|
||||
using (var wrapMode = new ImageAttributes())
|
||||
{
|
||||
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
||||
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
|
||||
}
|
||||
}
|
||||
return destImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,66 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
using PckStudio.Classes.FileTypes;
|
||||
|
||||
namespace PckStudio.Classes.IO.CSMB
|
||||
{
|
||||
internal class CSMBFileReader : StreamDataReader<CSMBFile>
|
||||
internal class CSMBFileReader : IDataFormatReader<CSMBFile>, IDataFormatReader
|
||||
{
|
||||
public static CSMBFile Read(Stream stream)
|
||||
{
|
||||
return new CSMBFileReader().ReadFromStream(stream);
|
||||
}
|
||||
|
||||
private CSMBFileReader() : base(false)
|
||||
private CSMBFileReader()
|
||||
{ }
|
||||
|
||||
protected override CSMBFile ReadFromStream(Stream stream)
|
||||
public CSMBFile FromFile(string filename)
|
||||
{
|
||||
CSMBFile BinFile = new CSMBFile();
|
||||
ReadInt(stream);
|
||||
int NumOfParts = ReadInt(stream);
|
||||
for(int i = 0; i < NumOfParts; i++)
|
||||
{
|
||||
CSMBPart part = new CSMBPart();
|
||||
part.Name = ReadString(stream);
|
||||
part.Parent = (CSMBParentPart)ReadInt(stream);
|
||||
part.posX = ReadFloat(stream);
|
||||
part.posY = ReadFloat(stream);
|
||||
part.posZ = ReadFloat(stream);
|
||||
part.sizeX = ReadFloat(stream);
|
||||
part.sizeY = ReadFloat(stream);
|
||||
part.sizeZ = ReadFloat(stream);
|
||||
part.uvX = ReadInt(stream);
|
||||
part.uvY = ReadInt(stream);
|
||||
part.MirrorTexture = ReadBool(stream);
|
||||
part.HideWArmour = ReadBool(stream);
|
||||
part.Inflation = ReadFloat(stream);
|
||||
BinFile.Parts.Add(part);
|
||||
}
|
||||
int NumOfOffsets = ReadInt(stream);
|
||||
for (int i = 0; i < NumOfOffsets; i++)
|
||||
{
|
||||
CSMBOffset offset = new CSMBOffset();
|
||||
offset.offsetPart = (CSMBOffsetPart)ReadInt(stream);
|
||||
offset.VerticalOffset = ReadFloat(stream);
|
||||
BinFile.Offsets.Add(offset);
|
||||
}
|
||||
return BinFile;
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
private string ReadString(Stream stream)
|
||||
public CSMBFile FromStream(Stream stream)
|
||||
{
|
||||
short strlen = ReadShort(stream);
|
||||
return ReadString(stream, strlen, Encoding.ASCII);
|
||||
CSMBFile csmbFile = new CSMBFile();
|
||||
using (var reader = new EndiannessAwareBinaryReader(stream, Encoding.ASCII, leaveOpen: true, Endianness.LittleEndian))
|
||||
{
|
||||
reader.ReadInt32();
|
||||
int numOfParts = reader.ReadInt32();
|
||||
for (int i = 0; i < numOfParts; i++)
|
||||
{
|
||||
CSMBPart part = new CSMBPart();
|
||||
part.Name = ReadString(reader);
|
||||
part.Parent = (CSMBParentPart)reader.ReadInt32();
|
||||
part.posX = reader.ReadSingle();
|
||||
part.posY = reader.ReadSingle();
|
||||
part.posZ = reader.ReadSingle();
|
||||
part.sizeX = reader.ReadSingle();
|
||||
part.sizeY = reader.ReadSingle();
|
||||
part.sizeZ = reader.ReadSingle();
|
||||
part.uvX = reader.ReadInt32();
|
||||
part.uvY = reader.ReadInt32();
|
||||
part.MirrorTexture = reader.ReadBoolean();
|
||||
part.HideWArmour = reader.ReadBoolean();
|
||||
part.Inflation = reader.ReadSingle();
|
||||
csmbFile.Parts.Add(part);
|
||||
}
|
||||
int numOfOffsets = reader.ReadInt32();
|
||||
for (int i = 0; i < numOfOffsets; i++)
|
||||
{
|
||||
CSMBOffset offset = new CSMBOffset();
|
||||
offset.offsetPart = (CSMBOffsetPart)reader.ReadInt32();
|
||||
offset.VerticalOffset = reader.ReadSingle();
|
||||
csmbFile.Offsets.Add(offset);
|
||||
}
|
||||
}
|
||||
return csmbFile;
|
||||
}
|
||||
|
||||
private string ReadString(EndiannessAwareBinaryReader reader)
|
||||
{
|
||||
ushort strlen = reader.ReadUInt16();
|
||||
return reader.ReadString(strlen);
|
||||
}
|
||||
|
||||
object IDataFormatReader.FromStream(Stream stream) => FromStream(stream);
|
||||
|
||||
object IDataFormatReader.FromFile(string filename) => FromFile(filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,58 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using OMI.Workers;
|
||||
using OMI;
|
||||
|
||||
namespace PckStudio.Classes.IO.CSMB
|
||||
{
|
||||
internal class CSMBFileWriter : StreamDataWriter
|
||||
internal class CSMBFileWriter : IDataFormatWriter
|
||||
{
|
||||
CSMBFile _CSMB;
|
||||
public static void Write(Stream stream, CSMBFile file)
|
||||
{
|
||||
new CSMBFileWriter(file).WriteToStream(stream);
|
||||
}
|
||||
|
||||
public CSMBFileWriter(CSMBFile csmb) : base(false)
|
||||
public CSMBFileWriter(CSMBFile csmb)
|
||||
{
|
||||
_CSMB = csmb;
|
||||
}
|
||||
|
||||
protected override void WriteToStream(Stream stream)
|
||||
public void WriteToFile(string filename)
|
||||
{
|
||||
WriteInt(stream, 0);
|
||||
WriteInt(stream, _CSMB.Parts.Count);
|
||||
foreach(CSMBPart part in _CSMB.Parts)
|
||||
using(var fs = File.OpenWrite(filename))
|
||||
{
|
||||
WriteString(stream, part.Name);
|
||||
WriteInt(stream, (int)part.Parent);
|
||||
WriteFloat(stream, part.posX);
|
||||
WriteFloat(stream, part.posY);
|
||||
WriteFloat(stream, part.posZ);
|
||||
WriteFloat(stream, part.sizeX);
|
||||
WriteFloat(stream, part.sizeY);
|
||||
WriteFloat(stream, part.sizeZ);
|
||||
WriteInt(stream, part.uvX);
|
||||
WriteInt(stream, part.uvY);
|
||||
WriteBool(stream, part.MirrorTexture);
|
||||
WriteBool(stream, part.HideWArmour);
|
||||
WriteFloat(stream, part.Inflation);
|
||||
}
|
||||
WriteInt(stream, _CSMB.Offsets.Count);
|
||||
foreach (CSMBOffset offset in _CSMB.Offsets)
|
||||
{
|
||||
WriteInt(stream, (int)offset.offsetPart);
|
||||
WriteFloat(stream, offset.VerticalOffset);
|
||||
WriteToStream(fs);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteString(Stream stream, string s)
|
||||
public void WriteToStream(Stream stream)
|
||||
{
|
||||
WriteShort(stream, (short)s.Length);
|
||||
WriteString(stream, s, Encoding.ASCII);
|
||||
using (var writer = new EndiannessAwareBinaryWriter(stream, Encoding.ASCII, leaveOpen: true, Endianness.LittleEndian))
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(_CSMB.Parts.Count);
|
||||
foreach (CSMBPart part in _CSMB.Parts)
|
||||
{
|
||||
writer.Write((short)part.Name.Length);
|
||||
writer.WriteString(part.Name);
|
||||
writer.Write((int)part.Parent);
|
||||
writer.Write(part.posX);
|
||||
writer.Write(part.posY);
|
||||
writer.Write(part.posZ);
|
||||
writer.Write(part.sizeX);
|
||||
writer.Write(part.sizeY);
|
||||
writer.Write(part.sizeZ);
|
||||
writer.Write(part.uvX);
|
||||
writer.Write(part.uvY);
|
||||
writer.Write(part.MirrorTexture);
|
||||
writer.Write(part.HideWArmour);
|
||||
writer.Write(part.Inflation);
|
||||
}
|
||||
writer.Write(_CSMB.Offsets.Count);
|
||||
foreach (CSMBOffset offset in _CSMB.Offsets)
|
||||
{
|
||||
writer.Write((int)offset.offsetPart);
|
||||
writer.Write(offset.VerticalOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -14,55 +17,73 @@ namespace PckStudio.Classes.IO.PCK
|
||||
{ }
|
||||
}
|
||||
|
||||
internal class PCKAudioFileReader : StreamDataReader<PCKAudioFile>
|
||||
internal class PCKAudioFileReader : IDataFormatReader<PCKAudioFile>, IDataFormatReader
|
||||
{
|
||||
private PCKAudioFile _file;
|
||||
private Endianness _endianness;
|
||||
private List<string> LUT = new List<string>();
|
||||
private List<PCKAudioFile.AudioCategory.EAudioType> _OriginalAudioTypeOrder = new List<PCKAudioFile.AudioCategory.EAudioType>();
|
||||
|
||||
|
||||
public static PCKAudioFile Read(Stream stream, bool isLittleEndian)
|
||||
public PCKAudioFileReader(Endianness endianness)
|
||||
{
|
||||
return new PCKAudioFileReader(isLittleEndian).ReadFromStream(stream);
|
||||
_endianness = endianness;
|
||||
}
|
||||
|
||||
private PCKAudioFileReader(bool isLittleEndian) : base(isLittleEndian)
|
||||
public PCKAudioFile FromFile(string filename)
|
||||
{
|
||||
if(File.Exists(filename))
|
||||
{
|
||||
PCKAudioFile file;
|
||||
using(var fs = File.OpenRead(filename))
|
||||
{
|
||||
file = FromStream(fs);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
throw new FileNotFoundException(filename);
|
||||
}
|
||||
|
||||
protected override PCKAudioFile ReadFromStream(Stream stream)
|
||||
public PCKAudioFile FromStream(Stream stream)
|
||||
{
|
||||
int pck_type = ReadInt(stream);
|
||||
if (pck_type > 0xf00000) // 03 00 00 00 == true
|
||||
throw new OverflowException(nameof(pck_type));
|
||||
if (pck_type > 1)
|
||||
throw new InvalidAudioPckException(nameof(pck_type));
|
||||
_file = new PCKAudioFile();
|
||||
ReadLookUpTable(stream);
|
||||
ReadCategories(stream);
|
||||
ReadCategorySongs(stream);
|
||||
using (var reader = new EndiannessAwareBinaryReader(stream,
|
||||
_endianness == Endianness.BigEndian
|
||||
? Encoding.BigEndianUnicode
|
||||
: Encoding.Unicode,
|
||||
leaveOpen: true, _endianness))
|
||||
{
|
||||
int pck_type = reader.ReadInt32();
|
||||
if (pck_type > 0xf00000) // 03 00 00 00 == true
|
||||
throw new OverflowException(nameof(pck_type));
|
||||
if (pck_type > 1)
|
||||
throw new InvalidAudioPckException(nameof(pck_type));
|
||||
_file = new PCKAudioFile();
|
||||
ReadLookUpTable(reader);
|
||||
ReadCategories(reader);
|
||||
ReadCategorySongs(reader);
|
||||
}
|
||||
return _file;
|
||||
}
|
||||
|
||||
private void ReadLookUpTable(Stream stream)
|
||||
private void ReadLookUpTable(EndiannessAwareBinaryReader reader)
|
||||
{
|
||||
int count = ReadInt(stream);
|
||||
int count = reader.ReadInt32();
|
||||
LUT = new List<string>(count);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int index = ReadInt(stream);
|
||||
LUT.Insert(index, ReadString(stream));
|
||||
int index = reader.ReadInt32();
|
||||
string value = ReadString(reader);
|
||||
LUT.Insert(index, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadCategories(Stream stream)
|
||||
private void ReadCategories(EndiannessAwareBinaryReader reader)
|
||||
{
|
||||
int categoryEntryCount = ReadInt(stream);
|
||||
int categoryEntryCount = reader.ReadInt32();
|
||||
for (; 0 < categoryEntryCount; categoryEntryCount--)
|
||||
{
|
||||
var parameterType = (PCKAudioFile.AudioCategory.EAudioParameterType)ReadInt(stream);
|
||||
var audioType = (PCKAudioFile.AudioCategory.EAudioType)ReadInt(stream);
|
||||
string name = ReadString(stream);
|
||||
var parameterType = (PCKAudioFile.AudioCategory.EAudioParameterType)reader.ReadInt32();
|
||||
var audioType = (PCKAudioFile.AudioCategory.EAudioType)reader.ReadInt32();
|
||||
string name = ReadString(reader);
|
||||
// AddCategory puts the file's categories out of order and causes some songs to be put in the wrong categories
|
||||
// This is my simple fix for the issue.
|
||||
_OriginalAudioTypeOrder.Add(audioType);
|
||||
@@ -70,17 +91,17 @@ namespace PckStudio.Classes.IO.PCK
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadCategorySongs(Stream stream)
|
||||
private void ReadCategorySongs(EndiannessAwareBinaryReader reader)
|
||||
{
|
||||
List<string> credits = new List<string>();
|
||||
List<string> creditIds = new List<string>();
|
||||
foreach (var c in _OriginalAudioTypeOrder)
|
||||
{
|
||||
int audioCount = ReadInt(stream);
|
||||
int audioCount = reader.ReadInt32();
|
||||
for (; 0 < audioCount; audioCount--)
|
||||
{
|
||||
string key = LUT[ReadInt(stream)];
|
||||
string value = ReadString(stream);
|
||||
string key = LUT[reader.ReadInt32()];
|
||||
string value = ReadString(reader);
|
||||
switch (key)
|
||||
{
|
||||
case "CUENAME":
|
||||
@@ -104,12 +125,16 @@ namespace PckStudio.Classes.IO.PCK
|
||||
}
|
||||
}
|
||||
|
||||
private string ReadString(Stream stream)
|
||||
private string ReadString(EndiannessAwareBinaryReader reader)
|
||||
{
|
||||
int len = ReadInt(stream);
|
||||
string s = ReadString(stream, len, IsUsingLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode);
|
||||
ReadInt(stream); // padding
|
||||
int len = reader.ReadInt32();
|
||||
string s = reader.ReadString(len);
|
||||
reader.ReadInt32(); // padding
|
||||
return s;
|
||||
}
|
||||
|
||||
object IDataFormatReader.FromStream(Stream stream) => FromStream(stream);
|
||||
|
||||
object IDataFormatReader.FromFile(string filename) => FromFile(filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace PckStudio.Classes.IO.PCK
|
||||
{
|
||||
internal class PCKAudioFileWriter : StreamDataWriter
|
||||
internal class PCKAudioFileWriter : IDataFormatWriter
|
||||
{
|
||||
|
||||
private PCKAudioFile _file;
|
||||
private Endianness _endianness;
|
||||
private static readonly List<string> LUT = new List<string>
|
||||
{
|
||||
"CUENAME",
|
||||
@@ -16,71 +19,82 @@ namespace PckStudio.Classes.IO.PCK
|
||||
"CREDITID"
|
||||
};
|
||||
|
||||
public static void Write(Stream stream, PCKAudioFile file, bool isLittleEndian)
|
||||
{
|
||||
new PCKAudioFileWriter(file, isLittleEndian).WriteToStream(stream);
|
||||
}
|
||||
|
||||
private PCKAudioFileWriter(PCKAudioFile file, bool isLittleEndian) : base(isLittleEndian)
|
||||
public PCKAudioFileWriter(PCKAudioFile file, Endianness endianness)
|
||||
{
|
||||
_file = file;
|
||||
_endianness = endianness;
|
||||
}
|
||||
|
||||
protected override void WriteToStream(Stream stream)
|
||||
public void WriteToFile(string filename)
|
||||
{
|
||||
WriteInt(stream, _file.type);
|
||||
WriteLookUpTable(stream);
|
||||
WriteCategories(stream);
|
||||
WriteCategorySongs(stream);
|
||||
using(var fs = File.OpenWrite(filename))
|
||||
{
|
||||
WriteToStream(fs);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteString(Stream stream, string s)
|
||||
public void WriteToStream(Stream stream)
|
||||
{
|
||||
WriteInt(stream, s.Length);
|
||||
WriteString(stream, s, IsUsingLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode);
|
||||
WriteInt(stream, 0); // padding
|
||||
using (var writer = new EndiannessAwareBinaryWriter(stream,
|
||||
_endianness == Endianness.BigEndian
|
||||
? Encoding.BigEndianUnicode
|
||||
: Encoding.Unicode,
|
||||
leaveOpen: true, _endianness))
|
||||
{
|
||||
writer.Write(_file.type);
|
||||
WriteLookUpTable(writer);
|
||||
WriteCategories(writer);
|
||||
WriteCategorySongs(writer);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteLookUpTable(Stream stream)
|
||||
private void WriteString(EndiannessAwareBinaryWriter writer, string s)
|
||||
{
|
||||
WriteInt(stream, 3);
|
||||
writer.Write(s.Length);
|
||||
writer.WriteString(s);
|
||||
writer.Write(0); // padding
|
||||
}
|
||||
|
||||
private void WriteLookUpTable(EndiannessAwareBinaryWriter writer)
|
||||
{
|
||||
writer.Write(3);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
WriteInt(stream, i);
|
||||
WriteString(stream, LUT[i]);
|
||||
writer.Write(i);
|
||||
WriteString(writer, LUT[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteCategories(Stream stream)
|
||||
private void WriteCategories(EndiannessAwareBinaryWriter writer)
|
||||
{
|
||||
WriteInt(stream, _file.Categories.Length);
|
||||
writer.Write(_file.Categories.Length);
|
||||
foreach (var category in _file.Categories)
|
||||
{
|
||||
WriteInt(stream, (int)category.parameterType);
|
||||
WriteInt(stream, (int)category.audioType);
|
||||
WriteString(stream, category.Name);
|
||||
writer.Write((int)category.parameterType);
|
||||
writer.Write((int)category.audioType);
|
||||
WriteString(writer, category.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteCategorySongs(Stream stream)
|
||||
private void WriteCategorySongs(EndiannessAwareBinaryWriter writer)
|
||||
{
|
||||
bool addCredit = true;
|
||||
foreach (var category in _file.Categories)
|
||||
{
|
||||
WriteInt(stream, category.SongNames.Count + (addCredit ? _file.Credits.Count * 2 : 0));
|
||||
writer.Write(category.SongNames.Count + (addCredit ? _file.Credits.Count * 2 : 0));
|
||||
foreach (var name in category.SongNames)
|
||||
{
|
||||
WriteInt(stream, LUT.IndexOf("CUENAME"));
|
||||
WriteString(stream, name);
|
||||
writer.Write(LUT.IndexOf("CUENAME"));
|
||||
WriteString(writer, name);
|
||||
}
|
||||
if (addCredit)
|
||||
{
|
||||
foreach (var credit in _file.Credits)
|
||||
{
|
||||
WriteInt(stream, LUT.IndexOf("CREDIT"));
|
||||
WriteString(stream, credit.Value);
|
||||
WriteInt(stream, LUT.IndexOf("CREDITID"));
|
||||
WriteString(stream, credit.Key);
|
||||
writer.Write(LUT.IndexOf("CREDIT"));
|
||||
WriteString(writer, credit.Value);
|
||||
writer.Write(LUT.IndexOf("CREDITID"));
|
||||
WriteString(writer, credit.Key);
|
||||
}
|
||||
}
|
||||
addCredit = false;
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/* Copyright (c) 2022-present miku-666
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1.The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PckStudio.Classes.IO
|
||||
{
|
||||
public abstract class StreamDataReader<T>
|
||||
{
|
||||
private static bool useLittleEndian;
|
||||
protected static bool IsUsingLittleEndian => useLittleEndian;
|
||||
protected abstract T ReadFromStream(Stream stream);
|
||||
|
||||
protected StreamDataReader(bool useLittleEndian)
|
||||
{
|
||||
StreamDataReader<T>.useLittleEndian = useLittleEndian;
|
||||
}
|
||||
|
||||
protected static string ReadString(Stream stream, int length, Encoding encoding)
|
||||
{
|
||||
byte[] buffer = ReadBytes(stream, length << Convert.ToInt32(encoding is UnicodeEncoding));
|
||||
return encoding.GetString(buffer).TrimEnd('\0');
|
||||
}
|
||||
|
||||
protected static byte[] ReadBytes(Stream stream, int count)
|
||||
{
|
||||
byte[] buffer = new byte[count];
|
||||
stream.Read(buffer, 0, count);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
protected static bool ReadBool(Stream stream)
|
||||
{
|
||||
return stream.ReadByte() != 0;
|
||||
}
|
||||
|
||||
protected static ushort ReadUShort(Stream stream) => (ushort)ReadShort(stream);
|
||||
protected static short ReadShort(Stream stream)
|
||||
{
|
||||
byte[] bytes = ReadBytes(stream, 2);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(bytes);
|
||||
return BitConverter.ToInt16(bytes, 0);
|
||||
}
|
||||
|
||||
protected static uint ReadUInt(Stream stream) => (uint)ReadInt(stream);
|
||||
protected static int ReadInt(Stream stream)
|
||||
{
|
||||
byte[] buffer = ReadBytes(stream, 4);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(buffer);
|
||||
return BitConverter.ToInt32(buffer, 0);
|
||||
}
|
||||
|
||||
protected static ulong ReadULong(Stream stream) => (ulong)ReadLong(stream);
|
||||
protected static long ReadLong(Stream stream)
|
||||
{
|
||||
byte[] buffer = ReadBytes(stream, 8);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(buffer);
|
||||
return BitConverter.ToInt64(buffer, 0);
|
||||
}
|
||||
|
||||
protected static float ReadFloat(Stream stream)
|
||||
{
|
||||
byte[] buffer = ReadBytes(stream, 4);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(buffer);
|
||||
return BitConverter.ToSingle(buffer, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/* Copyright (c) 2022-present miku-666
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1.The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PckStudio.Classes.IO
|
||||
{
|
||||
public abstract class StreamDataWriter
|
||||
{
|
||||
private static bool useLittleEndian;
|
||||
protected static bool IsUsingLittleEndian => useLittleEndian;
|
||||
|
||||
protected StreamDataWriter(bool littleEndian)
|
||||
{
|
||||
useLittleEndian = littleEndian;
|
||||
}
|
||||
|
||||
protected abstract void WriteToStream(Stream stream);
|
||||
|
||||
protected static void WriteBool(Stream stream, bool state)
|
||||
{
|
||||
stream.WriteByte((byte)(state ? 1 : 0));
|
||||
}
|
||||
|
||||
protected static void WriteUShort(Stream stream, ushort value) => WriteShort(stream, (short)value);
|
||||
|
||||
protected static void WriteShort(Stream stream, short value)
|
||||
{
|
||||
byte[] bytes = BitConverter.GetBytes(value);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(bytes);
|
||||
WriteBytes(stream, bytes, 2);
|
||||
}
|
||||
|
||||
protected static void WriteUInt(Stream stream, uint value) => WriteInt(stream, (int)value);
|
||||
protected static void WriteInt(Stream stream, int value)
|
||||
{
|
||||
byte[] buffer = BitConverter.GetBytes(value);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(buffer);
|
||||
WriteBytes(stream, buffer, 4);
|
||||
}
|
||||
|
||||
protected static void WriteULong(Stream stream, ulong value) => WriteLong(stream, (long)value);
|
||||
protected static void WriteLong(Stream stream, long value)
|
||||
{
|
||||
byte[] buffer = BitConverter.GetBytes(value);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(buffer);
|
||||
WriteBytes(stream, buffer, 8);
|
||||
}
|
||||
|
||||
protected static void WriteString(Stream stream, string s, Encoding encoding)
|
||||
=> WriteBytes(stream, encoding.GetBytes(s));
|
||||
|
||||
protected static void WriteBytes(Stream stream, byte[] bytes) => WriteBytes(stream, bytes, bytes.Length);
|
||||
protected static void WriteBytes(Stream stream, byte[] bytes, int count)
|
||||
{
|
||||
stream.Write(bytes, 0, count);
|
||||
}
|
||||
|
||||
protected static void WriteFloat(Stream stream, float value)
|
||||
{
|
||||
byte[] buffer = BitConverter.GetBytes(value);
|
||||
if (BitConverter.IsLittleEndian && !useLittleEndian)
|
||||
Array.Reverse(buffer);
|
||||
WriteBytes(stream, buffer, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,32 @@ namespace PckStudio.Classes.Misc
|
||||
public static DiscordRpcClient Client;
|
||||
public static readonly DateTime StartUpTime = DateTime.UtcNow;
|
||||
|
||||
private static readonly Assets _assets = new Assets()
|
||||
{
|
||||
LargeImageKey = "pcklgo",
|
||||
LargeImageText = "PCK-Studio",
|
||||
};
|
||||
|
||||
private static readonly Button[] _buttons = new Button[]
|
||||
{
|
||||
new Button()
|
||||
{
|
||||
Label = "Check it out.",
|
||||
Url = Program.ProjectUrl,
|
||||
}
|
||||
};
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Client = new DiscordRpcClient(Settings.Default.RichPresenceId);
|
||||
Client.Initialize();
|
||||
}
|
||||
|
||||
public static void SetPresence(string details)
|
||||
{
|
||||
SetPresence(details, null);
|
||||
}
|
||||
|
||||
public static void SetPresence(string details, string state)
|
||||
{
|
||||
Client?.SetPresence(new RichPresence()
|
||||
@@ -23,16 +43,14 @@ namespace PckStudio.Classes.Misc
|
||||
Details = details,
|
||||
State = state,
|
||||
Timestamps = new Timestamps() { Start = StartUpTime },
|
||||
Assets = new Assets()
|
||||
{
|
||||
LargeImageKey = "pcklgo",
|
||||
LargeImageText = "PCK-Studio",
|
||||
}
|
||||
Assets = _assets,
|
||||
Buttons = _buttons
|
||||
});
|
||||
}
|
||||
|
||||
public static void Deinitialize()
|
||||
{
|
||||
Client?.ClearPresence();
|
||||
Client?.Dispose();
|
||||
Client = null;
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ namespace PckStudio.Classes.Utils
|
||||
DINNERBONE = 1 << 31, // 0x80000000
|
||||
}
|
||||
|
||||
public struct SkinANIM
|
||||
{
|
||||
public class SkinANIM : ICloneable, IEquatable<SkinANIM>
|
||||
{
|
||||
private ANIM_EFFECTS _ANIM;
|
||||
public static readonly Regex animRegex = new Regex(@"^0x[0-9a-f]{1,8}\b", RegexOptions.IgnoreCase);
|
||||
|
||||
@@ -78,11 +78,6 @@ namespace PckStudio.Classes.Utils
|
||||
: this(ANIM_EFFECTS.NONE)
|
||||
{
|
||||
}
|
||||
|
||||
public SkinANIM(string anim)
|
||||
: this(ParseString(anim))
|
||||
{
|
||||
}
|
||||
|
||||
public SkinANIM(ANIM_EFFECTS anim)
|
||||
{
|
||||
@@ -93,10 +88,10 @@ namespace PckStudio.Classes.Utils
|
||||
|
||||
public static bool IsValidANIM(string anim) => animRegex.IsMatch(anim ?? string.Empty);
|
||||
|
||||
public static ANIM_EFFECTS ParseString(string anim)
|
||||
=> IsValidANIM(anim)
|
||||
? (ANIM_EFFECTS)Convert.ToInt32(anim.TrimEnd(' ', '\n', '\r'), 16)
|
||||
: ANIM_EFFECTS.NONE;
|
||||
public static SkinANIM FromString(string value)
|
||||
=> IsValidANIM(value)
|
||||
? new SkinANIM((ANIM_EFFECTS)Convert.ToInt32(value.TrimEnd(' ', '\n', '\r'), 16))
|
||||
: new SkinANIM();
|
||||
|
||||
public void SetANIM(ANIM_EFFECTS anim) => _ANIM = anim;
|
||||
|
||||
@@ -107,10 +102,16 @@ namespace PckStudio.Classes.Utils
|
||||
public static implicit operator SkinANIM(ANIM_EFFECTS anim) => new SkinANIM(anim);
|
||||
|
||||
public static bool operator ==(SkinANIM a, ANIM_EFFECTS b) => a._ANIM == b;
|
||||
|
||||
public static bool operator !=(SkinANIM a, ANIM_EFFECTS b) => !(a == b);
|
||||
public static bool operator ==(SkinANIM a, SkinANIM b) => a.Equals(b);
|
||||
public static bool operator !=(SkinANIM a, SkinANIM b) => !a.Equals(b);
|
||||
|
||||
public override bool Equals(object obj) => obj is SkinANIM a && a == _ANIM;
|
||||
public bool Equals(SkinANIM other)
|
||||
{
|
||||
return _ANIM == other._ANIM;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) => obj is SkinANIM a && Equals(a);
|
||||
|
||||
public override int GetHashCode() => (int)_ANIM;
|
||||
|
||||
@@ -134,5 +135,10 @@ namespace PckStudio.Classes.Utils
|
||||
{
|
||||
return (_ANIM & flag) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
this.Controls.Add(this.InputTextBox);
|
||||
this.Controls.Add(this.OKButton);
|
||||
this.Controls.Add(this.TextLabel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "AddFilePrompt";
|
||||
|
||||
@@ -6,26 +6,27 @@ namespace PckStudio
|
||||
{
|
||||
public partial class AddFilePrompt : MetroForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
|
||||
/// </summary>
|
||||
public string filepath => InputTextBox.Text;
|
||||
public int filetype => FileTypeComboBox.SelectedIndex;
|
||||
/// <summary>
|
||||
/// Text entered only valid when <see cref="DialogResult"/> == <see cref="DialogResult.OK"/>,
|
||||
/// otherwise <see cref="string.Empty"/>
|
||||
/// </summary>
|
||||
public string Filepath => DialogResult == DialogResult.OK ? InputTextBox.Text : string.Empty;
|
||||
public int Filetype => FileTypeComboBox.SelectedIndex;
|
||||
|
||||
public AddFilePrompt(string InitialText) : this(InitialText, -1)
|
||||
public AddFilePrompt(string initialText) : this(initialText, -1)
|
||||
{ }
|
||||
|
||||
public AddFilePrompt(string InitialText, int maxChar)
|
||||
public AddFilePrompt(string initialText, int maxChar)
|
||||
{
|
||||
InitializeComponent();
|
||||
InputTextBox.Text = InitialText;
|
||||
InputTextBox.Text = initialText;
|
||||
InputTextBox.MaxLength = maxChar < 0 ? short.MaxValue : maxChar;
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
|
||||
private void OKBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(FileTypeComboBox.SelectedIndex > -1) DialogResult = DialogResult.OK;
|
||||
if(FileTypeComboBox.SelectedIndex > -1)
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void InputTextBox_KeyDown(object sender, KeyEventArgs e)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
InitializeComponent();
|
||||
ImageList tiles = new ImageList();
|
||||
tiles.ColorDepth = ColorDepth.Depth32Bit;
|
||||
tiles.Images.AddRange(AnimationUtil.tileImages);
|
||||
tiles.Images.AddRange(AnimationResources.tileImages);
|
||||
treeViewBlocks.ImageList = tiles;
|
||||
treeViewItems.ImageList = tiles;
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (AnimationUtil.tileData["blocks"] != null)
|
||||
if (AnimationResources.tileData["blocks"] != null)
|
||||
{
|
||||
foreach (JObject content in AnimationUtil.tileData["blocks"].Children())
|
||||
foreach (JObject content in AnimationResources.tileData["blocks"].Children())
|
||||
{
|
||||
foreach (JProperty prop in content.Properties())
|
||||
{
|
||||
@@ -52,9 +52,9 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
}
|
||||
}
|
||||
}
|
||||
if (AnimationUtil.tileData["items"] != null)
|
||||
if (AnimationResources.tileData["items"] != null)
|
||||
{
|
||||
foreach (JObject content in AnimationUtil.tileData["items"].Children())
|
||||
foreach (JObject content in AnimationResources.tileData["items"].Children())
|
||||
{
|
||||
foreach (JProperty prop in content.Properties())
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.ToolboxItems;
|
||||
@@ -13,16 +14,12 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
public FrameEditor(ImageList texList)
|
||||
{
|
||||
InitializeComponent();
|
||||
label3.Text = "Select a frame and frame time:";
|
||||
FrameList.ImageList = texList;
|
||||
|
||||
int index = 0;
|
||||
foreach (Image frameTex in texList.Images)
|
||||
for (int index = 0; index < texList.Images.Count; index++)
|
||||
{
|
||||
TreeNode frame = new TreeNode($"Frame {index}", index, index);
|
||||
FrameList.Nodes.Add(frame);
|
||||
Console.WriteLine(index);
|
||||
index++;
|
||||
Debug.WriteLine(index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,16 +30,6 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
FrameTimeUpDown.Value = frameTime;
|
||||
}
|
||||
|
||||
private void SaveBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void FrameEditor_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -54,9 +41,10 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
private void CancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,14 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
{
|
||||
public partial class SetBulkSpeed : ThemeForm
|
||||
{
|
||||
public int time => (int)TimeUpDown.Value;
|
||||
public SetBulkSpeed(TreeView treeView)
|
||||
public int Ticks => (int)TimeUpDown.Value;
|
||||
|
||||
public SetBulkSpeed()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -25,7 +26,7 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (time < 0) return;
|
||||
if (Ticks < 0) return;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,20 +9,19 @@ namespace PckStudio
|
||||
/// <summary>
|
||||
/// Text entered <c>only access when DialogResult == DialogResult.OK</c>
|
||||
/// </summary>
|
||||
public string packName => InputTextBox.Text;
|
||||
public string packRes => metroComboBox1.Text;
|
||||
public string PackName => InputTextBox.Text;
|
||||
public string PackRes => metroComboBox1.Text;
|
||||
|
||||
public CreateTexturePack(string InitialText)
|
||||
public CreateTexturePack()
|
||||
{
|
||||
InitializeComponent();
|
||||
InputTextBox.Text = InitialText;
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
|
||||
private void LockPCKButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (metroComboBox1.SelectedIndex < 0) return;
|
||||
DialogResult = DialogResult.OK;
|
||||
if (metroComboBox1.SelectedIndex < 0)
|
||||
return;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,6 @@ namespace PckStudio
|
||||
public MipMapPrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
|
||||
private void OKBtn_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace PckStudio
|
||||
InitializeComponent();
|
||||
InputTextBox.Text = InitialText;
|
||||
InputTextBox.MaxLength = maxChar < 0 ? short.MaxValue : maxChar;
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
}
|
||||
|
||||
private void OKBtn_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
{
|
||||
public partial class TextPrompt : ThemeForm
|
||||
{
|
||||
public string[] TextOutput => DialogResult == DialogResult.OK ? PromptTextBox.Lines : null;
|
||||
public string[] TextOutput => DialogResult == DialogResult.OK ? PromptTextBox.Lines : Array.Empty<string>();
|
||||
public TextPrompt(string[] list = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PckStudio.Forms.Utilities.Skins
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
partial class ANIMEditor
|
||||
{
|
||||
@@ -28,7 +28,8 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.closeButton = new MetroFramework.Controls.MetroButton();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ANIMEditor));
|
||||
this.saveButton = new MetroFramework.Controls.MetroButton();
|
||||
this.effectsGroup = new System.Windows.Forms.GroupBox();
|
||||
this.rightLegOCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.headOCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
@@ -68,8 +69,8 @@
|
||||
this.importButton = new MetroFramework.Controls.MetroButton();
|
||||
this.exportButton = new MetroFramework.Controls.MetroButton();
|
||||
this.animValue = new MetroFramework.Controls.MetroLabel();
|
||||
this.uncheckButton = new MetroFramework.Controls.MetroButton();
|
||||
this.checkButton = new MetroFramework.Controls.MetroButton();
|
||||
this.uncheckAllButton = new MetroFramework.Controls.MetroButton();
|
||||
this.checkAllButton = new MetroFramework.Controls.MetroButton();
|
||||
this.toolTip = new MetroFramework.Components.MetroToolTip();
|
||||
this.resetButton = new MetroFramework.Controls.MetroButton();
|
||||
this.templateButton = new MetroFramework.Controls.MetroButton();
|
||||
@@ -78,16 +79,16 @@
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// closeButton
|
||||
// saveButton
|
||||
//
|
||||
this.closeButton.Location = new System.Drawing.Point(250, 514);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(126, 23);
|
||||
this.closeButton.TabIndex = 1;
|
||||
this.closeButton.Text = "Save";
|
||||
this.closeButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.closeButton.UseSelectable = true;
|
||||
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
|
||||
this.saveButton.Location = new System.Drawing.Point(250, 514);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Size = new System.Drawing.Size(126, 23);
|
||||
this.saveButton.TabIndex = 1;
|
||||
this.saveButton.Text = "Save";
|
||||
this.saveButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.saveButton.UseSelectable = true;
|
||||
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
|
||||
//
|
||||
// effectsGroup
|
||||
//
|
||||
@@ -646,27 +647,27 @@
|
||||
this.animValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.animValue.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// uncheckButton
|
||||
// uncheckAllButton
|
||||
//
|
||||
this.uncheckButton.Location = new System.Drawing.Point(229, 90);
|
||||
this.uncheckButton.Name = "uncheckButton";
|
||||
this.uncheckButton.Size = new System.Drawing.Size(186, 23);
|
||||
this.uncheckButton.TabIndex = 26;
|
||||
this.uncheckButton.Text = "Uncheck All";
|
||||
this.uncheckButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.uncheckButton.UseSelectable = true;
|
||||
this.uncheckButton.Click += new System.EventHandler(this.uncheckButton_Click);
|
||||
this.uncheckAllButton.Location = new System.Drawing.Point(229, 90);
|
||||
this.uncheckAllButton.Name = "uncheckAllButton";
|
||||
this.uncheckAllButton.Size = new System.Drawing.Size(186, 23);
|
||||
this.uncheckAllButton.TabIndex = 26;
|
||||
this.uncheckAllButton.Text = "Uncheck All";
|
||||
this.uncheckAllButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.uncheckAllButton.UseSelectable = true;
|
||||
this.uncheckAllButton.Click += new System.EventHandler(this.uncheckAllButton_Click);
|
||||
//
|
||||
// checkButton
|
||||
// checkAllButton
|
||||
//
|
||||
this.checkButton.Location = new System.Drawing.Point(32, 90);
|
||||
this.checkButton.Name = "checkButton";
|
||||
this.checkButton.Size = new System.Drawing.Size(186, 23);
|
||||
this.checkButton.TabIndex = 27;
|
||||
this.checkButton.Text = "Check All";
|
||||
this.checkButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.checkButton.UseSelectable = true;
|
||||
this.checkButton.Click += new System.EventHandler(this.checkButton_Click);
|
||||
this.checkAllButton.Location = new System.Drawing.Point(32, 90);
|
||||
this.checkAllButton.Name = "checkAllButton";
|
||||
this.checkAllButton.Size = new System.Drawing.Size(186, 23);
|
||||
this.checkAllButton.TabIndex = 27;
|
||||
this.checkAllButton.Text = "Check All";
|
||||
this.checkAllButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.checkAllButton.UseSelectable = true;
|
||||
this.checkAllButton.Click += new System.EventHandler(this.checkAllButton_Click);
|
||||
//
|
||||
// toolTip
|
||||
//
|
||||
@@ -701,29 +702,29 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
this.ClientSize = new System.Drawing.Size(614, 515);
|
||||
this.ClientSize = new System.Drawing.Size(630, 554);
|
||||
this.Controls.Add(this.templateButton);
|
||||
this.Controls.Add(this.effectsGroup);
|
||||
this.Controls.Add(this.resetButton);
|
||||
this.Controls.Add(this.checkButton);
|
||||
this.Controls.Add(this.uncheckButton);
|
||||
this.Controls.Add(this.checkAllButton);
|
||||
this.Controls.Add(this.uncheckAllButton);
|
||||
this.Controls.Add(this.animValue);
|
||||
this.Controls.Add(this.exportButton);
|
||||
this.Controls.Add(this.importButton);
|
||||
this.Controls.Add(this.copyButton);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.effectsGroup2);
|
||||
this.Controls.Add(this.closeButton);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 8.25F);
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.Location = new System.Drawing.Point(0, 0);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(630, 554);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(630, 554);
|
||||
this.Name = "ANIMEditor";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Resizable = false;
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Text = "ANIM Editor";
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.effectsGroup.ResumeLayout(false);
|
||||
this.effectsGroup.PerformLayout();
|
||||
this.effectsGroup2.ResumeLayout(false);
|
||||
@@ -736,7 +737,7 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
private MetroFramework.Controls.MetroButton closeButton;
|
||||
private MetroFramework.Controls.MetroButton saveButton;
|
||||
private System.Windows.Forms.GroupBox effectsGroup;
|
||||
private MetroFramework.Controls.MetroCheckBox headCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox leftLegCheckBox;
|
||||
@@ -776,8 +777,8 @@
|
||||
private MetroFramework.Controls.MetroButton importButton;
|
||||
private MetroFramework.Controls.MetroButton exportButton;
|
||||
private MetroFramework.Controls.MetroLabel animValue;
|
||||
private MetroFramework.Controls.MetroButton uncheckButton;
|
||||
private MetroFramework.Controls.MetroButton checkButton;
|
||||
private MetroFramework.Controls.MetroButton uncheckAllButton;
|
||||
private MetroFramework.Controls.MetroButton checkAllButton;
|
||||
private MetroFramework.Components.MetroToolTip toolTip;
|
||||
private MetroFramework.Controls.MetroButton resetButton;
|
||||
private MetroFramework.Controls.MetroButton templateButton;
|
||||
326
PCK-Studio/Forms/Editor/ANIMEditor.cs
Normal file
326
PCK-Studio/Forms/Editor/ANIMEditor.cs
Normal file
@@ -0,0 +1,326 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using PckStudio.Classes.Utils;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class ANIMEditor : MetroFramework.Forms.MetroForm
|
||||
{
|
||||
public SkinANIM ResultAnim => ruleset.Value;
|
||||
|
||||
private readonly SkinANIM initialANIM;
|
||||
private ANIMRuleSet ruleset;
|
||||
|
||||
sealed class ANIMRuleSet
|
||||
{
|
||||
public SkinANIM Value => anim;
|
||||
public Action<SkinANIM> OnCheckboxChanged;
|
||||
|
||||
private class Bictionary<T1, T2> : Dictionary<T1, T2>
|
||||
{
|
||||
public Bictionary(int capacity)
|
||||
: base(capacity)
|
||||
{ }
|
||||
|
||||
public T1 this[T2 index]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!this.Any(x => x.Value.Equals(index)))
|
||||
throw new KeyNotFoundException();
|
||||
return this.First(x => x.Value.Equals(index)).Key;
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddRange(IEnumerable<(T1, T2)> range)
|
||||
{
|
||||
foreach (var (key, value) in range)
|
||||
{
|
||||
Add(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
private Bictionary<CheckBox, ANIM_EFFECTS> checkBoxLinkage;
|
||||
private SkinANIM anim;
|
||||
private bool ignoreCheckChanged = false;
|
||||
|
||||
public ANIMRuleSet(params (CheckBox, ANIM_EFFECTS)[] linkage)
|
||||
{
|
||||
checkBoxLinkage = new Bictionary<CheckBox, ANIM_EFFECTS>(32);
|
||||
if (linkage.Length < 32)
|
||||
Debug.WriteLine($"Not all {nameof(ANIM_EFFECTS)} are mapped to a given checkbox.");
|
||||
|
||||
checkBoxLinkage.AddRange(linkage);
|
||||
foreach (var (checkbox, _) in linkage)
|
||||
{
|
||||
checkbox.CheckedChanged += checkedChanged;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetAll(bool state)
|
||||
{
|
||||
foreach (var item in checkBoxLinkage)
|
||||
{
|
||||
IgnoreAndDo(item.Key, checkbox =>
|
||||
{
|
||||
anim.SetFlag(item.Value, state);
|
||||
checkbox.Checked = state;
|
||||
checkbox.Enabled = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal void ApplyAnim(SkinANIM anim)
|
||||
{
|
||||
this.anim = anim;
|
||||
foreach (var item in checkBoxLinkage)
|
||||
item.Key.Enabled = true;
|
||||
foreach (var item in checkBoxLinkage)
|
||||
{
|
||||
item.Key.Checked = anim.GetFlag(item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!ignoreCheckChanged && sender is CheckBox checkBox && checkBoxLinkage.ContainsKey(checkBox))
|
||||
{
|
||||
switch (checkBoxLinkage[checkBox])
|
||||
{
|
||||
case ANIM_EFFECTS.HEAD_DISABLED:
|
||||
checkBoxLinkage[ANIM_EFFECTS.FORCE_HEAD_ARMOR].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
case ANIM_EFFECTS.BODY_DISABLED:
|
||||
checkBoxLinkage[ANIM_EFFECTS.FORCE_BODY_ARMOR].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
case ANIM_EFFECTS.LEFT_LEG_DISABLED:
|
||||
checkBoxLinkage[ANIM_EFFECTS.FORCE_LEFT_LEG_ARMOR].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
case ANIM_EFFECTS.RIGHT_LEG_DISABLED:
|
||||
checkBoxLinkage[ANIM_EFFECTS.FORCE_RIGHT_LEG_ARMOR].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
case ANIM_EFFECTS.LEFT_ARM_DISABLED:
|
||||
checkBoxLinkage[ANIM_EFFECTS.FORCE_LEFT_ARM_ARMOR].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
case ANIM_EFFECTS.RIGHT_ARM_DISABLED:
|
||||
checkBoxLinkage[ANIM_EFFECTS.FORCE_RIGHT_ARM_ARMOR].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
|
||||
case ANIM_EFFECTS.RESOLUTION_64x64:
|
||||
Uncheck(checkBoxLinkage[ANIM_EFFECTS.SLIM_MODEL]);
|
||||
checkBoxLinkage[ANIM_EFFECTS.SLIM_MODEL].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
|
||||
case ANIM_EFFECTS.SLIM_MODEL:
|
||||
Uncheck(checkBoxLinkage[ANIM_EFFECTS.RESOLUTION_64x64]);
|
||||
checkBoxLinkage[ANIM_EFFECTS.RESOLUTION_64x64].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
anim.SetFlag(checkBoxLinkage[checkBox], checkBox.Checked && checkBox.Enabled);
|
||||
OnCheckboxChanged?.Invoke(anim);
|
||||
}
|
||||
}
|
||||
|
||||
private void Uncheck(CheckBox checkBox)
|
||||
{
|
||||
checkBox.Checked = false;
|
||||
}
|
||||
|
||||
private void IgnoreAndDo(CheckBox checkBox, Action<CheckBox> action)
|
||||
{
|
||||
ignoreCheckChanged = true;
|
||||
action.Invoke(checkBox);
|
||||
ignoreCheckChanged = false;
|
||||
}
|
||||
}
|
||||
|
||||
public ANIMEditor(string ANIM)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (!SkinANIM.IsValidANIM(ANIM))
|
||||
{
|
||||
DialogResult = DialogResult.Abort;
|
||||
Close();
|
||||
}
|
||||
var anim = initialANIM = SkinANIM.FromString(ANIM);
|
||||
ruleset = new ANIMRuleSet(
|
||||
(bobbingCheckBox, ANIM_EFFECTS.HEAD_BOBBING_DISABLED),
|
||||
(bodyCheckBox, ANIM_EFFECTS.BODY_DISABLED),
|
||||
(bodyOCheckBox, ANIM_EFFECTS.BODY_OVERLAY_DISABLED),
|
||||
(chestplateCheckBox, ANIM_EFFECTS.FORCE_BODY_ARMOR),
|
||||
(classicCheckBox, ANIM_EFFECTS.RESOLUTION_64x64),
|
||||
(crouchCheckBox, ANIM_EFFECTS.DO_BACKWARDS_CROUCH),
|
||||
(dinnerboneCheckBox, ANIM_EFFECTS.DINNERBONE),
|
||||
(headCheckBox, ANIM_EFFECTS.HEAD_DISABLED),
|
||||
(headOCheckBox, ANIM_EFFECTS.HEAD_OVERLAY_DISABLED),
|
||||
(helmetCheckBox, ANIM_EFFECTS.FORCE_HEAD_ARMOR),
|
||||
(leftArmCheckBox, ANIM_EFFECTS.LEFT_ARM_DISABLED),
|
||||
(leftArmOCheckBox, ANIM_EFFECTS.LEFT_ARM_OVERLAY_DISABLED),
|
||||
(leftArmorCheckBox, ANIM_EFFECTS.FORCE_LEFT_ARM_ARMOR),
|
||||
(leftLegCheckBox, ANIM_EFFECTS.LEFT_LEG_DISABLED),
|
||||
(leftLeggingCheckBox, ANIM_EFFECTS.FORCE_LEFT_LEG_ARMOR),
|
||||
(leftLegOCheckBox, ANIM_EFFECTS.LEFT_LEG_OVERLAY_DISABLED),
|
||||
(noArmorCheckBox, ANIM_EFFECTS.ALL_ARMOR_DISABLED),
|
||||
(rightArmCheckBox, ANIM_EFFECTS.RIGHT_ARM_DISABLED),
|
||||
(rightArmOCheckBox, ANIM_EFFECTS.RIGHT_ARM_OVERLAY_DISABLED),
|
||||
(rightArmorCheckBox, ANIM_EFFECTS.FORCE_RIGHT_ARM_ARMOR),
|
||||
(rightLegCheckBox, ANIM_EFFECTS.RIGHT_LEG_DISABLED),
|
||||
(rightLeggingCheckBox, ANIM_EFFECTS.FORCE_RIGHT_LEG_ARMOR),
|
||||
(rightLegOCheckBox, ANIM_EFFECTS.RIGHT_LEG_OVERLAY_DISABLED),
|
||||
(santaCheckBox, ANIM_EFFECTS.BAD_SANTA),
|
||||
(slimCheckBox, ANIM_EFFECTS.SLIM_MODEL),
|
||||
(staticArmsCheckBox, ANIM_EFFECTS.STATIC_ARMS),
|
||||
(staticLegsCheckBox, ANIM_EFFECTS.STATIC_LEGS),
|
||||
(statueCheckBox, ANIM_EFFECTS.STATUE_OF_LIBERTY),
|
||||
(syncArmsCheckBox, ANIM_EFFECTS.SYNCED_ARMS),
|
||||
(syncLegsCheckBox, ANIM_EFFECTS.SYNCED_LEGS),
|
||||
(unknownCheckBox, ANIM_EFFECTS.__BIT_4),
|
||||
(zombieCheckBox, ANIM_EFFECTS.ZOMBIE_ARMS)
|
||||
);
|
||||
ruleset.OnCheckboxChanged = setDisplayAnim;
|
||||
setDisplayAnim(anim);
|
||||
ruleset.ApplyAnim(anim);
|
||||
}
|
||||
|
||||
private void setDisplayAnim(SkinANIM anim)
|
||||
{
|
||||
animValue.Text = anim.ToString();
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void copyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.SetText(animValue.Text);
|
||||
}
|
||||
|
||||
private void importButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string value = string.Empty;
|
||||
while (!SkinANIM.IsValidANIM(value))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(value)) MessageBox.Show($"The following value \"{value}\" is not valid. Please try again.");
|
||||
RenamePrompt diag = new RenamePrompt(value);
|
||||
diag.TextLabel.Text = "ANIM";
|
||||
diag.RenameButton.Text = "Ok";
|
||||
if (diag.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = diag.NewText;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
ruleset.ApplyAnim(SkinANIM.FromString(value));
|
||||
}
|
||||
|
||||
private void uncheckAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ruleset.SetAll(false);
|
||||
}
|
||||
|
||||
private void checkAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ruleset.SetAll(true);
|
||||
}
|
||||
|
||||
private void exportButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using SaveFileDialog saveFileDialog = new SaveFileDialog
|
||||
{
|
||||
FileName = animValue.Text + ".png",
|
||||
Filter = "Skin textures|*.png"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
bool isSlim = ruleset.Value.GetFlag(ANIM_EFFECTS.SLIM_MODEL);
|
||||
bool is64x64 = ruleset.Value.GetFlag(ANIM_EFFECTS.RESOLUTION_64x64);
|
||||
bool isClassic32 = !isSlim && !is64x64;
|
||||
|
||||
Image skin = isSlim ? Properties.Resources.slim_template : Properties.Resources.classic_template;
|
||||
|
||||
Size imgSize = new Size(64, isClassic32 ? 32 : 64);
|
||||
|
||||
Bitmap img = new Bitmap(imgSize.Width, imgSize.Height);
|
||||
using (Graphics graphic = Graphics.FromImage(img))
|
||||
{
|
||||
graphic.DrawImage(skin, new Rectangle(Point.Empty, imgSize), new Rectangle(Point.Empty, imgSize), GraphicsUnit.Pixel);
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.HEAD_OVERLAY_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(32, 0, 32, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.HEAD_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 0, 32, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.BODY_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(16, 16, 24, 16));
|
||||
if (img.Height == 64)
|
||||
{
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(40, 16, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 16, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.BODY_OVERLAY_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(16, 32, 24, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.RIGHT_ARM_OVERLAY_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(40, 32, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.RIGHT_LEG_OVERLAY_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 32, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.LEFT_LEG_OVERLAY_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 48, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(16, 48, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(32, 48, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.LEFT_ARM_OVERLAY_DISABLED)) graphic.FillRectangle(Brushes.Magenta, new Rectangle(48, 48, 16, 16));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since both classic 32 arms and legs use the same texture, removing the texture would remove both limbs instead of just one.
|
||||
// So both must be disabled by the user before they're removed from the texture;
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED) && ruleset.Value.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(40, 16, 16, 16));
|
||||
if (ruleset.Value.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED) && ruleset.Value.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 16, 16, 16));
|
||||
}
|
||||
img.MakeTransparent(Color.Magenta);
|
||||
skin = img;
|
||||
}
|
||||
skin.Save(saveFileDialog.FileName);
|
||||
}
|
||||
|
||||
private void resetButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ruleset.ApplyAnim((SkinANIM)initialANIM.Clone());
|
||||
}
|
||||
|
||||
static readonly Dictionary<string, ANIM_EFFECTS> Templates = new Dictionary<string, ANIM_EFFECTS>()
|
||||
{
|
||||
{ "Steve (64x32)", ANIM_EFFECTS.NONE },
|
||||
{ "Steve (64x64)", ANIM_EFFECTS.RESOLUTION_64x64 },
|
||||
{ "Alex (64x64)", ANIM_EFFECTS.SLIM_MODEL },
|
||||
{ "Zombie Skins", ANIM_EFFECTS.ZOMBIE_ARMS },
|
||||
{ "Cetacean Skins", ANIM_EFFECTS.SYNCED_ARMS | ANIM_EFFECTS.SYNCED_LEGS },
|
||||
{ "Ski Skins", ANIM_EFFECTS.SYNCED_ARMS | ANIM_EFFECTS.STATIC_LEGS },
|
||||
{ "Ghost Skins", ANIM_EFFECTS.STATIC_LEGS | ANIM_EFFECTS.ZOMBIE_ARMS },
|
||||
{ "Medusa (Greek Myth.)", ANIM_EFFECTS.SYNCED_LEGS },
|
||||
{ "Librarian (Halo)", ANIM_EFFECTS.STATIC_LEGS },
|
||||
{ "Grim Reaper (Halloween)", ANIM_EFFECTS.STATIC_LEGS | ANIM_EFFECTS.STATIC_ARMS }
|
||||
};
|
||||
|
||||
private void templateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var diag = new ItemSelectionPopUp(Templates.Keys.ToArray());
|
||||
diag.label2.Text = "Presets";
|
||||
diag.okBtn.Text = "Load";
|
||||
|
||||
if (diag.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var templateANIM = new SkinANIM(Templates[diag.SelectedItem]);
|
||||
DialogResult prompt = MessageBox.Show(this, "Would you like to add this preset's effects to your current ANIM? Otherwise all of your effects will be cleared. Either choice can be undone by pressing \"Restore ANIM\".", "", MessageBoxButtons.YesNo);
|
||||
if (prompt == DialogResult.Yes)
|
||||
templateANIM = ruleset.Value | templateANIM;
|
||||
ruleset.ApplyAnim(templateANIM);
|
||||
}
|
||||
}
|
||||
}
|
||||
2630
PCK-Studio/Forms/Editor/ANIMEditor.resx
Normal file
2630
PCK-Studio/Forms/Editor/ANIMEditor.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -14,11 +14,11 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
public int FrameCount => frames.Count;
|
||||
|
||||
public int FrameTextureCount => frameTextures.Count;
|
||||
public int TextureCount => frameTextures.Count;
|
||||
|
||||
public Frame this[int frameIndex] => frames[frameIndex];
|
||||
|
||||
// not implemented rn...
|
||||
// TODO: implement this
|
||||
public bool Interpolate { get; set; } = false;
|
||||
|
||||
private readonly List<Image> frameTextures;
|
||||
@@ -41,8 +41,6 @@ namespace PckStudio.Forms.Editor
|
||||
public readonly Image Texture;
|
||||
public int Ticks;
|
||||
|
||||
public static implicit operator Image(Frame f) => f.Texture;
|
||||
|
||||
public Frame(Image texture) : this(texture, MinimumFrameTime)
|
||||
{ }
|
||||
|
||||
@@ -53,39 +51,37 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
}
|
||||
|
||||
public void ParseAnim(string ANIM)
|
||||
private void ParseAnim(string ANIM)
|
||||
{
|
||||
_ = ANIM ?? throw new ArgumentNullException(nameof(ANIM));
|
||||
ANIM = (Interpolate = ANIM.StartsWith("#")) ? ANIM.Substring(1) : ANIM;
|
||||
string[] animData = ANIM.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
int lastFrameTime = MinimumFrameTime;
|
||||
if (animData.Length <= 0)
|
||||
{
|
||||
for (int i = 0; i < FrameTextureCount; i++)
|
||||
for (int i = 0; i < TextureCount; i++)
|
||||
{
|
||||
AddFrame(i, MinimumFrameTime);
|
||||
AddFrame(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
foreach (string frameInfo in animData)
|
||||
{
|
||||
foreach (string frameInfo in animData)
|
||||
{
|
||||
string[] frameData = frameInfo.Split('*');
|
||||
//if (frameData.Length < 2)
|
||||
// continue; // shouldn't happen
|
||||
int currentFrameIndex = int.TryParse(frameData[0], out currentFrameIndex) ? currentFrameIndex : 0;
|
||||
string[] frameData = frameInfo.Split('*');
|
||||
//if (frameData.Length < 2)
|
||||
// continue; // shouldn't happen
|
||||
int currentFrameIndex = 0;
|
||||
int.TryParse(frameData[0], out currentFrameIndex);
|
||||
|
||||
// Some textures like the Halloween 2015's Lava texture don't have a
|
||||
// frame time parameter for certain frames.
|
||||
// This will detect that and place the last frame time in its place.
|
||||
// This is accurate to console edition behavior.
|
||||
// - MattNL
|
||||
int currentFrameTime = string.IsNullOrEmpty(frameData[1]) ? lastFrameTime : int.Parse(frameData[1]);
|
||||
AddFrame(currentFrameIndex, currentFrameTime);
|
||||
lastFrameTime = currentFrameTime;
|
||||
}
|
||||
// Some textures like the Halloween 2015's Lava texture don't have a
|
||||
// frame time parameter for certain frames.
|
||||
// This will detect that and place the last frame time in its place.
|
||||
// This is accurate to console edition behavior.
|
||||
// - MattNL
|
||||
int currentFrameTime = string.IsNullOrEmpty(frameData[1]) ? lastFrameTime : int.Parse(frameData[1]);
|
||||
AddFrame(currentFrameIndex, currentFrameTime);
|
||||
lastFrameTime = currentFrameTime;
|
||||
}
|
||||
}
|
||||
|
||||
public Frame AddFrame(int frameTextureIndex) => AddFrame(frameTextureIndex, MinimumFrameTime);
|
||||
public Frame AddFrame(int frameTextureIndex, int frameTime)
|
||||
{
|
||||
@@ -131,7 +127,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(Interpolate ? "#" : string.Empty);
|
||||
foreach (var frame in frames)
|
||||
stringBuilder.Append($"{GetTextureIndex(frame)}*{frame.Ticks},");
|
||||
stringBuilder.Append($"{GetTextureIndex(frame.Texture)}*{frame.Ticks},");
|
||||
return stringBuilder.ToString(0, stringBuilder.Length - 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace PckStudio.Forms.Editor
|
||||
AnimationPlayer player;
|
||||
|
||||
bool isItem = false;
|
||||
string animationSection => AnimationUtil.GetAnimationSection(isItem);
|
||||
string animationSection => AnimationResources.GetAnimationSection(isItem);
|
||||
|
||||
public string TileName = string.Empty;
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace PckStudio.Forms.Editor
|
||||
: new Animation(frameTextures);
|
||||
player = new AnimationPlayer(pictureBoxWithInterpolationMode1);
|
||||
|
||||
foreach (JObject content in AnimationUtil.tileData[animationSection].Children())
|
||||
foreach (JObject content in AnimationResources.tileData[animationSection].Children())
|
||||
{
|
||||
var prop = content.Properties().FirstOrDefault(prop => prop.Name == TileName);
|
||||
if (prop is JProperty)
|
||||
@@ -265,15 +265,10 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void bulkAnimationSpeedToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetBulkSpeed diag = new SetBulkSpeed(frameTreeView);
|
||||
if(diag.ShowDialog(this) == DialogResult.OK)
|
||||
SetBulkSpeed diag = new SetBulkSpeed();
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
var list = currentAnimation.GetFrames();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
Animation.Frame f = list[i];
|
||||
currentAnimation.SetFrame(f, currentAnimation.GetTextureIndex(f), diag.time);
|
||||
}
|
||||
currentAnimation.GetFrames().ForEach(frame => frame.Ticks = diag.Ticks);
|
||||
LoadAnimationTreeView();
|
||||
}
|
||||
diag.Dispose();
|
||||
@@ -338,7 +333,7 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < new_animation.FrameTextureCount; i++)
|
||||
for (int i = 0; i < new_animation.TextureCount; i++)
|
||||
{
|
||||
new_animation.AddFrame(i, frameTime);
|
||||
}
|
||||
@@ -370,7 +365,7 @@ namespace PckStudio.Forms.Editor
|
||||
exportJavaAnimationToolStripMenuItem.Enabled =
|
||||
InterpolationCheckbox.Visible = !IsEditingSpecial;
|
||||
|
||||
foreach (JObject content in AnimationUtil.tileData[animationSection].Children())
|
||||
foreach (JObject content in AnimationResources.tileData[animationSection].Children())
|
||||
{
|
||||
var first = content.Properties().FirstOrDefault(p => p.Name == TileName);
|
||||
if (first is JProperty p) tileLabel.Text = (string)p.Value;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
Monitor.Enter(_animation);
|
||||
Animation.Frame frame = _animation[frameIndex];
|
||||
display.Image = frame;
|
||||
display.Image = frame.Texture;
|
||||
Monitor.Exit(_animation);
|
||||
return frame;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace PckStudio.Forms.Editor
|
||||
audioPCK = file;
|
||||
using (var stream = new MemoryStream(file.Data))
|
||||
{
|
||||
audioFile = PCKAudioFileReader.Read(stream, isLittleEndian);
|
||||
var reader = new PCKAudioFileReader(isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
audioFile = reader.FromStream(stream);
|
||||
}
|
||||
|
||||
SetUpTree();
|
||||
@@ -397,7 +398,8 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
PCKAudioFileWriter.Write(stream, audioFile, _isLittleEndian);
|
||||
var writer = new PCKAudioFileWriter(audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
audioPCK.SetData(stream.ToArray());
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
@@ -28,13 +28,13 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
TreeNode EntryNode = new TreeNode(entry.name);
|
||||
|
||||
foreach (JObject content in Utilities.BehaviourUtil.entityData["entities"].Children())
|
||||
foreach (JObject content in Utilities.BehaviourResources.entityData["entities"].Children())
|
||||
{
|
||||
var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.name);
|
||||
if (prop is JProperty)
|
||||
{
|
||||
EntryNode.Text = (string)prop.Value;
|
||||
EntryNode.ImageIndex = Utilities.BehaviourUtil.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
EntryNode.ImageIndex = Utilities.BehaviourResources.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
EntryNode.SelectedImageIndex = EntryNode.ImageIndex;
|
||||
break;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
|
||||
treeView1.ImageList = new ImageList();
|
||||
treeView1.ImageList.Images.AddRange(Utilities.BehaviourUtil.entityImages);
|
||||
treeView1.ImageList.Images.AddRange(Utilities.BehaviourResources.entityImages);
|
||||
treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
SetUpTree();
|
||||
}
|
||||
@@ -149,7 +149,7 @@ namespace PckStudio.Forms.Editor
|
||||
if (treeView1.SelectedNode == null) return;
|
||||
if (!(treeView1.SelectedNode.Tag is BehaviourFile.RiderPositionOverride entry)) return;
|
||||
|
||||
var diag = new Additional_Popups.EntityForms.AddEntry(Utilities.BehaviourUtil.entityData, Utilities.BehaviourUtil.entityImages);
|
||||
var diag = new Additional_Popups.EntityForms.AddEntry(Utilities.BehaviourResources.entityData, Utilities.BehaviourResources.entityImages);
|
||||
diag.acceptBtn.Text = "Save";
|
||||
|
||||
if (diag.ShowDialog() == DialogResult.OK)
|
||||
@@ -164,13 +164,13 @@ namespace PckStudio.Forms.Editor
|
||||
entry.name = diag.SelectedEntity;
|
||||
treeView1.SelectedNode.Tag = entry;
|
||||
|
||||
foreach (JObject content in Utilities.BehaviourUtil.entityData["entities"].Children())
|
||||
foreach (JObject content in Utilities.BehaviourResources.entityData["entities"].Children())
|
||||
{
|
||||
var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.name);
|
||||
if (prop is JProperty)
|
||||
{
|
||||
treeView1.SelectedNode.Text = (string)prop.Value;
|
||||
treeView1.SelectedNode.ImageIndex = Utilities.BehaviourUtil.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
treeView1.SelectedNode.ImageIndex = Utilities.BehaviourResources.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
treeView1.SelectedNode.SelectedImageIndex = treeView1.SelectedNode.ImageIndex;
|
||||
break;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void addNewEntryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var diag = new AddEntry(Utilities.BehaviourUtil.entityData, Utilities.BehaviourUtil.entityImages);
|
||||
var diag = new AddEntry(Utilities.BehaviourResources.entityData, Utilities.BehaviourResources.entityImages);
|
||||
|
||||
if(diag.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@@ -217,13 +217,13 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
TreeNode NewOverrideNode = new TreeNode(NewOverride.name);
|
||||
NewOverrideNode.Tag = NewOverride;
|
||||
foreach (JObject content in Utilities.BehaviourUtil.entityData["entities"].Children())
|
||||
foreach (JObject content in Utilities.BehaviourResources.entityData["entities"].Children())
|
||||
{
|
||||
var prop = content.Properties().FirstOrDefault(prop => prop.Name == NewOverride.name);
|
||||
if (prop is JProperty)
|
||||
{
|
||||
NewOverrideNode.Text = (string)prop.Value;
|
||||
NewOverrideNode.ImageIndex = Utilities.BehaviourUtil.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
NewOverrideNode.ImageIndex = Utilities.BehaviourResources.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
NewOverrideNode.SelectedImageIndex = NewOverrideNode.ImageIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace PckStudio.Forms.Utilities.Skins
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
partial class BoxEditor
|
||||
{
|
||||
@@ -1,9 +1,10 @@
|
||||
using PckStudio.ToolboxItems;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Forms.Utilities.Skins
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class BoxEditor : ThemeForm
|
||||
{
|
||||
@@ -12,13 +13,12 @@ namespace PckStudio.Forms.Utilities.Skins
|
||||
class BOX
|
||||
{
|
||||
public string Parent;
|
||||
public (float X, float Y, float Z) Pos;
|
||||
public (float X, float Y, float Z) Size;
|
||||
public float uvX, uvY;
|
||||
public Vector3 Pos;
|
||||
public Vector3 Size;
|
||||
public float U, V;
|
||||
public bool HideWithArmor;
|
||||
public bool Mirror;
|
||||
public float Inflation;
|
||||
|
||||
public BOX(string input)
|
||||
{
|
||||
string[] arguments = Regex.Split(input, @"\s+");
|
||||
@@ -26,16 +26,12 @@ namespace PckStudio.Forms.Utilities.Skins
|
||||
try
|
||||
{
|
||||
Parent = arguments[0].ToUpper(); // just in case a box has all lower, the editor still parses correctly
|
||||
Pos.X = float.Parse(arguments[1]);
|
||||
Pos.Y = float.Parse(arguments[2]);
|
||||
Pos.Z = float.Parse(arguments[3]);
|
||||
Size.X = float.Parse(arguments[4]);
|
||||
Size.Y = float.Parse(arguments[5]);
|
||||
Size.Z = float.Parse(arguments[6]);
|
||||
uvX = float.Parse(arguments[7]);
|
||||
uvY = float.Parse(arguments[8]);
|
||||
HideWithArmor = Convert.ToBoolean(Int32.Parse(arguments[9]));
|
||||
Mirror = Convert.ToBoolean(Int32.Parse(arguments[10]));
|
||||
Pos = new Vector3(float.Parse(arguments[1]), float.Parse(arguments[2]), float.Parse(arguments[3]));
|
||||
Size = new Vector3(float.Parse(arguments[4]), float.Parse(arguments[5]), float.Parse(arguments[6]));
|
||||
U = float.Parse(arguments[7]);
|
||||
V = float.Parse(arguments[8]);
|
||||
HideWithArmor = Convert.ToBoolean(int.Parse(arguments[9]));
|
||||
Mirror = Convert.ToBoolean(int.Parse(arguments[10]));
|
||||
Inflation = float.Parse(arguments[11]);
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
@@ -71,8 +67,8 @@ namespace PckStudio.Forms.Utilities.Skins
|
||||
SizeXUpDown.Value = (decimal)box.Size.X;
|
||||
SizeYUpDown.Value = (decimal)box.Size.Y;
|
||||
SizeZUpDown.Value = (decimal)box.Size.Z;
|
||||
uvXUpDown.Value = (decimal)box.uvX;
|
||||
uvYUpDown.Value = (decimal)box.uvY;
|
||||
uvXUpDown.Value = (decimal)box.U;
|
||||
uvYUpDown.Value = (decimal)box.V;
|
||||
armorCheckBox.Checked = box.HideWithArmor;
|
||||
mirrorCheckBox.Checked = box.Mirror;
|
||||
inflationUpDown.Value = (decimal)box.Inflation;
|
||||
6
PCK-Studio/Forms/Editor/LOCEditor.Designer.cs
generated
6
PCK-Studio/Forms/Editor/LOCEditor.Designer.cs
generated
@@ -40,7 +40,8 @@
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.locSort = new PckStudio.Forms.MyTablePanel();
|
||||
this.locSort = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.buttonReplaceAll = new System.Windows.Forms.Button();
|
||||
this.dataGridViewLocEntryData = new System.Windows.Forms.DataGridView();
|
||||
this.textBoxReplaceAll = new System.Windows.Forms.TextBox();
|
||||
this.treeViewLocKeys = new System.Windows.Forms.TreeView();
|
||||
@@ -219,7 +220,8 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem addDisplayIDToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteDisplayIDToolStripMenuItem;
|
||||
private System.Windows.Forms.TextBox textBoxReplaceAll;
|
||||
private PckStudio.Forms.MyTablePanel locSort;
|
||||
private System.Windows.Forms.TableLayoutPanel locSort;
|
||||
private System.Windows.Forms.Button buttonReplaceAll;
|
||||
private MetroFramework.Controls.MetroContextMenu GridContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem addLanguageToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeLanguageToolStripMenuItem;
|
||||
|
||||
@@ -138,7 +138,8 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
LOCFileWriter.Write(ms, currentLoc);
|
||||
var writer = new LOCFileWriter(currentLoc, 2);
|
||||
writer.WriteToStream(ms);
|
||||
_file.SetData(ms.ToArray());
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
@@ -27,13 +27,13 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
TreeNode EntryNode = new TreeNode(entry.Name);
|
||||
|
||||
foreach (JObject content in Utilities.MaterialUtil.entityData["entities"].Children())
|
||||
foreach (JObject content in Utilities.MaterialResources.entityData["entities"].Children())
|
||||
{
|
||||
var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.Name);
|
||||
if (prop is JProperty)
|
||||
{
|
||||
EntryNode.Text = (string)prop.Value;
|
||||
EntryNode.ImageIndex = Utilities.MaterialUtil.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
EntryNode.ImageIndex = Utilities.MaterialResources.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
EntryNode.SelectedImageIndex = EntryNode.ImageIndex;
|
||||
break;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
|
||||
treeView1.ImageList = new ImageList();
|
||||
Utilities.MaterialUtil.entityImages.ToList().ForEach(img => treeView1.ImageList.Images.Add(img));
|
||||
Utilities.MaterialResources.entityImages.ToList().ForEach(img => treeView1.ImageList.Images.Add(img));
|
||||
treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
SetUpTree();
|
||||
}
|
||||
@@ -132,7 +132,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void addToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var diag = new Additional_Popups.EntityForms.AddEntry(Utilities.MaterialUtil.entityData, Utilities.MaterialUtil.entityImages);
|
||||
var diag = new Additional_Popups.EntityForms.AddEntry(Utilities.MaterialResources.entityData, Utilities.MaterialResources.entityImages);
|
||||
|
||||
if (diag.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@@ -146,13 +146,13 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
TreeNode NewEntryNode = new TreeNode(NewEntry.Name);
|
||||
NewEntryNode.Tag = NewEntry;
|
||||
foreach (JObject content in Utilities.MaterialUtil.entityData["entities"].Children())
|
||||
foreach (JObject content in Utilities.MaterialResources.entityData["entities"].Children())
|
||||
{
|
||||
var prop = content.Properties().FirstOrDefault(prop => prop.Name == NewEntry.Name);
|
||||
if (prop is JProperty)
|
||||
{
|
||||
NewEntryNode.Text = (string)prop.Value;
|
||||
NewEntryNode.ImageIndex = Utilities.MaterialUtil.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
NewEntryNode.ImageIndex = Utilities.MaterialResources.entityData["entities"].Children().ToList().IndexOf(content);
|
||||
NewEntryNode.SelectedImageIndex = NewEntryNode.ImageIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using PckStudio.Classes._3ds.Utils;
|
||||
using PckStudio.ToolboxItems;
|
||||
using OMI.Formats.Languages;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Forms.Editor;
|
||||
|
||||
namespace PckStudio
|
||||
{
|
||||
@@ -378,10 +379,10 @@ namespace PckStudio
|
||||
|
||||
private void EditSkinButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using Forms.Utilities.Skins.ANIMEditor diag = new Forms.Utilities.Skins.ANIMEditor(anim.ToString());
|
||||
if (diag.ShowDialog(this) == DialogResult.OK && diag.saved)
|
||||
using ANIMEditor diag = new ANIMEditor(anim.ToString());
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
anim = new SkinANIM(diag.outANIM);
|
||||
anim = diag.ResultAnim;
|
||||
DrawModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
this.tabBody = new System.Windows.Forms.TabControl();
|
||||
this.tabArmor = new System.Windows.Forms.TabPage();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.myTablePanel2 = new PckStudio.Forms.MyTablePanel();
|
||||
this.myTablePanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.offsetArms = new System.Windows.Forms.TextBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.offsetBody = new System.Windows.Forms.TextBox();
|
||||
@@ -637,7 +637,7 @@
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TabControl tabBody;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private Forms.MyTablePanel myTablePanel2;
|
||||
private System.Windows.Forms.TableLayoutPanel myTablePanel2;
|
||||
private System.Windows.Forms.TextBox offsetArms;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.TextBox offsetBody;
|
||||
|
||||
@@ -10,25 +10,12 @@ using OMI.Formats.Pck;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public static class AnimationUtil
|
||||
public static class AnimationResources
|
||||
{
|
||||
public static string GetAnimationSection(bool isItem) => isItem ? "items" : "blocks";
|
||||
|
||||
public static readonly JObject tileData = JObject.Parse(Resources.tileData);
|
||||
private static Image[] _tileImages;
|
||||
|
||||
public static Image[] tileImages => _tileImages ??= Resources.terrain_sheet.CreateImageList(16).Concat(Resources.items_sheet.CreateImageList(16)).ToArray();
|
||||
|
||||
public static PckFile.FileData CreateNewAnimationFile(Image source, string tileName, bool isItem)
|
||||
{
|
||||
PckFile.FileData file = new PckFile.FileData($"res/textures/{GetAnimationSection(isItem)}/{tileName}.png", PckFile.FileData.FileType.TextureFile);
|
||||
file.Properties.Add(("ANIM", string.Empty));
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
source.Save(stream, ImageFormat.Png);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,28 +8,23 @@ using PckStudio.Classes.Extentions;
|
||||
using OMI.Formats.Behaviour;
|
||||
using OMI.Workers.Behaviour;
|
||||
using OMI.Formats.Pck;
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public static class BehaviourUtil
|
||||
public static class BehaviourResources
|
||||
{
|
||||
public static readonly JObject entityData = JObject.Parse(Resources.entityBehaviourData);
|
||||
private static Image[] _entityImages;
|
||||
|
||||
public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray();
|
||||
|
||||
public static PckFile.FileData CreateNewBehaviourFile()
|
||||
internal static byte[] BehaviourFileInitializer()
|
||||
{
|
||||
PckFile.FileData file = new PckFile.FileData($"behaviours.bin", PckFile.FileData.FileType.BehavioursFile);
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var writer = new BehavioursWriter(new BehaviourFile());
|
||||
writer.WriteToStream(stream);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
|
||||
return file;
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new BehavioursWriter(new BehaviourFile());
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
PCK-Studio/Forms/Utilities/MaterialResources.cs
Normal file
33
PCK-Studio/Forms/Utilities/MaterialResources.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Classes.Extentions;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Formats.Material;
|
||||
using OMI.Workers.Material;
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public static class MaterialResources
|
||||
{
|
||||
public static readonly JObject entityData = JObject.Parse(Resources.entityMaterialData);
|
||||
private static Image[] _entityImages;
|
||||
public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray();
|
||||
|
||||
public static byte[] MaterialsFileInitializer()
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
var matFile = new MaterialContainer
|
||||
{
|
||||
new MaterialContainer.Material("bat", "entity_alphatest")
|
||||
};
|
||||
var writer = new MaterialFileWriter(matFile);
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Classes.Extentions;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Formats.Material;
|
||||
using OMI.Workers.Material;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public static class MaterialUtil
|
||||
{
|
||||
public static readonly JObject entityData = JObject.Parse(Resources.entityMaterialData);
|
||||
private static Image[] _entityImages;
|
||||
public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray();
|
||||
|
||||
public static PckFile.FileData CreateNewMaterialsFile()
|
||||
{
|
||||
PckFile.FileData file = new PckFile.FileData($"entityMaterials.bin", PckFile.FileData.FileType.MaterialFile);
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var matFile = new MaterialContainer
|
||||
{
|
||||
new MaterialContainer.Material("bat", "entity_alphatest")
|
||||
};
|
||||
var writer = new MaterialFileWriter(matFile);
|
||||
writer.WriteToStream(stream);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,25 +11,19 @@ using OMI.Workers.Model;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public static class ModelsUtil
|
||||
public static class ModelsResources
|
||||
{
|
||||
public static readonly JObject entityData = JObject.Parse(Resources.entityModelData);
|
||||
private static Image[] _entityImages;
|
||||
|
||||
public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray();
|
||||
|
||||
public static PckFile.FileData CreateNewModelsFile()
|
||||
public static byte[] ModelsFileInitializer()
|
||||
{
|
||||
PckFile.FileData file = new PckFile.FileData($"models.bin", PckFile.FileData.FileType.ModelsFile);
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var writer = new ModelFileWriter(new ModelContainer());
|
||||
writer.WriteToStream(stream);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
|
||||
return file;
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new ModelFileWriter(new ModelContainer());
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="buttonClose.Text" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
</data>
|
||||
<data name="buttonDonate.Text" xml:space="preserve">
|
||||
<value>セーブ</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="resource.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="metroLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>81, 19</value>
|
||||
</data>
|
||||
<data name="metroLabel1.Text" xml:space="preserve">
|
||||
<value>Webサーバー</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>167, 19</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Text" xml:space="preserve">
|
||||
<value>PCKホスティングWebサーバー</value>
|
||||
</data>
|
||||
<data name="resource.ImeMode1" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>環境設定</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,348 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="metroLabel1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="metroLabel1.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="metroLabel1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 71</value>
|
||||
</data>
|
||||
<data name="metroLabel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>72, 19</value>
|
||||
</data>
|
||||
<data name="metroLabel1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="metroLabel1.Text" xml:space="preserve">
|
||||
<value>Webserver</value>
|
||||
</data>
|
||||
<data name=">>metroLabel1.Name" xml:space="preserve">
|
||||
<value>metroLabel1</value>
|
||||
</data>
|
||||
<data name=">>metroLabel1.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>metroLabel1.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>metroLabel1.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<metadata name="metroLabel2.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<data name="metroLabel2.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 134</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>148, 19</value>
|
||||
</data>
|
||||
<data name="metroLabel2.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>10</value>
|
||||
</data>
|
||||
<data name="metroLabel2.Text" xml:space="preserve">
|
||||
<value>PCK Hosting Webserver</value>
|
||||
</data>
|
||||
<data name=">>metroLabel2.Name" xml:space="preserve">
|
||||
<value>metroLabel2</value>
|
||||
</data>
|
||||
<data name=">>metroLabel2.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>metroLabel2.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>metroLabel2.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="buttonClose.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||
<value>Flat</value>
|
||||
</data>
|
||||
<data name="buttonClose.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 12pt</value>
|
||||
</data>
|
||||
<data name="buttonClose.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>218, 185</value>
|
||||
</data>
|
||||
<data name="buttonClose.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>192, 38</value>
|
||||
</data>
|
||||
<data name="buttonClose.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="buttonClose.Text" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name=">>buttonClose.Name" xml:space="preserve">
|
||||
<value>buttonClose</value>
|
||||
</data>
|
||||
<data name=">>buttonClose.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>buttonClose.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonClose.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="buttonSave.FlatStyle" type="System.Windows.Forms.FlatStyle, System.Windows.Forms">
|
||||
<value>Flat</value>
|
||||
</data>
|
||||
<data name="buttonSave.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 12pt</value>
|
||||
</data>
|
||||
<data name="buttonSave.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 185</value>
|
||||
</data>
|
||||
<data name="buttonSave.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>192, 38</value>
|
||||
</data>
|
||||
<data name="buttonSave.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="buttonSave.Text" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name=">>buttonSave.Name" xml:space="preserve">
|
||||
<value>buttonSave</value>
|
||||
</data>
|
||||
<data name=">>buttonSave.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>buttonSave.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonSave.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="resource.Image" type="System.Resources.ResXNullRef, System.Windows.Forms">
|
||||
<value />
|
||||
</data>
|
||||
<data name="resource.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="resource.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>365, 1</value>
|
||||
</data>
|
||||
<data name="resource.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>21, 21</value>
|
||||
</data>
|
||||
<data name="resource.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="resource.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="webServerTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 93</value>
|
||||
</data>
|
||||
<data name="webServerTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>387, 23</value>
|
||||
</data>
|
||||
<data name="webServerTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name=">>webServerTextBox.Name" xml:space="preserve">
|
||||
<value>webServerTextBox</value>
|
||||
</data>
|
||||
<data name=">>webServerTextBox.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>webServerTextBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>webServerTextBox.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="resource.Image1" type="System.Resources.ResXNullRef, System.Windows.Forms">
|
||||
<value />
|
||||
</data>
|
||||
<data name="resource.ImeMode1" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="resource.Location1" type="System.Drawing.Point, System.Drawing">
|
||||
<value>365, 1</value>
|
||||
</data>
|
||||
<data name="resource.Size1" type="System.Drawing.Size, System.Drawing">
|
||||
<value>21, 21</value>
|
||||
</data>
|
||||
<data name="resource.TabIndex1" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="resource.Visible1" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="pckWebServerTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>23, 156</value>
|
||||
</data>
|
||||
<data name="pckWebServerTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>387, 23</value>
|
||||
</data>
|
||||
<data name="pckWebServerTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>9</value>
|
||||
</data>
|
||||
<data name=">>pckWebServerTextBox.Name" xml:space="preserve">
|
||||
<value>pckWebServerTextBox</value>
|
||||
</data>
|
||||
<data name=">>pckWebServerTextBox.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>pckWebServerTextBox.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>pckWebServerTextBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>437, 251</value>
|
||||
</data>
|
||||
<data name="$this.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 8.25pt</value>
|
||||
</data>
|
||||
<data name="$this.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
<data name="$this.Text" xml:space="preserve">
|
||||
<value>Preferences</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>Preferences</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>PckStudio.ToolboxItems.ThemeForm, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,283 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Classes.Utils;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.ToolboxItems;
|
||||
|
||||
namespace PckStudio.Forms.Utilities.Skins
|
||||
{
|
||||
public partial class ANIMEditor : ThemeForm
|
||||
{
|
||||
public bool saved = false;
|
||||
readonly SkinANIM initialANIM;
|
||||
public string outANIM => animValue.Text;
|
||||
SkinANIM anim = new SkinANIM();
|
||||
|
||||
void processCheckBoxes(bool set_all = false, bool value = false)
|
||||
{
|
||||
#region processes every single checkbox with the correct ANIM flags
|
||||
helmetCheckBox.Enabled = set_all ? value : anim.GetFlag(ANIM_EFFECTS.HEAD_DISABLED);
|
||||
chestplateCheckBox.Enabled = set_all ? value : anim.GetFlag(ANIM_EFFECTS.BODY_DISABLED);
|
||||
leftArmorCheckBox.Enabled = set_all ? value : anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED);
|
||||
rightArmorCheckBox.Enabled = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED);
|
||||
leftLeggingCheckBox.Enabled = set_all ? value : anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED);
|
||||
rightLeggingCheckBox.Enabled = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED);
|
||||
|
||||
bobbingCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.HEAD_BOBBING_DISABLED);
|
||||
bodyCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.BODY_DISABLED);
|
||||
bodyOCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.BODY_OVERLAY_DISABLED);
|
||||
chestplateCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.FORCE_BODY_ARMOR);
|
||||
|
||||
classicCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RESOLUTION_64x64);
|
||||
crouchCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.DO_BACKWARDS_CROUCH);
|
||||
dinnerboneCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.DINNERBONE);
|
||||
headCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.HEAD_DISABLED);
|
||||
|
||||
headOCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.HEAD_OVERLAY_DISABLED);
|
||||
helmetCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.FORCE_HEAD_ARMOR);
|
||||
leftArmCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED);
|
||||
leftArmOCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_OVERLAY_DISABLED);
|
||||
|
||||
leftArmorCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.FORCE_LEFT_ARM_ARMOR);
|
||||
leftLegCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED);
|
||||
leftLeggingCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.FORCE_LEFT_LEG_ARMOR);
|
||||
leftLegOCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_OVERLAY_DISABLED);
|
||||
|
||||
noArmorCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.ALL_ARMOR_DISABLED);
|
||||
rightArmCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED);
|
||||
rightArmOCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_OVERLAY_DISABLED);
|
||||
rightArmorCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.FORCE_RIGHT_ARM_ARMOR);
|
||||
|
||||
rightLegCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED);
|
||||
rightLeggingCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.FORCE_RIGHT_LEG_ARMOR);
|
||||
rightLegOCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_OVERLAY_DISABLED);
|
||||
santaCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.BAD_SANTA);
|
||||
|
||||
slimCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.SLIM_MODEL);
|
||||
staticArmsCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.STATIC_ARMS);
|
||||
staticLegsCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.STATIC_LEGS);
|
||||
statueCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.STATUE_OF_LIBERTY);
|
||||
|
||||
syncArmsCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.SYNCED_ARMS);
|
||||
syncLegsCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.SYNCED_LEGS);
|
||||
unknownCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.__BIT_4);
|
||||
zombieCheckBox.Checked = set_all ? value : anim.GetFlag(ANIM_EFFECTS.ZOMBIE_ARMS);
|
||||
#endregion
|
||||
}
|
||||
|
||||
public ANIMEditor(string ANIM)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (!SkinANIM.IsValidANIM(ANIM))
|
||||
{
|
||||
DialogResult = DialogResult.Abort;
|
||||
Close();
|
||||
}
|
||||
initialANIM = anim = new SkinANIM(ANIM);
|
||||
|
||||
#region Event definitions, since the designer can't parse lambda experessions
|
||||
bobbingCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.HEAD_BOBBING_DISABLED); };
|
||||
bodyCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.BODY_DISABLED); };
|
||||
bodyOCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.BODY_OVERLAY_DISABLED); };
|
||||
chestplateCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_BODY_ARMOR); };
|
||||
|
||||
classicCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.RESOLUTION_64x64); };
|
||||
crouchCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.DO_BACKWARDS_CROUCH); };
|
||||
dinnerboneCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.DINNERBONE); };
|
||||
headCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.HEAD_DISABLED); };
|
||||
|
||||
headOCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.HEAD_OVERLAY_DISABLED); };
|
||||
helmetCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_HEAD_ARMOR); };
|
||||
leftArmCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.LEFT_ARM_DISABLED); };
|
||||
leftArmOCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.LEFT_ARM_OVERLAY_DISABLED); };
|
||||
|
||||
leftArmorCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_LEFT_ARM_ARMOR); };
|
||||
leftLegCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.LEFT_LEG_DISABLED); };
|
||||
leftLeggingCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_LEFT_LEG_ARMOR); };
|
||||
leftLegOCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.LEFT_LEG_OVERLAY_DISABLED); };
|
||||
|
||||
noArmorCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.ALL_ARMOR_DISABLED); };
|
||||
rightArmCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.RIGHT_ARM_DISABLED); };
|
||||
rightArmOCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.RIGHT_ARM_OVERLAY_DISABLED); };
|
||||
rightArmorCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_RIGHT_ARM_ARMOR); };
|
||||
|
||||
rightLegCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.RIGHT_LEG_DISABLED); };
|
||||
rightLeggingCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_RIGHT_LEG_ARMOR); };
|
||||
rightLegOCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.RIGHT_LEG_OVERLAY_DISABLED); };
|
||||
santaCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.BAD_SANTA); };
|
||||
|
||||
slimCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.SLIM_MODEL); };
|
||||
staticArmsCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.STATIC_ARMS); };
|
||||
staticLegsCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.STATIC_LEGS); };
|
||||
statueCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.STATUE_OF_LIBERTY); };
|
||||
|
||||
syncArmsCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.SYNCED_ARMS); };
|
||||
syncLegsCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.SYNCED_LEGS); };
|
||||
unknownCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.__BIT_4); };
|
||||
zombieCheckBox.CheckedChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.ZOMBIE_ARMS); };
|
||||
|
||||
helmetCheckBox.EnabledChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_HEAD_ARMOR); };
|
||||
chestplateCheckBox.EnabledChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_BODY_ARMOR); };
|
||||
rightArmorCheckBox.EnabledChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_RIGHT_ARM_ARMOR); };
|
||||
leftArmorCheckBox.EnabledChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_LEFT_ARM_ARMOR); };
|
||||
rightLeggingCheckBox.EnabledChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_RIGHT_LEG_ARMOR); };
|
||||
leftLeggingCheckBox.EnabledChanged += (sender, EventArgs) => { flagChanged(sender, EventArgs, ANIM_EFFECTS.FORCE_LEFT_LEG_ARMOR); };
|
||||
#endregion
|
||||
processCheckBoxes();
|
||||
}
|
||||
|
||||
private void closeButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
|
||||
saved = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void flagChanged(object sender, EventArgs e, ANIM_EFFECTS flag)
|
||||
{
|
||||
// Set value
|
||||
anim.SetFlag(flag, ((CheckBox)sender).Checked && ((CheckBox)sender).Enabled);
|
||||
|
||||
// Armor flags don't work if the respective parts are not enabled
|
||||
helmetCheckBox.Enabled = anim.GetFlag(ANIM_EFFECTS.HEAD_DISABLED);
|
||||
chestplateCheckBox.Enabled = anim.GetFlag(ANIM_EFFECTS.BODY_DISABLED);
|
||||
rightArmorCheckBox.Enabled = anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED);
|
||||
leftArmorCheckBox.Enabled = anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED);
|
||||
rightLeggingCheckBox.Enabled = anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED);
|
||||
leftLeggingCheckBox.Enabled = anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED);
|
||||
|
||||
animValue.Text = anim.ToString();
|
||||
}
|
||||
|
||||
private void copyButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Clipboard.SetText(animValue.Text);
|
||||
}
|
||||
|
||||
private void importButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
string new_value = "";
|
||||
|
||||
bool first = true;
|
||||
while (!SkinANIM.IsValidANIM(new_value))
|
||||
{
|
||||
if (!first) MessageBox.Show($"The following value \"{new_value}\" is not valid. Please try again.");
|
||||
RenamePrompt diag = new RenamePrompt(new_value);
|
||||
diag.TextLabel.Text = "ANIM";
|
||||
diag.RenameButton.Text = "Ok";
|
||||
if (diag.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
new_value = diag.NewText;
|
||||
}
|
||||
else return;
|
||||
first = false;
|
||||
}
|
||||
anim = new SkinANIM(new_value);
|
||||
processCheckBoxes();
|
||||
}
|
||||
|
||||
private void uncheckButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
processCheckBoxes(true);
|
||||
}
|
||||
|
||||
private void checkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
processCheckBoxes(true, true);
|
||||
}
|
||||
|
||||
private void exportButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.FileName = animValue.Text + ".png";
|
||||
saveFileDialog.Filter = "Skin textures|*.png";
|
||||
if (saveFileDialog.ShowDialog() != DialogResult.OK ||
|
||||
string.IsNullOrWhiteSpace(Path.GetDirectoryName(saveFileDialog.FileName))) return;
|
||||
bool isSlim = anim.GetFlag(ANIM_EFFECTS.SLIM_MODEL);
|
||||
bool isClassic64 = anim.GetFlag(ANIM_EFFECTS.RESOLUTION_64x64);
|
||||
bool isClassic32 = !isSlim && !isClassic64;
|
||||
|
||||
Image skin = isSlim ? Properties.Resources.slim_template : Properties.Resources.classic_template;
|
||||
|
||||
#region Image processing code for generating the skin templates based on the input ANIM value
|
||||
Bitmap nb = new Bitmap(64, (!isSlim && !isClassic64) ? 32 : 64);
|
||||
using (Graphics g = Graphics.FromImage(nb))
|
||||
{
|
||||
g.DrawImage(skin, new Rectangle(0, 0, 64, isClassic32 ? 32 : 64), new Rectangle(0, 0, 64, isClassic32 ? 32 : 64), GraphicsUnit.Pixel);
|
||||
if (anim.GetFlag(ANIM_EFFECTS.HEAD_OVERLAY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(32, 0, 32, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.HEAD_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(0, 0, 32, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.BODY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(16, 16, 24, 16));
|
||||
if (nb.Height == 64)
|
||||
{
|
||||
if (anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(40, 16, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(0, 16, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.BODY_OVERLAY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(16, 32, 24, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_OVERLAY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(40, 32, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_OVERLAY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(0, 32, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_OVERLAY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(0, 48, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(16, 48, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(32, 48, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_OVERLAY_DISABLED)) g.FillRectangle(Brushes.Magenta, new Rectangle(48, 48, 16, 16));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Since both classic 32 arms and legs use the same texture, removing the texture would remove both limbs instead of just one.
|
||||
// So both must be disabled by the user before they're removed from the texture;
|
||||
if (anim.GetFlag(ANIM_EFFECTS.RIGHT_ARM_DISABLED) && anim.GetFlag(ANIM_EFFECTS.LEFT_ARM_DISABLED))
|
||||
g.FillRectangle(Brushes.Magenta, new Rectangle(40, 16, 16, 16));
|
||||
if (anim.GetFlag(ANIM_EFFECTS.RIGHT_LEG_DISABLED) && anim.GetFlag(ANIM_EFFECTS.LEFT_LEG_DISABLED))
|
||||
g.FillRectangle(Brushes.Magenta, new Rectangle(0, 16, 16, 16));
|
||||
}
|
||||
nb.MakeTransparent(Color.Magenta);
|
||||
skin = nb;
|
||||
}
|
||||
#endregion
|
||||
|
||||
skin.Save(saveFileDialog.FileName);
|
||||
}
|
||||
|
||||
private void resetButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
anim = initialANIM;
|
||||
processCheckBoxes();
|
||||
}
|
||||
|
||||
static readonly Dictionary<string, ANIM_EFFECTS> Templates = new Dictionary<string, ANIM_EFFECTS>()
|
||||
{
|
||||
{ "Steve (64x32)", ANIM_EFFECTS.NONE },
|
||||
{ "Steve (64x64)", ANIM_EFFECTS.RESOLUTION_64x64 },
|
||||
{ "Alex (64x64)", ANIM_EFFECTS.SLIM_MODEL },
|
||||
{ "Zombie Skins", ANIM_EFFECTS.ZOMBIE_ARMS },
|
||||
{ "Cetacean Skins", ANIM_EFFECTS.SYNCED_ARMS | ANIM_EFFECTS.SYNCED_LEGS },
|
||||
{ "Ski Skins", ANIM_EFFECTS.SYNCED_ARMS | ANIM_EFFECTS.STATIC_LEGS },
|
||||
{ "Ghost Skins", ANIM_EFFECTS.STATIC_LEGS | ANIM_EFFECTS.ZOMBIE_ARMS },
|
||||
{ "Medusa (Greek Myth.)", ANIM_EFFECTS.SYNCED_LEGS },
|
||||
{ "Librarian (Halo)", ANIM_EFFECTS.STATIC_LEGS },
|
||||
{ "Grim Reaper (Halloween)", ANIM_EFFECTS.STATIC_LEGS | ANIM_EFFECTS.STATIC_ARMS }
|
||||
};
|
||||
|
||||
private void templateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var diag = new ItemSelectionPopUp(Templates.Keys.ToArray());
|
||||
diag.label2.Text = "Presets";
|
||||
//diag.button1.Text = "Load";
|
||||
//MNL or PhoenixARC or Miku, here is one problem. I removed the old button (button1) and relpaced it with the 'AddButton' but for osme reason, it does not work here.
|
||||
// - EternalModz
|
||||
|
||||
if (diag.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
var templateANIM = Templates[diag.SelectedItem];
|
||||
DialogResult prompt = MessageBox.Show(this, "Would you like to add this preset's effects to your current ANIM? Otherwise all of your effects will be cleared. Either choice can be undone by pressing \"Restore ANIM\".", "", MessageBoxButtons.YesNo);
|
||||
if (prompt == DialogResult.Yes) anim |= templateANIM;
|
||||
else anim = templateANIM;
|
||||
SkinANIM backup = anim;
|
||||
processCheckBoxes();
|
||||
anim = backup;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -30,7 +30,7 @@
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.metroTabPageMain = new MetroFramework.Controls.MetroTabPage();
|
||||
this.myTablePanel1 = new PckStudio.Forms.MyTablePanel();
|
||||
this.myTablePanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.EurDig = new System.Windows.Forms.RadioButton();
|
||||
this.USDig = new System.Windows.Forms.RadioButton();
|
||||
this.buttonServerToggle = new System.Windows.Forms.Button();
|
||||
@@ -339,7 +339,7 @@
|
||||
#endregion
|
||||
|
||||
private MetroFramework.Controls.MetroTabPage metroTabPageMain;
|
||||
private MyTablePanel myTablePanel1;
|
||||
private System.Windows.Forms.TableLayoutPanel myTablePanel1;
|
||||
private System.Windows.Forms.RadioButton USDisc;
|
||||
private System.Windows.Forms.RadioButton JPDig;
|
||||
private System.Windows.Forms.RadioButton EurDisc;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace PckStudio.Forms
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.metroTabPageMain = new MetroFramework.Controls.MetroTabPage();
|
||||
this.myTablePanel1 = new PckStudio.Forms.MyTablePanel();
|
||||
this.myTablePanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.EurDig = new System.Windows.Forms.RadioButton();
|
||||
this.USDig = new System.Windows.Forms.RadioButton();
|
||||
this.buttonServerToggle = new System.Windows.Forms.Button();
|
||||
@@ -341,7 +341,7 @@ namespace PckStudio.Forms
|
||||
#endregion
|
||||
|
||||
private MetroFramework.Controls.MetroTabPage metroTabPageMain;
|
||||
private MyTablePanel myTablePanel1;
|
||||
private System.Windows.Forms.TableLayoutPanel myTablePanel1;
|
||||
private System.Windows.Forms.RadioButton USDisc;
|
||||
private System.Windows.Forms.RadioButton JPDig;
|
||||
private System.Windows.Forms.RadioButton EurDisc;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallWiiU));
|
||||
this.metroTabPageMain = new MetroFramework.Controls.MetroTabPage();
|
||||
this.myTablePanel1 = new PckStudio.Forms.MyTablePanel();
|
||||
this.myTablePanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.buttonServerToggle = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.radioButtonSystem = new System.Windows.Forms.RadioButton();
|
||||
@@ -327,7 +327,7 @@
|
||||
#endregion
|
||||
|
||||
private MetroFramework.Controls.MetroTabPage metroTabPageMain;
|
||||
private MyTablePanel myTablePanel1;
|
||||
private System.Windows.Forms.TableLayoutPanel myTablePanel1;
|
||||
private System.Windows.Forms.RadioButton radioButtonJap;
|
||||
private System.Windows.Forms.RadioButton radioButtonEur;
|
||||
private System.Windows.Forms.RadioButton radioButtonUs;
|
||||
|
||||
2
PCK-Studio/Forms/Utilities/pckCenter.Designer.cs
generated
2
PCK-Studio/Forms/Utilities/pckCenter.Designer.cs
generated
@@ -1,4 +1,4 @@
|
||||
namespace PckStudio.Forms
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
partial class PCKCenter
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ using PckStudio.API.PCKCenter.model;
|
||||
using PckStudio.API.PCKCenter;
|
||||
using PckStudio.ToolboxItems;
|
||||
|
||||
namespace PckStudio.Forms
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public partial class PCKCenter : ThemeForm
|
||||
{
|
||||
@@ -175,10 +175,6 @@ namespace PckStudio.Forms
|
||||
EInfo.Description = desc;
|
||||
PJSON.Data.Add((++x).ToString(), EInfo);
|
||||
File.Copy(cacheDir + mod + ".png", cacheDir + "images/" + ++x + ".png");
|
||||
|
||||
|
||||
PckPreview pckPreview = new PckPreview(pckName, author, desc, direct, ad, bmp, 0, mod, null, IsVita, Packname);
|
||||
pckLayout.Controls.Add(pckPreview);
|
||||
}
|
||||
}
|
||||
catch (Exception err) { Console.WriteLine(err.Message); }
|
||||
@@ -288,9 +284,6 @@ namespace PckStudio.Forms
|
||||
{
|
||||
bmp = (Bitmap)Image.FromStream(memStream);
|
||||
}
|
||||
|
||||
PckPreview pckPreview = new PckPreview(pckName, author, desc, direct, ad, bmp, 1, mod, loadCollectdion, PSVitaPCKCheckbox.Checked, "");
|
||||
pckLayout.Controls.Add(pckPreview);
|
||||
}
|
||||
pckLayout.Enabled = true;
|
||||
}
|
||||
@@ -320,7 +313,7 @@ namespace PckStudio.Forms
|
||||
|
||||
try
|
||||
{
|
||||
RPC.SetPresence("Viewing the PCK Center", "Program by PhoenixARC");
|
||||
RPC.SetPresence("Viewing the PCK Center");
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -401,143 +394,4 @@ namespace PckStudio.Forms
|
||||
else { MessageBox.Show("No Packs Avaliable!"); }
|
||||
}
|
||||
}
|
||||
|
||||
public class PckPreview : UserControl
|
||||
{
|
||||
string name;
|
||||
string author;
|
||||
string desc;
|
||||
string direct;
|
||||
string ad;
|
||||
int mode;
|
||||
string mod;
|
||||
bool IsVita;
|
||||
string Pack;
|
||||
|
||||
Bitmap icon;
|
||||
|
||||
PictureBox iconBox = new PictureBox();
|
||||
public MyNameLabel nameLabel = new MyNameLabel();
|
||||
MyTablePanel layout = new MyTablePanel();
|
||||
MethodInvoker reloader;
|
||||
|
||||
public PckPreview(string name, string author, string desc, string direct, string ad, Bitmap icon, int mode, string mod, MethodInvoker Reloader, bool vita, string packName) : base()
|
||||
{
|
||||
reloader = Reloader;
|
||||
nameLabel.parentPreview = this;
|
||||
layout.parentPreview = this;
|
||||
this.name = name;
|
||||
this.author = author;
|
||||
this.desc = desc;
|
||||
this.direct = direct;
|
||||
this.ad = ad;
|
||||
this.mode = mode;
|
||||
this.mod = mod;
|
||||
this.icon = icon;
|
||||
IsVita = vita;
|
||||
Pack = packName;
|
||||
layout.BackColor = Color.White;
|
||||
Size = new Size(250, 280);
|
||||
nameLabel.Dock = DockStyle.Fill;
|
||||
nameLabel.Location = new Point(0,0);
|
||||
nameLabel.Size = new Size(230, 30);
|
||||
iconBox.Image = icon;
|
||||
//iconBox.Dock = DockStyle.Fill;
|
||||
iconBox.Anchor = AnchorStyles.None;
|
||||
nameLabel.Text = name;
|
||||
iconBox.SizeMode = PictureBoxSizeMode.StretchImage;
|
||||
iconBox.Size = new Size(230, 230);
|
||||
layout.Margin = new Padding(0, 0, 0, 0);
|
||||
Margin = new Padding(20, 15, 20, 15);
|
||||
nameLabel.ForeColor = Color.Black;
|
||||
nameLabel.TextAlign = ContentAlignment.MiddleCenter;
|
||||
nameLabel.Font = new Font(nameLabel.Font.FontFamily, 14);
|
||||
layout.Controls.Add(iconBox, 0, 1);
|
||||
layout.Controls.Add(nameLabel, 0, 0);
|
||||
layout.Parent = this;
|
||||
layout.Dock = DockStyle.Fill;
|
||||
iconBox.Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
public void setHover(bool hover)
|
||||
{
|
||||
layout.BackColor = hover ? Color.LightGray : Color.White;
|
||||
layout.Refresh();
|
||||
}
|
||||
public void onClick()
|
||||
{
|
||||
|
||||
layout.BackColor = Color.Gray;
|
||||
layout.Refresh();
|
||||
PCKCenterOpen openPck = new PCKCenterOpen(name, author, desc, direct, ad, icon, mode, mod, reloader, IsVita, Pack);
|
||||
openPck.ShowDialog();
|
||||
}
|
||||
|
||||
public void onDoubleClick()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class MyTablePanel : TableLayoutPanel
|
||||
{
|
||||
public PckPreview parentPreview;
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
if (parentPreview != null)
|
||||
{
|
||||
parentPreview.setHover(true);
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
}
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
if(parentPreview != null)
|
||||
{
|
||||
parentPreview.setHover(false);
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
}
|
||||
protected override void OnMouseClick(MouseEventArgs e)
|
||||
{
|
||||
if (parentPreview != null)
|
||||
{
|
||||
parentPreview.onClick();
|
||||
base.OnMouseClick(e);
|
||||
}
|
||||
}
|
||||
protected override void OnMouseDoubleClick(MouseEventArgs e)
|
||||
{
|
||||
if (parentPreview != null)
|
||||
{
|
||||
parentPreview.onDoubleClick();
|
||||
base.OnMouseDoubleClick(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MyNameLabel : Label
|
||||
{
|
||||
public PckPreview parentPreview;
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
parentPreview.setHover(true);
|
||||
base.OnMouseEnter(e);
|
||||
}
|
||||
protected override void OnMouseLeave(EventArgs e)
|
||||
{
|
||||
parentPreview.setHover(false);
|
||||
base.OnMouseLeave(e);
|
||||
}
|
||||
protected override void OnMouseClick(MouseEventArgs e)
|
||||
{
|
||||
parentPreview.onClick();
|
||||
base.OnMouseClick(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -138,6 +138,7 @@
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
this.Controls.Add(this.buttonDirect);
|
||||
this.Controls.Add(this.buttonBedrock);
|
||||
this.Controls.Add(this.buttonInstallPs3);
|
||||
this.Controls.Add(this.buttonInstallXbox);
|
||||
@@ -146,7 +147,6 @@
|
||||
this.Controls.Add(this.buttonDelete);
|
||||
this.Controls.Add(this.labelDesc);
|
||||
this.Controls.Add(this.labelName);
|
||||
this.Controls.Add(this.buttonDirect);
|
||||
this.Controls.Add(this.pictureBoxDisplay);
|
||||
this.ForeColor = System.Drawing.Color.White;
|
||||
this.MaximizeBox = false;
|
||||
|
||||
@@ -19,6 +19,7 @@ using PckStudio.Classes.FileTypes;
|
||||
using PckStudio.Classes.IO.PCK;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Pck;
|
||||
using PckStudio.Classes.Extentions;
|
||||
using PckStudio.ToolboxItems;
|
||||
|
||||
namespace PckStudio.Forms
|
||||
@@ -1027,17 +1028,26 @@ namespace PckStudio.Forms
|
||||
{
|
||||
var ms = new MemoryStream(skinTexture.Data);
|
||||
Bitmap saveSkin = new Bitmap(Image.FromStream(ms));
|
||||
var config = new ImageExtentions.GraphicsConfig()
|
||||
{
|
||||
CompositingMode = CompositingMode.SourceCopy,
|
||||
CompositingQuality = CompositingQuality.HighQuality,
|
||||
InterpolationMode = InterpolationMode.NearestNeighbor,
|
||||
SmoothingMode = SmoothingMode.HighQuality,
|
||||
PixelOffsetMode = PixelOffsetMode.HighQuality,
|
||||
};
|
||||
|
||||
if (saveSkin.Width == saveSkin.Height)
|
||||
{
|
||||
ResizeImage(saveSkin, 64, 64);
|
||||
saveSkin.ResizeImage(64, 64, config);
|
||||
}
|
||||
else if (saveSkin.Height == saveSkin.Width / 2)
|
||||
{
|
||||
ResizeImage(saveSkin, 64, 32);
|
||||
saveSkin.ResizeImage(64, 32, config);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResizeImage(saveSkin, 64, 64);
|
||||
saveSkin.ResizeImage(64, 64, config);
|
||||
}
|
||||
saveSkin.Save(root + "/" + skinTexture.Filename, ImageFormat.Png);
|
||||
}
|
||||
@@ -1078,32 +1088,6 @@ namespace PckStudio.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap ResizeImage(Image image, int width, int height)
|
||||
{
|
||||
var destRect = new Rectangle(0, 0, width, height);
|
||||
var destImage = new Bitmap(width, height);
|
||||
|
||||
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
||||
|
||||
using (var graphics = Graphics.FromImage(destImage))
|
||||
{
|
||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
using (var wrapMode = new ImageAttributes())
|
||||
{
|
||||
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
||||
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
|
||||
}
|
||||
}
|
||||
|
||||
return destImage;
|
||||
}
|
||||
|
||||
|
||||
private void buttonDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
<value>Segoe UI, 12pt</value>
|
||||
</data>
|
||||
<data name="buttonExport.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>692, 338</value>
|
||||
<value>495, 256</value>
|
||||
</data>
|
||||
<data name="buttonExport.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>45, 30</value>
|
||||
@@ -355,7 +355,7 @@
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>buttonInstallWiiU.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="pictureBoxDisplay.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>24, 64</value>
|
||||
|
||||
47
PCK-Studio/MainForm.Designer.cs
generated
47
PCK-Studio/MainForm.Designer.cs
generated
@@ -116,12 +116,12 @@
|
||||
this.tabControl = new MetroFramework.Controls.MetroTabControl();
|
||||
this.openTab = new MetroFramework.Controls.MetroTabPage();
|
||||
this.labelVersion = new MetroFramework.Controls.MetroLabel();
|
||||
this.pckOpen = new System.Windows.Forms.PictureBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.crEaTiiOn_Ultimate_GradientButton2 = new CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton();
|
||||
this.crEaTiiOn_Ultimate_GradientButton1 = new CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.crEaTiiOn_Ultimate_GradientButton3 = new CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton();
|
||||
this.pckOpen = new System.Windows.Forms.PictureBox();
|
||||
this.editorTab = new MetroFramework.Controls.MetroTabPage();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.pictureBoxImagePreview = new PckStudio.ToolboxItems.PictureBoxWithInterpolationMode();
|
||||
@@ -136,6 +136,7 @@
|
||||
this.buttonEdit = new MetroFramework.Controls.MetroButton();
|
||||
this.metroLabel1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.label11 = new MetroFramework.Controls.MetroLabel();
|
||||
this.pckFileLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.treeViewMain = new System.Windows.Forms.TreeView();
|
||||
this.imageList = new System.Windows.Forms.ImageList(this.components);
|
||||
this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
@@ -146,9 +147,9 @@
|
||||
this.contextMenuMetaTree.SuspendLayout();
|
||||
this.tabControl.SuspendLayout();
|
||||
this.openTab.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pckOpen)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pckOpen)).BeginInit();
|
||||
this.editorTab.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxImagePreview)).BeginInit();
|
||||
@@ -210,8 +211,8 @@
|
||||
//
|
||||
// audiopckToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.audiopckToolStripMenuItem, "audiopckToolStripMenuItem");
|
||||
this.audiopckToolStripMenuItem.Name = "audiopckToolStripMenuItem";
|
||||
resources.ApplyResources(this.audiopckToolStripMenuItem, "audiopckToolStripMenuItem");
|
||||
this.audiopckToolStripMenuItem.Click += new System.EventHandler(this.audiopckToolStripMenuItem_Click);
|
||||
//
|
||||
// colourscolToolStripMenuItem
|
||||
@@ -735,7 +736,7 @@
|
||||
this.tabControl.Controls.Add(this.editorTab);
|
||||
resources.ApplyResources(this.tabControl, "tabControl");
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.SelectedIndex = 1;
|
||||
this.tabControl.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.tabControl.TabStop = false;
|
||||
this.tabControl.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
@@ -772,6 +773,19 @@
|
||||
this.labelVersion.UseCustomBackColor = true;
|
||||
this.labelVersion.UseCustomForeColor = true;
|
||||
//
|
||||
// pckOpen
|
||||
//
|
||||
this.pckOpen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
resources.ApplyResources(this.pckOpen, "pckOpen");
|
||||
this.pckOpen.Name = "pckOpen";
|
||||
this.pckOpen.TabStop = false;
|
||||
this.pckOpen.Click += new System.EventHandler(this.OpenPck_Click);
|
||||
this.pckOpen.DragDrop += new System.Windows.Forms.DragEventHandler(this.OpenPck_DragDrop);
|
||||
this.pckOpen.DragEnter += new System.Windows.Forms.DragEventHandler(this.OpenPck_DragEnter);
|
||||
this.pckOpen.DragLeave += new System.EventHandler(this.OpenPck_DragLeave);
|
||||
this.pckOpen.MouseEnter += new System.EventHandler(this.OpenPck_MouseEnter);
|
||||
this.pckOpen.MouseLeave += new System.EventHandler(this.OpenPck_MouseLeave);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
@@ -848,19 +862,6 @@
|
||||
this.crEaTiiOn_Ultimate_GradientButton3.UseVisualStyleBackColor = false;
|
||||
this.crEaTiiOn_Ultimate_GradientButton3.Click += new System.EventHandler(this.crEaTiiOn_Ultimate_GradientButton3_Click);
|
||||
//
|
||||
// pckOpen
|
||||
//
|
||||
this.pckOpen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
resources.ApplyResources(this.pckOpen, "pckOpen");
|
||||
this.pckOpen.Name = "pckOpen";
|
||||
this.pckOpen.TabStop = false;
|
||||
this.pckOpen.Click += new System.EventHandler(this.OpenPck_Click);
|
||||
this.pckOpen.DragDrop += new System.Windows.Forms.DragEventHandler(this.OpenPck_DragDrop);
|
||||
this.pckOpen.DragEnter += new System.Windows.Forms.DragEventHandler(this.OpenPck_DragEnter);
|
||||
this.pckOpen.DragLeave += new System.EventHandler(this.OpenPck_DragLeave);
|
||||
this.pckOpen.MouseEnter += new System.EventHandler(this.OpenPck_MouseEnter);
|
||||
this.pckOpen.MouseLeave += new System.EventHandler(this.OpenPck_MouseLeave);
|
||||
//
|
||||
// editorTab
|
||||
//
|
||||
this.editorTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
@@ -868,6 +869,7 @@
|
||||
this.editorTab.Controls.Add(this.panel2);
|
||||
this.editorTab.Controls.Add(this.PropertiesTabControl);
|
||||
this.editorTab.Controls.Add(this.label11);
|
||||
this.editorTab.Controls.Add(this.pckFileLabel);
|
||||
this.editorTab.Controls.Add(this.treeViewMain);
|
||||
this.editorTab.Controls.Add(pictureBox2);
|
||||
this.editorTab.ForeColor = System.Drawing.Color.White;
|
||||
@@ -893,8 +895,8 @@
|
||||
//
|
||||
// pictureBoxImagePreview
|
||||
//
|
||||
this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent;
|
||||
resources.ApplyResources(this.pictureBoxImagePreview, "pictureBoxImagePreview");
|
||||
this.pictureBoxImagePreview.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pictureBoxImagePreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.pictureBoxImagePreview.Name = "pictureBoxImagePreview";
|
||||
this.pictureBoxImagePreview.TabStop = false;
|
||||
@@ -1055,6 +1057,12 @@
|
||||
resources.ApplyResources(this.label11, "label11");
|
||||
this.label11.Name = "label11";
|
||||
//
|
||||
// pckFileLabel
|
||||
//
|
||||
resources.ApplyResources(this.pckFileLabel, "pckFileLabel");
|
||||
this.pckFileLabel.Name = "pckFileLabel";
|
||||
this.pckFileLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// treeViewMain
|
||||
//
|
||||
this.treeViewMain.AllowDrop = true;
|
||||
@@ -1112,9 +1120,9 @@
|
||||
this.tabControl.ResumeLayout(false);
|
||||
this.openTab.ResumeLayout(false);
|
||||
this.openTab.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pckOpen)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pckOpen)).EndInit();
|
||||
this.editorTab.ResumeLayout(false);
|
||||
this.editorTab.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
@@ -1167,6 +1175,7 @@
|
||||
private MetroFramework.Controls.MetroTabPage editorTab;
|
||||
private MetroFramework.Controls.MetroCheckBox LittleEndianCheckBox;
|
||||
private MetroFramework.Controls.MetroLabel label11;
|
||||
private MetroFramework.Controls.MetroLabel pckFileLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem wiiUPCKInstallerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem PS3PCKInstallerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
|
||||
|
||||
@@ -7,13 +7,20 @@ using System.Windows.Forms;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Formats.GameRule;
|
||||
using OMI.Formats.Languages;
|
||||
using OMI.Workers.Pck;
|
||||
using OMI.Workers.GameRule;
|
||||
using OMI.Workers.Language;
|
||||
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Classes.FileTypes;
|
||||
using PckStudio.Classes.Utils;
|
||||
using PckStudio.Classes.Utils.ARC;
|
||||
using PckStudio.Classes._3ds.Utils;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Forms.Utilities.Skins;
|
||||
using PckStudio.Forms.Utilities;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
@@ -111,8 +118,7 @@ namespace PckStudio
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
RPC.Initialize();
|
||||
if (currentPCK == null)
|
||||
RPC.SetPresence("An Open Source .PCK File Editor", "Program by PhoenixARC");
|
||||
UpdateRPC();
|
||||
|
||||
skinToolStripMenuItem1.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.SkinFile);
|
||||
capeToolStripMenuItem.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.CapeFile);
|
||||
@@ -162,10 +168,25 @@ namespace PckStudio
|
||||
isTemplateFile = false;
|
||||
saveLocation = filePath;
|
||||
var reader = new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
PckFile pck = reader.FromFile(filePath);
|
||||
|
||||
//metroLabel3.Text = "Current PCK File: " + Path.GetFileName(filePath);
|
||||
return pck;
|
||||
try
|
||||
{
|
||||
PckFile pck = reader.FromFile(filePath);
|
||||
return pck;
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
MessageBox.Show("Failed to open pck\n" +
|
||||
$"Try {(LittleEndianCheckBox.Checked ? "unchecking" : "checking")} the 'Open/Save as Vita/PS4 pck' check box in the upper right corner.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Failed to open pck\n" +
|
||||
"If this is an Audio/Music Cues pck, please use the specialized editor while inside of the parent pck.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void CheckForPasswordAndRemove()
|
||||
@@ -179,7 +200,11 @@ namespace PckStudio
|
||||
private void LoadEditorTab()
|
||||
{
|
||||
fileEntryCountLabel.Text = "Files:" + currentPCK.Files.Count;
|
||||
treeViewMain.Enabled = treeMeta.Enabled = true;
|
||||
if (isTemplateFile)
|
||||
pckFileLabel.Text = "Unsaved File!";
|
||||
else
|
||||
pckFileLabel.Text = "Current PCK File: " + Path.GetFileName(saveLocation);
|
||||
treeViewMain.Enabled = treeMeta.Enabled = true;
|
||||
closeToolStripMenuItem.Visible = true;
|
||||
saveToolStripMenuItem.Enabled = true;
|
||||
saveToolStripMenuItem1.Enabled = true;
|
||||
@@ -214,7 +239,8 @@ namespace PckStudio
|
||||
convertToBedrockToolStripMenuItem.Enabled = false;
|
||||
addCustomPackImageToolStripMenuItem.Enabled = false;
|
||||
fileEntryCountLabel.Text = string.Empty;
|
||||
UpdateRPC();
|
||||
pckFileLabel.Text = string.Empty;
|
||||
UpdateRPC();
|
||||
|
||||
}
|
||||
|
||||
@@ -366,11 +392,11 @@ namespace PckStudio
|
||||
locfile.HasLocEntry("IDS_DISPLAY_NAME") &&
|
||||
locfile.Languages.Contains("en-EN"))
|
||||
{
|
||||
RPC.SetPresence($"Editing a Pack: {locfile.GetLocEntry("IDS_DISPLAY_NAME", "en-EN")}", "Program by PhoenixARC");
|
||||
RPC.SetPresence($"Editing a Pack: {locfile.GetLocEntry("IDS_DISPLAY_NAME", "en-EN")}");
|
||||
return;
|
||||
}
|
||||
// default
|
||||
RPC.SetPresence("An Open Source .PCK File Editor", "Program by PhoenixARC");
|
||||
RPC.SetPresence("An Open Source .PCK File Editor");
|
||||
}
|
||||
|
||||
private void HandleAudioFile(PckFile.FileData file)
|
||||
@@ -421,7 +447,7 @@ namespace PckStudio
|
||||
using (var ms = new MemoryStream(file.Data))
|
||||
{
|
||||
var texture = Image.FromStream(ms);
|
||||
SkinPreview frm = new SkinPreview(texture, file.Properties.GetPropertyValue("ANIM", s => new SkinANIM(s)));
|
||||
SkinPreview frm = new SkinPreview(texture, file.Properties.GetPropertyValue("ANIM", SkinANIM.FromString));
|
||||
frm.ShowDialog(this);
|
||||
frm.Dispose();
|
||||
}
|
||||
@@ -458,7 +484,7 @@ namespace PckStudio
|
||||
buttonEdit.Visible = true;
|
||||
}
|
||||
else if (file.Properties.HasProperty("ANIM") &&
|
||||
file.Properties.GetPropertyValue("ANIM", s => new SkinANIM(s)) == (ANIM_EFFECTS.RESOLUTION_64x64 | ANIM_EFFECTS.SLIM_MODEL))
|
||||
file.Properties.GetPropertyValue("ANIM", s => SkinANIM.FromString(s) == (ANIM_EFFECTS.RESOLUTION_64x64 | ANIM_EFFECTS.SLIM_MODEL)))
|
||||
{
|
||||
buttonEdit.Text = "View Skin";
|
||||
buttonEdit.Visible = true;
|
||||
@@ -813,12 +839,15 @@ namespace PckStudio
|
||||
audioPck.AddCategory(PCKAudioFile.AudioCategory.EAudioType.Overworld);
|
||||
audioPck.AddCategory(PCKAudioFile.AudioCategory.EAudioType.Nether);
|
||||
audioPck.AddCategory(PCKAudioFile.AudioCategory.EAudioType.End);
|
||||
PckFile.FileData pckFileData = currentPCK.CreateNew("audio.pck", PckFile.FileData.FileType.AudioFile);
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
PCKAudioFileWriter.Write(stream, audioPck, isLittle);
|
||||
pckFileData.SetData(stream.ToArray());
|
||||
}
|
||||
PckFile.FileData pckFileData = currentPCK.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();
|
||||
}
|
||||
});
|
||||
return pckFileData;
|
||||
}
|
||||
|
||||
@@ -841,28 +870,37 @@ namespace PckStudio
|
||||
|
||||
private void createAnimatedTextureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var ofd = new OpenFileDialog())
|
||||
using var ofd = new OpenFileDialog()
|
||||
{
|
||||
ofd.Filter = "PNG Files | *.png";
|
||||
ofd.Title = "Select a PNG File";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
Filter = "PNG Files | *.png",
|
||||
Title = "Select a PNG File",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
using ChangeTile diag = new ChangeTile();
|
||||
if (diag.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
using Image img = new Bitmap(ofd.FileName);
|
||||
var file = currentPCK.CreateNewFile(
|
||||
$"res/textures/{AnimationResources.GetAnimationSection(diag.IsItem)}/{diag.SelectedTile}.png",
|
||||
PckFile.FileData.FileType.TextureFile,
|
||||
() =>
|
||||
{
|
||||
using ChangeTile diag = new ChangeTile();
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
using Image img = new Bitmap(ofd.FileName);
|
||||
var file = AnimationUtil.CreateNewAnimationFile(img, diag.SelectedTile, diag.IsItem);
|
||||
using AnimationEditor animationEditor = new AnimationEditor(file);
|
||||
if (animationEditor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
file.Filename = animationEditor.TileName;
|
||||
currentPCK.Files.Add(file);
|
||||
ReloadMetaTreeView();
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
using var stream = new MemoryStream();
|
||||
img.Save(stream, ImageFormat.Png);
|
||||
return stream.ToArray();
|
||||
});
|
||||
file.Properties.Add(("ANIM", string.Empty));
|
||||
|
||||
using AnimationEditor animationEditor = new AnimationEditor(file);
|
||||
if (animationEditor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
file.Filename = animationEditor.TileName;
|
||||
ReloadMetaTreeView();
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -921,21 +959,21 @@ namespace PckStudio
|
||||
if (parent_file.Filetype is PckFile.FileData.FileType.TexturePackInfoFile || parent_file.Filetype is PckFile.FileData.FileType.SkinDataFile)
|
||||
{
|
||||
Console.WriteLine("Rebuilding " + parent_file.Filename);
|
||||
PckFile newPCKFile = new PckFile(3);
|
||||
PckFile newPCKFile = new PckFile(3)
|
||||
{
|
||||
HasVerionString = parent_file.Filetype is PckFile.FileData.FileType.SkinDataFile
|
||||
};
|
||||
|
||||
foreach (TreeNode node in GetAllChildNodes(parent.Nodes))
|
||||
{
|
||||
if (node.Tag is PckFile.FileData node_file)
|
||||
{
|
||||
PckFile.FileData new_file = newPCKFile.CreateNew(node_file.Filename, node_file.Filetype);
|
||||
PckFile.FileData new_file = newPCKFile.CreateNewFile(node_file.Filename, node_file.Filetype);
|
||||
foreach (var prop in node_file.Properties) new_file.Properties.Add(prop);
|
||||
new_file.SetData(node_file.Data);
|
||||
}
|
||||
}
|
||||
|
||||
// Bool to add the XMLVersion property
|
||||
bool isSkinsPCK = parent_file.Filetype is PckFile.FileData.FileType.SkinDataFile;
|
||||
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
var writer = new PckFileWriter(newPCKFile, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
@@ -979,9 +1017,9 @@ namespace PckStudio
|
||||
try
|
||||
{
|
||||
using ANIMEditor diag = new ANIMEditor(property.Item2);
|
||||
if (diag.ShowDialog(this) == DialogResult.OK && diag.saved)
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
file.Properties[i] = ("ANIM", diag.outANIM);
|
||||
file.Properties[i] = ("ANIM", diag.ResultAnim.ToString());
|
||||
if (IsSubPCKNode(treeViewMain.SelectedNode.FullPath))
|
||||
RebuildSubPCK(treeViewMain.SelectedNode);
|
||||
ReloadMetaTreeView();
|
||||
@@ -992,7 +1030,7 @@ namespace PckStudio
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
MessageBox.Show("Failed to parse ANIM value, aborting to normal functionality. Please make sure the value only includes hexadecimal characters (0-9,A-F) and has no more than 8 characters. It can have an optional prefix of \"0x\".");
|
||||
MessageBox.Show("Failed to parse ANIM value, aborting to normal functionality. Please make sure the value only includes hexadecimal characters (0-9,A-F) and has no more than 8 characters.");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1044,21 +1082,19 @@ namespace PckStudio
|
||||
|
||||
// Creates new empty file entry
|
||||
PckFile.FileData mf = new PckFile.FileData(string.Empty, mfO.Filetype);
|
||||
mf.SetData(mfO.Data); // adds file data to minefile
|
||||
mf.SetData(mfO.Data);
|
||||
string dirName = Path.GetDirectoryName(mfO.Filename);
|
||||
|
||||
int clone_number = 0;
|
||||
string prev_clone_str = "_clone1";
|
||||
string nameWithoutExt = Path.GetFileNameWithoutExtension(mfO.Filename);
|
||||
string newFileName = mfO.Filename;
|
||||
do // Checks for existing clones and names it accordingly
|
||||
do
|
||||
{
|
||||
clone_number++;
|
||||
string clone_str = "_clone" + clone_number.ToString();
|
||||
bool isClone = nameWithoutExt.Contains("_clone");
|
||||
if (isClone) newFileName = nameWithoutExt.Remove(nameWithoutExt.Length - 7) + clone_str + Path.GetExtension(mfO.Filename);
|
||||
else newFileName = nameWithoutExt + clone_str + Path.GetExtension(mfO.Filename);
|
||||
prev_clone_str = clone_str;
|
||||
}
|
||||
while (currentPCK.HasFile(dirName + (string.IsNullOrEmpty(dirName) ? "" : "/") + newFileName, mf.Filetype));
|
||||
|
||||
@@ -1179,23 +1215,26 @@ namespace PckStudio
|
||||
private PckFile InitializePack(int packId, int packVersion, string packName, bool createSkinsPCK)
|
||||
{
|
||||
var newPck = new PckFile(3);
|
||||
var zeroFile = newPck.CreateNew("0", PckFile.FileData.FileType.InfoFile);
|
||||
|
||||
var zeroFile = newPck.CreateNewFile("0", PckFile.FileData.FileType.InfoFile);
|
||||
zeroFile.Properties.Add(("PACKID", packId.ToString()));
|
||||
zeroFile.Properties.Add(("PACKVERSION", packVersion.ToString()));
|
||||
var loc = newPck.CreateNew("localisation.loc", PckFile.FileData.FileType.LocalisationFile);
|
||||
var locFile = new LOCFile();
|
||||
locFile.InitializeDefault(packName);
|
||||
using (var stream = new MemoryStream())
|
||||
|
||||
var loc = newPck.CreateNewFile("localisation.loc", PckFile.FileData.FileType.LocalisationFile, () =>
|
||||
{
|
||||
LOCFileWriter.Write(stream, locFile);
|
||||
loc.SetData(stream.ToArray());
|
||||
}
|
||||
var locFile = new LOCFile();
|
||||
locFile.InitializeDefault(packName);
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new LOCFileWriter(locFile, 2);
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
});
|
||||
|
||||
if (createSkinsPCK)
|
||||
{
|
||||
PckFile.FileData skinsPCKFile = newPck.CreateNew("Skins.pck", PckFile.FileData.FileType.SkinDataFile);
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
PckFile.FileData skinsPCKFile = newPck.CreateNewFile("Skins.pck", PckFile.FileData.FileType.SkinDataFile, () =>
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new PckFileWriter(new PckFile(3)
|
||||
{
|
||||
HasVerionString = true
|
||||
@@ -1204,8 +1243,8 @@ namespace PckStudio
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
skinsPCKFile.SetData(stream.ToArray());
|
||||
}
|
||||
return stream.ToArray();
|
||||
});
|
||||
}
|
||||
return newPck;
|
||||
}
|
||||
@@ -1213,7 +1252,17 @@ namespace PckStudio
|
||||
private PckFile InitializeTexturePack(int packId, int packVersion, string packName, string res, bool createSkinsPCK = false)
|
||||
{
|
||||
var newPck = InitializePack(packId, packVersion, packName, createSkinsPCK);
|
||||
var texturepackInfo = newPck.CreateNew($"{res}/{res}Info.pck", PckFile.FileData.FileType.TexturePackInfoFile);
|
||||
var texturepackInfo = newPck.CreateNewFile($"{res}/{res}Info.pck", PckFile.FileData.FileType.TexturePackInfoFile,
|
||||
() =>
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
var writer = new PckFileWriter(new PckFile(3),
|
||||
LittleEndianCheckBox.Checked
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(ms);
|
||||
return ms.ToArray();
|
||||
});
|
||||
texturepackInfo.Properties.Add(("PACKID", "0"));
|
||||
texturepackInfo.Properties.Add(("DATAPATH", $"{res}Data.pck"));
|
||||
|
||||
@@ -1221,34 +1270,25 @@ namespace PckStudio
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var icon = infoPCK.CreateNew("icon.png", PckFile.FileData.FileType.TextureFile);
|
||||
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.CreateNew("comparison.png", PckFile.FileData.FileType.TextureFile);
|
||||
var comparison = infoPCK.CreateNewFile("comparison.png", PckFile.FileData.FileType.TextureFile);
|
||||
Resources.Comparison.Save(ms, ImageFormat.Png);
|
||||
comparison.SetData(ms.ToArray());
|
||||
}
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
var writer = new PckFileWriter(new PckFile(3),
|
||||
LittleEndianCheckBox.Checked
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(ms);
|
||||
texturepackInfo.SetData(ms.ToArray());
|
||||
}
|
||||
return newPck;
|
||||
}
|
||||
|
||||
private PckFile InitializeMashUpPack(int packId, int packVersion, string packName, string res)
|
||||
{
|
||||
var newPck = InitializeTexturePack(packId, packVersion, packName, res, true);
|
||||
var gameRuleFile = newPck.CreateNew("GameRules.grf", PckFile.FileData.FileType.GameRulesFile);
|
||||
var gameRuleFile = newPck.CreateNewFile("GameRules.grf", PckFile.FileData.FileType.GameRulesFile);
|
||||
var grfFile = new GameRuleFile();
|
||||
grfFile.AddRule("MapOptions",
|
||||
new KeyValuePair<string, string>("seed", "0"),
|
||||
@@ -1291,10 +1331,10 @@ namespace PckStudio
|
||||
private void texturePackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
checkSaveState();
|
||||
CreateTexturePack packPrompt = new CreateTexturePack("");
|
||||
CreateTexturePack packPrompt = new CreateTexturePack();
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.packName, packPrompt.packRes);
|
||||
currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes);
|
||||
isTemplateFile = true;
|
||||
wasModified = true;
|
||||
LoadEditorTab();
|
||||
@@ -1304,10 +1344,10 @@ namespace PckStudio
|
||||
private void mashUpPackToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
checkSaveState();
|
||||
CreateTexturePack packPrompt = new CreateTexturePack("");
|
||||
CreateTexturePack packPrompt = new CreateTexturePack();
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.packName, packPrompt.packRes);
|
||||
currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes);
|
||||
isTemplateFile = true;
|
||||
wasModified = false;
|
||||
LoadEditorTab();
|
||||
@@ -1553,7 +1593,8 @@ namespace PckStudio
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
LOCFileWriter.Write(stream, locFile);
|
||||
var writer = new LOCFileWriter(locFile, 2);
|
||||
writer.WriteToStream(stream);
|
||||
locdata.SetData(stream.ToArray());
|
||||
}
|
||||
return true;
|
||||
@@ -1577,7 +1618,7 @@ namespace PckStudio
|
||||
{
|
||||
string skinNameImport = Path.GetFileName(contents.FileName);
|
||||
byte[] data = File.ReadAllBytes(contents.FileName);
|
||||
PckFile.FileData mfNew = currentPCK.CreateNew(skinNameImport, PckFile.FileData.FileType.SkinFile);
|
||||
PckFile.FileData mfNew = currentPCK.CreateNewFile(skinNameImport, PckFile.FileData.FileType.SkinFile);
|
||||
mfNew.SetData(data);
|
||||
string propertyFile = Path.GetFileNameWithoutExtension(contents.FileName) + ".txt";
|
||||
if (File.Exists(propertyFile))
|
||||
@@ -1663,31 +1704,6 @@ namespace PckStudio
|
||||
MessageBox.Show("This feature is currently being reworked.", "Currently unavailable", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
public static Bitmap ResizeImage(Image image, int width, int height)
|
||||
{
|
||||
var destRect = new Rectangle(0, 0, width, height);
|
||||
var destImage = new Bitmap(width, height);
|
||||
|
||||
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
|
||||
|
||||
using (var graphics = Graphics.FromImage(destImage))
|
||||
{
|
||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
graphics.SmoothingMode = SmoothingMode.HighQuality;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
using (var wrapMode = new ImageAttributes())
|
||||
{
|
||||
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
|
||||
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
|
||||
}
|
||||
}
|
||||
|
||||
return destImage;
|
||||
}
|
||||
|
||||
private void openToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
DateTime Begin = DateTime.Now;
|
||||
@@ -1954,7 +1970,7 @@ namespace PckStudio
|
||||
renamePrompt.TextLabel.Text = "Path";
|
||||
if (renamePrompt.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(renamePrompt.NewText))
|
||||
{
|
||||
var file = currentPCK.CreateNew(renamePrompt.NewText, PckFile.FileData.FileType.TextureFile);
|
||||
var file = currentPCK.CreateNewFile(renamePrompt.NewText, PckFile.FileData.FileType.TextureFile);
|
||||
file.SetData(File.ReadAllBytes(fileDialog.FileName));
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
@@ -2027,14 +2043,13 @@ namespace PckStudio
|
||||
|
||||
private void colourscolToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PckFile.FileData NewColorFile;
|
||||
if (currentPCK.TryGetFile("colours.col", PckFile.FileData.FileType.ColourTableFile, out NewColorFile))
|
||||
if (currentPCK.TryGetFile("colours.col", PckFile.FileData.FileType.ColourTableFile, out _))
|
||||
{
|
||||
MessageBox.Show("A color table file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
NewColorFile = currentPCK.CreateNew("colours.col", PckFile.FileData.FileType.ColourTableFile);
|
||||
NewColorFile.SetData(Resources.tu69colours);
|
||||
var newColorFile = currentPCK.CreateNewFile("colours.col", PckFile.FileData.FileType.ColourTableFile);
|
||||
newColorFile.SetData(Resources.tu69colours);
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
@@ -2140,19 +2155,14 @@ namespace PckStudio
|
||||
return;
|
||||
}
|
||||
|
||||
PckFile.FileData newSkinsPCKFile = currentPCK.CreateNew("Skins.pck", PckFile.FileData.FileType.SkinDataFile);
|
||||
using (var stream = new MemoryStream())
|
||||
currentPCK.CreateNewFile("Skins.pck", PckFile.FileData.FileType.SkinDataFile, () =>
|
||||
{
|
||||
var writer = new PckFileWriter(new PckFile(3)
|
||||
{
|
||||
HasVerionString = true
|
||||
},
|
||||
LittleEndianCheckBox.Checked
|
||||
? OMI.Endianness.LittleEndian
|
||||
: OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
newSkinsPCKFile.SetData(stream.ToArray());
|
||||
}
|
||||
using var stream = new MemoryStream();
|
||||
var writer = new PckFileWriter(new PckFile(3) { HasVerionString = true },
|
||||
LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
return stream.ToArray();
|
||||
});
|
||||
|
||||
BuildMainTreeView();
|
||||
|
||||
@@ -2201,7 +2211,7 @@ namespace PckStudio
|
||||
using AddFilePrompt diag = new AddFilePrompt("res/" + Path.GetFileName(ofd.FileName));
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
PckFile.FileData file = currentPCK.CreateNew(diag.filepath, (PckFile.FileData.FileType)diag.filetype);
|
||||
PckFile.FileData file = currentPCK.CreateNewFile(diag.Filepath, (PckFile.FileData.FileType)diag.Filetype);
|
||||
file.SetData(File.ReadAllBytes(ofd.FileName));
|
||||
|
||||
if (IsSubPCKNode(treeViewMain.SelectedNode.FullPath)) RebuildSubPCK(treeViewMain.SelectedNode);
|
||||
@@ -2216,27 +2226,24 @@ namespace PckStudio
|
||||
|
||||
private void behavioursbinToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PckFile.FileData NewBehaviourFile;
|
||||
if (currentPCK.TryGetFile("behaviours.bin", PckFile.FileData.FileType.BehavioursFile, out NewBehaviourFile))
|
||||
if (currentPCK.TryGetFile("behaviours.bin", PckFile.FileData.FileType.BehavioursFile, out _))
|
||||
{
|
||||
MessageBox.Show("A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
NewBehaviourFile = BehaviourUtil.CreateNewBehaviourFile();
|
||||
currentPCK.Files.Add(NewBehaviourFile);
|
||||
|
||||
currentPCK.CreateNewFile("behaviours.bin", PckFile.FileData.FileType.BehavioursFile, BehaviourResources.BehaviourFileInitializer);
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
private void entityMaterialsbinToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
PckFile.FileData NewMaterialsFile;
|
||||
if (currentPCK.TryGetFile("entityMaterials.bin", PckFile.FileData.FileType.MaterialFile, out NewMaterialsFile))
|
||||
if (currentPCK.TryGetFile("entityMaterials.bin", PckFile.FileData.FileType.MaterialFile, out _))
|
||||
{
|
||||
MessageBox.Show("A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
NewMaterialsFile = MaterialUtil.CreateNewMaterialsFile();
|
||||
currentPCK.Files.Add(NewMaterialsFile);
|
||||
currentPCK.CreateNewFile("entityMaterials.bin", PckFile.FileData.FileType.MaterialFile, MaterialResources.MaterialsFileInitializer);
|
||||
BuildMainTreeView();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -190,8 +190,6 @@
|
||||
<Compile Include="Classes\Utils\ARC\ARCUtil.cs" />
|
||||
<Compile Include="Classes\Extentions\ImageExtentions.cs" />
|
||||
<Compile Include="Classes\Utils\SkinANIM.cs" />
|
||||
<Compile Include="Classes\IO\StreamDataReader.cs" />
|
||||
<Compile Include="Classes\IO\StreamDataWriter.cs" />
|
||||
<Compile Include="Classes\Models\DefaultModels\Steve64x32Model.cs" />
|
||||
<Compile Include="Classes\Models\DefaultModels\ModelBase.cs" />
|
||||
<Compile Include="Classes\Models\DefaultModels\Texture.cs" />
|
||||
@@ -361,28 +359,28 @@
|
||||
<Compile Include="Forms\Additional-Popups\Grf\AddParameter.Designer.cs">
|
||||
<DependentUpon>AddParameter.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\ModelsUtil.cs" />
|
||||
<Compile Include="Forms\Utilities\MaterialUtil.cs" />
|
||||
<Compile Include="Forms\Utilities\BehaviourUtil.cs" />
|
||||
<Compile Include="Forms\Utilities\AnimationUtil.cs" />
|
||||
<Compile Include="Forms\Utilities\ModelsResources.cs" />
|
||||
<Compile Include="Forms\Utilities\MaterialResources.cs" />
|
||||
<Compile Include="Forms\Utilities\BehaviourResources.cs" />
|
||||
<Compile Include="Forms\Utilities\AnimationResources.cs" />
|
||||
<Compile Include="Forms\Editor\BoxEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Editor\BoxEditor.Designer.cs">
|
||||
<DependentUpon>BoxEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Editor\ANIMEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Editor\ANIMEditor.Designer.cs">
|
||||
<DependentUpon>ANIMEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\Preferences.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\Preferences.Designer.cs">
|
||||
<DependentUpon>Preferences.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\Skins\BoxEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\Skins\BoxEditor.Designer.cs">
|
||||
<DependentUpon>BoxEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\Skins\ANIMEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Utilities\Skins\ANIMEditor.Designer.cs">
|
||||
<DependentUpon>ANIMEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -565,17 +563,11 @@
|
||||
<EmbeddedResource Include="Forms\Additional-Popups\Grf\AddParameter.resx">
|
||||
<DependentUpon>AddParameter.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Utilities\Preferences.ja.resx">
|
||||
<DependentUpon>Preferences.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Utilities\Preferences.resx">
|
||||
<DependentUpon>Preferences.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Utilities\Skins\BoxEditor.resx">
|
||||
<EmbeddedResource Include="Forms\Editor\BoxEditor.resx">
|
||||
<DependentUpon>BoxEditor.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Utilities\Skins\ANIMEditor.resx">
|
||||
<EmbeddedResource Include="Forms\Editor\ANIMEditor.resx">
|
||||
<DependentUpon>ANIMEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.ja.resx">
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace PckStudio
|
||||
|
||||
static class Program
|
||||
{
|
||||
public static readonly string ProjectUrl = "https://github.com/PhoenixARC/-PCK-Studio";
|
||||
public static readonly string BaseAPIUrl = "http://api.pckstudio.xyz/api/pck";
|
||||
public static readonly string BackUpAPIUrl = "https://raw.githubusercontent.com/PhoenixARC/pckstudio.tk/main/studio/PCK/api/";
|
||||
public static readonly string AppData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PCK-Studio");
|
||||
|
||||
2
Vendor/OMI-Lib
vendored
2
Vendor/OMI-Lib
vendored
Submodule Vendor/OMI-Lib updated: e859271a0d...806fde8e51
Reference in New Issue
Block a user