Created message class and updated menu system

This commit is contained in:
2ndbeam 2024-05-19 16:09:50 +03:00
commit 7134891e55
12 changed files with 62 additions and 13 deletions

View file

@ -0,0 +1,16 @@
extends MenuResource
class_name ComboMenuResource
## Script path
@export var item_script: StringName
## Menu that will be transitioned to
@export var item_menu: StringName
## Returns script resource
func load_script() -> GDScript:
return ResourceLoader.load(item_script)
## Returns menu resource
func load_menu() -> Menu:
return ResourceLoader.load(item_menu)

View file

@ -4,16 +4,17 @@ extends Resource
class_name Menu
enum Action {
## Represents lack of action, should not have resource in item_data
NoneAction,
## Represents when this menu should be replaced with another.
## Attach Menu next to it in item_data
## Attach MenuMenuResource next to it in item_data
TransitAction,
## Represents scripts which should be attached to button on menu startup
## Attach Script next to it in item_data
## Attach ScriptMenuResource next to it in item_data
ButtonAction,
## WIP, should represent LineEdit or some other input control
InputAction,
## WIP
OtherAction
## Represents button script with transition after its execution
## Attach ComboMenuResource next to it in item_data
ComboAction
}
## Action string IDs. Should have same size as item_actions

View file

@ -0,0 +1,14 @@
extends Button
class_name MenuAction
var id: int = -1
func _init():
get_tree().create_timer(0.05).timeout.connect(_ready)
func _ready():
button_up.connect(action)
func action():
pass

View file

@ -4,5 +4,6 @@ class_name MenuMenuResource
@export var item: StringName
func load() -> Menu:
## Returns menu resource
func load_menu() -> Menu:
return ResourceLoader.load(item)

View file

@ -4,5 +4,6 @@ class_name ScriptMenuResource
@export var item: StringName
func load() -> GDScript:
## Returns script resource
func load_script() -> GDScript:
return ResourceLoader.load(item)