保存代码

This commit is contained in:
xsl
2025-12-16 22:15:42 +08:00
parent 4cf1990b16
commit 84cc693593
6 changed files with 164 additions and 25 deletions
+16 -2
View File
@@ -1322,7 +1322,19 @@ void FaceApp::drawFrame(long long frameTime)
_curTexIndex++;
if (_curTexIndex >= _curMotion_png_size)
{
_curTexIndex = 0;
if(_animationFinishedCallback != nullptr)
{
_animationFinishedCallback();
}
if (_animationLoop)
{
_curTexIndex = 0;
}
else
{
_curTexIndex = _curMotion_png_size - 1;
}
}
game_time = game_time - actionTime;
}
@@ -1357,7 +1369,7 @@ string FaceApp::preReadyMotion(const std::string& json, Callback callback)
return "failure";
}
void FaceApp::changeMotion(const string motion_type)
void FaceApp::changeMotion(const string motion_type, AnimationFinishedCallback callback, bool loop)
{
if (_curMotion_type == motion_type)
{
@@ -1387,6 +1399,8 @@ void FaceApp::changeMotion(const string motion_type)
_curMotion_type = motion_type;
_curMotion_png_size = _nextMotion.png_names.size();
_motionState = ready;
_animationFinishedCallback = callback;
_animationLoop = loop;
// for (int i = 0; i < _curMotion.png_names.size(); ++i)