Compare commits
2 commits
238c2690c3
...
62344f91ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 62344f91ee | |||
| 94e920a80f |
13 changed files with 636 additions and 46 deletions
46
Systems/Cards/CardBankItem.gd
Normal file
46
Systems/Cards/CardBankItem.gd
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
extends Control
|
||||||
|
class_name CardBankItem
|
||||||
|
|
||||||
|
signal card_selected(card_item, card)
|
||||||
|
|
||||||
|
var current_card = null
|
||||||
|
|
||||||
|
@onready var rank_label = $RankLabel
|
||||||
|
@onready var card_name_label = $CardNameLabel
|
||||||
|
@onready var card_frame = $CardFrame
|
||||||
|
|
||||||
|
# Card rank colors (matching CardSlot colors)
|
||||||
|
var rank_colors = {
|
||||||
|
Card.Rank.RANK_0: Color(0.9, 0.1, 0.1, 1.0), # Red
|
||||||
|
Card.Rank.RANK_1: Color(0.9, 0.6, 0.1, 1.0), # Orange
|
||||||
|
Card.Rank.RANK_2: Color(0.1, 0.7, 0.1, 1.0), # Green
|
||||||
|
Card.Rank.RANK_3: Color(0.1, 0.7, 0.9, 1.0) # Blue
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
# Connect signals for interaction
|
||||||
|
mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
gui_input.connect(_on_gui_input)
|
||||||
|
if card_frame:
|
||||||
|
card_frame.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||||
|
|
||||||
|
func set_card(card):
|
||||||
|
current_card = card
|
||||||
|
update_appearance()
|
||||||
|
|
||||||
|
func update_appearance():
|
||||||
|
if current_card:
|
||||||
|
# Update card details
|
||||||
|
card_name_label.text = current_card.cardName
|
||||||
|
rank_label.text = str(current_card.rank)
|
||||||
|
|
||||||
|
# Set color based on rank
|
||||||
|
if current_card.rank in rank_colors:
|
||||||
|
rank_label.modulate = rank_colors[current_card.rank]
|
||||||
|
card_frame.modulate = rank_colors[current_card.rank]
|
||||||
|
|
||||||
|
func _on_gui_input(event):
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||||
|
if current_card:
|
||||||
|
emit_signal("card_selected", self, current_card)
|
||||||
89
Systems/Cards/CardSlot.gd
Normal file
89
Systems/Cards/CardSlot.gd
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
extends Panel
|
||||||
|
class_name CardSlot
|
||||||
|
|
||||||
|
signal card_selected(card_slot, card)
|
||||||
|
|
||||||
|
var current_card = null
|
||||||
|
var dragging = false
|
||||||
|
var drag_offset = Vector2()
|
||||||
|
|
||||||
|
@onready var card_name_label = $CardNameLabel
|
||||||
|
@onready var card_rank_label = $RankLabel
|
||||||
|
@onready var card_border = $CardBorder
|
||||||
|
@onready var card_bg = $CardBackground
|
||||||
|
|
||||||
|
# Card rank colors
|
||||||
|
var rank_colors = {
|
||||||
|
Card.Rank.RANK_0: Color(0.9, 0.1, 0.1, 1.0), # Red
|
||||||
|
Card.Rank.RANK_1: Color(0.9, 0.6, 0.1, 1.0), # Orange
|
||||||
|
Card.Rank.RANK_2: Color(0.1, 0.7, 0.1, 1.0), # Green
|
||||||
|
Card.Rank.RANK_3: Color(0.1, 0.7, 0.9, 1.0) # Blue
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
# Set up card appearance
|
||||||
|
update_appearance()
|
||||||
|
|
||||||
|
# Connect signals for interaction
|
||||||
|
mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
gui_input.connect(_on_gui_input)
|
||||||
|
if card_border:
|
||||||
|
card_border.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||||
|
|
||||||
|
func set_card(card):
|
||||||
|
current_card = card
|
||||||
|
update_appearance()
|
||||||
|
|
||||||
|
func clear():
|
||||||
|
current_card = null
|
||||||
|
update_appearance()
|
||||||
|
|
||||||
|
func has_card():
|
||||||
|
return current_card != null
|
||||||
|
|
||||||
|
func update_appearance():
|
||||||
|
if current_card:
|
||||||
|
# Show card details
|
||||||
|
card_name_label.text = current_card.cardName
|
||||||
|
card_name_label.visible = true
|
||||||
|
|
||||||
|
# Set rank display
|
||||||
|
card_rank_label.text = str(current_card.rank)
|
||||||
|
card_rank_label.visible = true
|
||||||
|
|
||||||
|
# Set color based on rank
|
||||||
|
if current_card.rank in rank_colors:
|
||||||
|
card_rank_label.add_theme_color_override("font_color", rank_colors[current_card.rank])
|
||||||
|
card_border.modulate = rank_colors[current_card.rank]
|
||||||
|
|
||||||
|
# Show card background
|
||||||
|
card_bg.modulate = Color(0.2, 0.2, 0.25, 1.0)
|
||||||
|
else:
|
||||||
|
# Empty slot
|
||||||
|
card_name_label.visible = false
|
||||||
|
card_rank_label.visible = false
|
||||||
|
card_border.modulate = Color(0.4, 0.4, 0.4, 0.5)
|
||||||
|
card_bg.modulate = Color(0.15, 0.15, 0.15, 0.8)
|
||||||
|
|
||||||
|
func _on_gui_input(event):
|
||||||
|
if event is InputEventMouseButton:
|
||||||
|
if event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
if event.pressed:
|
||||||
|
# Start drag
|
||||||
|
if current_card:
|
||||||
|
emit_signal("card_selected", self, current_card)
|
||||||
|
# dragging = true
|
||||||
|
# drag_offset = get_global_mouse_position() - global_position
|
||||||
|
# else:
|
||||||
|
# # End drag
|
||||||
|
# if dragging:
|
||||||
|
# dragging = false
|
||||||
|
# emit_signal("card_selected", self, current_card)
|
||||||
|
# elif current_card:
|
||||||
|
# # Just a click, still select the card
|
||||||
|
# emit_signal("card_selected", self, current_card)
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if dragging:
|
||||||
|
# Update position while dragging
|
||||||
|
global_position = get_global_mouse_position() - drag_offset
|
||||||
|
|
@ -4,7 +4,7 @@ func _init():
|
||||||
super._init()
|
super._init()
|
||||||
# id = Utils.generate_guid()
|
# id = Utils.generate_guid()
|
||||||
cardName = "Double Time"
|
cardName = "Double Time"
|
||||||
rank = Rank.RANK_2
|
rank = Rank.RANK_3
|
||||||
effectType = EffectType.MOVEMENT_MODIFIER
|
effectType = EffectType.MOVEMENT_MODIFIER
|
||||||
description = "Piece can move twice in one turn"
|
description = "Piece can move twice in one turn"
|
||||||
duration = 2 # Lasts for 2 turns
|
duration = 2 # Lasts for 2 turns
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ func _init():
|
||||||
duration = 1
|
duration = 1
|
||||||
super._init()
|
super._init()
|
||||||
cardName = "Explosive Boots"
|
cardName = "Explosive Boots"
|
||||||
rank = Rank.RANK_2
|
rank = Rank.RANK_3
|
||||||
effectType = EffectType.PIECE_EFFECT
|
effectType = EffectType.PIECE_EFFECT
|
||||||
description = "All enemy units within 1 radius of the moving peice at the end of the turn are captured"
|
description = "All enemy units within 1 radius of the moving peice at the end of the turn are captured"
|
||||||
unitWhitelist = ["Pawn", "Knight", "King"]
|
unitWhitelist = ["Pawn", "Knight", "King"]
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ class_name DeckManager
|
||||||
|
|
||||||
var deck: Array = []
|
var deck: Array = []
|
||||||
var hand: Array = []
|
var hand: Array = []
|
||||||
|
var bank: Array = []
|
||||||
var discard: Array = []
|
var discard: Array = []
|
||||||
var attached_cards: Dictionary = {} # piece_id: card
|
var attached_cards: Dictionary = {} # piece_id: card
|
||||||
var attached_effects: Dictionary = {} # piece_id: [card]
|
var attached_effects: Dictionary = {} # piece_id: [card]
|
||||||
|
|
@ -17,7 +18,9 @@ const CARD_BASE_COSTS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _init():
|
func _init():
|
||||||
|
print("************************DECK INIT*****************")
|
||||||
initializeStartingDeck()
|
initializeStartingDeck()
|
||||||
|
initializeStartingBank()
|
||||||
|
|
||||||
func initializeStartingDeck():
|
func initializeStartingDeck():
|
||||||
deck.clear();
|
deck.clear();
|
||||||
|
|
@ -30,8 +33,22 @@ func initializeStartingDeck():
|
||||||
deck.append(DoubleTimeCard.new())
|
deck.append(DoubleTimeCard.new())
|
||||||
deck.append(DrunkDrivingCard.new())
|
deck.append(DrunkDrivingCard.new())
|
||||||
deck.append(SupernovaCard.new())
|
deck.append(SupernovaCard.new())
|
||||||
shuffleDeck()
|
|
||||||
drawStartingHand()
|
func initializeStartingBank():
|
||||||
|
# sample
|
||||||
|
bank.append(HopscotchCard.new())
|
||||||
|
bank.append(FieryCapeCard.new())
|
||||||
|
bank.append(FieryTrailCard.new())
|
||||||
|
bank.append(ExplosiveBootsCard.new())
|
||||||
|
bank.append(DoubleTimeCard.new())
|
||||||
|
bank.append(DrunkDrivingCard.new())
|
||||||
|
bank.append(SupernovaCard.new())
|
||||||
|
|
||||||
|
# Add some duplicates for testing
|
||||||
|
for i in range(3):
|
||||||
|
bank.append(HopscotchCard.new())
|
||||||
|
bank.append(FieryCapeCard.new())
|
||||||
|
|
||||||
|
|
||||||
func shuffleDeck():
|
func shuffleDeck():
|
||||||
deck.shuffle()
|
deck.shuffle()
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ func connect_to_engine(_path: String, g: ChessGame) -> bool:
|
||||||
if ServerManager.is_server_running():
|
if ServerManager.is_server_running():
|
||||||
print("**************SERVER RUNNING ****************")
|
print("**************SERVER RUNNING ****************")
|
||||||
running = true
|
running = true
|
||||||
start_game(1350)
|
start_game(2100)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
await get_tree().create_timer(delay).timeout
|
await get_tree().create_timer(delay).timeout
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ func _ready() -> void:
|
||||||
print("MenuContainer not found, will initialize game now")
|
print("MenuContainer not found, will initialize game now")
|
||||||
call_deferred("initialize_game_system")
|
call_deferred("initialize_game_system")
|
||||||
turnIndicator.visible = false
|
turnIndicator.visible = false
|
||||||
|
deckManager = DeckManager.new()
|
||||||
# 2rnbqkbnr1R/2ppp1pppp2/5p6/75/66/66/66/66/66/66/2PPPPPPPP2/2RNBQKBN3 b KQkq - 0 3
|
# 2rnbqkbnr1R/2ppp1pppp2/5p6/75/66/66/66/66/66/66/2PPPPPPPP2/2RNBQKBN3 b KQkq - 0 3
|
||||||
func _on_new_game_requested(options = {}):
|
func _on_new_game_requested(options = {}):
|
||||||
print("ChessGame received new_game_requested signal ", is_initialized)
|
print("ChessGame received new_game_requested signal ", is_initialized)
|
||||||
|
|
@ -190,8 +191,9 @@ func initializeCardPreview() -> void:
|
||||||
add_child(cardPreview)
|
add_child(cardPreview)
|
||||||
|
|
||||||
func initializeDeckSystem() -> void:
|
func initializeDeckSystem() -> void:
|
||||||
|
deckManager.shuffleDeck()
|
||||||
|
deckManager.drawStartingHand()
|
||||||
# Initialize the deck manager and card display
|
# Initialize the deck manager and card display
|
||||||
deckManager = DeckManager.new()
|
|
||||||
cardDisplay = CardDisplay.new()
|
cardDisplay = CardDisplay.new()
|
||||||
add_child(deckManager)
|
add_child(deckManager)
|
||||||
add_child(cardDisplay)
|
add_child(cardDisplay)
|
||||||
|
|
|
||||||
154
Systems/Game/DeckManagerScreen.gd
Normal file
154
Systems/Game/DeckManagerScreen.gd
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
extends Control
|
||||||
|
class_name DeckManagerScreen
|
||||||
|
|
||||||
|
signal back_pressed
|
||||||
|
|
||||||
|
# Node references
|
||||||
|
@onready var deckGrid = $MainContainer/GridScrollContainer/GridContainer
|
||||||
|
@onready var bankContainer = $MainContainer/BankContainer/ScrollContainer/VBoxContainer
|
||||||
|
@onready var backButton = $BackButton
|
||||||
|
|
||||||
|
# Default deck size (can be overridden via options)
|
||||||
|
var maxDeckSize = 35
|
||||||
|
var deckManager = null
|
||||||
|
var bankCards = [] # Cards available but not in deck
|
||||||
|
|
||||||
|
# The current deck
|
||||||
|
var currentDeck = []
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
# Connect back button
|
||||||
|
if backButton:
|
||||||
|
backButton.connect("pressed", Callable(self, "_on_backButton_pressed"))
|
||||||
|
|
||||||
|
|
||||||
|
func initialize(options = null):
|
||||||
|
# Process options if provided
|
||||||
|
if options:
|
||||||
|
if options.has("maxDeckSize") and options.maxDeckSize is int:
|
||||||
|
maxDeckSize = options.maxDeckSize
|
||||||
|
|
||||||
|
|
||||||
|
# Find the DeckManager instance
|
||||||
|
var board = get_node_or_null("/root/Board") as ChessGame
|
||||||
|
if board and "deckManager" in board:
|
||||||
|
deckManager = board.deckManager
|
||||||
|
print("Found deck manager:", deckManager)
|
||||||
|
# if(!deckManager.deck):
|
||||||
|
# deckManager.initializeStartingDeck()
|
||||||
|
else:
|
||||||
|
print("DeckManager not found on Board node")
|
||||||
|
print("DECK MANAGER")
|
||||||
|
|
||||||
|
# Load cards from deck and bank
|
||||||
|
loadCards()
|
||||||
|
|
||||||
|
# Set up the grid with empty card containers
|
||||||
|
setupDeckGrid()
|
||||||
|
|
||||||
|
# Populate the bank with available cards
|
||||||
|
populateBank()
|
||||||
|
|
||||||
|
func loadCards():
|
||||||
|
if deckManager:
|
||||||
|
# Clone the deck to work with
|
||||||
|
currentDeck = deckManager.deck.duplicate()
|
||||||
|
|
||||||
|
bankCards = deckManager.bank.duplicate()
|
||||||
|
else:
|
||||||
|
# Fallback with empty collections if deck manager not found
|
||||||
|
currentDeck = []
|
||||||
|
bankCards = []
|
||||||
|
print("Warning: DeckManager not found")
|
||||||
|
|
||||||
|
|
||||||
|
func setupDeckGrid():
|
||||||
|
# Clear existing children
|
||||||
|
for child in deckGrid.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
# Calculate grid dimensions
|
||||||
|
var cols = 7 #check screen to deteremine
|
||||||
|
var rows = maxDeckSize / cols
|
||||||
|
deckGrid.columns = cols
|
||||||
|
|
||||||
|
# Create card slots
|
||||||
|
for i in range(maxDeckSize):
|
||||||
|
var card_slot = preload("res://card_slot.tscn").instantiate()
|
||||||
|
deckGrid.add_child(card_slot)
|
||||||
|
|
||||||
|
# Connect signals
|
||||||
|
card_slot.connect("card_selected", Callable(self, "_on_deck_card_selected"))
|
||||||
|
|
||||||
|
# Set card if available
|
||||||
|
if i < currentDeck.size():
|
||||||
|
card_slot.set_card(currentDeck[i])
|
||||||
|
else:
|
||||||
|
card_slot.clear()
|
||||||
|
|
||||||
|
func populateBank():
|
||||||
|
# Clear existing children
|
||||||
|
for child in bankContainer.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
|
||||||
|
# Add each bank card to the list
|
||||||
|
for card in bankCards:
|
||||||
|
var card_item = preload("res://card_bank_item.tscn").instantiate()
|
||||||
|
bankContainer.add_child(card_item)
|
||||||
|
card_item.set_card(card)
|
||||||
|
card_item.connect("card_selected", Callable(self, "_on_bank_card_selected"))
|
||||||
|
|
||||||
|
func _on_deck_card_selected(card_slot, card):
|
||||||
|
if card:
|
||||||
|
# Remove card from deck
|
||||||
|
var index = currentDeck.find(card)
|
||||||
|
if index >= 0:
|
||||||
|
currentDeck.remove_at(index)
|
||||||
|
|
||||||
|
# Add to bank
|
||||||
|
bankCards.append(card)
|
||||||
|
|
||||||
|
# Update UI
|
||||||
|
card_slot.clear()
|
||||||
|
populateBank()
|
||||||
|
|
||||||
|
func _on_bank_card_selected(card_item, card):
|
||||||
|
print("_on_bank_card_selected")
|
||||||
|
# Find first empty slot in deck
|
||||||
|
var empty_slot_index = -1
|
||||||
|
for i in range(deckGrid.get_child_count()):
|
||||||
|
var slot = deckGrid.get_child(i)
|
||||||
|
if !slot.has_card():
|
||||||
|
empty_slot_index = i
|
||||||
|
break
|
||||||
|
|
||||||
|
if empty_slot_index >= 0 and currentDeck.size() < maxDeckSize:
|
||||||
|
# Remove from bank
|
||||||
|
var bank_index = bankCards.find(card)
|
||||||
|
if bank_index >= 0:
|
||||||
|
bankCards.remove_at(bank_index)
|
||||||
|
|
||||||
|
# Add to deck
|
||||||
|
currentDeck.append(card)
|
||||||
|
|
||||||
|
# Update UI
|
||||||
|
deckGrid.get_child(empty_slot_index).set_card(card)
|
||||||
|
populateBank()
|
||||||
|
|
||||||
|
func saveDeck():
|
||||||
|
if deckManager:
|
||||||
|
# Save the current deck to the deck manager
|
||||||
|
deckManager.deck = currentDeck.duplicate()
|
||||||
|
deckManager.bank = bankCards.duplicate()
|
||||||
|
|
||||||
|
print("Deck saved with ", currentDeck.size(), " cards")
|
||||||
|
|
||||||
|
func _on_backButton_pressed():
|
||||||
|
# Save changes before returning
|
||||||
|
saveDeck()
|
||||||
|
|
||||||
|
# Emit signal to go back
|
||||||
|
emit_signal("back_pressed")
|
||||||
|
|
||||||
|
# Hide this screen
|
||||||
|
visible = false
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
extends Control
|
extends Control
|
||||||
class_name MenuContainer
|
class_name MenuContainer
|
||||||
|
|
||||||
# Path to the game scene or initialization script
|
|
||||||
const ChessGame = preload("res://Systems/Game/ChessGame.gd")
|
|
||||||
|
|
||||||
const VERSION_FILE_PATH = "res://Game.json"
|
const VERSION_FILE_PATH = "res://Game.json"
|
||||||
# Signal to notify parent when a new game is requested
|
# Signal to notify parent when a new game is requested
|
||||||
# signal new_game_requested
|
# signal new_game_requested
|
||||||
|
|
@ -18,6 +15,7 @@ signal map_open_requested(options)
|
||||||
@onready var titleText = $HBoxContainer/VBoxContainer/TitleText
|
@onready var titleText = $HBoxContainer/VBoxContainer/TitleText
|
||||||
@onready var developerText = $HBoxContainer/VBoxContainer/DeveloperText
|
@onready var developerText = $HBoxContainer/VBoxContainer/DeveloperText
|
||||||
@onready var gameMenuScreen = get_node("/root/Board/GameMenuScreen")
|
@onready var gameMenuScreen = get_node("/root/Board/GameMenuScreen")
|
||||||
|
@onready var deckManagerScreen = get_node("/root/Board/DeckManagerScreen")
|
||||||
|
|
||||||
@onready var stateMachine = get_node("/root/Board/StateMachine")
|
@onready var stateMachine = get_node("/root/Board/StateMachine")
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
@ -32,6 +30,10 @@ func _ready():
|
||||||
gameMenuScreen.connect("map_open_requested", Callable(self, "_on_map_open_requested"))
|
gameMenuScreen.connect("map_open_requested", Callable(self, "_on_map_open_requested"))
|
||||||
gameMenuScreen.connect("new_game_requested", Callable(self, "_on_start_game_pressed"))
|
gameMenuScreen.connect("new_game_requested", Callable(self, "_on_start_game_pressed"))
|
||||||
gameMenuScreen.visible = false
|
gameMenuScreen.visible = false
|
||||||
|
|
||||||
|
if deckManagerScreen:
|
||||||
|
deckManagerScreen.connect("back_pressed", Callable(self, "_on_deck_manager_back_pressed"))
|
||||||
|
deckManagerScreen.visible = false
|
||||||
load_version()
|
load_version()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,8 +104,24 @@ func _on_shop_open_requested(options):
|
||||||
|
|
||||||
func _on_deckmanager_open_requested(options):
|
func _on_deckmanager_open_requested(options):
|
||||||
print("Deck Manager requested with options:", options)
|
print("Deck Manager requested with options:", options)
|
||||||
|
|
||||||
|
# Hide game menu
|
||||||
|
gameMenuScreen.visible = false
|
||||||
|
|
||||||
|
# Show and initialize deck manager
|
||||||
|
if deckManagerScreen:
|
||||||
|
deckManagerScreen.visible = true
|
||||||
|
deckManagerScreen.initialize(options)
|
||||||
|
|
||||||
|
# Also emit signal for other systems that might need to know
|
||||||
emit_signal("deckmanager_open_requested", options)
|
emit_signal("deckmanager_open_requested", options)
|
||||||
|
|
||||||
|
func _on_deck_manager_back_pressed():
|
||||||
|
# Return to game menu screen
|
||||||
|
deckManagerScreen.visible = false
|
||||||
|
gameMenuScreen.visible = true
|
||||||
|
|
||||||
|
|
||||||
func _on_map_open_requested(options):
|
func _on_map_open_requested(options):
|
||||||
print("Map requested with options:", options)
|
print("Map requested with options:", options)
|
||||||
emit_signal("map_open_requested", options)
|
emit_signal("map_open_requested", options)
|
||||||
|
|
@ -111,40 +129,8 @@ func _on_map_open_requested(options):
|
||||||
func _on_start_game_pressed(options):
|
func _on_start_game_pressed(options):
|
||||||
print("Starting game with options:", options)
|
print("Starting game with options:", options)
|
||||||
|
|
||||||
# Find the ChessGame instance
|
|
||||||
# var chess_game = _find_chess_game()
|
|
||||||
|
|
||||||
# if chess_game:
|
|
||||||
# # Reset the game board if it exists
|
|
||||||
# chess_game.resetBoard()
|
|
||||||
|
|
||||||
# # Start state machine
|
|
||||||
# if stateMachine:
|
|
||||||
# stateMachine.transitionToNextState(Constants.WHITE_TURN)
|
|
||||||
# else:
|
|
||||||
# print("Warning: StateMachine not found")
|
|
||||||
# else:
|
|
||||||
# print("Error: ChessGame not found")
|
|
||||||
|
|
||||||
# Emit signal for parent to handle with options
|
|
||||||
emit_signal("new_game_requested", options)
|
emit_signal("new_game_requested", options)
|
||||||
|
|
||||||
|
|
||||||
# Find the ChessGame node
|
|
||||||
func _find_chess_game():
|
|
||||||
# Try to find existing ChessGame node
|
|
||||||
var chess_game = get_node_or_null("/root/Game/ChessGame")
|
|
||||||
|
|
||||||
# If not found, check if we're a child of ChessGame
|
|
||||||
if not chess_game:
|
|
||||||
var parent = get_parent()
|
|
||||||
while parent and not chess_game:
|
|
||||||
if parent.get_class() == "ChessGame" or parent is ChessGame:
|
|
||||||
chess_game = parent
|
|
||||||
parent = parent.get_parent()
|
|
||||||
|
|
||||||
return chess_game
|
|
||||||
|
|
||||||
# Public method to show the menu
|
# Public method to show the menu
|
||||||
func show_menu():
|
func show_menu():
|
||||||
self.visible = true
|
self.visible = true
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=28 format=3 uid="uid://d0qyk6v20uief"]
|
[gd_scene load_steps=29 format=3 uid="uid://d0qyk6v20uief"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Systems/Game/ChessGame.gd" id="1_fkb2r"]
|
[ext_resource type="Script" path="res://Systems/Game/ChessGame.gd" id="1_fkb2r"]
|
||||||
[ext_resource type="Script" path="res://Systems/StateMachine/GameStates/WhiteTurn.gd" id="3_276ip"]
|
[ext_resource type="Script" path="res://Systems/StateMachine/GameStates/WhiteTurn.gd" id="3_276ip"]
|
||||||
|
|
@ -27,13 +27,14 @@
|
||||||
[ext_resource type="Script" path="res://Systems/Game/Menu/MenuTextOption.gd" id="24_aslgu"]
|
[ext_resource type="Script" path="res://Systems/Game/Menu/MenuTextOption.gd" id="24_aslgu"]
|
||||||
[ext_resource type="Script" path="res://Systems/Game/GameMenuScreen.gd" id="26_pb4ja"]
|
[ext_resource type="Script" path="res://Systems/Game/GameMenuScreen.gd" id="26_pb4ja"]
|
||||||
[ext_resource type="Script" path="res://Systems/Game/GameMenuButton.gd" id="26_t2e38"]
|
[ext_resource type="Script" path="res://Systems/Game/GameMenuButton.gd" id="26_t2e38"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c7uqbcxdjoais" path="res://deck_manager_screen.tscn" id="28_4nyv8"]
|
||||||
|
|
||||||
[node name="Board" type="Control"]
|
[node name="Board" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
offset_right = -104.0
|
offset_right = 8.0
|
||||||
offset_bottom = -5.0
|
offset_bottom = -5.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
@ -382,3 +383,7 @@ size_flags_horizontal = 3
|
||||||
[node name="GameImage" type="TextureRect" parent="GameMenuScreen/HBoxContainer/CenterContainer"]
|
[node name="GameImage" type="TextureRect" parent="GameMenuScreen/HBoxContainer/CenterContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
texture = ExtResource("23_vmvai")
|
texture = ExtResource("23_vmvai")
|
||||||
|
|
||||||
|
[node name="DeckManagerScreen" parent="." instance=ExtResource("28_4nyv8")]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 1
|
||||||
|
|
|
||||||
57
card_bank_item.tscn
Normal file
57
card_bank_item.tscn
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://cqg23tpbanwv4"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Systems/Cards/CardBankItem.gd" id="1_gu47gh"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_asdfvfa"]
|
||||||
|
bg_color = Color(0.15, 0.15, 0.15, 1)
|
||||||
|
border_width_left = 1
|
||||||
|
border_width_top = 1
|
||||||
|
border_width_right = 1
|
||||||
|
border_width_bottom = 1
|
||||||
|
border_color = Color(0.4, 0.4, 0.4, 1)
|
||||||
|
corner_radius_top_left = 4
|
||||||
|
corner_radius_top_right = 4
|
||||||
|
corner_radius_bottom_right = 4
|
||||||
|
corner_radius_bottom_left = 4
|
||||||
|
|
||||||
|
[node name="CardBankItem" type="Control"]
|
||||||
|
custom_minimum_size = Vector2(0, 40)
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 10
|
||||||
|
anchor_right = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
script = ExtResource("1_gu47gh")
|
||||||
|
|
||||||
|
[node name="CardFrame" type="Panel" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_asdfvfa")
|
||||||
|
|
||||||
|
[node name="RankLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 8.0
|
||||||
|
offset_right = 32.0
|
||||||
|
offset_bottom = 32.0
|
||||||
|
theme_override_colors/font_color = Color(0.1, 0.7, 0.9, 1)
|
||||||
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "3"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="CardNameLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 40.0
|
||||||
|
offset_right = -10.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_font_sizes/font_size = 16
|
||||||
|
text = "Card Name"
|
||||||
|
vertical_alignment = 1
|
||||||
124
card_slot.tscn
Normal file
124
card_slot.tscn
Normal file
|
|
@ -0,0 +1,124 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://b13w87rkhvwcv"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Systems/Cards/CardSlot.gd" id="1_asdwda"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_asdawdf"]
|
||||||
|
bg_color = Color(0.15, 0.15, 0.15, 1)
|
||||||
|
border_width_left = 2
|
||||||
|
border_width_top = 2
|
||||||
|
border_width_right = 2
|
||||||
|
border_width_bottom = 2
|
||||||
|
border_color = Color(0.4, 0.4, 0.4, 1)
|
||||||
|
corner_radius_top_left = 8
|
||||||
|
corner_radius_top_right = 8
|
||||||
|
corner_radius_bottom_right = 8
|
||||||
|
corner_radius_bottom_left = 8
|
||||||
|
|
||||||
|
[node name="CardSlot" type="Panel"]
|
||||||
|
custom_minimum_size = Vector2(120, 160)
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_asdawdf")
|
||||||
|
script = ExtResource("1_asdwda")
|
||||||
|
|
||||||
|
[node name="CardBackground" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 2.0
|
||||||
|
offset_top = 2.0
|
||||||
|
offset_right = -2.0
|
||||||
|
offset_bottom = -2.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.15, 0.15, 0.15, 1)
|
||||||
|
|
||||||
|
[node name="CardBorder" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color(0, 0, 0, 0)
|
||||||
|
|
||||||
|
[node name="RankLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 1
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_left = -35.0
|
||||||
|
offset_top = 5.0
|
||||||
|
offset_right = -5.0
|
||||||
|
offset_bottom = 35.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
theme_override_colors/font_color = Color(0.1, 0.7, 0.9, 1)
|
||||||
|
theme_override_font_sizes/font_size = 24
|
||||||
|
text = "3"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="TopLeftRank" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
offset_left = 5.0
|
||||||
|
offset_top = 5.0
|
||||||
|
offset_right = 35.0
|
||||||
|
offset_bottom = 35.0
|
||||||
|
theme_override_colors/font_color = Color(0.1, 0.7, 0.9, 1)
|
||||||
|
theme_override_font_sizes/font_size = 24
|
||||||
|
text = "3"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="CardNameLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 14
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = -15.0
|
||||||
|
offset_right = -10.0
|
||||||
|
offset_bottom = 15.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_font_sizes/font_size = 16
|
||||||
|
text = "Card Name"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
autowrap_mode = 3
|
||||||
|
|
||||||
|
[node name="BottomLeftRank" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 5.0
|
||||||
|
offset_top = -35.0
|
||||||
|
offset_right = 35.0
|
||||||
|
offset_bottom = -5.0
|
||||||
|
grow_vertical = 0
|
||||||
|
theme_override_colors/font_color = Color(0.1, 0.7, 0.9, 1)
|
||||||
|
theme_override_font_sizes/font_size = 24
|
||||||
|
text = "3"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="BottomRightRank" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -35.0
|
||||||
|
offset_top = -35.0
|
||||||
|
offset_right = -5.0
|
||||||
|
offset_bottom = -5.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
theme_override_colors/font_color = Color(0.1, 0.7, 0.9, 1)
|
||||||
|
theme_override_font_sizes/font_size = 24
|
||||||
|
text = "3"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
110
deck_manager_screen.tscn
Normal file
110
deck_manager_screen.tscn
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c7uqbcxdjoais"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Systems/Game/DeckManagerScreen.gd" id="1_gokg4"]
|
||||||
|
[ext_resource type="Script" path="res://Systems/Game/GameMenuButton.gd" id="4_gokg4"]
|
||||||
|
|
||||||
|
[node name="DeckManagerScreen" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_gokg4")
|
||||||
|
|
||||||
|
[node name="Background" type="ColorRect" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
color = Color(0.08, 0.08, 0.12, 1)
|
||||||
|
|
||||||
|
[node name="TitleLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 10
|
||||||
|
anchor_right = 1.0
|
||||||
|
offset_top = 20.0
|
||||||
|
offset_bottom = 72.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_font_sizes/font_size = 36
|
||||||
|
text = "DECK MANAGER"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="MainContainer" type="HBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 20.0
|
||||||
|
offset_top = 100.0
|
||||||
|
offset_right = -20.0
|
||||||
|
offset_bottom = -60.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="GridScrollContainer" type="ScrollContainer" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
size_flags_stretch_ratio = 3.0
|
||||||
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
|
[node name="GridContainer" type="GridContainer" parent="MainContainer/GridScrollContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
theme_override_constants/h_separation = 10
|
||||||
|
theme_override_constants/v_separation = 10
|
||||||
|
columns = 5
|
||||||
|
|
||||||
|
[node name="BankContainer" type="VBoxContainer" parent="MainContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MainContainer/BankContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "AVAILABLE CARDS"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="MainContainer/BankContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="ScrollContainer" type="ScrollContainer" parent="MainContainer/BankContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MainContainer/BankContainer/ScrollContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
theme_override_constants/separation = 5
|
||||||
|
|
||||||
|
[node name="BackButton" type="RichTextLabel" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 2
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 20.0
|
||||||
|
offset_top = -50.0
|
||||||
|
offset_right = 155.0
|
||||||
|
offset_bottom = -20.0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "BACK"
|
||||||
|
script = ExtResource("4_gokg4")
|
||||||
|
|
||||||
|
[node name="SaveLabel" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 3
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = -223.0
|
||||||
|
offset_top = -40.0
|
||||||
|
offset_right = -20.0
|
||||||
|
offset_bottom = -15.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
text = "Changes will be saved automatically"
|
||||||
|
horizontal_alignment = 2
|
||||||
Loading…
Reference in a new issue