diff --git a/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt b/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt index 381c173a..4b616a4c 100644 --- a/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt +++ b/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/MixTouch.kt @@ -38,7 +38,9 @@ class MixTouch(private val mixAnimPlugin: MixAnimPlugin) { list?.forEach {frame -> val src = mixAnimPlugin.srcMap?.map?.get(frame.srcId) ?: return@forEach if (calClick(x.toInt(), y.toInt(), frame.frame)) { - return Resource(src) + return Resource(src).apply { + curPoint = frame.frame + } } } } diff --git a/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt b/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt index 5e5c4b26..f56f8536 100644 --- a/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt +++ b/Android/PlayerProj/animplayer/src/main/java/com/tencent/qgame/animplayer/mix/Resource.kt @@ -16,18 +16,20 @@ package com.tencent.qgame.animplayer.mix import android.graphics.Bitmap +import com.tencent.qgame.animplayer.PointRect /** * 资源描述 */ -class Resource { +class Resource(src: Src) { var id = "" var type = Src.SrcType.UNKNOWN var loadType = Src.LoadType.UNKNOWN var tag = "" var bitmap: Bitmap? = null + var curPoint: PointRect? = null // src在当前帧的位置信息 - constructor(src: Src) { + init { id = src.srcId type = src.srcType loadType = src.loadType diff --git a/Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt b/Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt index b23ad69b..ffa8f190 100644 --- a/Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt +++ b/Android/PlayerProj/app/src/main/java/com/tencent/qgame/playerproj/player/AnimVapxDemoActivity.kt @@ -70,6 +70,8 @@ class AnimVapxDemoActivity : Activity(), IAnimListener { Handler(Looper.getMainLooper()) } + private var lastToast: Toast? = null + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_anim_simple_demo) @@ -140,11 +142,13 @@ class AnimVapxDemoActivity : Activity(), IAnimListener { // 注册点击事件监听 animView.setOnResourceClickListener(object : OnResourceClickListener { override fun onClick(resource: Resource) { - Toast.makeText( + lastToast?.cancel() + lastToast = Toast.makeText( this@AnimVapxDemoActivity, - "srcTag=${resource.tag} onClick", + "srcTag=${resource.tag} onClick ${resource.curPoint}", Toast.LENGTH_LONG - ).show() + ) + lastToast?.show() } })