新增自定义动画类,修复道具数量显示功能,更新项目脚本配置,禁用多个项目功能,调整UI元素位置,删除无用文件。
This commit is contained in:
90
Base/_Tool/CustomAnimation_Class.nut
Normal file
90
Base/_Tool/CustomAnimation_Class.nut
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
文件名:CustomAnimation_Class.nut
|
||||
路径:Base/_Tool/CustomAnimation_Class.nut
|
||||
创建日期:2026-01-13 19:54
|
||||
文件用途:
|
||||
*/
|
||||
class Rindro_CustomAnimation {
|
||||
|
||||
//Img路径
|
||||
ImgPath = null;
|
||||
//Img对象
|
||||
Img = null;
|
||||
//帧信息
|
||||
ImgFrame = null;
|
||||
|
||||
|
||||
//播放状态
|
||||
State = 0;
|
||||
//循环
|
||||
LoopFlag = true;
|
||||
|
||||
//当前帧数
|
||||
CurFrame = 0;
|
||||
//初始化时间
|
||||
InitTime = 0;
|
||||
//Ani当前帧播放时间
|
||||
PlayCurTime = 0;
|
||||
|
||||
|
||||
//img 路径 调用帧数组
|
||||
constructor(path, frame) {
|
||||
ImgPath = path.tolower();
|
||||
Img = Rindro_Image(ImgPath);
|
||||
ImgFrame = frame;
|
||||
InitTime = Clock();
|
||||
State = 1;
|
||||
|
||||
//预载入img
|
||||
foreach(FrameObj in ImgFrame) {
|
||||
Img.DrawPng(FrameObj.ImgIndex, -999, 999);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Show(dt, X, Y) {
|
||||
if (State == 1) {
|
||||
if (ImgFrame) {
|
||||
local NowFrameObj = ImgFrame[CurFrame];
|
||||
PlayCurTime += dt;
|
||||
Img.DrawPng(NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y);
|
||||
|
||||
if (PlayCurTime >= NowFrameObj.Delay) {
|
||||
CurFrame++;
|
||||
//播放完成
|
||||
if (CurFrame >= ImgFrame.len()) {
|
||||
if (LoopFlag) CurFrame = 0;
|
||||
else State = 0;
|
||||
}
|
||||
InitTime = Clock();
|
||||
PlayCurTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ShowEx(dt, X, Y, gRgba, rate_x, rate_y) {
|
||||
if (State == 1) {
|
||||
if (ImgFrame) {
|
||||
local NowFrameObj = ImgFrame[CurFrame];
|
||||
PlayCurTime += dt;
|
||||
Img.DrawExPng(NowFrameObj.ImgIndex, NowFrameObj.Pos[0] + X, NowFrameObj.Pos[1] + Y, 0, gRgba, rate_x, rate_y);
|
||||
if (PlayCurTime >= NowFrameObj.Delay) {
|
||||
CurFrame++;
|
||||
//播放完成
|
||||
if (CurFrame >= ImgFrame.len()) {
|
||||
if (LoopFlag) CurFrame = 0;
|
||||
else State = 0;
|
||||
}
|
||||
InitTime = Clock();
|
||||
PlayCurTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Reset() {
|
||||
CurFrame = 0;
|
||||
State = 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user