help
This commit is contained in:
@@ -2,12 +2,14 @@ extends Button
|
||||
|
||||
const HISTORY = preload("res://Scenes/BrowserMenus/history.tscn")
|
||||
const SETTINGS = preload("res://Scenes/BrowserMenus/settings.tscn")
|
||||
const HELP = preload("res://Scenes/BrowserMenus/help.tscn")
|
||||
|
||||
@onready var tab_container: TabManager = $"../../TabContainer"
|
||||
@onready var main: Main = $"../../../"
|
||||
|
||||
var history_scene: PopupPanel = null
|
||||
var settings_scene: PopupPanel = null
|
||||
var help_scene: PopupPanel = null
|
||||
|
||||
func _on_pressed() -> void:
|
||||
%OptionsMenu.show()
|
||||
@@ -44,6 +46,8 @@ func _on_options_menu_id_pressed(id: int) -> void:
|
||||
show_history()
|
||||
if id == 5: # downloads
|
||||
show_downloads()
|
||||
if id == 8: # help
|
||||
show_help()
|
||||
if id == 9: # settings
|
||||
show_settings()
|
||||
if id == 10: # exit
|
||||
@@ -67,6 +71,19 @@ func _on_history_closed() -> void:
|
||||
func show_downloads() -> void:
|
||||
main.download_manager.show_downloads_history()
|
||||
|
||||
func show_help() -> void:
|
||||
if help_scene == null:
|
||||
help_scene = HELP.instantiate()
|
||||
main.add_child(help_scene)
|
||||
|
||||
help_scene.connect("popup_hide", _on_help_closed)
|
||||
else:
|
||||
help_scene.show()
|
||||
|
||||
func _on_help_closed() -> void:
|
||||
if help_scene:
|
||||
help_scene.hide()
|
||||
|
||||
func show_settings() -> void:
|
||||
if settings_scene == null:
|
||||
settings_scene = SETTINGS.instantiate()
|
||||
|
||||
74
flumi/Scripts/Browser/help.gd
Normal file
74
flumi/Scripts/Browser/help.gd
Normal file
@@ -0,0 +1,74 @@
|
||||
extends PopupPanel
|
||||
|
||||
@onready var shortcuts_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabShortcuts
|
||||
@onready var browser_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabBrowser
|
||||
@onready var protocol_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabProtocol
|
||||
@onready var scripting_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabScripting
|
||||
|
||||
@onready var shortcuts_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/ShortcutsPanel
|
||||
@onready var browser_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/BrowserPanel
|
||||
@onready var protocol_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/ProtocolPanel
|
||||
@onready var scripting_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/ScriptingPanel
|
||||
|
||||
func _ready() -> void:
|
||||
shortcuts_tab.pressed.connect(_on_shortcuts_tab_pressed)
|
||||
browser_tab.pressed.connect(_on_browser_tab_pressed)
|
||||
protocol_tab.pressed.connect(_on_protocol_tab_pressed)
|
||||
scripting_tab.pressed.connect(_on_scripting_tab_pressed)
|
||||
|
||||
show_shortcuts_panel()
|
||||
|
||||
func _on_shortcuts_tab_pressed() -> void:
|
||||
show_shortcuts_panel()
|
||||
|
||||
func _on_browser_tab_pressed() -> void:
|
||||
show_browser_panel()
|
||||
|
||||
func _on_protocol_tab_pressed() -> void:
|
||||
show_protocol_panel()
|
||||
|
||||
func _on_scripting_tab_pressed() -> void:
|
||||
show_scripting_panel()
|
||||
|
||||
func show_shortcuts_panel() -> void:
|
||||
shortcuts_panel.visible = true
|
||||
browser_panel.visible = false
|
||||
protocol_panel.visible = false
|
||||
scripting_panel.visible = false
|
||||
|
||||
update_tab_colors(shortcuts_tab)
|
||||
|
||||
func show_browser_panel() -> void:
|
||||
shortcuts_panel.visible = false
|
||||
browser_panel.visible = true
|
||||
protocol_panel.visible = false
|
||||
scripting_panel.visible = false
|
||||
|
||||
update_tab_colors(browser_tab)
|
||||
|
||||
func show_protocol_panel() -> void:
|
||||
shortcuts_panel.visible = false
|
||||
browser_panel.visible = false
|
||||
protocol_panel.visible = true
|
||||
scripting_panel.visible = false
|
||||
|
||||
update_tab_colors(protocol_tab)
|
||||
|
||||
func show_scripting_panel() -> void:
|
||||
shortcuts_panel.visible = false
|
||||
browser_panel.visible = false
|
||||
protocol_panel.visible = false
|
||||
scripting_panel.visible = true
|
||||
|
||||
update_tab_colors(scripting_tab)
|
||||
|
||||
func update_tab_colors(active_tab: Button) -> void:
|
||||
var tabs = [shortcuts_tab, browser_tab, protocol_tab, scripting_tab]
|
||||
|
||||
for tab in tabs:
|
||||
if tab == active_tab:
|
||||
tab.modulate = Color.WHITE
|
||||
tab.add_theme_color_override("font_color", Color.WHITE)
|
||||
else:
|
||||
tab.modulate = Color(0.8, 0.8, 0.8)
|
||||
tab.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8))
|
||||
1
flumi/Scripts/Browser/help.gd.uid
Normal file
1
flumi/Scripts/Browser/help.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bcew7v6hqhjox
|
||||
Reference in New Issue
Block a user