mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-13 15:34:53 +00:00
✨ add a map selector for multiplayer hosting
This commit is contained in:
parent
9613e6b651
commit
8321eec6a3
21 changed files with 110 additions and 62 deletions
|
|
@ -51,6 +51,9 @@ signal join_server(host : String, port : int)
|
|||
|
||||
@onready var modal : Control = $Modal
|
||||
@onready var menu : CanvasLayer = get_parent()
|
||||
@onready var game : Node3D = get_tree().current_scene
|
||||
@onready var map_selector : OptionButton = %MapSelector
|
||||
|
||||
@export var tab_container : TabContainer
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -58,7 +61,12 @@ func _ready() -> void:
|
|||
_registered_ports.compile(r'^(?:102[4-9]|10[3-9]\\d|1[1-9]\\d{2}|[2-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$')
|
||||
_join_address.compile(r'^(?<host>[a-zA-Z0-9.-]+)(:(?<port>:102[4-9]|10[3-9]\\d|1[1-9]\\d{2}|[2-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]))?$')
|
||||
_load_config()
|
||||
hide() # start hidden
|
||||
call_deferred(\"_populate_map_selector\")
|
||||
|
||||
func _populate_map_selector() -> void:
|
||||
for map : PackedScene in game.maps:
|
||||
var map_name : String = map._bundled.names[0]
|
||||
map_selector.add_item(map_name)
|
||||
|
||||
func _load_config() -> void:
|
||||
var error : Error = _config_file.load(CONFIG_FILE_PATH)
|
||||
|
|
@ -406,6 +414,12 @@ unique_name_in_owner = true
|
|||
layout_mode = 2
|
||||
placeholder_text = "9000"
|
||||
|
||||
[node name="MapSelector" type="OptionButton" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
clip_text = true
|
||||
allow_reselect = true
|
||||
|
||||
[node name="Modal" type="Panel" parent="Multiplayer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue