feat: update

This commit is contained in:
2026-07-07 18:15:47 +08:00
parent 286d0ce069
commit 950b1969d8
97 changed files with 388 additions and 3755 deletions
+25 -24
View File
@@ -605,40 +605,41 @@ func _get_all_mesh_instances(node: Node) -> Array:
# RPCs
# -----------------------------------------------------------------
var _candy_scene: PackedScene = preload("res://scenes/candy.tscn")
@rpc("any_peer", "call_local", "reliable")
func sync_candy_stack(count: int, color_id: int) -> void:
var visuals = get_node_or_null("Visuals")
if not visuals: return
var old_stack = visuals.get_node_or_null("CandyStack")
func sync_candy_stack(colors: Array) -> void:
var old_stack = get_node_or_null("CandyStack")
if old_stack:
old_stack.queue_free()
if count <= 0: return
if colors.is_empty() or not _candy_scene: return
var stack_node = Node3D.new()
stack_node.name = "CandyStack"
visuals.add_child(stack_node)
add_child(stack_node)
stack_node.position = Vector3(0, 2.0, 0)
stack_node.position = Vector3(0, 1.8, 0)
# Determine base tile and override material based on the mode config or default tile meshes
var mesh_path = "res://assets/models/tiles/tile_heart.tres"
match color_id:
0: mesh_path = "res://assets/models/tiles/tile_heart.tres"
1: mesh_path = "res://assets/models/tiles/tile_diamond.tres"
2: mesh_path = "res://assets/models/tiles/tile_star.tres"
3: mesh_path = "res://assets/models/tiles/tile_coin.tres"
var tile_mesh = load(mesh_path)
if not tile_mesh: return
var candy_colors = {
0: Color(1.0, 0.3, 0.3), # HEART = red
1: Color(0.3, 0.6, 1.0), # DIAMOND = blue
2: Color(1.0, 0.8, 0.0), # STAR = gold
3: Color(0.0, 1.0, 0.4), # COIN = green
}
for i in range(count):
var mi = MeshInstance3D.new()
mi.mesh = tile_mesh
mi.position = Vector3(0, i * 0.4, 0)
mi.scale = Vector3(0.5, 0.5, 0.5)
stack_node.add_child(mi)
for i in range(colors.size()):
var color_id = colors[i]
var base_color = candy_colors.get(color_id, Color.WHITE)
var candy = _candy_scene.instantiate()
candy.position = Vector3(0, i * 0.35, 0)
# Tint material to match color
var mesh = candy.get_node_or_null("Mesh")
if mesh and mesh.material_override:
var mat = mesh.material_override.duplicate()
mat.albedo_color = base_color
mesh.material_override = mat
stack_node.add_child(candy)
@rpc("any_peer", "call_local", "reliable")
func sync_character(character_name: String) -> void: