portrait on equippedview

This commit is contained in:
minjaesong
2022-03-25 16:22:35 +09:00
parent 327e000a54
commit 8c8e41871a
2 changed files with 67 additions and 61 deletions

View File

@@ -90,9 +90,8 @@ class AssembledSpriteAnimation(
} }
} }
fun renderThisAnimation(batch: SpriteBatch, posX: Float, posY: Float, scale: Float, animName: String) {
override fun render(batch: SpriteBatch, posX: Float, posY: Float, scale: Float) { val animNameRoot = animName.substring(0, animName.indexOfLast { it == '_' })
if (parentActor.isVisible) {
val tx = (parentActor.hitboxTranslateX) * scale val tx = (parentActor.hitboxTranslateX) * scale
val txFlp = -(parentActor.hitboxTranslateX) * scale val txFlp = -(parentActor.hitboxTranslateX) * scale
@@ -101,9 +100,9 @@ class AssembledSpriteAnimation(
val tyFlp = (parentActor.hitboxTranslateY) * scale val tyFlp = (parentActor.hitboxTranslateY) * scale
adp.animations[currentAnimation]!!.let { theAnim -> adp.animations[animNameRoot]!!.let { theAnim ->
val skeleton = theAnim.skeleton.joints.reversed() val skeleton = theAnim.skeleton.joints.reversed()
val transforms = adp.getTransform("${currentAnimation}_${1+currentFrame}") val transforms = adp.getTransform(animName)
val bodypartOrigins = adp.bodypartJoints val bodypartOrigins = adp.bodypartJoints
AssembleFrameBase.makeTransformList(skeleton, transforms).forEach { (name, bodypartPos0) -> AssembleFrameBase.makeTransformList(skeleton, transforms).forEach { (name, bodypartPos0) ->
@@ -157,10 +156,12 @@ class AssembledSpriteAnimation(
} }
} }
} }
}
} }
override fun render(batch: SpriteBatch, posX: Float, posY: Float, scale: Float) {
if (parentActor.isVisible) {
renderThisAnimation(batch, posX, posY, scale, "${currentAnimation}_${1+currentFrame}")
} }
} }

View File

@@ -82,8 +82,8 @@ class UIItemInventoryEquippedView(
// sprite // sprite
val sprite = INGAME.actorNowPlaying?.sprite INGAME.actorNowPlaying?.let { actor ->
sprite?.let { actor.sprite?.let {
blendNormal(batch) blendNormal(batch)
batch.color = SPRITE_DRAW_COL batch.color = SPRITE_DRAW_COL
@@ -96,10 +96,15 @@ class UIItemInventoryEquippedView(
) )
} }
else if (it is AssembledSpriteAnimation) { else if (it is AssembledSpriteAnimation) {
// TODO it.renderThisAnimation(batch,
posX + ((width - actor.baseHitboxW) / 2).toFloat(),
posY + ((width - actor.baseHitboxH) / 2).toFloat(),
1f, "ANIM_IDLE_1"
)
} }
} }
}
// slot image on each cells // slot image on each cells
itemGrid.forEachIndexed { index, cell -> itemGrid.forEachIndexed { index, cell ->