mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 05:24:06 +09:00
portrait on equippedview
This commit is contained in:
@@ -90,9 +90,8 @@ class AssembledSpriteAnimation(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun render(batch: SpriteBatch, posX: Float, posY: Float, scale: Float) {
|
||||
if (parentActor.isVisible) {
|
||||
fun renderThisAnimation(batch: SpriteBatch, posX: Float, posY: Float, scale: Float, animName: String) {
|
||||
val animNameRoot = animName.substring(0, animName.indexOfLast { it == '_' })
|
||||
|
||||
val tx = (parentActor.hitboxTranslateX) * scale
|
||||
val txFlp = -(parentActor.hitboxTranslateX) * scale
|
||||
@@ -101,9 +100,9 @@ class AssembledSpriteAnimation(
|
||||
val tyFlp = (parentActor.hitboxTranslateY) * scale
|
||||
|
||||
|
||||
adp.animations[currentAnimation]!!.let { theAnim ->
|
||||
adp.animations[animNameRoot]!!.let { theAnim ->
|
||||
val skeleton = theAnim.skeleton.joints.reversed()
|
||||
val transforms = adp.getTransform("${currentAnimation}_${1+currentFrame}")
|
||||
val transforms = adp.getTransform(animName)
|
||||
val bodypartOrigins = adp.bodypartJoints
|
||||
|
||||
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}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ class UIItemInventoryEquippedView(
|
||||
|
||||
|
||||
// sprite
|
||||
val sprite = INGAME.actorNowPlaying?.sprite
|
||||
sprite?.let {
|
||||
INGAME.actorNowPlaying?.let { actor ->
|
||||
actor.sprite?.let {
|
||||
blendNormal(batch)
|
||||
|
||||
batch.color = SPRITE_DRAW_COL
|
||||
@@ -96,10 +96,15 @@ class UIItemInventoryEquippedView(
|
||||
)
|
||||
}
|
||||
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
|
||||
itemGrid.forEachIndexed { index, cell ->
|
||||
|
||||
Reference in New Issue
Block a user