82 lines
No EOL
2.7 KiB
GDScript
82 lines
No EOL
2.7 KiB
GDScript
extends Control
|
|
class_name GameMenuScreen
|
|
|
|
# Signals with optional parameters
|
|
signal shop_open_requested(options)
|
|
signal deckmanager_open_requested(options)
|
|
signal map_open_requested(options)
|
|
signal new_game_requested(options)
|
|
|
|
|
|
# @onready var newGameButton = $HBoxContainer/VBoxContainer/MenuOptions/NewGameText
|
|
# @onready var continueButton = $HBoxContainer/VBoxContainer/MenuOptions/Continue
|
|
# @onready var optionsButton = $HBoxContainer/VBoxContainer/MenuOptions/Options
|
|
# @onready var versionText = $HBoxContainer/VBoxContainer/VersionText
|
|
# @onready var titleText = $HBoxContainer/VBoxContainer/TitleText
|
|
# @onready var developerText = $HBoxContainer/VBoxContainer/DeveloperText
|
|
|
|
# Node references
|
|
@onready var shopButton = $HBoxContainer/VBoxContainer/GameOptions/ShopText
|
|
@onready var deckButton = $HBoxContainer/VBoxContainer/GameOptions/ManageDeckText
|
|
@onready var mapButton = $HBoxContainer/VBoxContainer/GameOptions/MapText
|
|
@onready var startButton = $HBoxContainer/VBoxContainer/GameOptions/StartText
|
|
@onready var backButton = $HBoxContainer/VBoxContainer/GameOptions/BackText
|
|
|
|
# Reference to main menu container
|
|
var main_menu_container = null
|
|
|
|
func _ready():
|
|
# Setup button signals
|
|
if shopButton:
|
|
shopButton.connect("pressed", Callable(self, "_on_shop_button_pressed"))
|
|
|
|
if deckButton:
|
|
deckButton.connect("pressed", Callable(self, "_on_deck_button_pressed"))
|
|
|
|
if mapButton:
|
|
mapButton.connect("pressed", Callable(self, "_on_map_button_pressed"))
|
|
|
|
if startButton:
|
|
startButton.connect("pressed", Callable(self, "_on_start_button_pressed"))
|
|
|
|
if backButton:
|
|
backButton.connect("pressed", Callable(self, "_on_back_button_pressed"))
|
|
|
|
|
|
func setup(menu_container):
|
|
main_menu_container = menu_container
|
|
|
|
func _on_shop_button_pressed():
|
|
print("Shop button pressed")
|
|
# Emit signal with null options
|
|
emit_signal("shop_open_requested", null)
|
|
|
|
func _on_deck_button_pressed():
|
|
print("Manage Deck button pressed")
|
|
# Emit signal with null options
|
|
emit_signal("deckmanager_open_requested", null)
|
|
|
|
func _on_map_button_pressed():
|
|
print("Map button pressed")
|
|
emit_signal("map_open_requested", null)
|
|
visible = false
|
|
|
|
func _on_start_button_pressed():
|
|
print("Start button pressed")
|
|
# Emit signal with empty options dictionary
|
|
emit_signal("new_game_requested", {})
|
|
|
|
# emit_signal("new_game_requested")
|
|
# Hide this menu
|
|
self.visible = false
|
|
|
|
func _on_back_button_pressed():
|
|
print("Back button pressed")
|
|
# Return to main menu
|
|
if main_menu_container:
|
|
main_menu_container.visible = true
|
|
# Hide this menu
|
|
self.visible = false
|
|
|
|
func show_menu():
|
|
self.visible = true |