mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-24 15:14:33 +00:00
Added Atlas Editor support for Experience Orbs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2023-present miku-666
|
||||
/* Copyright (c) 2023-present miku-666, MattNL
|
||||
* 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.
|
||||
@@ -111,9 +111,11 @@ namespace PckStudio.Forms.Editor
|
||||
"mapicons" => (Tiles.MapIconTileInfos, "map_icons"),
|
||||
"additionalmapicons" => (Tiles.AdditionalMapIconTileInfos, "additional_map_icons"),
|
||||
"moon_phases" => (Tiles.MoonPhaseTileInfos, "moon_phases"),
|
||||
"xporb" => (Tiles.ExperienceOrbTileInfos, "experience_orbs"),
|
||||
_ => (null, null),
|
||||
};
|
||||
|
||||
// there's got to be a better way to get around this clone exception
|
||||
originalPictureBox.Image = (Image)((Bitmap)atlas).Clone(new Rectangle(new Point(0, 0), new Size(atlas.Width - 1, atlas.Height - 1)), PixelFormat.Format32bppArgb);
|
||||
|
||||
var images = atlas.Split(_areaSize, _imageLayout);
|
||||
@@ -368,9 +370,12 @@ namespace PckStudio.Forms.Editor
|
||||
var col = FindBlendColorByKey(dataTile.Tile.ColourEntry.DefaultName);
|
||||
return col;
|
||||
}
|
||||
|
||||
return Color.White;
|
||||
}
|
||||
|
||||
int xp_orb_red = 0x0;
|
||||
bool xp_orb_reverse = false;
|
||||
private Color FindBlendColorByKey(string colorKey)
|
||||
{
|
||||
if (_colourTable is not null &&
|
||||
@@ -390,6 +395,18 @@ namespace PckStudio.Forms.Editor
|
||||
return waterColor.SurfaceColor;
|
||||
}
|
||||
}
|
||||
|
||||
// Experience Orbs are hardcoded within a range and do not have color table entries
|
||||
if (colorKey == "experience_orb")
|
||||
{
|
||||
if (xp_orb_red == 0) xp_orb_reverse = false;
|
||||
if (xp_orb_red == 0xFF) xp_orb_reverse = true;
|
||||
|
||||
xp_orb_red += xp_orb_reverse ? -0x05 : 0x05;
|
||||
|
||||
return Color.FromArgb(xp_orb_red, 255, 0);
|
||||
}
|
||||
|
||||
return Color.White;
|
||||
}
|
||||
|
||||
@@ -397,6 +414,10 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
switch (keyData)
|
||||
{
|
||||
case Keys.R:
|
||||
// Reselects the specific tile. Can be held to for cycling through colors for XP orbs
|
||||
SelectedIndex = _selectedTile.Index;
|
||||
return true;
|
||||
case Keys.Left:
|
||||
SelectedIndex = _selectedTile.Index - 1;
|
||||
return true;
|
||||
|
||||
@@ -15,14 +15,21 @@ namespace PckStudio.Internal.Json
|
||||
{
|
||||
[JsonProperty("blocks")]
|
||||
public List<JsonTileInfo> Blocks { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public List<JsonTileInfo> Items { get; set; }
|
||||
|
||||
[JsonProperty("moon_phases")]
|
||||
public List<JsonTileInfo> MoonPhases { get; set; }
|
||||
|
||||
[JsonProperty("map_icons")]
|
||||
public List<JsonTileInfo> MapIcons { get; set; }
|
||||
|
||||
[JsonProperty("additional_map_icons")]
|
||||
public List<JsonTileInfo> AdditionalMapIcons { get; set; }
|
||||
|
||||
[JsonProperty("experience_orbs")]
|
||||
public List<JsonTileInfo> ExperienceOrbs { get; set; }
|
||||
}
|
||||
|
||||
internal static class Tiles
|
||||
@@ -36,6 +43,7 @@ namespace PckStudio.Internal.Json
|
||||
internal static List<JsonTileInfo> MoonPhaseTileInfos => JsonTileData.MoonPhases;
|
||||
internal static List<JsonTileInfo> MapIconTileInfos => JsonTileData.MapIcons;
|
||||
internal static List<JsonTileInfo> AdditionalMapIconTileInfos => JsonTileData.AdditionalMapIcons;
|
||||
internal static List<JsonTileInfo> ExperienceOrbTileInfos => JsonTileData.ExperienceOrbs;
|
||||
|
||||
private static Image[] _itemImages;
|
||||
public static Image[] ItemImages => _itemImages ??= Resources.items_sheet.SplitHorizontal(16).ToArray();
|
||||
@@ -50,7 +58,10 @@ namespace PckStudio.Internal.Json
|
||||
public static Image[] MapIconImages => _mapIconImages ??= Resources.map_icons_sheet.SplitHorizontal(4).ToArray();
|
||||
|
||||
private static Image[] _additionalMapIconImages;
|
||||
public static Image[] AdditionalMapIconImages => _mapIconImages ??= Resources.additional_map_icons_sheet.SplitHorizontal(4).ToArray();
|
||||
public static Image[] AdditionalMapIconImages => _additionalMapIconImages ??= Resources.additional_map_icons_sheet.SplitHorizontal(4).ToArray();
|
||||
|
||||
private static Image[] _experienceOrbIconImages;
|
||||
public static Image[] ExperienceOrbIconImages => _experienceOrbIconImages ??= Resources.experience_orbs_sheet.SplitHorizontal(4).ToArray();
|
||||
|
||||
private static ImageList _itemImageList;
|
||||
public static ImageList ItemImageList
|
||||
@@ -111,5 +122,35 @@ namespace PckStudio.Internal.Json
|
||||
return _mapIconImageList;
|
||||
}
|
||||
}
|
||||
|
||||
private static ImageList _additionalMapIconImageList;
|
||||
public static ImageList AdditionalMapIconImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_additionalMapIconImageList is null)
|
||||
{
|
||||
_additionalMapIconImageList = new ImageList();
|
||||
_additionalMapIconImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_additionalMapIconImageList.Images.AddRange(AdditionalMapIconImages);
|
||||
}
|
||||
return _additionalMapIconImageList;
|
||||
}
|
||||
}
|
||||
|
||||
private static ImageList _experienceOrbsImageList;
|
||||
public static ImageList ExperienceOrbsImageList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_experienceOrbsImageList is null)
|
||||
{
|
||||
_experienceOrbsImageList = new ImageList();
|
||||
_experienceOrbsImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
_experienceOrbsImageList.Images.AddRange(ExperienceOrbIconImages);
|
||||
}
|
||||
return _experienceOrbsImageList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,14 +379,16 @@ namespace PckStudio
|
||||
bool isMoonPhases = file.Filename == "res/terrain/moon_phases.png";
|
||||
bool isMapIcons = file.Filename == "res/misc/mapicons.png";
|
||||
bool isAdditionalMapIcons = file.Filename == "res/misc/additionalmapicons.png";
|
||||
bool isXPOrbs = file.Filename == "res/item/xporb.png";
|
||||
|
||||
if (isTerrainOrItems || isMoonPhases || isMapIcons || isAdditionalMapIcons)
|
||||
if (isTerrainOrItems || isMoonPhases || isMapIcons || isAdditionalMapIcons || isXPOrbs)
|
||||
{
|
||||
var img = file.GetTexture();
|
||||
|
||||
var columnCount = 0;
|
||||
// all of the other atlases so far use 4
|
||||
var columnCount = 4;
|
||||
|
||||
if (isTerrainOrItems) columnCount = 16;
|
||||
else if (isMoonPhases || isMapIcons || isAdditionalMapIcons) columnCount = 4;
|
||||
|
||||
var resolution = img.Width / columnCount;
|
||||
var size = new Size(resolution, resolution);
|
||||
|
||||
@@ -680,6 +680,7 @@
|
||||
<None Include="Resources\atlases\additional_mapicons.png" />
|
||||
<None Include="Resources\atlases\map_icons.png" />
|
||||
<Content Include="Resources\atlases\entities.png" />
|
||||
<None Include="Resources\atlases\experience_orbs.png" />
|
||||
<Content Include="Resources\atlases\items.png" />
|
||||
<Content Include="Resources\atlases\moon_phases.png" />
|
||||
<Content Include="Resources\atlases\terrain.png" />
|
||||
|
||||
10
PCK-Studio/Properties/Resources.Designer.cs
generated
10
PCK-Studio/Properties/Resources.Designer.cs
generated
@@ -294,6 +294,16 @@ namespace PckStudio.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap experience_orbs_sheet {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("experience_orbs_sheet", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -337,4 +337,7 @@
|
||||
<data name="map_icons_sheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\atlases\map_icons.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="experience_orbs_sheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\atlases\experience_orbs.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
PCK-Studio/Resources/atlases/experience_orbs.png
Normal file
BIN
PCK-Studio/Resources/atlases/experience_orbs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 583 B |
@@ -4322,5 +4322,126 @@
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
}
|
||||
],
|
||||
"experience_orbs": [
|
||||
{
|
||||
"internalName": "experience_orb_0",
|
||||
"displayName": "Experience Orb (Size 1)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_1",
|
||||
"displayName": "Experience Orb (Size 2)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_2",
|
||||
"displayName": "Experience Orb (Size 3)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_3",
|
||||
"displayName": "Experience Orb (Size 4)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_4",
|
||||
"displayName": "Experience Orb (Size 5)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_5",
|
||||
"displayName": "Experience Orb (Size 6)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_6",
|
||||
"displayName": "Experience Orb (Size 7)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_7",
|
||||
"displayName": "Experience Orb (Size 8)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_8",
|
||||
"displayName": "Experience Orb (Size 9)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_9",
|
||||
"displayName": "Experience Orb (Size 10)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "experience_orb_10",
|
||||
"displayName": "Experience Orb (Size 11)",
|
||||
"hasColourEntry": true,
|
||||
"colourEntry": {
|
||||
"defaultName": "experience_orb",
|
||||
"variants": ["experience_orb"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
},
|
||||
{
|
||||
"internalName": "",
|
||||
"displayName": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user