Refactored to allow hotseat and multiplayer. TODO: Create interface class for webrtc/enet multiplayer
This commit is contained in:
parent
d688eaf9c6
commit
5fe8f22ccb
27 changed files with 798 additions and 135 deletions
27
main_menu.gd
27
main_menu.gd
|
|
@ -1,13 +1,17 @@
|
|||
extends Control
|
||||
|
||||
@onready var exit_button = $PanelContainer/MarginContainer/VBoxContainer/ExitButton
|
||||
@onready var lan_button = $PanelContainer/MarginContainer/VBoxContainer/LANButton
|
||||
|
||||
@onready var rules = $Rules
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
if OS.has_feature("web"):
|
||||
exit_button.visible = false
|
||||
lan_button.visible = false
|
||||
|
||||
WSClient.lobby_joined.connect(_on_lobby_joined)
|
||||
#WSClient.lobby_joined.connect(_on_lobby_joined)
|
||||
GameData.reset()
|
||||
|
||||
func _on_lobby_joined(lobby: String) -> void:
|
||||
|
|
@ -21,7 +25,7 @@ func _process(delta: float) -> void:
|
|||
|
||||
func _on_host_button_pressed():
|
||||
GameData.is_player_black = false
|
||||
WSClient.start(GameData.WEBSOCKET_ENDPOINT, "", false)
|
||||
#WSClient.start(GameData.WEBSOCKET_ENDPOINT, "", false)
|
||||
|
||||
|
||||
func _on_join_button_pressed():
|
||||
|
|
@ -34,5 +38,22 @@ func _on_exit_button_pressed():
|
|||
|
||||
func _on_rules_button_pressed():
|
||||
# https://bacon.bytesandpieces.xyz/swarm/
|
||||
OS.shell_open("https://www.ultraboardgames.com/hive/game-rules.php")
|
||||
#OS.shell_open("https://www.ultraboardgames.com/hive/game-rules.php")
|
||||
rules.show_panel()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_online_button_pressed():
|
||||
#GameData.is_player_black = false
|
||||
#WSClient.start(GameData.WEBSOCKET_ENDPOINT, "", false)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_online_button_2_pressed():
|
||||
get_tree().change_scene_to_file("res://UI/join_menu.tscn")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_local_button_pressed():
|
||||
GameData.is_hot_seat = true
|
||||
get_tree().change_scene_to_file("res://Game.tscn")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue