保存代码
This commit is contained in:
+16
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user