Created message class and updated menu system
This commit is contained in:
parent
6963cab2af
commit
7134891e55
12 changed files with 62 additions and 13 deletions
16
scripts/Classes/Menu/combo_menu_resource.gd
Normal file
16
scripts/Classes/Menu/combo_menu_resource.gd
Normal 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)
|
||||
|
|
@ -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
|
||||
|
|
|
|||
14
scripts/Classes/Menu/menu_action.gd
Normal file
14
scripts/Classes/Menu/menu_action.gd
Normal 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
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue