mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-30 13:36:37 +00:00
tileData.json - Updated fields that have color entries
This commit is contained in:
@@ -50,7 +50,7 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
|
||||
private void GetTileDataToView(string key, TreeNodeCollection collection, Action<TreeNode> additinalAction)
|
||||
{
|
||||
List<AnimationResources.TileInfo> textureInfos = key switch
|
||||
List<AnimationResources.JsonTileInfo> textureInfos = key switch
|
||||
{
|
||||
"blocks" => AnimationResources.BlockTileInfos,
|
||||
"items" => AnimationResources.ItemTileInfos,
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace PckStudio.Forms.Editor
|
||||
_ => throw new ArgumentOutOfRangeException(currentAnimation.Category.ToString())
|
||||
};
|
||||
|
||||
if (textureInfos.FirstOrDefault(p => p.InternalName == TileName) is AnimationResources.TileInfo textureInfo)
|
||||
if (textureInfos.FirstOrDefault(p => p.InternalName == TileName) is AnimationResources.JsonTileInfo textureInfo)
|
||||
{
|
||||
tileLabel.Text = textureInfo.DisplayName;
|
||||
return;
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace PckStudio
|
||||
internal readonly string Name;
|
||||
internal readonly string TextureName;
|
||||
internal readonly Rectangle Area;
|
||||
internal readonly AnimationResources.TileInfo Tile;
|
||||
internal readonly AnimationResources.JsonTileInfo Tile;
|
||||
|
||||
public SelectedTile(int index, string name, string textureName, Rectangle area, AnimationResources.TileInfo tile)
|
||||
public SelectedTile(int index, string name, string textureName, Rectangle area, AnimationResources.JsonTileInfo tile)
|
||||
{
|
||||
Index = index;
|
||||
Name = name;
|
||||
@@ -70,7 +70,7 @@ namespace PckStudio
|
||||
private readonly int _columnCount;
|
||||
private readonly string _atlasType;
|
||||
private readonly List<Image> _textures;
|
||||
private readonly List<AnimationResources.TileInfo> _textureInfos;
|
||||
private readonly List<AnimationResources.JsonTileInfo> _textureInfos;
|
||||
|
||||
private SelectedTile _selectedItem = new SelectedTile();
|
||||
private ColorContainer _colourTable;
|
||||
@@ -149,9 +149,10 @@ namespace PckStudio
|
||||
{
|
||||
var img = _textures[index];
|
||||
if (_selectedItem.Tile.HasColourEntry &&
|
||||
!string.IsNullOrWhiteSpace(_selectedItem.Tile.ColourEntryName) &&
|
||||
_selectedItem.Tile.HasColourEntry &&
|
||||
!string.IsNullOrWhiteSpace(_selectedItem.Tile.ColourEntry.DefaultName) &&
|
||||
_colourTable is not null &&
|
||||
_colourTable.Colors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntryName) is ColorContainer.Color color)
|
||||
_colourTable.Colors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntry.DefaultName) is ColorContainer.Color color)
|
||||
{
|
||||
img = img.Blend(color.ColorPallette, BlendMode.Multiply);
|
||||
}
|
||||
@@ -333,16 +334,16 @@ namespace PckStudio
|
||||
|
||||
AnimationEditor animationEditor;
|
||||
if (_selectedItem.Tile.HasColourEntry &&
|
||||
!string.IsNullOrWhiteSpace(_selectedItem.Tile.ColourEntryName) &&
|
||||
!string.IsNullOrWhiteSpace(_selectedItem.Tile.ColourEntry.DefaultName) &&
|
||||
_colourTable is not null)
|
||||
{
|
||||
Color blenColor = Color.White;
|
||||
if (_selectedItem.Tile.IsWaterColour &&
|
||||
_colourTable.WaterColors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntryName) is ColorContainer.WaterColor waterColor)
|
||||
if (_selectedItem.Tile.ColourEntry.IsWaterColour &&
|
||||
_colourTable.WaterColors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntry.DefaultName) is ColorContainer.WaterColor waterColor)
|
||||
{
|
||||
blenColor = waterColor.SurfaceColor;
|
||||
}
|
||||
else if (_colourTable.Colors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntryName) is ColorContainer.Color color)
|
||||
else if (_colourTable.Colors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntry.DefaultName) is ColorContainer.Color color)
|
||||
{
|
||||
blenColor = color.ColorPallette;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@ namespace PckStudio.Forms.Utilities
|
||||
internal class TileJson
|
||||
{
|
||||
[JsonProperty("blocks")]
|
||||
public List<TileInfo> Blocks { get; set; }
|
||||
public List<JsonTileInfo> Blocks { get; set; }
|
||||
[JsonProperty("items")]
|
||||
public List<TileInfo> Items { get; set; }
|
||||
public List<JsonTileInfo> Items { get; set; }
|
||||
}
|
||||
|
||||
private static TileJson _jsonData;
|
||||
internal static TileJson JsonTileData => _jsonData ??= JsonConvert.DeserializeObject<TileJson>(Resources.tileData);
|
||||
|
||||
public class TileInfo
|
||||
internal class JsonTileInfo
|
||||
{
|
||||
[JsonProperty("displayName")]
|
||||
public string DisplayName { get; set; }
|
||||
@@ -37,22 +37,31 @@ namespace PckStudio.Forms.Utilities
|
||||
[JsonProperty("hasColourEntry", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool HasColourEntry { get; set; }
|
||||
|
||||
[JsonProperty("isWaterColour", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool IsWaterColour { get; set; }
|
||||
[JsonProperty("colourEntry", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public JsonColorEntry ColourEntry { get; set; }
|
||||
|
||||
[JsonProperty("colourEntryName", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public string ColourEntryName { get; set; }
|
||||
|
||||
public TileInfo(string displayName, string internalName)
|
||||
public JsonTileInfo(string displayName, string internalName)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
InternalName = internalName;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<TileInfo> ItemTileInfos => JsonTileData.Items;
|
||||
internal class JsonColorEntry
|
||||
{
|
||||
[JsonProperty("defaultName", Required = Required.Always)]
|
||||
public string DefaultName { get; set; }
|
||||
|
||||
public static List<TileInfo> BlockTileInfos => JsonTileData.Blocks;
|
||||
[JsonProperty("isWaterColour", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public bool IsWaterColour { get; set; }
|
||||
|
||||
[JsonProperty("variants", DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public string[] Variants { get; set; }
|
||||
}
|
||||
|
||||
internal static List<JsonTileInfo> ItemTileInfos => JsonTileData.Items;
|
||||
|
||||
internal static List<JsonTileInfo> BlockTileInfos => JsonTileData.Blocks;
|
||||
|
||||
private static Image[] _itemImages;
|
||||
public static Image[] ItemImages => _itemImages ??= Resources.items_sheet.CreateImageList(16).ToArray();
|
||||
|
||||
@@ -6,8 +6,16 @@
|
||||
"internalName": "grass_top",
|
||||
"displayName": "Grass Block (Top)",
|
||||
"hasColourEntry": true,
|
||||
"isWaterColour": false,
|
||||
"colourEntryName": "Grass_Common"
|
||||
"colourEntry": {
|
||||
"isWaterColour": false,
|
||||
"defaultName": "Grass_Common",
|
||||
"variants": [
|
||||
"Grass_Common",
|
||||
"Grass_Mesa",
|
||||
"Grass_Swamp1",
|
||||
"Grass_Swamp2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "stone",
|
||||
@@ -161,8 +169,16 @@
|
||||
"internalName": "grass_side_overlay",
|
||||
"displayName": "Grass Side (Overlay)",
|
||||
"hasColourEntry": true,
|
||||
"isWaterColour": false,
|
||||
"colourEntryName": "Grass_Common"
|
||||
"colourEntry": {
|
||||
"isWaterColour": false,
|
||||
"defaultName": "Grass_Common",
|
||||
"variants": [
|
||||
"Grass_Common",
|
||||
"Grass_Mesa",
|
||||
"Grass_Swamp1",
|
||||
"Grass_Swamp2"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "tallgrass",
|
||||
@@ -314,7 +330,12 @@
|
||||
},
|
||||
{
|
||||
"internalName": "waterlily",
|
||||
"displayName": "Lily Pad"
|
||||
"displayName": "Lily Pad",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "Tile_WaterLily",
|
||||
"variants": [ "Tile_WaterLily" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "mycel_side",
|
||||
@@ -832,15 +853,21 @@
|
||||
"internalName": "water",
|
||||
"displayName": "Water",
|
||||
"hasColourEntry": true,
|
||||
"isWaterColour": true,
|
||||
"colourEntryName": "default"
|
||||
"colourEntry": {
|
||||
"isWaterColour": true,
|
||||
"defaultName": "default",
|
||||
"variants": [ "default" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "water_flow",
|
||||
"displayName": "Flowing Water",
|
||||
"hasColourEntry": true,
|
||||
"isWaterColour": true,
|
||||
"colourEntryName": "default"
|
||||
"colourEntry": {
|
||||
"isWaterColour": true,
|
||||
"defaultName": "default",
|
||||
"variants": [ "default" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
@@ -2514,7 +2541,13 @@
|
||||
"items": [
|
||||
{
|
||||
"internalName": "helmetCloth",
|
||||
"displayName": "Leather Cap"
|
||||
"displayName": "Leather Cap",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"isWaterColour": false,
|
||||
"defaultName": "Armour_Default_Leather_Colour",
|
||||
"variants": [ "Armour_Default_Leather_Colour" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "helmetChain",
|
||||
@@ -2578,7 +2611,13 @@
|
||||
},
|
||||
{
|
||||
"internalName": "chestplateCloth",
|
||||
"displayName": "Leather Tunic"
|
||||
"displayName": "Leather Tunic",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"isWaterColour": false,
|
||||
"defaultName": "Armour_Default_Leather_Colour",
|
||||
"variants": [ "Armour_Default_Leather_Colour" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "chestplateChain",
|
||||
@@ -2642,7 +2681,13 @@
|
||||
},
|
||||
{
|
||||
"internalName": "leggingsCloth",
|
||||
"displayName": "Leather Pants"
|
||||
"displayName": "Leather Pants",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"isWaterColour": false,
|
||||
"defaultName": "Armour_Default_Leather_Colour",
|
||||
"variants": [ "Armour_Default_Leather_Colour" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "leggingsChain",
|
||||
@@ -2706,7 +2751,13 @@
|
||||
},
|
||||
{
|
||||
"internalName": "bootsCloth",
|
||||
"displayName": "Leather Boots"
|
||||
"displayName": "Leather Boots",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"isWaterColour": false,
|
||||
"defaultName": "Armour_Default_Leather_Colour",
|
||||
"variants": [ "Armour_Default_Leather_Colour" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "bootsChain",
|
||||
@@ -2729,8 +2780,8 @@
|
||||
"displayName": "Stick"
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
"internalName": "compass",
|
||||
"displayName": "Compass"
|
||||
},
|
||||
{
|
||||
"internalName": "diamond",
|
||||
@@ -2793,8 +2844,8 @@
|
||||
"displayName": "Fishing Rod"
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
"internalName": "clock",
|
||||
"displayName": "Clock"
|
||||
},
|
||||
{
|
||||
"internalName": "bowl",
|
||||
|
||||
Reference in New Issue
Block a user