Core - Rename const 'Animation.MinimumFrameTime' to 'Animation.MINIMUM_FRAME_TIME'

This commit is contained in:
miku-666
2025-11-19 20:11:03 +01:00
parent 8a3c45260d
commit 1cbc51def8
5 changed files with 9 additions and 9 deletions

View File

@@ -270,7 +270,7 @@ namespace PckStudio.Forms.Editor
diag.SaveBtn.Text = "Add";
if (diag.ShowDialog(this) == DialogResult.OK)
{
EditorValue.AddFrame(diag.FrameTextureIndex, _editable ? diag.FrameTime : Animation.MinimumFrameTime);
EditorValue.AddFrame(diag.FrameTextureIndex, _editable ? diag.FrameTime : Animation.MINIMUM_FRAME_TIME);
UpdateTreeView();
}
}

View File

@@ -27,7 +27,7 @@ namespace PckStudio.Core
{
public sealed class Animation
{
public const int MinimumFrameTime = 1;
public const int MINIMUM_FRAME_TIME = 1;
public int FrameCount => _frames.Count;
@@ -41,7 +41,7 @@ namespace PckStudio.Core
private object _syncLock = new object();
public Animation(IEnumerable<Image> textures, bool initFramesFromTextures = false, int frameTime = MinimumFrameTime)
public Animation(IEnumerable<Image> textures, bool initFramesFromTextures = false, int frameTime = MINIMUM_FRAME_TIME)
{
_textures = new List<Image>(textures);
if (initFramesFromTextures)
@@ -69,7 +69,7 @@ namespace PckStudio.Core
private int _ticks;
private object _syncObject = new object();
public Frame(Image texture) : this(texture, MinimumFrameTime)
public Frame(Image texture) : this(texture, MINIMUM_FRAME_TIME)
{ }
public Frame(Image texture, int frameTime)
@@ -160,7 +160,7 @@ namespace PckStudio.Core
}
}
public void SetFrame(int frameIndex, int textureIndex, int frameTime = MinimumFrameTime)
public void SetFrame(int frameIndex, int textureIndex, int frameTime = MINIMUM_FRAME_TIME)
{
CheckTextureIndex(textureIndex);
SetFrame(frameIndex, new Frame(_textures[textureIndex], frameTime));

View File

@@ -31,7 +31,7 @@ namespace PckStudio.Core
public override Size GetSize(Size tileSize) => new Size(tileSize.Width * (Direction == ImageLayoutDirection.Horizontal ? Count : 1), tileSize.Height * (Direction == ImageLayoutDirection.Vertical ? Count : 1));
public AtlasGroupAnimation(string name, int row, int column, int frameCount, ImageLayoutDirection direction, int frameTime = Animation.MinimumFrameTime)
public AtlasGroupAnimation(string name, int row, int column, int frameCount, ImageLayoutDirection direction, int frameTime = Animation.MINIMUM_FRAME_TIME)
: base(name, row, column)
{
Count = frameCount;

View File

@@ -41,7 +41,7 @@ namespace PckStudio.Core
public override Size GetSize(Size tileSize) => new Size(RowSpan * tileSize.Width * (Direction == ImageLayoutDirection.Horizontal ? _frameCount : 1), ColumnSpan * tileSize.Height * (Direction == ImageLayoutDirection.Vertical ? _frameCount : 1));
public AtlasGroupLargeTileAnimation(string name, int row, int column, int rowSpan, int columnSpan, int frameCount, ImageLayoutDirection direction, int frameTime = Animation.MinimumFrameTime)
public AtlasGroupLargeTileAnimation(string name, int row, int column, int rowSpan, int columnSpan, int frameCount, ImageLayoutDirection direction, int frameTime = Animation.MINIMUM_FRAME_TIME)
: base(name, row, column)
{
_frameCount = Math.Abs(frameCount);

View File

@@ -48,7 +48,7 @@ namespace PckStudio.Core.Deserializer
return false;
}
int lastFrameTime = Animation.MinimumFrameTime;
int lastFrameTime = Animation.MINIMUM_FRAME_TIME;
foreach (string frameInfo in animData)
{
string[] frameData = frameInfo.Split('*');
@@ -74,7 +74,7 @@ namespace PckStudio.Core.Deserializer
if (jsonObject["animation"] is not JToken animation)
return result;
int frameTime = Animation.MinimumFrameTime;
int frameTime = Animation.MINIMUM_FRAME_TIME;
if (animation["frametime"] is JToken frametime_token && frametime_token.Type == JTokenType.Integer)
frameTime = (int)frametime_token;