Start work on lobby items
This commit is contained in:
parent
a304697c80
commit
91e55a1709
6 changed files with 68 additions and 12 deletions
Binary file not shown.
|
@ -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")
|
||||
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)
|
|
@ -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
|
||||
|
|
24
Scenes/Lobby/RoomEntry.gd
Normal file
24
Scenes/Lobby/RoomEntry.gd
Normal file
|
@ -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
|
|
@ -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"]
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue