localised resources and remaining scenes

This commit is contained in:
2025-08-21 18:41:32 +10:00
parent 2859b6dd43
commit 57a57d2b91
38 changed files with 484 additions and 129 deletions

View File

@@ -12,7 +12,7 @@ var spawned_cards: Array[CardItem] = []
func _ready() -> void:
button.hover_text = tr("BUTTON_RADIO_INTERACT")
button.hover_text = tr("PROMPT_RADIO_INTERACT")
func get_faction_cards(faction: Card.Faction) -> Array[Card]:
@@ -76,9 +76,20 @@ func find_cards(faction: Card.Faction) -> void:
var decided_rarity: int = generate_rarity()
var card_choices: Array[Card] = get_faction_cards(faction)
var cards: Array[Card] = []
for card: Card in card_choices:
if card.rarity == decided_rarity:
cards.append(card)
var valid_cards_found: bool = false
var testing_rarity: int = decided_rarity
while !valid_cards_found:
for card: Card in card_choices:
if card.rarity == testing_rarity:
cards.append(card)
if cards.size() != 0:
valid_cards_found = true
testing_rarity -= 1
if testing_rarity < 0:
testing_rarity = 4
if testing_rarity == decided_rarity:
print("This character doesn't have any cards!")
return
var menu: ChooseCardScreen = card_selection_menu.instantiate() as ChooseCardScreen
menu.add_cards(cards)
menu.card_chosen.connect(output_card)

View File

@@ -13,10 +13,10 @@ var game_manager: GameManager
func _ready() -> void:
winrate_label.text = "Your 20-game winrate is now: " + str(Data.save_data.winrate) + "%!"
total_games_label.text = "Total games: " + str(Data.save_data.wins + Data.save_data.losses)
total_wins_label.text = "Total wins: " + str(Data.save_data.wins)
total_losses_label.text = "Total losses: " + str(Data.save_data.losses)
winrate_label.text = str(Data.save_data.winrate) + "%"
total_games_label.text = str(Data.save_data.wins + Data.save_data.losses)
total_wins_label.text = str(Data.save_data.wins)
total_losses_label.text = str(Data.save_data.losses)
for wave_key: int in game_manager.stats.enemies_undefeated:
var spawned_box: EnemyBox = box.instantiate() as EnemyBox
undefeated_enemies.add_child(spawned_box)

View File

@@ -22,10 +22,10 @@ grow_vertical = 2
script = ExtResource("1_oa7nq")
box = ExtResource("2_xm8em")
outcome_label = NodePath("VBoxContainer/Labels/OutcomeLabel")
winrate_label = NodePath("VBoxContainer/Labels/WinRateLabel")
total_games_label = NodePath("VBoxContainer/Labels/TotalGamesLabel")
total_wins_label = NodePath("VBoxContainer/Labels/TotalWinsLabel")
total_losses_label = NodePath("VBoxContainer/Labels/TotalLossesLabel")
winrate_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer/WinRateLabel2")
total_games_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer2/WinRateLabel3")
total_wins_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer3/WinRateLabel4")
total_losses_label = NodePath("VBoxContainer/Labels/VBoxContainer/HBoxContainer4/WinRateLabel5")
undefeated_enemies = NodePath("VBoxContainer/UndefeatedEnemies")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
@@ -42,28 +42,76 @@ text = "LABEL_WIN_MESSAGE"
horizontal_alignment = 1
vertical_alignment = 1
[node name="WinRateLabel" type="Label" parent="VBoxContainer/Labels"]
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Labels"]
layout_mode = 2
size_flags_horizontal = 4
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
layout_mode = 2
[node name="WinRateLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_WINRATE"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TotalGamesLabel" type="Label" parent="VBoxContainer/Labels"]
[node name="WinRateLabel2" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
vertical_alignment = 1
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
layout_mode = 2
[node name="TotalGamesLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_GAMES"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TotalWinsLabel" type="Label" parent="VBoxContainer/Labels"]
[node name="WinRateLabel3" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer2"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
vertical_alignment = 1
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
layout_mode = 2
[node name="TotalWinsLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer3"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_WINS"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TotalLossesLabel" type="Label" parent="VBoxContainer/Labels"]
[node name="WinRateLabel4" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer3"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
vertical_alignment = 1
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/Labels/VBoxContainer"]
layout_mode = 2
[node name="TotalLossesLabel" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer4"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_LOSSES"
horizontal_alignment = 1
vertical_alignment = 1
[node name="WinRateLabel5" type="Label" parent="VBoxContainer/Labels/VBoxContainer/HBoxContainer4"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
vertical_alignment = 1
[node name="UndefeatedEnemies" type="VBoxContainer" parent="VBoxContainer"]

View File

@@ -145,9 +145,10 @@ func _on_changelog_button_pressed() -> void:
func load_stats(stats: SaveData) -> void:
$ProfileManager/VBoxContainer/Stats/Wins/Label2.text = str(stats.wins)
$ProfileManager/VBoxContainer/Stats/Losses/Label2.text = str(stats.losses)
$ProfileManager/VBoxContainer/Stats/Winrate/Label2.text = str(stats.winrate) + "%"
$ProfileManager/VBoxContainer/Stats/Games/Label2.text = str(Data.save_data.wins + Data.save_data.losses)
$ProfileManager/VBoxContainer/Stats/Wins/Label2.text = str(Data.save_data.wins)
$ProfileManager/VBoxContainer/Stats/Losses/Label2.text = str(Data.save_data.losses)
$ProfileManager/VBoxContainer/Stats/Winrate/Label2.text = str(Data.save_data.winrate) + "%"
$ProfileManager/VBoxContainer/Stats/EngineerCardsBought/Label2.text = str(stats.engineer_cards_bought)
$ProfileManager/VBoxContainer/Stats/MageCardsBought/Label2.text = str(stats.mage_cards_bought)

View File

@@ -243,6 +243,23 @@ text = "LABEL_STATS"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Games" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
layout_mode = 2
[node name="Label" type="Label" parent="ProfileManager/VBoxContainer/Stats/Games"]
layout_mode = 2
size_flags_horizontal = 3
text = "LABEL_GAMES"
vertical_alignment = 1
[node name="Label2" type="Label" parent="ProfileManager/VBoxContainer/Stats/Games"]
auto_translate_mode = 2
layout_mode = 2
size_flags_horizontal = 3
text = "0"
horizontal_alignment = 2
vertical_alignment = 1
[node name="Wins" type="HBoxContainer" parent="ProfileManager/VBoxContainer/Stats"]
layout_mode = 2

View File

@@ -19,6 +19,8 @@ var price_dict: Dictionary = {
var cards_generated: int = 0
var blanks_available: int = 5
var blank_cost: int = 20
var buy_blank_prompt: String = "PROMPT_BUY_BLANK"
var buy_card_prompt: String = "PROMPT_BUY_CARD"
func close() -> void:
@@ -56,7 +58,7 @@ func randomize_cards() -> void:
cards[x].set_card(chosen_card)
cards[x].view_tower()
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
choice_buttons[x].hover_text = "#Interact# Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name
choice_buttons[x].hover_text = tr(buy_card_prompt).format({Card_Name = tr(chosen_card.display_name), Card_Cost = str(price_dict[chosen_card.rarity])})
if chosen_card.faction == Card.Faction.MAGE:
Data.save_data.saw_mage_card_in_shop()
for x: int in 2:
@@ -69,7 +71,7 @@ func randomize_cards() -> void:
cards[x+3].set_card(chosen_card)
cards[x+3].view_tower()
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
choice_buttons[x+3].hover_text = "#Interact# Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name
choice_buttons[x+3].hover_text = tr(buy_card_prompt).format({Card_Name = tr(chosen_card.display_name), Card_Cost = str(price_dict[chosen_card.rarity])})
if chosen_card.faction == Card.Faction.MAGE:
Data.save_data.saw_mage_card_in_shop()
for x: int in 1:
@@ -84,7 +86,7 @@ func randomize_cards() -> void:
cards[x+5].set_card(chosen_card)
cards[x+5].view_tower()
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
choice_buttons[x+5].hover_text = "#Interact# Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name
choice_buttons[x+5].hover_text = tr(buy_card_prompt).format({Card_Name = tr(chosen_card.display_name), Card_Cost = str(price_dict[chosen_card.rarity])})
if chosen_card.faction == Card.Faction.MAGE:
Data.save_data.saw_mage_card_in_shop()
for x: CollisionShape3D in choice_colliders:
@@ -93,29 +95,24 @@ func randomize_cards() -> void:
x.visible = true
for x: CSGBox3D in blank_models:
x.visible = true
blank_button_collider.disabled = false
blank_button.hover_text = "#Interact# Spend $" + str(blank_cost) + " to acquire a blank cassette"
blank_button_collider.set_deferred("disabled", false)
blank_button.hover_text = tr(buy_blank_prompt).format({Blank_Cost = str(blank_cost)})
func retrieve_card(i: int, callback: Hero) -> void:
#close()
choice_colliders[i].disabled = true
choice_sprites[i].set_visible(false)
var card: Card = cards[i].stats
if card.faction == Card.Faction.ENGINEER:
Data.save_data.bought_engineer_card()
if card.faction == Card.Faction.MAGE:
Data.save_data.bought_mage_card()
callback.add_card(card)
#var item: ItemCard = item_card_scene.instantiate() as ItemCard
#item.card = card
#item.position = Vector3(2.128, 0, 0)
#add_child(item)
#button_collider.disabled = false
#button_box.position = Vector3(0,0,0)
if callback.currency >= price_dict[cards[i].stats.rarity]:
choice_colliders[i].disabled = true
choice_sprites[i].set_visible(false)
var card: Card = cards[i].stats
if card.faction == Card.Faction.ENGINEER:
Data.save_data.bought_engineer_card()
if card.faction == Card.Faction.MAGE:
Data.save_data.bought_mage_card()
callback.currency -= price_dict[cards[i].stats.rarity]
callback.add_card(card)
func retrieve_blank(i: int, callback: Hero) -> void:
func retrieve_blank(_i: int, callback: Hero) -> void:
if callback.currency >= blank_cost:
blank_models[5 - blanks_available].visible = false
blanks_available -= 1

View File

@@ -4,14 +4,13 @@
[ext_resource type="Texture2D" uid="uid://dlqnhs8or4ik2" path="res://Assets/Textures/cardhand.png" id="1_d5oo3"]
[ext_resource type="Texture2D" uid="uid://buf8t5gc7iw3a" path="res://Assets/TextureAtlases/rarityborders.tres" id="3_pclfx"]
[node name="Node2D" type="Node2D" node_paths=PackedStringArray("rarity_sprite", "title_text", "description", "target_label", "energy_cost", "duration")]
[node name="Node2D" type="Node2D" node_paths=PackedStringArray("rarity_sprite", "title_text", "description", "target_label", "energy_cost")]
script = ExtResource("1_2cfmh")
rarity_sprite = NodePath("Sprite2D2")
title_text = NodePath("Title")
description = NodePath("Description")
target_label = NodePath("Title2")
energy_cost = NodePath("EnergyCost")
duration = NodePath("")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1