a-little-org-called-mario/a-little-game-called-mario

marwing, mouse doesn't work on `N` notes screen

duianto opened this issue · 1 comments

In marwing, the mouse doesn't work on the N notes screen.

The mouse cursor should:

  • become visible when N is pressed.
  • be hidden when the notes screen is closed:
    • N
    • esc
    • or mouse click on top right X

I did this for PauseMenu

if data:
self.current_mouse_mode = Input.get_mouse_mode()
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)

else:
Input.set_mouse_mode(self.current_mouse_mode)
self.current_mouse_mode = Input.MOUSE_MODE_VISIBLE

But doing the same thing for every UI node seems tedious, it would be better to use signals and make Marwing scene manage this on it own:

func _ready():
	EventBus.connect("notes_opened", Input, "set_mouse_mode", [Input.MOUSE_MODE_VISIBLE])
	EventBus.connect("notes_closed", Input, "set_mouse_mode", [Input.MOUSE_MODE_CAPTURED])

But there is a problem, the DialogueBox in marwing level is a Popup which is block the other UI controls. Not sure though if there is a reason for it to be a popup, and we probably can change it to be just a Control