Rename OK and Continue buttons to Load and Debug Menu
This commit is contained in:
parent
253f1fa1fb
commit
09c2a16087
2
main.gd
2
main.gd
|
@ -39,7 +39,7 @@ func _ready() -> void:
|
|||
instantiate_menu_list(globals.INITIAL_MENUS)
|
||||
|
||||
RomLoader.connect('rom_loaded', self, '_on_rom_loaded')
|
||||
menus[Menu.LOADER].connect('continue_pressed', self, 'push_debug_menu')
|
||||
menus[Menu.LOADER].connect('debug_pressed', self, 'push_debug_menu')
|
||||
menus[Menu.LOADER].connect('savefile_loaded', self, '_on_savefile_loaded')
|
||||
Common.update_window_scale()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends PanelContainer
|
||||
#warning-ignore-all:return_value_discarded
|
||||
|
||||
signal continue_pressed
|
||||
signal debug_pressed
|
||||
signal savefile_loaded(dicts)
|
||||
|
||||
const globals = preload('res://globals.gd') # Make LSP shut up about non-const
|
||||
|
@ -21,8 +21,8 @@ onready var itemlist: ItemList = $VBoxContainer/HBoxContainer/PanelContainer/Ite
|
|||
onready var vscroller: VScrollBar = itemlist.get_child(0)
|
||||
onready var folder_buttons_scroller: ScrollContainer = $VBoxContainer/ScrollContainer
|
||||
onready var folder_buttons: HBoxContainer = $VBoxContainer/ScrollContainer/folder_buttons
|
||||
onready var btn_ok: Button = $'%btn_ok'
|
||||
onready var btn_continue: Button = $'%btn_continue'
|
||||
onready var btn_load: Button = $'%btn_load'
|
||||
onready var btn_debug: Button = $'%btn_debug'
|
||||
onready var lbl_filename_header: Label = $'%lbl_filename_header'
|
||||
onready var lbl_filename_content: Label = $'%lbl_filename_content'
|
||||
onready var lbl_filetype_header: Label = $'%lbl_filetype_header'
|
||||
|
@ -153,7 +153,7 @@ func view_entry(entry: String, index: int = -1):
|
|||
lbl_filetype_header.modulate = active_modulate_color
|
||||
if dir.dir_exists(entry):
|
||||
lbl_filetype_content.text = 'Folder'
|
||||
btn_ok.disabled = false
|
||||
btn_load.disabled = false
|
||||
elif dir.file_exists(entry):
|
||||
var file := File.new()
|
||||
var filename := dir.get_current_dir() + '/' + entry
|
||||
|
@ -186,9 +186,9 @@ func view_entry(entry: String, index: int = -1):
|
|||
lbl_fileinfo_content.text = prodcode
|
||||
match current_mode:
|
||||
SELECT_ROM:
|
||||
btn_ok.disabled = (ext != 'sfc' and ext != 'smc') # Only allow opening snes roms for now
|
||||
btn_load.disabled = (ext != 'sfc' and ext != 'smc') # Only allow opening snes roms for now
|
||||
SELECT_SAVE, COMPLETE:
|
||||
btn_ok.disabled = (ext != 'srm')
|
||||
btn_load.disabled = (ext != 'srm')
|
||||
|
||||
func init_labels():
|
||||
lbl_filename_header.modulate = inactive_modulate_color
|
||||
|
@ -199,7 +199,7 @@ func init_labels():
|
|||
lbl_filesize_content.text = ''
|
||||
lbl_fileinfo_header.modulate = inactive_modulate_color
|
||||
lbl_fileinfo_content.text = ''
|
||||
btn_ok.disabled = true
|
||||
btn_load.disabled = true
|
||||
|
||||
func _ready() -> void:
|
||||
init_labels()
|
||||
|
@ -211,8 +211,8 @@ func _ready() -> void:
|
|||
var error = dir.open(home_path)
|
||||
if error == OK:
|
||||
update_view()
|
||||
btn_ok.connect('pressed', self, 'activate_current_entry')
|
||||
btn_continue.connect('pressed', self, '_on_continue_pressed')
|
||||
btn_load.connect('pressed', self, 'activate_current_entry')
|
||||
btn_debug.connect('pressed', self, '_on_debug_pressed')
|
||||
RomLoader.connect('rom_loaded', self, '_on_rom_loaded')
|
||||
print(ProjectSettings.globalize_path('user://'))
|
||||
print(ProjectSettings.globalize_path(dir.get_current_dir()))
|
||||
|
@ -221,13 +221,13 @@ func _set_mode(new_mode) -> void:
|
|||
match new_mode:
|
||||
SELECT_ROM:
|
||||
$'%lbl_prompt'.text = "Select a ROM from your device's storage"
|
||||
btn_continue.disabled = true
|
||||
btn_debug.disabled = true
|
||||
SELECT_SAVE:
|
||||
$'%lbl_prompt'.text = "Select a save file from your device's storage"
|
||||
btn_continue.disabled = false
|
||||
btn_debug.disabled = false
|
||||
COMPLETE:
|
||||
$'%lbl_prompt'.text = "Save file loaded, press Continue"
|
||||
btn_continue.disabled = false
|
||||
$'%lbl_prompt'.text = "Save file loaded"
|
||||
btn_debug.disabled = false
|
||||
current_mode = new_mode
|
||||
update_view()
|
||||
init_labels()
|
||||
|
@ -241,6 +241,6 @@ func _on_ItemList_item_selected(index: int) -> void:
|
|||
func _on_rom_loaded() -> void:
|
||||
_set_mode(SELECT_SAVE)
|
||||
|
||||
func _on_continue_pressed() -> void:
|
||||
emit_signal('continue_pressed')
|
||||
func _on_debug_pressed() -> void:
|
||||
emit_signal('debug_pressed')
|
||||
|
||||
|
|
|
@ -165,24 +165,24 @@ margin_top = 163.0
|
|||
margin_right = 148.0
|
||||
margin_bottom = 185.0
|
||||
|
||||
[node name="btn_ok" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
[node name="btn_load" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 24.0
|
||||
margin_right = 36.0
|
||||
margin_bottom = 22.0
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
disabled = true
|
||||
text = "OK"
|
||||
text = "Load"
|
||||
|
||||
[node name="btn_continue" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
[node name="btn_debug" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 32.0
|
||||
margin_right = 91.0
|
||||
margin_left = 44.0
|
||||
margin_right = 124.0
|
||||
margin_bottom = 22.0
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
disabled = true
|
||||
text = "Continue"
|
||||
text = "Debug Menu"
|
||||
|
||||
[connection signal="item_activated" from="VBoxContainer/HBoxContainer/PanelContainer/ItemList" to="." method="_on_ItemList_item_activated"]
|
||||
[connection signal="item_selected" from="VBoxContainer/HBoxContainer/PanelContainer/ItemList" to="." method="_on_ItemList_item_selected"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends PanelContainer
|
||||
#warning-ignore-all:return_value_discarded
|
||||
|
||||
signal continue_pressed
|
||||
signal debug_pressed
|
||||
signal savefile_loaded(dicts)
|
||||
|
||||
const globals = preload('res://globals.gd') # Make LSP shut up about non-const
|
||||
|
@ -22,8 +22,8 @@ onready var itemlist: ItemList = $VBoxContainer/HBoxContainer/PanelContainer/Ite
|
|||
onready var vscroller: VScrollBar = itemlist.get_child(0)
|
||||
onready var folder_buttons_scroller: ScrollContainer = $VBoxContainer/ScrollContainer
|
||||
onready var folder_buttons: HBoxContainer = $VBoxContainer/ScrollContainer/folder_buttons
|
||||
onready var btn_ok: Button = $'%btn_ok'
|
||||
onready var btn_continue: Button = $'%btn_continue'
|
||||
onready var btn_load: Button = $'%btn_load'
|
||||
onready var btn_debug: Button = $'%btn_debug'
|
||||
onready var lbl_filename_header: Label = $'%lbl_filename_header'
|
||||
onready var lbl_filename_content: Label = $'%lbl_filename_content'
|
||||
onready var lbl_filetype_header: Label = $'%lbl_filetype_header'
|
||||
|
@ -53,8 +53,8 @@ static func join_path(tokens) -> String:
|
|||
return path if path else '/'
|
||||
|
||||
func update_view():
|
||||
for child in folder_buttons.get_children():
|
||||
child.queue_free()
|
||||
# for child in folder_buttons.get_children():
|
||||
# child.queue_free()
|
||||
|
||||
itemlist.clear()
|
||||
var files := []
|
||||
|
@ -120,9 +120,9 @@ func view_entry(entry: String, _index: int = -1):
|
|||
lbl_fileinfo_content.text = prodcode
|
||||
match current_mode:
|
||||
SELECT_ROM:
|
||||
btn_ok.disabled = (ext != 'sfc' and ext != 'smc') # Only allow opening snes roms for now
|
||||
btn_load.disabled = (ext != 'sfc' and ext != 'smc') # Only allow opening snes roms for now
|
||||
SELECT_SAVE, COMPLETE:
|
||||
btn_ok.disabled = (ext != 'srm')
|
||||
btn_load.disabled = (ext != 'srm')
|
||||
|
||||
func init_labels():
|
||||
lbl_filename_header.modulate = inactive_modulate_color
|
||||
|
@ -145,8 +145,8 @@ func _ready() -> void:
|
|||
return
|
||||
init_labels()
|
||||
update_view()
|
||||
btn_ok.connect('pressed', self, 'activate_current_entry')
|
||||
btn_continue.connect('pressed', self, '_on_continue_pressed')
|
||||
btn_load.connect('pressed', self, 'activate_current_entry')
|
||||
btn_debug.connect('pressed', self, '_on_debug_pressed')
|
||||
RomLoader.connect('rom_loaded', self, '_on_rom_loaded')
|
||||
HTML5.connect('uploaded_file', self, '_upload_file')
|
||||
|
||||
|
@ -154,13 +154,13 @@ func _set_mode(new_mode) -> void:
|
|||
match new_mode:
|
||||
SELECT_ROM:
|
||||
$'%lbl_prompt'.text = "Select a ROM from your device's storage"
|
||||
btn_continue.disabled = true
|
||||
btn_debug.disabled = true
|
||||
SELECT_SAVE:
|
||||
$'%lbl_prompt'.text = "Select a save file from your device's storage"
|
||||
btn_continue.disabled = false
|
||||
btn_debug.disabled = false
|
||||
COMPLETE:
|
||||
$'%lbl_prompt'.text = "Save file loaded, press Continue"
|
||||
btn_continue.disabled = false
|
||||
$'%lbl_prompt'.text = "Save file loaded"
|
||||
btn_debug.disabled = false
|
||||
current_mode = new_mode
|
||||
update_view()
|
||||
init_labels()
|
||||
|
@ -177,5 +177,5 @@ func _on_btn_upload_pressed() -> void:
|
|||
func _on_rom_loaded() -> void:
|
||||
_set_mode(SELECT_SAVE)
|
||||
|
||||
func _on_continue_pressed() -> void:
|
||||
emit_signal('continue_pressed')
|
||||
func _on_debug_pressed() -> void:
|
||||
emit_signal('debug_pressed')
|
||||
|
|
|
@ -19,40 +19,40 @@ custom_constants/separation = 2
|
|||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_right = 376.0
|
||||
margin_bottom = 22.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="lbl_prompt" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 4.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 18.0
|
||||
margin_bottom = 14.0
|
||||
text = "Select a ROM from your device's storage"
|
||||
|
||||
[node name="btn_upload" type="Button" parent="VBoxContainer/HBoxContainer2"]
|
||||
margin_left = 246.0
|
||||
margin_right = 293.0
|
||||
margin_bottom = 22.0
|
||||
text = "Upload"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
margin_top = 24.0
|
||||
margin_top = 16.0
|
||||
margin_right = 376.0
|
||||
margin_bottom = 53.0
|
||||
margin_bottom = 45.0
|
||||
rect_min_size = Vector2( 0, 29 )
|
||||
scroll_vertical_enabled = false
|
||||
|
||||
[node name="folder_buttons" type="HBoxContainer" parent="VBoxContainer/ScrollContainer"]
|
||||
margin_right = 85.0
|
||||
margin_bottom = 22.0
|
||||
custom_constants/separation = 4
|
||||
|
||||
[node name="btn_upload" type="Button" parent="VBoxContainer/ScrollContainer/folder_buttons"]
|
||||
margin_right = 85.0
|
||||
margin_bottom = 22.0
|
||||
text = "Upload files..."
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
margin_top = 55.0
|
||||
margin_top = 47.0
|
||||
margin_right = 376.0
|
||||
margin_bottom = 232.0
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_right = 220.0
|
||||
margin_bottom = 177.0
|
||||
margin_bottom = 185.0
|
||||
rect_min_size = Vector2( 120, 0 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 1.5
|
||||
|
@ -61,13 +61,13 @@ size_flags_stretch_ratio = 1.5
|
|||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = 216.0
|
||||
margin_bottom = 173.0
|
||||
margin_bottom = 181.0
|
||||
rect_min_size = Vector2( 120, 160 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
|
||||
margin_left = 228.0
|
||||
margin_right = 376.0
|
||||
margin_bottom = 177.0
|
||||
margin_bottom = 185.0
|
||||
size_flags_horizontal = 3
|
||||
custom_constants/separation = 1
|
||||
|
||||
|
@ -156,7 +156,7 @@ text = "Info:"
|
|||
[node name="mc4" type="MarginContainer" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
margin_top = 105.0
|
||||
margin_right = 148.0
|
||||
margin_bottom = 154.0
|
||||
margin_bottom = 162.0
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_top = 0
|
||||
custom_constants/margin_left = 12
|
||||
|
@ -166,35 +166,35 @@ custom_constants/margin_bottom = 0
|
|||
unique_name_in_owner = true
|
||||
margin_left = 12.0
|
||||
margin_right = 148.0
|
||||
margin_bottom = 49.0
|
||||
margin_bottom = 57.0
|
||||
size_flags_vertical = 3
|
||||
text = "Test"
|
||||
autowrap = true
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
|
||||
margin_top = 155.0
|
||||
margin_top = 163.0
|
||||
margin_right = 148.0
|
||||
margin_bottom = 177.0
|
||||
margin_bottom = 185.0
|
||||
|
||||
[node name="btn_ok" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
[node name="btn_load" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 24.0
|
||||
margin_right = 36.0
|
||||
margin_bottom = 22.0
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
disabled = true
|
||||
text = "OK"
|
||||
text = "Load"
|
||||
|
||||
[node name="btn_continue" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
[node name="btn_debug" type="Button" parent="VBoxContainer/HBoxContainer/VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 32.0
|
||||
margin_right = 91.0
|
||||
margin_left = 44.0
|
||||
margin_right = 124.0
|
||||
margin_bottom = 22.0
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
disabled = true
|
||||
text = "Continue"
|
||||
text = "Debug Menu"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer2/btn_upload" to="." method="_on_btn_upload_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/ScrollContainer/folder_buttons/btn_upload" to="." method="_on_btn_upload_pressed"]
|
||||
[connection signal="item_activated" from="VBoxContainer/HBoxContainer/PanelContainer/ItemList" to="." method="_on_ItemList_item_activated"]
|
||||
[connection signal="item_selected" from="VBoxContainer/HBoxContainer/PanelContainer/ItemList" to="." method="_on_ItemList_item_selected"]
|
||||
|
|
Loading…
Reference in New Issue