Improved UI textbox

This commit is contained in:
2026-06-12 11:56:30 -05:00
parent f6a0bb156e
commit 2f3a4eab66
39 changed files with 574 additions and 706 deletions
+20 -50
View File
@@ -1,6 +1,5 @@
class_name EntityInteractableArea extends Area3D
const ItemAction = preload("res://cutscene/item/ItemAction.gd")
const DialogueAction = preload("res://cutscene/dialogue/DialogueAction.gd")
@export var entity:Entity
@@ -8,44 +7,32 @@ func isInteractable() -> bool:
if !entity:
return false
if entity.interactType == Entity.InteractType.NONE:
return false
if entity.interactType == Entity.InteractType.CONVERSATION:
return entity.dialogueResource != null
if entity.interactType == Entity.InteractType.CUTSCENE:
if entity.cutscene == null:
match entity.interactType:
Entity.InteractType.NONE:
return false
if !entity.cutscene.canRun():
return false
return true
if entity.interactType == Entity.InteractType.ONE_TIME_ITEM:
if entity.oneTimeItem == null:
return false
if entity.oneTimeItem.quantity <= 0:
return false
if entity.oneTimeItem.item == Item.Id.NULL:
return false
return true
if entity.interactType == Entity.InteractType.BATTLE_TEST:
return true
if entity.interactType == Entity.InteractType.CHATBOX:
return entity.chatboxMessage != ""
Entity.InteractType.CONVERSATION:
return entity.dialogueBasePath != ""
Entity.InteractType.CUTSCENE:
return entity.cutscene != null and entity.cutscene.canRun()
Entity.InteractType.ONE_TIME_ITEM:
return (
entity.oneTimeItem != null
and entity.oneTimeItem.quantity > 0
and entity.oneTimeItem.item != Item.Id.NULL
)
Entity.InteractType.BATTLE_TEST:
return true
return false
func _onConversationInteract(other:Entity) -> void:
assert(entity.dialogueResource != null)
func _onConversationInteract(_other:Entity) -> void:
assert(entity.dialogueBasePath != "")
var cutscene:Cutscene = Cutscene.new()
cutscene.addCallable(DialogueAction.getDialogueCallable(
entity.dialogueResource,
entity.dialogueBasePath,
entity.dialogueTitle,
[entity],
{"npc": entity, "player": other}
DialogueAction.DialogueMode.CONVERSATION
))
cutscene.start()
@@ -57,24 +44,17 @@ func _onItemInteract(_other:Entity) -> void:
entity.queue_free()
func onInteract(other:Entity) -> void:
if entity.interactType == Entity.InteractType.NONE:
return
match entity.interactType:
Entity.InteractType.NONE:
return
Entity.InteractType.CONVERSATION:
_onConversationInteract(other)
return
Entity.InteractType.ONE_TIME_ITEM:
_onItemInteract(other)
return
Entity.InteractType.CUTSCENE:
var cutscene:Cutscene = Cutscene.new()
entity.cutscene.queue(cutscene)
cutscene.start()
return
Entity.InteractType.BATTLE_TEST:
var testEnemy = BattleFighter.new({
'controller': BattleFighter.FighterController.AI
@@ -85,13 +65,3 @@ func onInteract(other:Entity) -> void:
BATTLE.BattlePosition.LEFT_MIDDLE_FRONT: testEnemy
}))
cutscene.start()
return
Entity.InteractType.CHATBOX:
assert(entity.chatboxMessage != "")
var chatbox:WorldChatBox = UI.spawnWorldChatBox(entity)
chatbox.showAdvanceable(entity.chatboxMessage)
return
_:
pass