save code
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 205 KiB After Width: | Height: | Size: 206 KiB |
@@ -29,13 +29,23 @@ class MakeupActivity : FaceActivity()
|
||||
}
|
||||
}
|
||||
|
||||
var isLoadFinished : Boolean = false
|
||||
var loadFinishedFun = object : CallbackInterface {
|
||||
override fun OnLoadActionFinished(motion_type: String) {
|
||||
isLoadFinished = true;
|
||||
if(actionState == ActionState.Loading)
|
||||
{
|
||||
actionState = ActionState.LoadingFinished
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var actionState : ActionState = ActionState.None;
|
||||
|
||||
enum class ActionState{
|
||||
None,
|
||||
Loading,
|
||||
LoadingFinished,
|
||||
Playing
|
||||
}
|
||||
|
||||
private var updateJob: Job? = null
|
||||
|
||||
@@ -65,31 +75,23 @@ class MakeupActivity : FaceActivity()
|
||||
|
||||
val mlist = MotionList();
|
||||
getMotionByName("4")?.let { mlist.motions.add(it) }
|
||||
//getMotionByName("11")?.let { mlist.motions.add(it) }
|
||||
//getMotionByName("13")?.let { mlist.motions.add(it) }
|
||||
PreLoadAction(mlist.toJsonString(), loadFinishedFun)
|
||||
getMotionByName("11")?.let { mlist.motions.add(it) }
|
||||
getMotionByName("13")?.let { mlist.motions.add(it) }
|
||||
if(actionState == ActionState.None)
|
||||
{
|
||||
PreLoadAction(mlist.toJsonString(), loadFinishedFun)
|
||||
actionState = ActionState.Loading
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun update()
|
||||
{
|
||||
// //下一个动画加载完成,并且当前动画已经播放完了 (刚开始的时候当前动画初始化为播放完成)
|
||||
// if(isLoadFinished && isMotionFinished)
|
||||
// {
|
||||
// //切换到加载完成的动画
|
||||
// isMotionFinished = false
|
||||
// ChangeMotion(motionQueue[_motionIndex], animationFinishedFun, false)
|
||||
//
|
||||
// isLoadFinished = false
|
||||
//
|
||||
// //如果还有动画,则开始预先加载
|
||||
// if(_motionIndex + 1 < motionQueue.size)
|
||||
// {
|
||||
// _motionIndex += 1
|
||||
// PreLoadAction(motionQueue[_motionIndex], loadFinishedFun)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
if(actionState == ActionState.LoadingFinished)
|
||||
{
|
||||
ChangeMotionList(animationFinishedFun, true)
|
||||
actionState = ActionState.Playing
|
||||
}
|
||||
}
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user