diff --git a/scenes/card/card.gd b/scenes/card/card.gd index e2cd00b..2b2ba94 100644 --- a/scenes/card/card.gd +++ b/scenes/card/card.gd @@ -5,10 +5,7 @@ extends Node2D ## Contains helper text for the text, the cards ID, and the image path. # Card information. -var card_id: String -var card_name: String -var card_type: String -var oracle_text: String +var card_info: Dictionary # Card properties. var tapped: bool @@ -22,7 +19,7 @@ var mouse_offset: Vector2 func init(id: String) -> void: - card_id = id + card_info["id"] = id # This is called when we want to apply the behaviour of the mouse being @@ -35,7 +32,7 @@ func check_hover() -> void: func error(error_type: String) -> String: - return "ERROR::CARD::%s::%s::%s::\n" % [card_id, card_name, error_type] + return "ERROR::CARD::%s::%s::%s::\n" % [card_info["id"], card_info["name"], error_type] func colission_size() -> Vector2: diff --git a/scenes/card/load.gd b/scenes/card/load.gd index 5603660..b3ea812 100644 --- a/scenes/card/load.gd +++ b/scenes/card/load.gd @@ -25,7 +25,7 @@ func _load_card() -> Error: func _load_data() -> Error: var cached_json = FileAccess.get_file_as_string( - "user://card_cache/" + card.card_id + "/card.json" + "user://card_cache/" + card.card_info["id"] + "/card.json" ) if cached_json.is_empty(): @@ -37,17 +37,17 @@ func _load_data() -> Error: if card_json == null: push_error("%s\nCard json data is could not be parsed as valid json" % card.error("DATA")) return FAILED - - card.card_name = card_json["name"] - card.card_type = card_json["type_line"] - card.oracle_text = card_json["oracle_text"] + + card.card_info["name"] = card_json["name"] + card.card_info["type"] = card_json["type_line"] + card.card_info["desc"] = card_json["oracle_text"] return OK func _load_image() -> Error: # NOTE: Assuming we're going with using the .png cards on board. - var cached_img = FileAccess.get_file_as_bytes("user://card_cache/" + card.card_id + "/card.png") + var cached_img = FileAccess.get_file_as_bytes("user://card_cache/" + card.card_info["id"] + "/card.png") if cached_img.is_empty(): push_error("%sCard on-board image was not found in cache" % card.error("CACHE")) diff --git a/tabletop.gd b/tabletop.gd index 0c17226..a9633d2 100644 --- a/tabletop.gd +++ b/tabletop.gd @@ -113,6 +113,11 @@ func _ready() -> void: var deck = deck_input.new() add_child(deck) deck.add_new_deck(cards, "Blood rites") + + + + + # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/tabletop.tscn b/tabletop.tscn index b31f107..73967b0 100644 --- a/tabletop.tscn +++ b/tabletop.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=5 format=3 uid="uid://b4ldtb3gw0jlu"] +[gd_scene load_steps=6 format=3 uid="uid://b4ldtb3gw0jlu"] [ext_resource type="Script" uid="uid://cfkew150yl1y3" path="res://tabletop.gd" id="1_3we3x"] +[ext_resource type="Script" uid="uid://brto6yniu3yx1" path="res://tooltip.gd" id="2_d43bn"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3we3x"] bg_color = Color(0, 0, 0, 1) @@ -34,6 +35,7 @@ theme_override_constants/separation = 0 [node name="MenuArea" type="PanelContainer" parent="UI/BigBar/Items"] custom_minimum_size = Vector2(0, 540) layout_mode = 2 +script = ExtResource("2_d43bn") [node name="ChatArea" type="PanelContainer" parent="UI/BigBar/Items"] custom_minimum_size = Vector2(0, 270) diff --git a/tooltip.gd b/tooltip.gd new file mode 100644 index 0000000..509d18d --- /dev/null +++ b/tooltip.gd @@ -0,0 +1,4 @@ +extends PanelContainer + +func _ready(): + pass diff --git a/tooltip.gd.uid b/tooltip.gd.uid new file mode 100644 index 0000000..326b94d --- /dev/null +++ b/tooltip.gd.uid @@ -0,0 +1 @@ +uid://brto6yniu3yx1