chore: update to newer godot version. Added UID
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://b3cyy67wp6hd0"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/scripts/game.gd" id="1_vl3q8"]
|
||||
[ext_resource type="Script" path="res://src/scripts/ui.gd" id="2_dljv7"]
|
||||
[ext_resource type="Script" uid="uid://dvscisoria6aj" path="res://src/scripts/game.gd" id="1_vl3q8"]
|
||||
[ext_resource type="Script" uid="uid://j8w01uew0ovu" path="res://src/scripts/ui.gd" id="2_dljv7"]
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
script = ExtResource("1_vl3q8")
|
||||
|
||||
1
src/scripts/game.gd.uid
Normal file
1
src/scripts/game.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dvscisoria6aj
|
||||
@@ -26,7 +26,7 @@ func _ready():
|
||||
# Load card atlas if exists
|
||||
if FileAccess.file_exists("res://src/assets/card_atlas.png"):
|
||||
card_atlas = load("res://src/assets/card_atlas.png")
|
||||
|
||||
|
||||
setup_ui()
|
||||
|
||||
func setup_ui():
|
||||
@@ -34,64 +34,64 @@ func setup_ui():
|
||||
var main_vbox = VBoxContainer.new()
|
||||
add_child(main_vbox)
|
||||
main_vbox.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
|
||||
|
||||
# Game state info
|
||||
game_state_label = Label.new()
|
||||
game_state_label.text = "Spiel wird geladen..."
|
||||
game_state_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
main_vbox.add_child(game_state_label)
|
||||
|
||||
|
||||
# Top area (Opponent + Jokers)
|
||||
var top_hbox = HBoxContainer.new()
|
||||
main_vbox.add_child(top_hbox)
|
||||
|
||||
|
||||
setup_opponent_area(top_hbox)
|
||||
setup_joker_area(top_hbox)
|
||||
|
||||
|
||||
# Middle area (Table + Trump)
|
||||
var middle_hbox = HBoxContainer.new()
|
||||
main_vbox.add_child(middle_hbox)
|
||||
|
||||
|
||||
setup_table_area(middle_hbox)
|
||||
setup_trump_area(middle_hbox)
|
||||
|
||||
|
||||
# Action buttons
|
||||
action_buttons = HBoxContainer.new()
|
||||
action_buttons.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
main_vbox.add_child(action_buttons)
|
||||
|
||||
|
||||
setup_action_buttons()
|
||||
|
||||
|
||||
# Bottom area (Player hand + Controls)
|
||||
var bottom_vbox = VBoxContainer.new()
|
||||
main_vbox.add_child(bottom_vbox)
|
||||
|
||||
|
||||
setup_controls(bottom_vbox)
|
||||
setup_player_area(bottom_vbox)
|
||||
|
||||
func setup_opponent_area(parent):
|
||||
var area = VBoxContainer.new()
|
||||
parent.add_child(area)
|
||||
|
||||
|
||||
var label = Label.new()
|
||||
label.text = "Gegner"
|
||||
area.add_child(label)
|
||||
|
||||
|
||||
opponent_hand_container = HBoxContainer.new()
|
||||
area.add_child(opponent_hand_container)
|
||||
|
||||
func setup_joker_area(parent):
|
||||
var area = VBoxContainer.new()
|
||||
parent.add_child(area)
|
||||
|
||||
|
||||
var label = Label.new()
|
||||
label.text = "Joker (0/3)"
|
||||
label.name = "JokerLabel"
|
||||
area.add_child(label)
|
||||
|
||||
|
||||
joker_slots_container = HBoxContainer.new()
|
||||
area.add_child(joker_slots_container)
|
||||
|
||||
|
||||
# Create 3 joker slots
|
||||
for i in range(3):
|
||||
var slot = create_joker_slot()
|
||||
@@ -100,12 +100,12 @@ func setup_joker_area(parent):
|
||||
func setup_table_area(parent):
|
||||
var table_container = VBoxContainer.new()
|
||||
parent.add_child(table_container)
|
||||
|
||||
|
||||
var label = Label.new()
|
||||
label.text = "Spielfeld"
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
table_container.add_child(label)
|
||||
|
||||
|
||||
table_area = GridContainer.new()
|
||||
table_area.columns = 4 # Angriff/Verteidigung Paare
|
||||
table_container.add_child(table_area)
|
||||
@@ -113,18 +113,18 @@ func setup_table_area(parent):
|
||||
func setup_trump_area(parent):
|
||||
var area = VBoxContainer.new()
|
||||
parent.add_child(area)
|
||||
|
||||
|
||||
var label = Label.new()
|
||||
label.text = "Trump"
|
||||
area.add_child(label)
|
||||
|
||||
|
||||
trump_display = create_card_back()
|
||||
area.add_child(trump_display)
|
||||
|
||||
|
||||
var deck_label = Label.new()
|
||||
deck_label.text = "Deck"
|
||||
area.add_child(deck_label)
|
||||
|
||||
|
||||
deck_display = create_card_back()
|
||||
area.add_child(deck_display)
|
||||
|
||||
@@ -133,23 +133,23 @@ func setup_action_buttons():
|
||||
defend_btn.text = "Verteidigung beenden"
|
||||
defend_btn.pressed.connect(_on_defend_button_pressed)
|
||||
action_buttons.add_child(defend_btn)
|
||||
|
||||
|
||||
var take_btn = Button.new()
|
||||
take_btn.text = "Karten nehmen"
|
||||
take_btn.pressed.connect(_on_take_cards_pressed)
|
||||
action_buttons.add_child(take_btn)
|
||||
|
||||
|
||||
# Initially hidden
|
||||
action_buttons.visible = false
|
||||
|
||||
func setup_controls(parent):
|
||||
var controls = HBoxContainer.new()
|
||||
parent.add_child(controls)
|
||||
|
||||
|
||||
coins_label = Label.new()
|
||||
coins_label.text = "Münzen: 100"
|
||||
controls.add_child(coins_label)
|
||||
|
||||
|
||||
var booster_btn = Button.new()
|
||||
booster_btn.text = "Booster kaufen (50)"
|
||||
booster_btn.pressed.connect(_on_booster_button_pressed)
|
||||
@@ -158,11 +158,11 @@ func setup_controls(parent):
|
||||
func setup_player_area(parent):
|
||||
var area = VBoxContainer.new()
|
||||
parent.add_child(area)
|
||||
|
||||
|
||||
var label = Label.new()
|
||||
label.text = "Deine Karten"
|
||||
area.add_child(label)
|
||||
|
||||
|
||||
player_hand_container = HBoxContainer.new()
|
||||
area.add_child(player_hand_container)
|
||||
|
||||
@@ -171,7 +171,7 @@ func create_card_ui(card, clickable: bool = true) -> Control:
|
||||
var card_button = Button.new()
|
||||
card_button.custom_minimum_size = card_size
|
||||
card_button.disabled = not clickable
|
||||
|
||||
|
||||
if card.is_joker:
|
||||
card_button.text = "JOKER\n" + str(card.joker_type)
|
||||
card_button.modulate = Color.GOLD
|
||||
@@ -179,35 +179,35 @@ func create_card_ui(card, clickable: bool = true) -> Control:
|
||||
var suit_symbols = ["♥", "♦", "♣", "♠"]
|
||||
var suit_text = suit_symbols[card.suit]
|
||||
card_button.text = str(card.value) + "\n" + suit_text
|
||||
|
||||
|
||||
# Color coding
|
||||
if card.suit in [0, 1]: # Hearts, Diamonds
|
||||
card_button.modulate = Color.RED
|
||||
else: # Clubs, Spades
|
||||
card_button.modulate = Color.BLACK
|
||||
|
||||
|
||||
if clickable:
|
||||
card_button.pressed.connect(_on_card_clicked.bind(card))
|
||||
|
||||
|
||||
return card_button
|
||||
|
||||
func create_card_back() -> Control:
|
||||
var card_back = ColorRect.new()
|
||||
card_back.color = Color.BLUE
|
||||
card_back.custom_minimum_size = card_size
|
||||
|
||||
|
||||
var label = Label.new()
|
||||
label.text = "🂠"
|
||||
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
||||
card_back.add_child(label)
|
||||
|
||||
|
||||
return card_back
|
||||
|
||||
func create_joker_slot() -> Control:
|
||||
var slot = Panel.new()
|
||||
slot.custom_minimum_size = card_size * 0.7
|
||||
|
||||
|
||||
var style = StyleBoxFlat.new()
|
||||
style.bg_color = Color.GRAY
|
||||
style.border_width_left = 2
|
||||
@@ -216,7 +216,7 @@ func create_joker_slot() -> Control:
|
||||
style.border_width_bottom = 2
|
||||
style.border_color = Color.WHITE
|
||||
slot.add_theme_stylebox_override("panel", style)
|
||||
|
||||
|
||||
return slot
|
||||
|
||||
# Update Functions
|
||||
@@ -224,7 +224,7 @@ func update_player_hand(cards: Array):
|
||||
# Clear existing cards
|
||||
for child in player_hand_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
|
||||
# Add new cards
|
||||
for card in cards:
|
||||
var card_ui = create_card_ui(card, true)
|
||||
@@ -234,7 +234,7 @@ func update_opponent_hand(card_count: int):
|
||||
# Clear existing cards
|
||||
for child in opponent_hand_container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
|
||||
# Add card backs
|
||||
for i in range(card_count):
|
||||
var card_back = create_card_back()
|
||||
@@ -245,23 +245,23 @@ func update_table(table_pairs: Array, attacking_cards: Array):
|
||||
# Clear existing table
|
||||
for child in table_area.get_children():
|
||||
child.queue_free()
|
||||
|
||||
|
||||
# Show completed pairs
|
||||
for pair in table_pairs:
|
||||
var attack_card = create_card_ui(pair.attack, false)
|
||||
attack_card.modulate = Color.ORANGE # Angriff
|
||||
table_area.add_child(attack_card)
|
||||
|
||||
|
||||
var defend_card = create_card_ui(pair.defend, false)
|
||||
defend_card.modulate = Color.GREEN # Verteidigung
|
||||
table_area.add_child(defend_card)
|
||||
|
||||
|
||||
# Show undefended attacks
|
||||
for card in attacking_cards:
|
||||
var attack_card = create_card_ui(card, false)
|
||||
attack_card.modulate = Color.RED # Unverteidigt
|
||||
table_area.add_child(attack_card)
|
||||
|
||||
|
||||
# Empty slot for defense
|
||||
var empty_slot = Panel.new()
|
||||
empty_slot.custom_minimum_size = card_size
|
||||
@@ -273,13 +273,13 @@ func update_table(table_pairs: Array, attacking_cards: Array):
|
||||
func update_joker_slots(active_jokers: Array):
|
||||
var label = joker_slots_container.get_parent().get_node("JokerLabel")
|
||||
label.text = "Joker (" + str(active_jokers.size()) + "/3)"
|
||||
|
||||
|
||||
# Update slots
|
||||
for i in range(3):
|
||||
var slot = joker_slots_container.get_child(i)
|
||||
if i < active_jokers.size():
|
||||
slot.modulate = Color.GREEN
|
||||
|
||||
|
||||
# Add joker label
|
||||
var joker_label = Label.new()
|
||||
joker_label.text = str(active_jokers[i])
|
||||
@@ -329,23 +329,23 @@ func update_game_state(state, is_player_turn: bool):
|
||||
func show_joker_choice(joker_type):
|
||||
var dialog = AcceptDialog.new()
|
||||
dialog.title = "Joker gezogen!"
|
||||
|
||||
|
||||
var vbox = VBoxContainer.new()
|
||||
|
||||
|
||||
var info_label = Label.new()
|
||||
info_label.text = "Du hast einen " + str(joker_type) + " Joker gezogen!"
|
||||
vbox.add_child(info_label)
|
||||
|
||||
|
||||
var play_btn = Button.new()
|
||||
play_btn.text = "Sofort spielen"
|
||||
play_btn.pressed.connect(_on_joker_play_immediate.bind(joker_type, dialog))
|
||||
vbox.add_child(play_btn)
|
||||
|
||||
|
||||
var keep_btn = Button.new()
|
||||
keep_btn.text = "Behalten (Risiko!)"
|
||||
keep_btn.pressed.connect(_on_joker_keep.bind(dialog))
|
||||
vbox.add_child(keep_btn)
|
||||
|
||||
|
||||
dialog.add_child(vbox)
|
||||
add_child(dialog)
|
||||
dialog.popup_centered()
|
||||
|
||||
1
src/scripts/ui.gd.uid
Normal file
1
src/scripts/ui.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://j8w01uew0ovu
|
||||
Reference in New Issue
Block a user