initial starter deck added. the turn rotation works sometimes
1
.gitignore
vendored
@ -15,3 +15,4 @@ data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
Project\ Exports/
|
||||
*~
|
||||
|
BIN
Assets/back.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
34
Assets/back.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bj07g3riacndc"
|
||||
path="res://.godot/imported/back.png-053dd747ba6ac70cbaf48f0fcdf7d070.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/back.png"
|
||||
dest_files=["res://.godot/imported/back.png-053dd747ba6ac70cbaf48f0fcdf7d070.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
|
BIN
Assets/card.png
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
Assets/card.png~
Before Width: | Height: | Size: 6.0 KiB |
BIN
Assets/slice.png
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 539 B |
Before Width: | Height: | Size: 642 B |
BIN
Assets/task.png
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
@ -1,18 +1,27 @@
|
||||
class_name PlayerBoard
|
||||
extends Node2D
|
||||
|
||||
var player_info = {}
|
||||
var workers = []
|
||||
var roster = []
|
||||
var shift_deck = []
|
||||
var slots = []
|
||||
@export var poor_deck: Deck
|
||||
@export var good_deck: Deck
|
||||
@export var great_deck: Deck
|
||||
@export var shift_deck: Deck
|
||||
@export var slots: Array[Workspace] = []
|
||||
#Workaround for bug in 4.0.3.stable
|
||||
@export var slot1: Workspace
|
||||
@export var slot2: Workspace
|
||||
@export var slot3: Workspace
|
||||
@export var slot4: Workspace
|
||||
|
||||
|
||||
func _ready():
|
||||
#Workaround for bug in 4.0.3.stable
|
||||
slots.append($Slot1)
|
||||
slots.append($Slot2)
|
||||
slots.append($Slot3)
|
||||
slots.append($Slot4)
|
||||
slots.append(slot1)
|
||||
slots.append(slot2)
|
||||
slots.append(slot3)
|
||||
slots.append(slot4)
|
||||
|
||||
|
||||
func add_to_roster(node_paths):
|
||||
@ -23,3 +32,9 @@ func add_to_roster(node_paths):
|
||||
for x in 4:
|
||||
if x < roster.size():
|
||||
slots[x].add_worker(roster[x])
|
||||
|
||||
|
||||
func draw_client():
|
||||
var card = shift_deck.draw_card()
|
||||
card.slide_to_position(position.x, position.y, 0.0, 0.3)
|
||||
card.turn_front()
|
||||
|
@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://c7j6lwbwgbosr"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://c7j6lwbwgbosr"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/client.gd" id="1_bvmvn"]
|
||||
[ext_resource type="Texture2D" uid="uid://dpu7jjppeja2v" path="res://Assets/task.png" id="2_k2tqp"]
|
||||
[ext_resource type="Texture2D" uid="uid://de0gq6h0onwex" path="res://Assets/slice.png" id="3_pxlet"]
|
||||
[ext_resource type="Texture2D" uid="uid://b72amudxuxo8n" path="res://Assets/hard.png" id="4_8gylx"]
|
||||
[ext_resource type="Texture2D" uid="uid://bj07g3riacndc" path="res://Assets/back.png" id="4_tye4g"]
|
||||
[ext_resource type="Texture2D" uid="uid://ws1ghxt16a54" path="res://Assets/hardest.png" id="5_hl5js"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_xciys"]
|
||||
@ -14,18 +15,19 @@ shadow_size = 0
|
||||
font_size = 24
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_70vuu"]
|
||||
size = Vector2(350, 253)
|
||||
size = Vector2(350, 250)
|
||||
|
||||
[node name="Card" type="Node2D"]
|
||||
script = ExtResource("1_bvmvn")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
[node name="front" type="TextureRect" parent="."]
|
||||
visible = false
|
||||
texture_filter = 1
|
||||
offset_right = 350.0
|
||||
offset_bottom = 250.0
|
||||
texture = ExtResource("2_k2tqp")
|
||||
|
||||
[node name="Title" type="Label" parent="Background"]
|
||||
[node name="Title" type="Label" parent="front"]
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
@ -38,7 +40,7 @@ horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Initial Stress" type="Label" parent="Background"]
|
||||
[node name="Initial Stress" type="Label" parent="front"]
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
texture_filter = 1
|
||||
layout_mode = 0
|
||||
@ -51,47 +53,43 @@ horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Slice1" type="TextureRect" parent="Background"]
|
||||
visible = false
|
||||
[node name="Slice1" type="TextureRect" parent="front"]
|
||||
layout_mode = 0
|
||||
offset_left = 325.0
|
||||
offset_top = 6.0
|
||||
offset_right = 344.0
|
||||
offset_bottom = 25.0
|
||||
offset_left = 318.0
|
||||
offset_top = 12.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = 30.0
|
||||
texture = ExtResource("3_pxlet")
|
||||
|
||||
[node name="Slice2" type="TextureRect" parent="Background"]
|
||||
visible = false
|
||||
[node name="Slice2" type="TextureRect" parent="front"]
|
||||
layout_mode = 0
|
||||
offset_left = 326.0
|
||||
offset_top = 25.0
|
||||
offset_right = 345.0
|
||||
offset_bottom = 44.0
|
||||
offset_left = 318.0
|
||||
offset_top = 28.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = 46.0
|
||||
texture = ExtResource("3_pxlet")
|
||||
flip_v = true
|
||||
|
||||
[node name="Slice3" type="TextureRect" parent="Background"]
|
||||
visible = false
|
||||
[node name="Slice3" type="TextureRect" parent="front"]
|
||||
layout_mode = 0
|
||||
offset_left = 308.0
|
||||
offset_top = 24.0
|
||||
offset_right = 327.0
|
||||
offset_bottom = 43.0
|
||||
offset_left = 302.0
|
||||
offset_top = 28.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = 46.0
|
||||
texture = ExtResource("3_pxlet")
|
||||
flip_h = true
|
||||
flip_v = true
|
||||
|
||||
[node name="Slice4" type="TextureRect" parent="Background"]
|
||||
visible = false
|
||||
[node name="Slice4" type="TextureRect" parent="front"]
|
||||
layout_mode = 0
|
||||
offset_left = 308.0
|
||||
offset_top = 7.0
|
||||
offset_right = 327.0
|
||||
offset_bottom = 26.0
|
||||
offset_left = 302.0
|
||||
offset_top = 12.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = 30.0
|
||||
texture = ExtResource("3_pxlet")
|
||||
flip_h = true
|
||||
|
||||
[node name="Turns Left Counter" type="Label" parent="Background"]
|
||||
[node name="Turns Left Counter" type="Label" parent="front"]
|
||||
layout_mode = 0
|
||||
offset_left = 354.0
|
||||
offset_right = 394.0
|
||||
@ -184,7 +182,7 @@ scale = Vector2(0.9, 0.9)
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2(175, 124.5)
|
||||
position = Vector2(175, 125)
|
||||
shape = SubResource("RectangleShape2D_70vuu")
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
@ -195,7 +193,6 @@ offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[node name="4turn" type="Button" parent="Control"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 91.0
|
||||
offset_top = 56.0
|
||||
@ -204,7 +201,6 @@ offset_bottom = 118.0
|
||||
text = "4"
|
||||
|
||||
[node name="3turn" type="Button" parent="Control"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 90.0
|
||||
offset_top = 131.0
|
||||
@ -213,7 +209,6 @@ offset_bottom = 193.0
|
||||
text = "3"
|
||||
|
||||
[node name="2turn" type="Button" parent="Control"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 176.0
|
||||
offset_top = 132.0
|
||||
@ -222,7 +217,6 @@ offset_bottom = 194.0
|
||||
text = "2"
|
||||
|
||||
[node name="1turn" type="Button" parent="Control"]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 176.0
|
||||
offset_top = 56.0
|
||||
@ -230,6 +224,13 @@ offset_right = 240.0
|
||||
offset_bottom = 118.0
|
||||
text = "1"
|
||||
|
||||
[node name="back" type="TextureRect" parent="."]
|
||||
offset_top = 250.0
|
||||
offset_right = 250.0
|
||||
offset_bottom = 600.0
|
||||
rotation = -1.5708
|
||||
texture = ExtResource("4_tye4g")
|
||||
|
||||
[connection signal="pressed" from="Control/4turn" to="." method="_on_turn_pressed" binds= [4]]
|
||||
[connection signal="pressed" from="Control/3turn" to="." method="_on_turn_pressed" binds= [3]]
|
||||
[connection signal="pressed" from="Control/2turn" to="." method="_on_turn_pressed" binds= [2]]
|
||||
|
@ -2,40 +2,63 @@
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/network_lobby.gd" id="1_dsni2"]
|
||||
|
||||
[node name="Root" type="Node2D"]
|
||||
[node name="Root" type="Node2D" node_paths=PackedStringArray("username_field", "IP_field", "Port_field")]
|
||||
script = ExtResource("1_dsni2")
|
||||
username_field = NodePath("CanvasLayer/Control/UI/Username")
|
||||
IP_field = NodePath("CanvasLayer/Control/UI/IPField")
|
||||
Port_field = NodePath("CanvasLayer/Control/UI/PortField")
|
||||
|
||||
[node name="UI" type="VBoxContainer" parent="."]
|
||||
offset_right = 116.0
|
||||
offset_bottom = 136.0
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Username" type="LineEdit" parent="UI"]
|
||||
[node name="Control" type="Control" parent="CanvasLayer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="UI" type="VBoxContainer" parent="CanvasLayer/Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -150.0
|
||||
offset_top = -125.0
|
||||
offset_right = 150.0
|
||||
offset_bottom = 125.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Username" type="LineEdit" parent="CanvasLayer/Control/UI"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "username"
|
||||
alignment = 2
|
||||
|
||||
[node name="IPField" type="LineEdit" parent="UI"]
|
||||
[node name="IPField" type="LineEdit" parent="CanvasLayer/Control/UI"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "localhost"
|
||||
alignment = 2
|
||||
|
||||
[node name="PortField" type="LineEdit" parent="UI"]
|
||||
[node name="PortField" type="LineEdit" parent="CanvasLayer/Control/UI"]
|
||||
layout_mode = 2
|
||||
placeholder_text = "58008"
|
||||
alignment = 2
|
||||
|
||||
[node name="Connect" type="Button" parent="UI"]
|
||||
[node name="Connect" type="Button" parent="CanvasLayer/Control/UI"]
|
||||
layout_mode = 2
|
||||
text = "Connect"
|
||||
|
||||
[node name="Host" type="Button" parent="UI"]
|
||||
[node name="Host" type="Button" parent="CanvasLayer/Control/UI"]
|
||||
layout_mode = 2
|
||||
text = "Host"
|
||||
|
||||
[node name="SinglePlayer" type="Button" parent="UI"]
|
||||
[node name="SinglePlayer" type="Button" parent="CanvasLayer/Control/UI"]
|
||||
layout_mode = 2
|
||||
text = "SinglePlayer"
|
||||
|
||||
[connection signal="pressed" from="UI/Connect" to="." method="connect_to_server"]
|
||||
[connection signal="pressed" from="UI/Host" to="." method="host_server"]
|
||||
[connection signal="pressed" from="UI/SinglePlayer" to="." method="_on_single_player_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/UI/Connect" to="." method="connect_to_server"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/UI/Host" to="." method="host_server"]
|
||||
[connection signal="pressed" from="CanvasLayer/Control/UI/SinglePlayer" to="." method="_on_single_player_pressed"]
|
||||
|
@ -75,7 +75,7 @@ anchors_preset = -1
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -42.5
|
||||
offset_top = 21.0
|
||||
offset_top = 30.0
|
||||
offset_right = 42.5
|
||||
offset_bottom = 31.0
|
||||
grow_horizontal = 2
|
||||
@ -107,6 +107,38 @@ size_flags_vertical = 3
|
||||
[node name="LineEdit" type="LineEdit" parent="CanvasLayer/UI/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Hire" type="Button" parent="CanvasLayer/UI"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -8.0
|
||||
offset_top = -4.0
|
||||
offset_right = -30.0
|
||||
offset_bottom = 4.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
text = "Hire Worker"
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer/UI"]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -40.0
|
||||
offset_top = -11.5
|
||||
offset_right = -137.0
|
||||
offset_bottom = 11.5
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
text = "$50"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="CanvasLayer/UI/Confirm" to="." method="_on_confirm_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/UI/HBoxContainer/LobbyReadyButton" to="." method="_on_lobby_ready_button_pressed"]
|
||||
[connection signal="text_submitted" from="CanvasLayer/UI/VBoxContainer/LineEdit" to="." method="_on_line_edit_text_submitted"]
|
||||
|
@ -13,61 +13,59 @@ script = ExtResource("1_cg0id")
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 94.0
|
||||
offset_top = 4.0
|
||||
offset_right = 1027.0
|
||||
offset_bottom = 183.0
|
||||
theme_override_font_sizes/font_size = 129
|
||||
offset_left = 79.0
|
||||
offset_top = 31.0
|
||||
offset_right = 603.0
|
||||
offset_bottom = 159.0
|
||||
theme_override_font_sizes/font_size = 91
|
||||
text = "Lexi's Game"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Play Game" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 389.0
|
||||
offset_top = 187.0
|
||||
offset_right = 743.0
|
||||
offset_bottom = 350.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
offset_left = 31.0
|
||||
offset_top = 215.0
|
||||
offset_right = 281.0
|
||||
offset_bottom = 273.0
|
||||
theme_override_font_sizes/font_size = 36
|
||||
text = "Play"
|
||||
|
||||
[node name="Worker Deck" type="Button" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 383.0
|
||||
offset_top = 394.0
|
||||
offset_right = 737.0
|
||||
offset_bottom = 557.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "worker deck
|
||||
dev tool"
|
||||
offset_left = 874.0
|
||||
offset_top = 261.0
|
||||
offset_right = 1124.0
|
||||
offset_bottom = 319.0
|
||||
theme_override_font_sizes/font_size = 36
|
||||
text = "worker editor"
|
||||
|
||||
[node name="Task Deck" type="Button" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 383.0
|
||||
offset_top = 570.0
|
||||
offset_right = 737.0
|
||||
offset_bottom = 733.0
|
||||
theme_override_font_sizes/font_size = 40
|
||||
text = "task deck
|
||||
dev tool"
|
||||
offset_left = 874.0
|
||||
offset_top = 332.0
|
||||
offset_right = 1124.0
|
||||
offset_bottom = 390.0
|
||||
theme_override_font_sizes/font_size = 36
|
||||
text = "client editor"
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 652.0
|
||||
offset_top = 343.0
|
||||
offset_right = 696.0
|
||||
offset_bottom = 367.0
|
||||
scale = Vector2(2, 2)
|
||||
offset_left = 1054.0
|
||||
offset_top = 221.0
|
||||
offset_right = 1098.0
|
||||
offset_bottom = 245.0
|
||||
scale = Vector2(1.5, 1.5)
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 378.0
|
||||
offset_top = 344.0
|
||||
offset_right = 642.0
|
||||
offset_bottom = 402.0
|
||||
theme_override_font_sizes/font_size = 35
|
||||
offset_left = 895.0
|
||||
offset_top = 219.0
|
||||
offset_right = 1055.0
|
||||
offset_bottom = 253.0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "Show dev tools"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
@ -5,26 +5,34 @@
|
||||
[ext_resource type="PackedScene" uid="uid://y2i3u6n1oowh" path="res://Scenes/deck.tscn" id="3_ypq4b"]
|
||||
[ext_resource type="PackedScene" uid="uid://baoec8cqmedf6" path="res://Scenes/worker_slot.tscn" id="4_o73ea"]
|
||||
|
||||
[node name="PlayerBoard" type="Node2D"]
|
||||
[node name="PlayerBoard" type="Node2D" node_paths=PackedStringArray("poor_deck", "good_deck", "great_deck", "shift_deck", "slot1", "slot2", "slot3", "slot4")]
|
||||
script = ExtResource("1_80bvu")
|
||||
poor_deck = NodePath("PoorDeck")
|
||||
good_deck = NodePath("GoodDeck")
|
||||
great_deck = NodePath("GreatDeck")
|
||||
shift_deck = NodePath("ShiftDeck")
|
||||
slot1 = NodePath("Slot1")
|
||||
slot2 = NodePath("Slot2")
|
||||
slot3 = NodePath("Slot3")
|
||||
slot4 = NodePath("Slot4")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_rx76r")
|
||||
|
||||
[node name="ShiftDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(835, -345)
|
||||
type = 1
|
||||
|
||||
[node name="GreatDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(85, -345)
|
||||
[node name="PoorDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(-855, -345)
|
||||
type = 1
|
||||
|
||||
[node name="GoodDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(-385, -345)
|
||||
type = 1
|
||||
|
||||
[node name="PoorDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(-855, -345)
|
||||
[node name="GreatDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(85, -345)
|
||||
type = 1
|
||||
|
||||
[node name="ShiftDeck" parent="." instance=ExtResource("3_ypq4b")]
|
||||
position = Vector2(835, -345)
|
||||
type = 1
|
||||
|
||||
[node name="Slot1" parent="." instance=ExtResource("4_o73ea")]
|
||||
|
@ -60,9 +60,9 @@ uppercase = true
|
||||
[node name="Capacity" type="Label" parent="Sprite2D"]
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
texture_filter = 1
|
||||
offset_left = 77.0
|
||||
offset_left = 78.0
|
||||
offset_top = 126.0
|
||||
offset_right = 114.0
|
||||
offset_right = 115.0
|
||||
offset_bottom = 163.0
|
||||
text = "99"
|
||||
label_settings = SubResource("LabelSettings_88ebh")
|
||||
@ -71,6 +71,7 @@ vertical_alignment = 1
|
||||
uppercase = true
|
||||
|
||||
[node name="Bonus1" type="Node2D" parent="Sprite2D"]
|
||||
position = Vector2(-2, 1)
|
||||
|
||||
[node name="Icon1" type="Sprite2D" parent="Sprite2D/Bonus1"]
|
||||
visible = false
|
||||
@ -80,6 +81,7 @@ region_enabled = true
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="frame1" type="Sprite2D" parent="Sprite2D/Bonus1"]
|
||||
visible = false
|
||||
position = Vector2(-99, 145)
|
||||
texture = ExtResource("4_rce5w")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
@ -91,6 +93,7 @@ texture = ExtResource("5_a2bm7")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="Bonus2" type="Node2D" parent="Sprite2D"]
|
||||
position = Vector2(1, 1)
|
||||
|
||||
[node name="Icon2" type="Sprite2D" parent="Sprite2D/Bonus2"]
|
||||
visible = false
|
||||
@ -100,6 +103,7 @@ region_enabled = true
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="frame2" type="Sprite2D" parent="Sprite2D/Bonus2"]
|
||||
visible = false
|
||||
position = Vector2(-52, 145)
|
||||
texture = ExtResource("4_rce5w")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
@ -111,6 +115,7 @@ texture = ExtResource("5_a2bm7")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="Bonus3" type="Node2D" parent="Sprite2D"]
|
||||
position = Vector2(3, 1)
|
||||
|
||||
[node name="Icon3" type="Sprite2D" parent="Sprite2D/Bonus3"]
|
||||
visible = false
|
||||
@ -120,6 +125,7 @@ region_enabled = true
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="frame3" type="Sprite2D" parent="Sprite2D/Bonus3"]
|
||||
visible = false
|
||||
position = Vector2(-6, 145)
|
||||
texture = ExtResource("4_rce5w")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
@ -131,6 +137,7 @@ texture = ExtResource("5_a2bm7")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="Bonus4" type="Node2D" parent="Sprite2D"]
|
||||
position = Vector2(5, 1)
|
||||
|
||||
[node name="Icon4" type="Sprite2D" parent="Sprite2D/Bonus4"]
|
||||
visible = false
|
||||
@ -140,6 +147,7 @@ region_enabled = true
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
||||
[node name="frame4" type="Sprite2D" parent="Sprite2D/Bonus4"]
|
||||
visible = false
|
||||
position = Vector2(40, 145)
|
||||
texture = ExtResource("4_rce5w")
|
||||
region_rect = Rect2(0, 0, 32, 32)
|
||||
|
@ -19,7 +19,6 @@ texture = ExtResource("1_fxq0t")
|
||||
position = Vector2(-225, -175)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Worker"]
|
||||
visible = false
|
||||
position = Vector2(125, 175)
|
||||
shape = SubResource("RectangleShape2D_1gv0f")
|
||||
|
||||
@ -27,6 +26,8 @@ shape = SubResource("RectangleShape2D_1gv0f")
|
||||
position = Vector2(-125, -175)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Client"]
|
||||
visible = false
|
||||
position = Vector2(175, 125)
|
||||
shape = SubResource("RectangleShape2D_27hn2")
|
||||
|
||||
[connection signal="input_event" from="Worker" to="." method="_on_area2d_input_event"]
|
||||
[connection signal="input_event" from="Client" to="." method="_on_area2d_input_event"]
|
||||
|
@ -8,6 +8,7 @@ signal chat_message_submitted(String)
|
||||
@onready var ready_label = $CanvasLayer/UI/HBoxContainer/LobbyReadyLabel
|
||||
@onready var canvas = $CanvasLayer
|
||||
@onready var chat_box = $CanvasLayer/UI/VBoxContainer/RichTextLabel
|
||||
var game_started = false
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@ -17,12 +18,12 @@ func _ready() -> void:
|
||||
$Camera2D.make_current()
|
||||
|
||||
|
||||
@rpc("call_local")
|
||||
@rpc("call_local", "reliable")
|
||||
func ready_self():
|
||||
ready_button_pressed.emit(player_info["id"])
|
||||
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func update_ready_label(readied_players, total_players):
|
||||
if readied_players == total_players:
|
||||
ready_label.visible = false
|
||||
@ -32,6 +33,7 @@ func update_ready_label(readied_players, total_players):
|
||||
func _on_lobby_ready_button_pressed() -> void:
|
||||
rpc("ready_self")
|
||||
ready_button.visible = false
|
||||
rpc("end_turn")
|
||||
|
||||
|
||||
func add_chat_line(line: String) -> void:
|
||||
@ -55,3 +57,18 @@ func select_card(card):
|
||||
func _on_confirm_pressed() -> void:
|
||||
$CanvasLayer/UI/Confirm.visible = false
|
||||
rpc("confirm_draft")
|
||||
|
||||
|
||||
func start_turn():
|
||||
super()
|
||||
|
||||
|
||||
func select_workspace(workspace):
|
||||
super(workspace)
|
||||
ready_button.visible = true
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func confirm_draft():
|
||||
super()
|
||||
ready_button.visible = true
|
||||
|
@ -3,12 +3,18 @@ extends Node
|
||||
|
||||
signal workers_discarded
|
||||
signal workers_kept
|
||||
signal turn_finished
|
||||
signal round_finished
|
||||
|
||||
var player_info
|
||||
@export var hand_position: Node2D
|
||||
@export var client_position: Vector2
|
||||
var hand = []
|
||||
var draft_picked = []
|
||||
var draft_pick_amount = 0
|
||||
var reputation_points = 0
|
||||
var board: PlayerBoard
|
||||
var current_client: Client
|
||||
|
||||
|
||||
func draft(cards, pick):
|
||||
@ -32,7 +38,15 @@ func select_card(card):
|
||||
card.slide_to_position(card.position.x, card.position.y + 50.0, 0.0, 0.1)
|
||||
|
||||
|
||||
@rpc("call_local")
|
||||
func select_workspace(workspace):
|
||||
if current_client == null:
|
||||
return
|
||||
workspace.add_client(current_client)
|
||||
current_client = null
|
||||
rpc("end_turn")
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func confirm_draft():
|
||||
var discarded_cards = []
|
||||
var kept_cards = []
|
||||
@ -41,5 +55,23 @@ func confirm_draft():
|
||||
discarded_cards.append(card.get_path())
|
||||
else:
|
||||
kept_cards.append(card.get_path())
|
||||
card.card_clicked.disconnect(select_card)
|
||||
workers_discarded.emit(discarded_cards)
|
||||
workers_kept.emit(kept_cards)
|
||||
draft_picked = []
|
||||
hand = []
|
||||
draft_pick_amount = 0
|
||||
|
||||
|
||||
func start_turn():
|
||||
current_client = board.shift_deck.draw_card()
|
||||
if current_client == null:
|
||||
round_finished.emit()
|
||||
return
|
||||
current_client.slide_to_position(board.global_position.x, board.global_position.y, 0.0, 0.3)
|
||||
current_client.turn_front()
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func end_turn():
|
||||
turn_finished.emit()
|
||||
|
@ -1,6 +1,8 @@
|
||||
class_name Client
|
||||
extends Card
|
||||
|
||||
signal time_slots_selected
|
||||
|
||||
enum difficulties {EASY, MEDIUM, HARD}
|
||||
|
||||
var icon_prefab = preload("res://Scenes/bonus_icon.tscn")
|
||||
@ -11,10 +13,12 @@ var turns_left = 4
|
||||
var time_slots = [true, true, false, true]
|
||||
var icon_list = []
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if sliding:
|
||||
slide(delta)
|
||||
|
||||
|
||||
func setup(_title, _initial_stress, _time_slots, _services):
|
||||
if _title != "":
|
||||
title = _title
|
||||
@ -38,20 +42,20 @@ func setup(_title, _initial_stress, _time_slots, _services):
|
||||
difficulty = difficulties.MEDIUM
|
||||
6, 7:
|
||||
difficulty = difficulties.HARD
|
||||
$Background/Slice1.visible = false
|
||||
$Background/Slice2.visible = false
|
||||
$Background/Slice3.visible = false
|
||||
$Background/Slice4.visible = false
|
||||
$front/Slice1.visible = false
|
||||
$front/Slice2.visible = false
|
||||
$front/Slice3.visible = false
|
||||
$front/Slice4.visible = false
|
||||
if time_slots[0] == true:
|
||||
$Background/Slice1.visible = true
|
||||
$front/Slice1.visible = true
|
||||
if time_slots[1] == true:
|
||||
$Background/Slice2.visible = true
|
||||
$front/Slice2.visible = true
|
||||
if time_slots[2] == true:
|
||||
$Background/Slice3.visible = true
|
||||
$front/Slice3.visible = true
|
||||
if time_slots[3] == true:
|
||||
$Background/Slice4.visible = true
|
||||
$Background/Title.text = str(title)
|
||||
$"Background/Initial Stress".text = str(initial_stress)
|
||||
$front/Slice4.visible = true
|
||||
$front/Title.text = str(title)
|
||||
$"front/Initial Stress".text = str(initial_stress)
|
||||
for x in icon_list:
|
||||
x.queue_free()
|
||||
icon_list = []
|
||||
@ -102,13 +106,23 @@ func setup(_title, _initial_stress, _time_slots, _services):
|
||||
func show_time_selector():
|
||||
$Control.visible = true
|
||||
|
||||
|
||||
func update_counter():
|
||||
$"Background/Turns Left Counter".text = str(turns_left)
|
||||
|
||||
signal time_slots_selected
|
||||
|
||||
func _on_turn_pressed(num):
|
||||
turns_left = num
|
||||
update_counter()
|
||||
$Control.visible = false
|
||||
time_slots_selected.emit()
|
||||
|
||||
|
||||
func turn_front():
|
||||
$back.visible = false
|
||||
$front.visible = true
|
||||
|
||||
|
||||
func turn_back():
|
||||
$back.visible = true
|
||||
$front.visible = false
|
||||
|
@ -37,6 +37,8 @@ func _on_area_2d_mouse_exited() -> void:
|
||||
|
||||
|
||||
func draw_card() -> Card:
|
||||
if cards.size() == 0:
|
||||
return null
|
||||
return cards.pop_back()
|
||||
|
||||
|
||||
|
@ -23,7 +23,10 @@ const CLIENT_DECK_SAVE_PATH = "user://client_deck.json"
|
||||
var networked_controllers: Array[HumanController] = []
|
||||
var current_player := 0
|
||||
var players: Array[PlayerController] = []
|
||||
var player_boards: Array[PlayerBoard] = []
|
||||
var readied_players: Array[int] = []
|
||||
var round_number := 0
|
||||
var turn_number := 0
|
||||
|
||||
var _worker_scene = preload("res://Scenes/worker_card.tscn")
|
||||
var _client_scene = preload("res://Scenes/client_card.tscn")
|
||||
@ -75,7 +78,7 @@ func _load_clients():
|
||||
client_deck.shuffle()
|
||||
|
||||
|
||||
@rpc #Called by the network lobby code
|
||||
@rpc("reliable") #Called by the network lobby code
|
||||
func add_player(id: int, username: String, type: PlayerType) -> void:
|
||||
if players.size() > 4:
|
||||
return
|
||||
@ -105,17 +108,26 @@ func add_player(id: int, username: String, type: PlayerType) -> void:
|
||||
player_info["id"] = id
|
||||
player_info["username"] = username
|
||||
controller.player_info = player_info
|
||||
board.player_info = player_info
|
||||
PlayerType.BOT:
|
||||
controller = _bot_scene.instantiate()
|
||||
controller.name = str(id)
|
||||
controller.set_multiplayer_authority(id)
|
||||
board.add_child(controller)
|
||||
controller.client_position = board.position
|
||||
controller.board = board
|
||||
board.slots[0].clicked.connect(controller.select_workspace)
|
||||
board.slots[1].clicked.connect(controller.select_workspace)
|
||||
board.slots[2].clicked.connect(controller.select_workspace)
|
||||
board.slots[3].clicked.connect(controller.select_workspace)
|
||||
board.name = "board " + str(player_boards.size())
|
||||
player_boards.append(board)
|
||||
players.append(controller)
|
||||
for player in networked_controllers:
|
||||
player.rpc("update_ready_label", readied_players.size(), players.size())
|
||||
|
||||
|
||||
@rpc("call_local", "any_peer") #called from message() by player signals
|
||||
@rpc("call_local", "any_peer", "reliable") #called from message() by player signals
|
||||
func relay_chat_message(msg):
|
||||
for player in networked_controllers:
|
||||
player.add_chat_line(msg)
|
||||
@ -128,14 +140,20 @@ func message(msg):
|
||||
func ready_player(id):
|
||||
if not readied_players.has(id):
|
||||
readied_players.append(id)
|
||||
if readied_players.size() == players.size():
|
||||
start_game()
|
||||
for player in networked_controllers:
|
||||
player.rpc("update_ready_label", readied_players.size(), players.size())
|
||||
if readied_players.size() == players.size() and is_multiplayer_authority():
|
||||
if round_number == 0:
|
||||
rpc("start_game")
|
||||
else:
|
||||
rpc("start_round")
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func start_game():
|
||||
#Only the host should shuffle the decks
|
||||
readied_players = []
|
||||
round_number += 1
|
||||
if is_multiplayer_authority():
|
||||
randomize()
|
||||
var deck_order = []
|
||||
@ -148,19 +166,40 @@ func start_game():
|
||||
rpc("send_client_order", deck_order)
|
||||
for player in players:
|
||||
rpc("draft_workers", player.player_info["username"], 4, 2)
|
||||
rpc("draft_clients", player.player_info["username"])
|
||||
|
||||
|
||||
@rpc
|
||||
@rpc("call_local", "reliable")
|
||||
func start_round():
|
||||
readied_players = []
|
||||
round_number += 1
|
||||
turn_number = 0
|
||||
if is_multiplayer_authority():
|
||||
rpc("start_turn")
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func start_turn():
|
||||
turn_number += 1
|
||||
for x in players.size():
|
||||
#players[x].rpc("start_turn")
|
||||
players[x].start_turn()
|
||||
await players[x].turn_finished
|
||||
if is_multiplayer_authority():
|
||||
rpc("start_turn")
|
||||
|
||||
|
||||
@rpc("reliable")
|
||||
func send_worker_order(node_paths):
|
||||
worker_deck.order(node_paths)
|
||||
|
||||
|
||||
@rpc
|
||||
@rpc("reliable")
|
||||
func send_client_order(node_paths):
|
||||
client_deck.order(node_paths)
|
||||
|
||||
|
||||
@rpc("call_local")
|
||||
@rpc("call_local", "reliable")
|
||||
func draft_workers(player, draw_amount, pick_amount):
|
||||
var cards = []
|
||||
for x in draw_amount:
|
||||
@ -170,8 +209,24 @@ func draft_workers(player, draw_amount, pick_amount):
|
||||
x.draft(cards, pick_amount)
|
||||
|
||||
|
||||
@rpc("call_local")
|
||||
@rpc("call_local", "reliable")
|
||||
func discard_workers(node_paths):
|
||||
for path in node_paths:
|
||||
var card = get_node(path)
|
||||
worker_discard.place(card)
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func draft_clients(player):
|
||||
var cards = []
|
||||
for x in 2 + (2 * round_number):
|
||||
cards.append(client_deck.draw_card())
|
||||
for x in player_boards:
|
||||
if x.player_info["username"] == player:
|
||||
for card in cards:
|
||||
x.shift_deck.place(card)
|
||||
|
||||
|
||||
@rpc("call_local", "reliable")
|
||||
func discard_clients(_node_paths):
|
||||
pass
|
||||
|
@ -13,19 +13,23 @@ var enet_peer = ENetMultiplayerPeer.new()
|
||||
var game : Game
|
||||
var players_connected = 0
|
||||
|
||||
@export var username_field: LineEdit
|
||||
@export var IP_field: LineEdit
|
||||
@export var Port_field: LineEdit
|
||||
|
||||
func _ready() -> void:
|
||||
game = game_scene.instantiate() as Game
|
||||
|
||||
|
||||
func host_server() -> void:
|
||||
if $UI/Username.text == "":
|
||||
if username_field.text == "":
|
||||
return
|
||||
$UI.visible = false
|
||||
$CanvasLayer/Control/UI.visible = false
|
||||
enet_peer.create_server(SERVER_PORT, MAX_PLAYERS)
|
||||
multiplayer.multiplayer_peer = enet_peer
|
||||
add_child(game)
|
||||
|
||||
player_info[1] = $UI/Username.text
|
||||
player_info[1] = username_field.text
|
||||
add_player(1, player_info[1])
|
||||
|
||||
multiplayer.peer_connected.connect(
|
||||
@ -35,15 +39,15 @@ func host_server() -> void:
|
||||
|
||||
|
||||
func connect_to_server() -> void:
|
||||
if $UI/Username.text == "":
|
||||
if username_field.text == "":
|
||||
return
|
||||
$UI.visible = false
|
||||
var ip = $UI/IPField.text if $UI/IPField.text != "" else $UI/IPField.placeholder_text
|
||||
var port = $UI/PortField.text if $UI/PortField.text != "" else $UI/PortField.placeholder_text
|
||||
$CanvasLayer/Control/UI.visible = false
|
||||
var ip = IP_field.text if IP_field.text != "" else IP_field.placeholder_text
|
||||
var port = Port_field.text if Port_field.text != "" else Port_field.placeholder_text
|
||||
enet_peer.create_client(ip, int(port))
|
||||
multiplayer.multiplayer_peer = enet_peer
|
||||
add_child(game)
|
||||
player_info[multiplayer.get_unique_id()] = $UI/Username.text
|
||||
player_info[multiplayer.get_unique_id()] = username_field.text
|
||||
|
||||
|
||||
func add_player(peer_id, username):
|
||||
@ -51,12 +55,12 @@ func add_player(peer_id, username):
|
||||
game.add_player(peer_id, username, game.PlayerType.HUMAN)
|
||||
|
||||
|
||||
@rpc("any_peer")
|
||||
@rpc("any_peer", "reliable")
|
||||
func add_new_player(peer_id, username):
|
||||
add_player(peer_id, username)
|
||||
|
||||
|
||||
@rpc
|
||||
@rpc("reliable")
|
||||
func add_previous_players(players):
|
||||
for key in players:
|
||||
if players[key] == player_info[multiplayer.get_unique_id()]:
|
||||
|
@ -1,5 +1,8 @@
|
||||
class_name Workspace
|
||||
extends Node2D
|
||||
|
||||
signal clicked(Workspace)
|
||||
|
||||
var worker: Worker
|
||||
var client: Client
|
||||
|
||||
@ -20,3 +23,8 @@ func add_client(card: Client) -> bool:
|
||||
client = card
|
||||
client.slide_to_position(_c_pos.x, _c_pos.y, 0, 0.2)
|
||||
return true
|
||||
|
||||
|
||||
func _on_area2d_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
|
||||
if event is InputEventMouseButton and event.pressed and worker != null:
|
||||
emit_signal("clicked", self)
|
||||
|
@ -9,6 +9,9 @@ stress inducing session needs to be longer so the same worker needs to remain oc
|
||||
you more to do on your turn because you get to decide what all your little workers do rather than them only
|
||||
being interacted with when you're placing down a client card
|
||||
|
||||
yeah there should be a system for doing something with ur workers each turn, like u do a service and it gives
|
||||
u some client happiness with determines which deck they discard to, and gives u overall reputation points
|
||||
|
||||
the roster system is kind of fucked if you start with 2/4 cards and dont get new ones often
|
||||
like, you would never have any in reserve, but do u need any? idk figure it out
|
||||
|
||||
|