diff --git a/AssetSrc/playerboticons.afdesign b/AssetSrc/playerboticons.afdesign index 69c3847..0cc62b0 100644 Binary files a/AssetSrc/playerboticons.afdesign and b/AssetSrc/playerboticons.afdesign differ diff --git a/Scenes/Lobby.gd b/Scenes/Lobby.gd index 88f3149..b0e908f 100644 --- a/Scenes/Lobby.gd +++ b/Scenes/Lobby.gd @@ -2,8 +2,23 @@ extends Control signal loaded() +onready var roomList := $RoomScroll/RoomList + +var RoomItem := preload("res://Scenes/Lobby/RoomEntry.tscn") + func _ready(): # Load bgm BGM.load_music("lobby") - emit_signal("loaded") \ No newline at end of file + emit_signal("loaded") + + add_room("test", "Unnamed room") + +func add_room(id: String, name: String): + var item := RoomItem.instance() + item.roomName = name + item.connect("clicked", self, "_room_clicked", [id]) + roomList.add_child(item) + +func _room_clicked(id: String): + print(id) \ No newline at end of file diff --git a/Scenes/Lobby.tscn b/Scenes/Lobby.tscn index 599ecd6..e4610c6 100644 --- a/Scenes/Lobby.tscn +++ b/Scenes/Lobby.tscn @@ -1,15 +1,14 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://Scenes/Lobby.gd" type="Script" id=1] [ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=2] -[ext_resource path="res://Scenes/Lobby/RoomEntry.tscn" type="PackedScene" id=3] [node name="Lobby" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource( 1 ) -[node name="TextureRect" type="TextureRect" parent="."] +[node name="Background" type="TextureRect" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 margin_left = -1.29236 @@ -18,20 +17,17 @@ texture = ExtResource( 2 ) expand = true stretch_mode = 7 -[node name="ScrollContainer" type="ScrollContainer" parent="."] +[node name="RoomScroll" type="ScrollContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 30.0 margin_top = 100.0 margin_right = -30.0 margin_bottom = -300.0 +scroll_horizontal_enabled = false -[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] +[node name="RoomList" type="VBoxContainer" parent="RoomScroll"] margin_right = 1220.0 margin_bottom = 400.0 size_flags_horizontal = 3 size_flags_vertical = 3 - -[node name="Control" parent="ScrollContainer/VBoxContainer" instance=ExtResource( 3 )] -anchor_right = 0.0 -margin_right = 1220.0 diff --git a/Scenes/Lobby/RoomEntry.gd b/Scenes/Lobby/RoomEntry.gd new file mode 100644 index 0000000..b95f25d --- /dev/null +++ b/Scenes/Lobby/RoomEntry.gd @@ -0,0 +1,24 @@ +extends Panel + +signal clicked() + +export var roomName: String = "Unnamed room" + +onready var roomNameLabel := $RoomName + +func _ready(): + roomNameLabel.text = roomName + +func _gui_input(event: InputEvent): + # Left double click + if event is InputEventMouseButton and event.button_index == BUTTON_LEFT: + accept_event() + if event.doubleclick: + emit_signal("clicked") + else: + #TODO Fade in + pass + +func _mouse_exited(): + #TODO if faded in, fade out + pass \ No newline at end of file diff --git a/Scenes/Lobby/RoomEntry.tscn b/Scenes/Lobby/RoomEntry.tscn index c81406e..ef73b55 100644 --- a/Scenes/Lobby/RoomEntry.tscn +++ b/Scenes/Lobby/RoomEntry.tscn @@ -1,4 +1,14 @@ -[gd_scene format=2] +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Scenes/Lobby/RoomEntry.gd" type="Script" id=1] +[ext_resource path="res://UIAssets/Fonts/Catamaran-Bold.ttf" type="DynamicFontData" id=2] + +[sub_resource type="DynamicFont" id=1] +size = 26 +use_mipmaps = true +use_filter = true +extra_spacing_top = 2 +font_data = ExtResource( 2 ) [node name="RoomEntry" type="Panel"] anchor_right = 1.0 @@ -6,3 +16,14 @@ margin_right = -280.0 margin_bottom = 50.0 rect_min_size = Vector2( 0, 50 ) size_flags_horizontal = 3 +script = ExtResource( 1 ) + +[node name="RoomName" type="Label" parent="."] +margin_left = 20.0 +margin_right = 411.0 +margin_bottom = 50.0 +custom_fonts/font = SubResource( 1 ) +text = "Unnamed Room" +valign = 1 +[connection signal="gui_input" from="." to="." method="_gui_input"] +[connection signal="mouse_exited" from="RoomName" to="." method="_mouse_exited"] diff --git a/Scenes/Scripts/Draft.gd b/Scenes/Scripts/Draft.gd index ce7c7ab..4e3c3a1 100644 --- a/Scenes/Scripts/Draft.gd +++ b/Scenes/Scripts/Draft.gd @@ -48,7 +48,7 @@ func _card_picked(cardID: String): CardList.add_card(cardID) players["Player 1"].set_picked(true) $CardZoom.fadeout() - #clear_cards() + clear_cards() func add_player(playerName: String, isBot: bool): var item := PlayerItem.instance()