mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-07 14:58:18 +00:00
Moved Tile Json definitions to seperate files inside Internal/Json
This commit is contained in:
@@ -6,6 +6,7 @@ using MetroFramework.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Forms.Utilities;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
{
|
||||
@@ -50,7 +51,7 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
|
||||
private void GetTileDataToView(string key, TreeNodeCollection collection, Action<TreeNode> additinalAction)
|
||||
{
|
||||
List<AnimationResources.JsonTileInfo> textureInfos = key switch
|
||||
List<JsonTileInfo> textureInfos = key switch
|
||||
{
|
||||
"blocks" => AnimationResources.BlockTileInfos,
|
||||
"items" => AnimationResources.ItemTileInfos,
|
||||
|
||||
@@ -17,6 +17,7 @@ using PckStudio.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using System.Diagnostics;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -408,7 +409,7 @@ namespace PckStudio.Forms.Editor
|
||||
_ => throw new ArgumentOutOfRangeException(currentAnimation.Category.ToString())
|
||||
};
|
||||
|
||||
if (textureInfos.FirstOrDefault(p => p.InternalName == TileName) is AnimationResources.JsonTileInfo textureInfo)
|
||||
if (textureInfos.FirstOrDefault(p => p.InternalName == TileName) is JsonTileInfo textureInfo)
|
||||
{
|
||||
tileLabel.Text = textureInfo.DisplayName;
|
||||
return;
|
||||
|
||||
@@ -31,6 +31,7 @@ using OMI.Workers.Color;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Forms.Utilities;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
namespace PckStudio
|
||||
{
|
||||
@@ -55,14 +56,14 @@ namespace PckStudio
|
||||
private readonly List<AtlasTile> _tiles;
|
||||
|
||||
private AtlasTile _selectedTile;
|
||||
private class AtlasTile
|
||||
private sealed class AtlasTile
|
||||
{
|
||||
internal readonly int Index;
|
||||
internal readonly Rectangle Area;
|
||||
internal readonly AnimationResources.JsonTileInfo Tile;
|
||||
internal readonly JsonTileInfo Tile;
|
||||
internal readonly Image Texture;
|
||||
|
||||
public AtlasTile(int index, Rectangle area, AnimationResources.JsonTileInfo tile, Image texture)
|
||||
public AtlasTile(int index, Rectangle area, JsonTileInfo tile, Image texture)
|
||||
{
|
||||
Index = index;
|
||||
Area = area;
|
||||
|
||||
@@ -10,54 +10,15 @@ using PckStudio.Extensions;
|
||||
using PckStudio.Forms.Editor;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Internal.Json;
|
||||
|
||||
namespace PckStudio.Forms.Utilities
|
||||
{
|
||||
public static class AnimationResources
|
||||
{
|
||||
internal class TileJson
|
||||
{
|
||||
[JsonProperty("blocks")]
|
||||
public List<JsonTileInfo> Blocks { get; set; }
|
||||
[JsonProperty("items")]
|
||||
public List<JsonTileInfo> Items { get; set; }
|
||||
}
|
||||
|
||||
private static TileJson _jsonData;
|
||||
internal static TileJson JsonTileData => _jsonData ??= JsonConvert.DeserializeObject<TileJson>(Resources.tileData);
|
||||
|
||||
internal class JsonTileInfo
|
||||
{
|
||||
[JsonProperty("displayName")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[JsonProperty("internalName")]
|
||||
public string InternalName { get; set; }
|
||||
|
||||
[JsonProperty("hasColourEntry", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool HasColourEntry { get; set; }
|
||||
|
||||
[JsonProperty("colourEntry", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public JsonColorEntry ColourEntry { get; set; }
|
||||
|
||||
public JsonTileInfo(string displayName, string internalName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
InternalName = internalName;
|
||||
}
|
||||
}
|
||||
|
||||
internal class JsonColorEntry
|
||||
{
|
||||
[JsonProperty("defaultName", Required = Required.Always)]
|
||||
public string DefaultName { get; set; }
|
||||
|
||||
[JsonProperty("isWaterColour", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool IsWaterColour { get; set; }
|
||||
|
||||
[JsonProperty("variants", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public string[] Variants { get; set; }
|
||||
}
|
||||
private static JsonTiles _jsonData;
|
||||
internal static JsonTiles JsonTileData => _jsonData ??= JsonConvert.DeserializeObject<JsonTiles>(Resources.tileData);
|
||||
|
||||
internal static List<JsonTileInfo> ItemTileInfos => JsonTileData.Items;
|
||||
|
||||
|
||||
21
PCK-Studio/Internal/Json/ColorEntry.cs
Normal file
21
PCK-Studio/Internal/Json/ColorEntry.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
{
|
||||
internal class JsonColorEntry
|
||||
{
|
||||
[JsonProperty("defaultName", Required = Required.Always)]
|
||||
public string DefaultName { get; set; }
|
||||
|
||||
[JsonProperty("isWaterColour", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool IsWaterColour { get; set; }
|
||||
|
||||
[JsonProperty("variants", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public string[] Variants { get; set; }
|
||||
}
|
||||
}
|
||||
30
PCK-Studio/Internal/Json/TileInfo.cs
Normal file
30
PCK-Studio/Internal/Json/TileInfo.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
{
|
||||
internal class JsonTileInfo
|
||||
{
|
||||
[JsonProperty("displayName")]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[JsonProperty("internalName")]
|
||||
public string InternalName { get; set; }
|
||||
|
||||
[JsonProperty("hasColourEntry", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool HasColourEntry { get; set; }
|
||||
|
||||
[JsonProperty("colourEntry", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public JsonColorEntry ColourEntry { get; set; }
|
||||
|
||||
public JsonTileInfo(string displayName, string internalName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
InternalName = internalName;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
PCK-Studio/Internal/Json/Tiles.cs
Normal file
17
PCK-Studio/Internal/Json/Tiles.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
{
|
||||
internal class JsonTiles
|
||||
{
|
||||
[JsonProperty("blocks")]
|
||||
public List<JsonTileInfo> Blocks { get; set; }
|
||||
[JsonProperty("items")]
|
||||
public List<JsonTileInfo> Items { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,9 @@
|
||||
<Compile Include="Classes\Misc\OpenFolderDialog.cs" />
|
||||
<Compile Include="Classes\Models\DefaultModels\Steve64x64Model.cs" />
|
||||
<Compile Include="Internal\ApplicationScope.cs" />
|
||||
<Compile Include="Internal\Json\ColorEntry.cs" />
|
||||
<Compile Include="Internal\Json\TileInfo.cs" />
|
||||
<Compile Include="Internal\Json\Tiles.cs" />
|
||||
<Compile Include="Internal\Profiler.cs" />
|
||||
<Compile Include="Internal\SettingsManager.cs" />
|
||||
<Compile Include="Internal\SkinBOX.cs" />
|
||||
@@ -814,6 +817,6 @@
|
||||
<PropertyGroup>
|
||||
<StringDate>$([System.DateTime]::Now.ToString('yyyy-MM-dd'))</StringDate>
|
||||
</PropertyGroup>
|
||||
<ZipDirectory SourceDirectory="$(OutputPath)" DestinationFile="$(OutputPath)\..\$(AssemblyName)_$(Configuration)_$(StringDate).zip" Overwrite="true" />
|
||||
<ZipDirectory SourceDirectory="$(OutputPath)" DestinationFile="$(OutputPath)\..\$(AssemblyName)_$(Configuration)@$(BuildBranch)_$(StringDate).zip" Overwrite="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user