goals synced

This commit is contained in:
2025-02-04 16:42:13 +08:00
parent ef8d06b6cc
commit 1c67557135
4 changed files with 450 additions and 90 deletions
+24
View File
@@ -180,9 +180,32 @@ func _on_playerboard_slot_clicked(event, slot_index):
ActionState.PUTTING:
local_player_character.handle_put_slot_selected(slot_index)
func update_goals_ui():
if not local_player_character:
return
for i in range(9): # 9 slots in the goals UI
var slot = $PlayergoalsUI.get_child(i)
var goal_value = local_player_character.goals[i]
# Hide all tile textures first
slot.get_node("TileHeart").hide()
slot.get_node("TileDiamond").hide()
slot.get_node("TileStar").hide()
slot.get_node("TileCoin").hide()
# Show the appropriate texture based on goal value
match goal_value:
7: slot.get_node("TileHeart").show()
8: slot.get_node("TileDiamond").show()
9: slot.get_node("TileStar").show()
10: slot.get_node("TileCoin").show()
func update_playerboard_ui():
if not local_player_character:
return
update_goals_ui() # Update goals UI whenever playerboard updates
for i in range(25):
var slot = playerboard_ui.get_child(i)
@@ -270,6 +293,7 @@ func add_player_character(peer_id):
local_player_character = player_character
update_button_states()
update_playerboard_ui()
update_goals_ui()
func add_bot(bot_id):
rpc("create_bot", bot_id)
+412 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://dxn87yj8qnfpp"]
[gd_scene load_steps=18 format=3 uid="uid://dxn87yj8qnfpp"]
[ext_resource type="MeshLibrary" uid="uid://54tpx8cmksfc" path="res://addons/enhanced_gridmap/meshlibrary/default.tres" id="1_110wo"]
[ext_resource type="Script" path="res://scenes/main.gd" id="1_xcpe3"]
@@ -7,11 +7,15 @@
[ext_resource type="StyleBox" uid="uid://dlw1ogamn741n" path="res://assets/styles/box_flat.tres" id="5_dvx6y"]
[ext_resource type="Texture2D" uid="uid://2yrc6rl4dmd8" path="res://assets/textures/player_board_and_blue_print/tile_null.tres" id="6_2vy7d"]
[ext_resource type="Texture2D" uid="uid://cwxgdi7b4ps40" path="res://assets/textures/Hilight.png" id="7_2nq2l"]
[ext_resource type="Texture2D" uid="uid://bhg7uhpdxksno" path="res://assets/textures/player_board_and_blue_print/tile_star.tres" id="7_icbqr"]
[ext_resource type="Texture2D" uid="uid://c2bj21abtgda1" path="res://assets/models/pboard/HighlightRect.tres" id="7_vv0nt"]
[ext_resource type="Texture2D" uid="uid://0wjk16jlgfq" path="res://assets/models/pboard/SelectRect.tres" id="8_8meci"]
[ext_resource type="Texture2D" uid="uid://dojnv8o6we4ey" path="res://assets/textures/Selected.png" id="8_b18m4"]
[ext_resource type="Texture2D" uid="uid://u378heff6oio" path="res://assets/textures/player_board_and_blue_print/tile_heart.tres" id="8_dqhc7"]
[ext_resource type="Texture2D" uid="uid://68x88jj25yxg" path="res://assets/textures/Adjacent.png" id="9_6gcb6"]
[ext_resource type="Texture2D" uid="uid://dasaeaytvhll0" path="res://assets/models/pboard/AdjacentRect.tres" id="9_aspsw"]
[ext_resource type="Texture2D" uid="uid://cq80fn561r2jm" path="res://assets/textures/player_board_and_blue_print/tile_diamond.tres" id="9_uyhwp"]
[ext_resource type="Texture2D" uid="uid://3m65qapks1kp" path="res://assets/textures/player_board_and_blue_print/tile_coin.tres" id="10_lkxas"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1cewu"]
@@ -53,6 +57,413 @@ offset_bottom = 59.0
grow_horizontal = 2
theme_override_styles/panel = ExtResource("5_dvx6y")
[node name="PlayergoalsUI" type="GridContainer" parent="."]
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 40.0
offset_top = -392.0
offset_right = 156.0
offset_bottom = -276.0
grow_vertical = 0
columns = 3
[node name="Slot1" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot1"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot1"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot1"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot1"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot2" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot2"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot2"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot2"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot2"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot3" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot3"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot3"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot3"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot3"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot4" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot4"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot4"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot4"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot4"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot5" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot5"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot5"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot5"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot5"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot6" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot6"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot6"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot6"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot6"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot7" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot7"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot7"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot7"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot7"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot8" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot8"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot8"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot8"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot8"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="Slot9" type="TextureRect" parent="PlayergoalsUI"]
layout_mode = 2
texture = ExtResource("6_2vy7d")
[node name="TileStar" type="TextureRect" parent="PlayergoalsUI/Slot9"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("7_icbqr")
[node name="TileHeart" type="TextureRect" parent="PlayergoalsUI/Slot9"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("8_dqhc7")
[node name="TileDiamond" type="TextureRect" parent="PlayergoalsUI/Slot9"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("9_uyhwp")
[node name="TileCoin" type="TextureRect" parent="PlayergoalsUI/Slot9"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("10_lkxas")
[node name="PlayerboardUI" type="GridContainer" parent="."]
clip_contents = true
anchors_preset = 2