mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
portrait on equippedview
This commit is contained in:
@@ -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}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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 ->
|
||||||
|
|||||||
Reference in New Issue
Block a user