extends Control

@onready var spine_sprite: SpineSprite = $Control/SpineSprite
var anim_state: SpineAnimationState
var last_menu: String = "stats"
var options = {
  "stats": {},
  "inv": {},
  "journal": {},
  "menu": {},
}

func _ready() -> void:
  anim_state = spine_sprite.get_animation_state()
  anim_state.set_animation("pointer", true, 4)
  anim_state.set_animation("typing", true, 3)
  
  Messagebus.LAPTOP.connect(maybe_show_laptop)

func maybe_show_laptop(show: bool):
  var a = spine_sprite.get_animation_state()
  if self.is_visible_in_tree():
    self.hide()
    a.set_animation("hide", false, 0)
  else:
    self.show()
    a.set_animation("show", false, 0)
      
      
  #
#func _process(delta: float) -> void:
  #if Input.is_action_pressed("Pause"):
    #print("enter laptop state here")
    #if self.is_visible_in_tree():
      #self.hide()
      #anim_state.set_animation("hide", false, 0)
    #else:
      #self.show()
      #anim_state.set_animation("show", false, 0)
      #
