summaryrefslogtreecommitdiff
path: root/UI
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-10-27 15:52:48 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-10-27 15:52:48 +0100
commit15a1d2a66e48324e1d560dc13b776627820f3999 (patch)
tree4c062545a4c1a750293b52d5c11258f9b4218a2a /UI
parenta495681453c97578cc4a408d6919c6879524a603 (diff)
next commit
Diffstat (limited to 'UI')
-rw-r--r--UI/Camera.gd7
-rw-r--r--UI/Lobby.tscn29
-rw-r--r--UI/lobby.gd15
3 files changed, 45 insertions, 6 deletions
diff --git a/UI/Camera.gd b/UI/Camera.gd
index 3009ed2..60bb46d 100644
--- a/UI/Camera.gd
+++ b/UI/Camera.gd
@@ -33,7 +33,7 @@ func _ready():
zoomed.emit(zoom)
)
- Input.mouse_mode = Input.MOUSE_MODE_CONFINED
+ #Input.mouse_mode = Input.MOUSE_MODE_CONFINED
func _input(event):
@@ -43,12 +43,16 @@ func _input(event):
(limit_bottom - limit_top) / get_rect().size.y > 1.0
)
if can_zoom_out:
+ var previous_mouse_position := get_global_mouse_position()
var new_zoom = max(zoom.x - zoom_step, zoom_min)
zoom = Vector2(new_zoom, new_zoom)
+ global_position += previous_mouse_position - get_global_mouse_position()
zoomed.emit(zoom)
if event.is_action("camera_zoom_in"):
+ var previous_mouse_position := get_global_mouse_position()
var new_zoom = min(zoom.x + zoom_step, zoom_max)
zoom = Vector2(new_zoom, new_zoom)
+ global_position += previous_mouse_position - get_global_mouse_position()
zoomed.emit(zoom)
@@ -77,6 +81,7 @@ func _input(event):
is_in_edge_mode = true
edge += Vector2.DOWN
edge = edge.normalized()
+ is_in_edge_mode = false
if event is InputEventMouseButton and event.is_pressed():
Input.mouse_mode = Input.MOUSE_MODE_CONFINED
diff --git a/UI/Lobby.tscn b/UI/Lobby.tscn
index 02f32ce..6c7f1f7 100644
--- a/UI/Lobby.tscn
+++ b/UI/Lobby.tscn
@@ -1,8 +1,13 @@
-[gd_scene load_steps=4 format=3 uid="uid://r45j806p4a74"]
+[gd_scene load_steps=9 format=3 uid="uid://r45j806p4a74"]
[ext_resource type="Script" path="res://UI/lobby.gd" id="1_mm4gt"]
[ext_resource type="Theme" uid="uid://bt84t61hrvoyn" path="res://UI/lobby_theme.tres" id="2_syjfh"]
+[ext_resource type="PackedScene" uid="uid://bl65jllb3e2py" path="res://Stages/Wintermaul/Wintermaul.tscn" id="3_3hc3h"]
[ext_resource type="Texture2D" uid="uid://ci7qydmwbanbp" path="res://Stages/Wintermaul/Assets/thumbnail.png" id="3_8r1n2"]
+[ext_resource type="PackedScene" uid="uid://dwscklgkbhq28" path="res://Stages/Wintermaul2/Wintermaul2.tscn" id="4_v1caa"]
+[ext_resource type="Texture2D" uid="uid://cfiu7ah67vdpg" path="res://Stages/Square/Assets/thumbnail.png" id="5_5ewsi"]
+[ext_resource type="PackedScene" uid="uid://jxy7fj7yymfl" path="res://Stages/TinySwords/WintermaulTinySwords.tscn" id="5_hnsfx"]
+[ext_resource type="Texture2D" uid="uid://cujvoqsqfrl4a" path="res://Stages/Wintermaul2/Assets/thumbnail.png" id="5_j23oc"]
[node name="Lobby" type="Control"]
layout_mode = 3
@@ -78,14 +83,34 @@ layout_mode = 2
mouse_default_cursor_shape = 2
toggle_mode = true
text = "Wintermaul"
+metadata/map_scene = ExtResource("3_3hc3h")
+metadata/thumbnail = ExtResource("3_8r1n2")
[node name="MapButton2" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
layout_mode = 2
mouse_default_cursor_shape = 2
toggle_mode = true
text = "Squares"
+metadata/thumbnail = ExtResource("5_5ewsi")
-[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer"]
+[node name="MapButton3" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
+layout_mode = 2
+mouse_default_cursor_shape = 2
+toggle_mode = true
+text = "Wintermaul 2"
+metadata/map_scene = ExtResource("4_v1caa")
+metadata/thumbnail = ExtResource("5_j23oc")
+
+[node name="MapButton4" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer/Maps"]
+visible = false
+layout_mode = 2
+mouse_default_cursor_shape = 2
+toggle_mode = true
+text = "Wintermaul Tiny Swords"
+metadata/map_scene = ExtResource("5_hnsfx")
+
+[node name="Thumbnail" type="TextureRect" parent="MarginContainer/VBoxContainer/CenterContainer/HBoxContainer"]
+unique_name_in_owner = true
custom_minimum_size = Vector2(300, 260)
layout_mode = 2
texture = ExtResource("3_8r1n2")
diff --git a/UI/lobby.gd b/UI/lobby.gd
index f849d81..1cb4d5c 100644
--- a/UI/lobby.gd
+++ b/UI/lobby.gd
@@ -3,7 +3,7 @@ extends Control
signal joined
-var current_map_idx := 0
+var current_map_idx := 2
@onready var list: VBoxContainer = %PlayersList
@@ -35,6 +35,10 @@ func _ready() -> void:
update_players()
multiplayer.peer_disconnected.connect(remove_player)
+
+ # reset map texture for clean load
+ %Thumbnail.texture = null
+ set_map(current_map_idx)
func update_players():
@@ -74,7 +78,8 @@ func _on_cancel_button_pressed() -> void:
@rpc("authority", "call_local")
func start():
- get_tree().change_scene_to_file("res://Stages/Wintermaul/Wintermaul.tscn")
+ var scene = %Maps.get_child(current_map_idx).get_meta("map_scene")
+ get_tree().change_scene_to_packed(scene)
@rpc("authority", "call_local")
@@ -82,4 +87,8 @@ func set_map(index: int):
for node: Button in %Maps.get_children():
node.add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 0.5))
- %Maps.get_child(index).add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 1.0))
+ var node = %Maps.get_child(index)
+ var thumbnail = node.get_meta("thumbnail")
+
+ node.add_theme_color_override("font_color", Color(1.0, 1.0, 1.0, 1.0))
+ %Thumbnail.texture = thumbnail