mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-02 20:04:32 +00:00
Core - Massive DLCManager changes
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AnimatedGif;
|
||||
|
||||
namespace PckStudio.Core.Extensions
|
||||
@@ -23,5 +26,26 @@ namespace PckStudio.Core.Extensions
|
||||
ms.Position = 0;
|
||||
return Image.FromStream(ms);
|
||||
}
|
||||
|
||||
public static Animation Combine(this Animation first, Animation second, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
if (first == null)
|
||||
return second;
|
||||
if (second == null)
|
||||
return first;
|
||||
if (first.TextureCount != second.TextureCount)
|
||||
return first;
|
||||
if (first.FrameCount != second.FrameCount)
|
||||
return first;
|
||||
|
||||
Image[] secondTextures = second.GetTextures().ToArray();
|
||||
|
||||
Animation animation = new Animation(first.GetTextures().enumerate().Select(ift => ift.value.Combine(secondTextures[ift.index], layoutDirection)));
|
||||
foreach ((int texId, int frameTime) item in first.GetFrames().Select(f => (texId: first.GetTextureIndex(f.Texture), frameTime: f.Ticks)))
|
||||
{
|
||||
animation.AddFrame(item.texId, item.frameTime);
|
||||
}
|
||||
return animation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user