swapped out old remix menu for new one

This commit is contained in:
2025-10-20 20:29:52 +11:00
parent d4cf1d91e8
commit 1494026aac
7 changed files with 118 additions and 63 deletions

View File

@@ -356,15 +356,15 @@ func update_selected_box() -> void:
func equip_weapon(slot: int = 0) -> void: func equip_weapon(slot: int = 0) -> void:
if weapons[slot] != null:
unequip_weapon(slot)
if !game_manager.card_gameplay or hand.size == 1:
return
if hand.size == 0: if hand.size == 0:
return return
var energy_cost: int = selected_card.cost var energy_cost: int = selected_card.cost
if game_manager.card_gameplay and energy < energy_cost: if game_manager.card_gameplay and energy < energy_cost:
return return
if weapons[slot] != null:
unequip_weapon(slot)
if !game_manager.card_gameplay:
return
if hand.size > 0: if hand.size > 0:
if game_manager.card_gameplay: if game_manager.card_gameplay:
energy -= energy_cost energy -= energy_cost

View File

@@ -18,15 +18,23 @@ func set_attribute(attribute: String, value: float) -> void:
attributes[attribute] = value attributes[attribute] = value
func tower_features_applied() -> CardText: func get_duplicate() -> CardText:
var card_text: CardText = self.duplicate() var card_text: CardText = self.duplicate()
card_text.target_type = target_type.duplicate()
card_text.attributes = attributes.duplicate()
card_text.features = features.duplicate()
return card_text
func tower_features_applied() -> CardText:
var card_text: CardText = get_duplicate()
for feature: Feature in features: for feature: Feature in features:
feature.attach_to_tower(card_text) feature.attach_to_tower(card_text)
return card_text return card_text
func weapon_features_applied() -> CardText: func weapon_features_applied() -> CardText:
var card_text: CardText = self.duplicate() var card_text: CardText = get_duplicate()
for feature: Feature in features: for feature: Feature in features:
feature.attach_to_weapon(card_text) feature.attach_to_weapon(card_text)
return card_text return card_text

View File

@@ -28,6 +28,11 @@ func set_card(new_card: Card, side: bool) -> void:
populate_targets() populate_targets()
func hide_features() -> void:
$FeaturesLabel.visible = false
$FeaturesVBox.visible = false
func populate_features() -> void: func populate_features() -> void:
for child: Node in feature_list.get_children(): for child: Node in feature_list.get_children():
child.queue_free() child.queue_free()
@@ -55,6 +60,6 @@ func populate_targets() -> void:
func process_card_text(card_text: CardText) -> String: func process_card_text(card_text: CardText) -> String:
var processed_string: String = tr(card_text.text) var processed_string: String = tr(card_text.text)
for key: String in card_text.attributes: for key: String in card_text.attributes:
processed_string = processed_string.replace(key, "[color=red]" + str(card_text.attributes[key]) + "[color=white]") processed_string = processed_string.replace(key, "[color=red]" + str(snapped(card_text.attributes[key], 0.01)) + "[color=white]")
processed_string = processed_string.replace("%", "") processed_string = processed_string.replace("%", "")
return processed_string return processed_string

View File

@@ -2,17 +2,22 @@ class_name RemixTable
extends StaticBody3D extends StaticBody3D
@export var remix_menu_scene: PackedScene @export var remix_menu_scene: PackedScene
@export var button: InteractButton
var reply_player: Hero var reply_player: Hero
func _ready() -> void:
button.hover_text = tr("PROMPT_REMIX_INTERACT")
func _on_static_body_3d_button_interacted(value: int, callback: Hero) -> void:
if callback.hand.size >= 2: func _on_static_body_3d_button_interacted(_value: int, callback: Hero) -> void:
if callback.hand.size >= 1:
reply_player = callback reply_player = callback
var menu: RemixMenu = remix_menu_scene.instantiate() as RemixMenu var menu: TrackEditor = remix_menu_scene.instantiate() as TrackEditor
var card_array: Array[Card] = [] var card_array: Array[Card] = []
for card: Card in callback.hand.contents: for card: Card in callback.hand.contents:
card_array.append(card) card_array.append(card)
menu.populate_feature_slots()
menu.add_option(card_array) menu.add_option(card_array)
menu.cards_remixed.connect(output) menu.cards_remixed.connect(output)
reply_player.pause() reply_player.pause()
@@ -22,6 +27,7 @@ func _on_static_body_3d_button_interacted(value: int, callback: Hero) -> void:
func output(cards_to_remove: Array[Card], cards_to_add: Array[Card]) -> void: func output(cards_to_remove: Array[Card], cards_to_add: Array[Card]) -> void:
for card: Card in cards_to_remove: for card: Card in cards_to_remove:
reply_player.hand.contents.erase(card) reply_player.hand.contents.erase(card)
reply_player.check_removal()
for card: Card in cards_to_add: for card: Card in cards_to_add:
reply_player.add_card(card) reply_player.add_card(card)
reply_player.unpause() reply_player.unpause()

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://c6isprnkaliqr"] [gd_scene load_steps=6 format=3 uid="uid://c6isprnkaliqr"]
[ext_resource type="Script" uid="uid://bpvmvx10q4ayd" path="res://remix_table.gd" id="1_q8doq"] [ext_resource type="Script" uid="uid://bpvmvx10q4ayd" path="res://remix_table.gd" id="1_q8doq"]
[ext_resource type="PackedScene" uid="uid://cqdft7j5pwg4b" path="res://remix_menu.tscn" id="2_ibyhf"] [ext_resource type="PackedScene" uid="uid://bajli4d3nqwll" path="res://track_editor.tscn" id="2_ibyhf"]
[ext_resource type="Script" uid="uid://dkfswql8ui0bt" path="res://Scripts/interact_button.gd" id="2_mjah6"] [ext_resource type="Script" uid="uid://dkfswql8ui0bt" path="res://Scripts/interact_button.gd" id="2_mjah6"]
[sub_resource type="BoxShape3D" id="BoxShape3D_ibyhf"] [sub_resource type="BoxShape3D" id="BoxShape3D_ibyhf"]
@@ -9,9 +9,10 @@
[sub_resource type="BoxShape3D" id="BoxShape3D_78x4u"] [sub_resource type="BoxShape3D" id="BoxShape3D_78x4u"]
size = Vector3(0.5, 0.5, 0.5) size = Vector3(0.5, 0.5, 0.5)
[node name="Node3D" type="StaticBody3D"] [node name="RemixTable" type="StaticBody3D" node_paths=PackedStringArray("button")]
script = ExtResource("1_q8doq") script = ExtResource("1_q8doq")
remix_menu_scene = ExtResource("2_ibyhf") remix_menu_scene = ExtResource("2_ibyhf")
button = NodePath("StaticBody3D")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_ibyhf") shape = SubResource("BoxShape3D_ibyhf")

View File

@@ -1,24 +1,32 @@
class_name TrackEditor class_name TrackEditor
extends Control extends Control
signal cards_remixed(cards_consumed: Array[Card], cards_created: Array[Card])
@export var drag_feature: FeatureUI @export var drag_feature: FeatureUI
@export var sample_library: VBoxContainer @export var sample_library: VBoxContainer
@export var feature_scene: PackedScene @export var feature_scene: PackedScene
@export var features_list: Array[Feature]
@export var parts: HBoxContainer @export var parts: HBoxContainer
@export var drop_down: OptionButton
@export var card_desc: CardDescriptionUI
const FEATURE_SLOTS: int = 6
var dragging: bool = false var dragging: bool = false
var hovered_feature: Feature var hovered_feature: Feature
var hovered_drop_slot: int = -2 var hovered_drop_slot: int = -2
var feature_uis: Array[FeatureUI] var feature_uis: Array[FeatureUI]
var features_list: Array[Feature]
var slots: Array[VBoxContainer] var slots: Array[VBoxContainer]
var cards: Array[Card]
const FEATURE_SLOTS: int = 6 var card_selected: Card
var temp_card: Card
func _ready() -> void: func _ready() -> void:
populate_sample_library() #populate_sample_library()
populate_feature_slots() #populate_feature_slots()
card_desc.hide_features()
parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1)) parts.mouse_entered.connect(set_hovered_drop_slot.bind(-1))
parts.mouse_exited.connect(unset_hovered_drop_slot) parts.mouse_exited.connect(unset_hovered_drop_slot)
@@ -36,18 +44,51 @@ func _input(event: InputEvent) -> void:
detach_feat_from_mouse() detach_feat_from_mouse()
func select_card(option: int) -> void:
for feature_ui: FeatureUI in feature_uis:
feature_ui.queue_free()
feature_uis = []
card_selected = cards[option]
temp_card = card_selected.duplicate()
temp_card.tower_stats = temp_card.tower_stats.get_duplicate()
temp_card.weapon_stats = temp_card.weapon_stats.get_duplicate()
card_desc.set_card(temp_card, true)
for feature: Feature in temp_card.tower_stats.features:
add_feature(feature, false)
func add_option(card_options: Array[Card]) -> void:
cards = card_options
for card: Card in cards:
drop_down.add_item(tr(card.display_name))
drop_down.select(0)
select_card(0)
populate_sample_library()
func populate_sample_library() -> void: func populate_sample_library() -> void:
for x: int in 3: for card: Card in cards:
var hbox: HBoxContainer = HBoxContainer.new() for feature: Feature in card.tower_stats.features:
hbox.size_flags_vertical = Control.SIZE_EXPAND_FILL if !features_list.has(feature):
for y: int in 3: features_list.append(feature)
for feature: Feature in card.weapon_stats.features:
if !features_list.has(feature):
features_list.append(feature)
var i: int = 0
var hbox: HBoxContainer
for feature: Feature in features_list:
if i == 0:
hbox = HBoxContainer.new()
sample_library.add_child(hbox)
var feat: FeatureUI = feature_scene.instantiate() as FeatureUI var feat: FeatureUI = feature_scene.instantiate() as FeatureUI
feat.set_feature(features_list[x]) feat.set_feature(feature)
feat.mouse_filter = Control.MOUSE_FILTER_PASS feat.mouse_filter = Control.MOUSE_FILTER_PASS
feat.size_flags_horizontal = Control.SIZE_EXPAND_FILL feat.size_flags_horizontal = Control.SIZE_EXPAND_FILL
feat.mouse_entered.connect(set_hovered_feature.bind(feat.feature)) feat.mouse_entered.connect(set_hovered_feature.bind(feat.feature))
hbox.add_child(feat) hbox.add_child(feat)
sample_library.add_child(hbox) i += 1
if i == 3:
i = 0
sample_library.mouse_exited.connect(unset_hovered_feature) sample_library.mouse_exited.connect(unset_hovered_feature)
@@ -73,7 +114,7 @@ func populate_feature_slots() -> void:
slots.append(vbox) slots.append(vbox)
func add_feature(feature: Feature) -> void: func add_feature(feature: Feature, modify_resource: bool = true) -> void:
if hovered_drop_slot >= 0 and hovered_drop_slot < feature_uis.size(): if hovered_drop_slot >= 0 and hovered_drop_slot < feature_uis.size():
change_feature(feature_uis[hovered_drop_slot], feature) change_feature(feature_uis[hovered_drop_slot], feature)
elif feature_uis.size() < FEATURE_SLOTS: elif feature_uis.size() < FEATURE_SLOTS:
@@ -81,10 +122,16 @@ func add_feature(feature: Feature) -> void:
feature_visual.set_feature(feature) feature_visual.set_feature(feature)
slots[feature_uis.size()].add_child(feature_visual) slots[feature_uis.size()].add_child(feature_visual)
feature_uis.append(feature_visual) feature_uis.append(feature_visual)
if modify_resource:
temp_card.tower_stats.features.append(feature)
card_desc.set_card(temp_card, true)
func change_feature(existing_feature: FeatureUI, new_feature: Feature) -> void: func change_feature(existing_feature: FeatureUI, new_feature: Feature) -> void:
existing_feature.set_feature(new_feature) existing_feature.set_feature(new_feature)
var i: int = feature_uis.find(existing_feature)
temp_card.tower_stats.features[i] = new_feature
card_desc.set_card(temp_card, true)
func attach_feat_to_mouse(feature: Feature) -> void: func attach_feat_to_mouse(feature: Feature) -> void:
@@ -117,8 +164,16 @@ func unset_hovered_drop_slot() -> void:
func _on_cancel_button_pressed() -> void: func _on_cancel_button_pressed() -> void:
var cards_to_remove: Array[Card] = []
var cards_to_add: Array[Card] = []
cards_remixed.emit(cards_to_remove, cards_to_add)
queue_free() queue_free()
func _on_confirm_button_pressed() -> void: func _on_confirm_button_pressed() -> void:
pass # Replace with function body. var cards_to_remove: Array[Card] = []
var cards_to_add: Array[Card] = []
cards_to_remove.append(card_selected)
cards_to_add.append(temp_card)
cards_remixed.emit(cards_to_remove, cards_to_add)
queue_free()

View File

@@ -1,13 +1,10 @@
[gd_scene load_steps=7 format=3 uid="uid://bajli4d3nqwll"] [gd_scene load_steps=4 format=3 uid="uid://bajli4d3nqwll"]
[ext_resource type="PackedScene" uid="uid://c8xdsg6gtwvh3" path="res://feature_ui.tscn" id="1_y6tpq"] [ext_resource type="PackedScene" uid="uid://c8xdsg6gtwvh3" path="res://feature_ui.tscn" id="1_y6tpq"]
[ext_resource type="Script" uid="uid://mrv5vrlxfc13" path="res://track_editor.gd" id="1_yrnbk"] [ext_resource type="Script" uid="uid://mrv5vrlxfc13" path="res://track_editor.gd" id="1_yrnbk"]
[ext_resource type="Script" uid="uid://bsuinotkvh7eu" path="res://Scripts/Resources/feature.gd" id="3_dya4i"] [ext_resource type="PackedScene" uid="uid://cmlpmr78tmo6p" path="res://card_description_ui.tscn" id="3_q6wwl"]
[ext_resource type="Resource" uid="uid://nh7g23b3rnvr" path="res://Scripts/Features/Radar/radar_feature.tres" id="4_4gmyw"]
[ext_resource type="Resource" uid="uid://dfup264h2pun7" path="res://Scripts/Features/HeavyRounds/heavy_rounds_feature.tres" id="5_dxngn"]
[ext_resource type="Resource" uid="uid://bij61ul87ka0r" path="res://Scripts/Features/ExtendedBarrel/extended_barrel_feature.tres" id="6_1rakx"]
[node name="Control" type="Control" node_paths=PackedStringArray("drag_feature", "sample_library", "parts")] [node name="Control" type="Control" node_paths=PackedStringArray("drag_feature", "sample_library", "parts", "drop_down", "card_desc")]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@@ -16,10 +13,11 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_yrnbk") script = ExtResource("1_yrnbk")
drag_feature = NodePath("FeatureUI") drag_feature = NodePath("FeatureUI")
sample_library = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel/SampleLibrary") sample_library = NodePath("PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel/ScrollContainer/SampleLibrary")
feature_scene = ExtResource("1_y6tpq") feature_scene = ExtResource("1_y6tpq")
features_list = Array[ExtResource("3_dya4i")]([ExtResource("4_4gmyw"), ExtResource("5_dxngn"), ExtResource("6_1rakx")])
parts = NodePath("PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/Parts") parts = NodePath("PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/Parts")
drop_down = NodePath("PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/CassetteSelector/OptionButton")
card_desc = NodePath("PanelContainer/VBoxContainer/InfoPanel/DescriptionVBox")
[node name="PanelContainer" type="PanelContainer" parent="."] [node name="PanelContainer" type="PanelContainer" parent="."]
layout_mode = 1 layout_mode = 1
@@ -78,31 +76,8 @@ layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
size_flags_stretch_ratio = 5.0 size_flags_stretch_ratio = 5.0
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel"] [node name="DescriptionVBox" parent="PanelContainer/VBoxContainer/InfoPanel" instance=ExtResource("3_q6wwl")]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3
[node name="Label" type="Label" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer"]
layout_mode = 2
text = "LABEL_CARD_DESCRIPTION"
horizontal_alignment = 1
vertical_alignment = 1
[node name="RichTextLabel" type="RichTextLabel" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
bbcode_enabled = true
text = "a long ass example description of a card that goes into honestly way too much detail but at least if we can support a lot of text at a good size then we dont have to worry about really complicated cards fucking up our UI later in developement if we end up needing to explain a lot"
[node name="Label2" type="Label" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer"]
layout_mode = 2
text = "LABEL_TARGET_LIST"
horizontal_alignment = 1
vertical_alignment = 1
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/InfoPanel"] [node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer/InfoPanel"]
layout_mode = 2 layout_mode = 2
@@ -123,7 +98,11 @@ text = "TITLE_SAMPLES"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="SampleLibrary" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel"] [node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel"]
layout_mode = 2
size_flags_vertical = 3
[node name="SampleLibrary" type="VBoxContainer" parent="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/SamplePanel/ScrollContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
@@ -150,5 +129,6 @@ grow_horizontal = 1
grow_vertical = 1 grow_vertical = 1
mouse_filter = 2 mouse_filter = 2
[connection signal="item_selected" from="PanelContainer/VBoxContainer/VBoxContainer/SourceCartridge/CassetteSelector/OptionButton" to="." method="select_card"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/CancelButton" to="." method="_on_cancel_button_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/CancelButton" to="." method="_on_cancel_button_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/ConfirmButton" to="." method="_on_confirm_button_pressed"] [connection signal="pressed" from="PanelContainer/VBoxContainer/InfoPanel/VBoxContainer2/Controls/ConfirmButton" to="." method="_on_confirm_button_pressed"]