diff options
author | tpart <tpart120@proton.me> | 2024-07-07 18:52:49 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-07-07 18:52:54 +0200 |
commit | 44499c6e81dc5cc014f502cf6cb4db0c96081d7e (patch) | |
tree | 7cf07ee27ba517d7d4766677cc367bd1f9a16fbd | |
parent | a72f4466c568dd7d7fe6f76a295fdd1162c1d312 (diff) | |
download | hurrycurry-44499c6e81dc5cc014f502cf6cb4db0c96081d7e.tar hurrycurry-44499c6e81dc5cc014f502cf6cb4db0c96081d7e.tar.bz2 hurrycurry-44499c6e81dc5cc014f502cf6cb4db0c96081d7e.tar.zst |
Add lobby menu
-rw-r--r-- | client/game.gd | 26 | ||||
-rw-r--r-- | client/global.gd | 16 | ||||
-rw-r--r-- | client/menu/controller_buttons/a.svg | 6 | ||||
-rw-r--r-- | client/menu/controller_buttons/a.svg.import | 37 | ||||
-rw-r--r-- | client/menu/controller_buttons/controller_button.gd | 39 | ||||
-rw-r--r-- | client/menu/controller_buttons/controller_button.tscn | 9 | ||||
-rw-r--r-- | client/menu/game.gd | 18 | ||||
-rw-r--r-- | client/menu/game.tscn | 6 | ||||
-rw-r--r-- | client/menu/lobby.gd | 76 | ||||
-rw-r--r-- | client/menu/lobby.tscn | 110 | ||||
-rw-r--r-- | client/menu/lobby/player.gd | 22 | ||||
-rw-r--r-- | client/menu/lobby/player.tscn | 43 | ||||
-rw-r--r-- | client/menu/menu.gd | 4 | ||||
-rw-r--r-- | client/menu/theme/lobby_panel_override.tres | 4 | ||||
-rw-r--r-- | client/menu/user.webp | bin | 0 -> 15122 bytes | |||
-rw-r--r-- | client/menu/user.webp.import | 34 | ||||
-rw-r--r-- | client/multiplayer.gd | 11 | ||||
-rw-r--r-- | client/project.godot | 21 |
18 files changed, 463 insertions, 19 deletions
diff --git a/client/game.gd b/client/game.gd index 1e7a378d..97460c01 100644 --- a/client/game.gd +++ b/client/game.gd @@ -1,6 +1,7 @@ # Undercooked - a game about cooking # Copyright 2024 nokoe # Copyright 2024 metamuffin +# Copyright 2024 tpart # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -17,6 +18,9 @@ class_name Game extends Node3D +signal update_players(players: Dictionary) +signal data_updated() + var player_id: int = -1 var item_names: Array = [] var item_index_by_name: Dictionary = {} @@ -24,6 +28,7 @@ var tile_names: Array = [] var tile_index_by_name: Dictionary = {} var tile_collide: Array = [] var tile_interact: Array = [] +var map_names: Array = [] var marker_target = Vector3(0,0,0) var players := {} @@ -34,6 +39,8 @@ var players := {} @onready var marker: Marker = $Marker @onready var environment = $WorldEnvironment @onready var debug_label = $Debug +@onready var overlay = $Overlay +@onready var lobby = $"../Lobby" func _ready(): if !Global.on_vulkan(): @@ -50,12 +57,14 @@ func _ready(): item_names_: Array, tile_names_: Array, tile_collide_: Array, - tile_interact_: Array + tile_interact_: Array, + map_names_: Array ): item_names = item_names_ tile_names = tile_names_ tile_collide = tile_collide_ tile_interact = tile_interact_ + map_names = map_names_ tile_index_by_name = {} for id in tile_names.size(): tile_index_by_name[tile_names[id]] = id @@ -63,6 +72,8 @@ func _ready(): item_index_by_name.clear() for i in range(item_names.size()): item_index_by_name[item_names[i]] = i + + data_updated.emit() ) await mp.init @@ -78,6 +89,7 @@ func _ready(): player_instance = Player.new(player, player_name, pos, character, self) players[player] = player_instance add_child(player_instance) + update_players.emit(players) ) mp.set_tile.connect(set_tile) @@ -97,6 +109,7 @@ func _ready(): player.hand.queue_free() players.erase(id) player.queue_free() + update_players.emit(players) ) mp.set_tile_item.connect(func(tile: Vector2i, item: int): @@ -193,7 +206,7 @@ func _ready(): mp.send_join(Global.profile["username"], Global.profile["character"]) - mp.set_ingame.connect(func (state): + mp.set_ingame.connect(func (state, _lobby): if state: map.gi_bake() await get_parent().menu_anim_open() @@ -205,8 +218,13 @@ func _ready(): mp.server_message.connect(func(text): print(text)) - mp.score.connect($Overlay.update) - mp.hide_score.connect($Overlay.reset) + mp.score.connect(overlay.update) + mp.hide_score.connect(overlay.reset) + + mp.set_ingame.connect( + func toggle_lobby(_state: bool, lobby_state: bool): + lobby.visible = lobby_state + ) func _process(delta): marker.position = Global.interpolate(marker.position, marker_target, delta * 30.) diff --git a/client/global.gd b/client/global.gd index 2d0c0cb2..d50788ba 100644 --- a/client/global.gd +++ b/client/global.gd @@ -18,14 +18,15 @@ extends Node signal settings_changed() +signal using_joypad_change(using: bool) var default_profile := { "username": "Giovanni", "character": 0, "last_server_url": "" } - var languages := [tr("System default"), "en", "de"] +var using_joypad := false var default_settings := { "language": DropdownSetting.new(tr("Language"), 0, languages), @@ -63,12 +64,23 @@ func _ready(): get_viewport().gui_focus_changed.connect(Sound.play_hover_maybe) get_viewport().gui_focus_changed.connect(func (node): focused_node = node) + -func _input(_event): +func _input(event): if Input.is_action_just_pressed("fullscreen"): Global.set_setting("fullscreen", not Global.get_setting("fullscreen")) save_settings() update_fullscreen() + + # Update using_joypad variable + if event is InputEventMouseButton or event is InputEventKey: + if using_joypad: + using_joypad = false + using_joypad_change.emit(using_joypad) + elif event is InputEventJoypadButton or event is InputEventJoypadMotion: + if not using_joypad: + using_joypad = true + using_joypad_change.emit(using_joypad) func apply_settings(): update_fullscreen() diff --git a/client/menu/controller_buttons/a.svg b/client/menu/controller_buttons/a.svg new file mode 100644 index 00000000..3b660d91 --- /dev/null +++ b/client/menu/controller_buttons/a.svg @@ -0,0 +1,6 @@ +<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs/> + <g> + <path stroke="none" fill="#7DB700" d="M56 32 Q56 42 48.95 48.95 42 56 32 56 22.05 56 15 48.95 8 42 8 32 8 22.05 15 15 22.05 8 32 8 42 8 48.95 15 56 22.05 56 32 M38 42 L42 42 34 22 30 22 22 42 26 42 27.6 38 36.4 38 38 42 M32 27 L34.8 34 29.2 34 32 27"/> + </g> +</svg>
\ No newline at end of file diff --git a/client/menu/controller_buttons/a.svg.import b/client/menu/controller_buttons/a.svg.import new file mode 100644 index 00000000..236e085f --- /dev/null +++ b/client/menu/controller_buttons/a.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bgkhnp15u1utp" +path="res://.godot/imported/a.svg-207eeddefe74f1190424a9aa1808de8f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://menu/controller_buttons/a.svg" +dest_files=["res://.godot/imported/a.svg-207eeddefe74f1190424a9aa1808de8f.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/client/menu/controller_buttons/controller_button.gd b/client/menu/controller_buttons/controller_button.gd new file mode 100644 index 00000000..4fa70b5a --- /dev/null +++ b/client/menu/controller_buttons/controller_button.gd @@ -0,0 +1,39 @@ +# Undercooked - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + +extends Button +class_name ControllerButton + +@export var controller_texture: Texture2D +@export var press_action: String + +func _ready(): + set_texture_enabled(Global.using_joypad) + Global.using_joypad_change.connect(set_texture_enabled) + +func _input(event): + if press_action == null: + return + if not is_visible_in_tree(): + return + if Input.is_action_just_pressed(press_action): + pressed.emit() + +func set_texture_enabled(b: bool): + if b: + icon = controller_texture + else: + icon = null diff --git a/client/menu/controller_buttons/controller_button.tscn b/client/menu/controller_buttons/controller_button.tscn new file mode 100644 index 00000000..c5d745ba --- /dev/null +++ b/client/menu/controller_buttons/controller_button.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://b1f7bgn65j7b5"] + +[ext_resource type="Script" path="res://menu/controller_buttons/controller_button.gd" id="1_p2m8i"] + +[node name="ControllerButton" type="Button"] +offset_right = 8.0 +offset_bottom = 8.0 +focus_mode = 0 +script = ExtResource("1_p2m8i") diff --git a/client/menu/game.gd b/client/menu/game.gd index f2526645..c36fca86 100644 --- a/client/menu/game.gd +++ b/client/menu/game.gd @@ -1,3 +1,19 @@ +# Undercooked - a game about cooking +# Copyright 2024 metamuffin +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# extends Menu func _ready(): @@ -5,7 +21,7 @@ func _ready(): super() func _input(_event): - if Input.is_action_just_pressed("pause"): + if Input.is_action_just_pressed("ui_cancel"): open_ingame_menu() func open_ingame_menu(): diff --git a/client/menu/game.tscn b/client/menu/game.tscn index 708adf74..af7f22a8 100644 --- a/client/menu/game.tscn +++ b/client/menu/game.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://bbjwoxs71fnsk"] +[gd_scene load_steps=4 format=3 uid="uid://bbjwoxs71fnsk"] [ext_resource type="Script" path="res://menu/game.gd" id="1_cdpsh"] [ext_resource type="PackedScene" uid="uid://c6krh36hoqfg8" path="res://game.tscn" id="2_uojcy"] +[ext_resource type="PackedScene" uid="uid://bc50la65ntifb" path="res://menu/lobby.tscn" id="3_udxby"] [node name="GameMenu" type="Control"] layout_mode = 3 @@ -14,3 +15,6 @@ script = ExtResource("1_cdpsh") auto_anim = false [node name="Game" parent="." instance=ExtResource("2_uojcy")] + +[node name="Lobby" parent="." instance=ExtResource("3_udxby")] +layout_mode = 1 diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd new file mode 100644 index 00000000..e96e11c4 --- /dev/null +++ b/client/menu/lobby.gd @@ -0,0 +1,76 @@ +# Undercooked - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +extends Control + +const PLAYER = preload("res://menu/lobby/player.tscn") + +var selected_map := 0 +var selected_map_name: String + +@onready var game: Game = $"../Game" +@onready var map_count = game.map_names.size() +@onready var player_container = $VBoxContainer/Top/MarginContainer/VBoxContainer/Players +@onready var map_name_label = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/MapSelection + +@onready var prev_map = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/Left +@onready var next_map = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/Right + +func _ready(): + game.update_players.connect(update_players) + initialize() + game.data_updated.connect(initialize) + +func initialize(): + map_count = game.map_names.size() + select_map(0) + +func select_map(i: int): + if i >= game.map_names.size(): + return + selected_map = i + var map_name: String = game.map_names[i] + map_name_label.text = map_name + selected_map_name = map_name + +func update_players(player_list: Dictionary): + for i in player_container.get_children(): + i.queue_free() + + for i in player_list.keys(): + var p: PlayerTag = PLAYER.instantiate() + player_container.add_child(p) + p.setup(player_list[i].name) + +func _input(event): + if not visible: + return + + if Input.is_action_just_pressed("previous"): + prev_map.emit_signal("pressed") + elif Input.is_action_just_pressed("next"): + next_map.emit_signal("pressed") + +func _on_left_pressed(): + selected_map = (selected_map - 1) % map_count + select_map(selected_map) + +func _on_right_pressed(): + selected_map = (selected_map + 1) % map_count + select_map(selected_map) + +func _on_controller_button_pressed(): + if selected_map_name != null: + game.mp.send_chat("/start %s" % selected_map_name) diff --git a/client/menu/lobby.tscn b/client/menu/lobby.tscn new file mode 100644 index 00000000..38b2a5b9 --- /dev/null +++ b/client/menu/lobby.tscn @@ -0,0 +1,110 @@ +[gd_scene load_steps=10 format=3 uid="uid://bc50la65ntifb"] + +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_u18ke"] +[ext_resource type="Script" path="res://menu/lobby.gd" id="2_7657i"] +[ext_resource type="StyleBox" uid="uid://de80aw86emnql" path="res://menu/theme/lobby_panel_override.tres" id="3_6iqoe"] +[ext_resource type="Texture2D" uid="uid://35rd5gamtyqm" path="res://menu/arrow.svg" id="3_jxleg"] +[ext_resource type="Texture2D" uid="uid://j75dbytlbju" path="res://menu/arrow_pressed.svg" id="4_eapmn"] +[ext_resource type="Texture2D" uid="uid://b33qmctbpf48g" path="res://menu/arrow_hover.svg" id="5_odwav"] +[ext_resource type="Texture2D" uid="uid://by3qsrpxnfq4w" path="res://menu/arrow_focus.svg" id="6_tulu3"] +[ext_resource type="PackedScene" uid="uid://b1f7bgn65j7b5" path="res://menu/controller_buttons/controller_button.tscn" id="7_t6mox"] +[ext_resource type="Texture2D" uid="uid://bgkhnp15u1utp" path="res://menu/controller_buttons/a.svg" id="8_chn2q"] + +[node name="Lobby" type="Control" groups=["no_auto_focus"]] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("1_u18ke") +script = ExtResource("2_7657i") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Top" type="PanelContainer" parent="VBoxContainer"] +layout_mode = 2 +theme_override_styles/panel = ExtResource("3_6iqoe") + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Top"] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Top/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 24 + +[node name="Players" type="HBoxContainer" parent="VBoxContainer/Top/MarginContainer/VBoxContainer"] +layout_mode = 2 +alignment = 1 + +[node name="Spacer" type="Control" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +mouse_filter = 2 + +[node name="Bottom" type="PanelContainer" parent="VBoxContainer"] +layout_mode = 2 +theme_override_styles/panel = ExtResource("3_6iqoe") + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Bottom"] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Bottom/MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 24 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer"] +layout_mode = 2 +alignment = 1 + +[node name="Left" type="TextureButton" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(19, 0) +layout_mode = 2 +focus_mode = 0 +texture_normal = ExtResource("3_jxleg") +texture_pressed = ExtResource("4_eapmn") +texture_hover = ExtResource("5_odwav") +texture_focused = ExtResource("6_tulu3") +ignore_texture_size = true +stretch_mode = 4 +flip_h = true + +[node name="MapSelection" type="Label" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(264, 0) +layout_mode = 2 +text = "Map" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Right" type="TextureButton" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(19, 0) +layout_mode = 2 +focus_mode = 0 +texture_normal = ExtResource("3_jxleg") +texture_pressed = ExtResource("4_eapmn") +texture_hover = ExtResource("5_odwav") +texture_focused = ExtResource("6_tulu3") +ignore_texture_size = true +stretch_mode = 4 + +[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="ControllerButton" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource("7_t6mox")] +custom_minimum_size = Vector2(148, 0) +layout_mode = 2 +text = "Start Game" +icon = ExtResource("8_chn2q") +expand_icon = true +controller_texture = ExtResource("8_chn2q") +press_action = "ui_accept" + +[connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/Left" to="." method="_on_left_pressed"] +[connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/Right" to="." method="_on_right_pressed"] +[connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/ControllerButton" to="." method="_on_controller_button_pressed"] diff --git a/client/menu/lobby/player.gd b/client/menu/lobby/player.gd new file mode 100644 index 00000000..c5c05eb4 --- /dev/null +++ b/client/menu/lobby/player.gd @@ -0,0 +1,22 @@ +# Undercooked - a game about cooking +# Copyright 2024 tpart +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +extends PanelContainer +class_name PlayerTag + +@onready var name_label = $MarginContainer/HBoxContainer/Label + +func setup(player_name: String): + name_label.text = player_name diff --git a/client/menu/lobby/player.tscn b/client/menu/lobby/player.tscn new file mode 100644 index 00000000..964bc4fb --- /dev/null +++ b/client/menu/lobby/player.tscn @@ -0,0 +1,43 @@ +[gd_scene load_steps=6 format=3 uid="uid://gmldnel4xbxy"] + +[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_flfqn"] +[ext_resource type="Texture2D" uid="uid://222w1wha75od" path="res://menu/user.webp" id="2_mnaqt"] +[ext_resource type="Script" path="res://menu/lobby/player.gd" id="2_w3lyk"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1227j"] +bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 16 +corner_radius_top_right = 16 +corner_radius_bottom_right = 16 +corner_radius_bottom_left = 16 + +[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3yp6e"] +content_margin_right = 8.0 + +[node name="Player" type="PanelContainer"] +offset_right = 40.0 +offset_bottom = 40.0 +theme = ExtResource("1_flfqn") +theme_override_styles/panel = SubResource("StyleBoxFlat_1227j") +script = ExtResource("2_w3lyk") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 2 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] +layout_mode = 2 + +[node name="Icon" type="TextureRect" parent="MarginContainer/HBoxContainer"] +layout_mode = 2 +texture = ExtResource("2_mnaqt") +expand_mode = 2 + +[node name="Label" type="Label" parent="MarginContainer/HBoxContainer"] +layout_mode = 2 +theme_override_styles/normal = SubResource("StyleBoxEmpty_3yp6e") +text = "Player" +vertical_alignment = 1 diff --git a/client/menu/menu.gd b/client/menu/menu.gd index 7ae7f3a0..51f0cf6b 100644 --- a/client/menu/menu.gd +++ b/client/menu/menu.gd @@ -67,6 +67,8 @@ func replace_menu(path: String): var focus_auto_changed := false func focus_first(node: Node) -> bool: focus_auto_changed = true + if node.is_in_group("no_auto_focus"): + return false if node is Button or node is LineEdit: node.grab_focus() print("Node %s (%s) was selected for focus" % [node.name, node]) @@ -77,7 +79,7 @@ func focus_first(node: Node) -> bool: return false func connect_button_sounds(node: Node): - if node is Button: + if node is Button or node is TextureButton: if not node.is_in_group("no_click_sound"): node.pressed.connect(Sound.play_click) if node is Button or node is LineEdit or node is Slider: diff --git a/client/menu/theme/lobby_panel_override.tres b/client/menu/theme/lobby_panel_override.tres new file mode 100644 index 00000000..04fd16b0 --- /dev/null +++ b/client/menu/theme/lobby_panel_override.tres @@ -0,0 +1,4 @@ +[gd_resource type="StyleBoxFlat" format=3 uid="uid://de80aw86emnql"] + +[resource] +bg_color = Color(0.0941176, 0.0941176, 0.0941176, 1) diff --git a/client/menu/user.webp b/client/menu/user.webp Binary files differnew file mode 100644 index 00000000..5bba0540 --- /dev/null +++ b/client/menu/user.webp diff --git a/client/menu/user.webp.import b/client/menu/user.webp.import new file mode 100644 index 00000000..112cf9b8 --- /dev/null +++ b/client/menu/user.webp.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://222w1wha75od" +path="res://.godot/imported/user.webp-257e5395baacd6a382811f4f2dd7cd93.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://menu/user.webp" +dest_files=["res://.godot/imported/user.webp-257e5395baacd6a382811f4f2dd7cd93.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/client/multiplayer.gd b/client/multiplayer.gd index af80fc0f..a1e865f2 100644 --- a/client/multiplayer.gd +++ b/client/multiplayer.gd @@ -23,7 +23,8 @@ signal data( item_names: Array, tile_names: Array, tile_collide: Array, - tile_interact: Array + tile_interact: Array, + map_names: Array ) signal set_tile(tile: Vector2i, kind: int, neighbors: Array) signal remove_tile(tile: Vector2i) @@ -46,7 +47,7 @@ signal set_tile_progress(tile: Vector2i, progress: float, warn: bool) signal set_player_progress(player: int, progress: float, warn: bool) signal set_tile_finished(tile: Vector2i, warn: bool) signal set_player_finished(player: int, warn: bool) -signal set_ingame(state: bool) +signal set_ingame(state: bool, lobby: bool) signal score(demands_failed: int, demands_completed: int, points: int, time_remaining: float) signal hide_score() signal server_message(text: String) @@ -98,7 +99,8 @@ func handle_packet(bytes: PackedByteArray): var tile_names = decoded["data"]["tile_names"] var tile_collide = decoded["data"]["tile_collide"] var tile_interact = decoded["data"]["tile_interact"] - data.emit(item_names, tile_names, tile_collide, tile_interact) + var map_names = decoded["data"]["map_names"] + data.emit(item_names, tile_names, tile_collide, tile_interact, map_names) "add_player": var id = decoded["id"] var player_name = decoded["name"] @@ -223,7 +225,8 @@ func handle_packet(bytes: PackedByteArray): clear_message.emit(player) "set_ingame": var state = decoded["state"] - set_ingame.emit(state) + var lobby = decoded["lobby"] + set_ingame.emit(state, lobby) "error": var message = decoded["message"] push_warning("server error: %s" % message) diff --git a/client/project.godot b/client/project.godot index 3638f83e..8150da86 100644 --- a/client/project.godot +++ b/client/project.godot @@ -44,6 +44,7 @@ ui_cancel={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null) ] } forward={ @@ -101,12 +102,6 @@ interact={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":74,"key_label":0,"unicode":106,"echo":false,"script":null) ] } -pause={ -"deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"echo":false,"script":null) -, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null) -] -} boost={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"echo":false,"script":null) @@ -145,6 +140,20 @@ fullscreen={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194342,"key_label":0,"unicode":0,"echo":false,"script":null) ] } +previous={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":true,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null) +] +} +next={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":true,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null) +] +} [internationalization] |