* Changement de l'UI, ajouts de l'inspecteur par carte et changement de police * Ajout d'un semblant d'exploration * Ajout de la sauvegarde des entités * Restructuration mineure de l'arborescence * Fix divers et réécriture des textes
54 lines
1.3 KiB
GDScript
54 lines
1.3 KiB
GDScript
extends Entity
|
|
class_name InspectableEntity
|
|
|
|
const MODULATE_INSPECTED_COLOR = Color.GRAY
|
|
const MODULATE_AFFECTED_COLOR = Color.RED
|
|
const DESC_ICON = preload("res://common/icons/align-right.svg")
|
|
|
|
@export var default_info_title = ""
|
|
@export_multiline var default_info_desc = ""
|
|
|
|
@onready var default_modulate : Color = modulate
|
|
@onready var inspectable_signals_setuped : bool = setup_inspectable_signals()
|
|
|
|
func inspect(is_inspected : bool = true):
|
|
modulate = MODULATE_INSPECTED_COLOR if is_inspected else default_modulate
|
|
|
|
func affect_preview(is_affected : bool = true):
|
|
modulate = MODULATE_AFFECTED_COLOR if is_affected else default_modulate
|
|
|
|
func setup_inspectable_signals() -> bool:
|
|
mouse_entered.connect(_on_mouse_entered)
|
|
mouse_exited.connect(_on_mouse_excited)
|
|
return true
|
|
|
|
func _on_mouse_entered():
|
|
Pointer.inspect(self)
|
|
|
|
func _on_mouse_excited():
|
|
Pointer.stop_inspect(self)
|
|
|
|
func pointer_text() -> String:
|
|
return default_info_title
|
|
|
|
func card_info() -> CardInfo:
|
|
var info = CardInfo.new(
|
|
pointer_text()
|
|
)
|
|
|
|
if default_info_desc != "":
|
|
var desc_section = CardSectionInfo.new(
|
|
"Description",
|
|
default_info_desc
|
|
)
|
|
desc_section.title_icon = DESC_ICON
|
|
info.sections.append(
|
|
desc_section
|
|
)
|
|
|
|
return info
|
|
|
|
func _notification(what):
|
|
if (what == NOTIFICATION_PREDELETE):
|
|
Pointer.stop_inspect(self)
|