From 65dc02585e09dc008789fb3017f7287d36e24c5b Mon Sep 17 00:00:00 2001 From: istamarahsan Date: Sat, 25 Jan 2025 18:40:14 +0700 Subject: [PATCH] feat: red and green card templates --- assets/Bohemian Soul.otf | 3 + assets/Bohemian Soul.otf.import | 34 +++++ assets/Inter-Regular.otf | 3 + assets/Inter-Regular.otf.import | 34 +++++ assets/card_base/Frame.png | 3 + assets/card_base/Frame.png.import | 34 +++++ assets/card_base/G-OuterFill.png | 3 + assets/card_base/G-OuterFill.png.import | 34 +++++ assets/card_base/InnerFill.png | 3 + assets/card_base/InnerFill.png.import | 34 +++++ assets/card_base/Pill.png | 3 + assets/card_base/Pill.png.import | 34 +++++ assets/card_base/R-OuterFill.png | 3 + assets/card_base/R-OuterFill.png.import | 34 +++++ assets/card_base/Separator.png | 3 + assets/card_base/Separator.png.import | 34 +++++ assets/card_base/Stroke.png | 3 + assets/card_base/Stroke.png.import | 34 +++++ assets/energy.png | 3 + assets/energy.png.import | 34 +++++ cards.tres | 8 ++ data/cards/{ => monster}/baraga.tres | 0 data/cards/{ => monster}/taiman.tres | 0 data/cards/potion.tres | 16 --- data/cards/support/potion.tres | 20 +++ demo_game.tscn | 6 +- tcg/card/card.gd | 4 + test_card.gd | 7 + test_card.tscn | 28 ++++ ui/card/GreenCard.tscn | 165 +++++++++++++++++++++++ ui/card/RedCard.tscn | 167 ++++++++++++++++++++++++ ui/card/card_base.gd | 20 +++ 32 files changed, 792 insertions(+), 19 deletions(-) create mode 100644 assets/Bohemian Soul.otf create mode 100644 assets/Bohemian Soul.otf.import create mode 100644 assets/Inter-Regular.otf create mode 100644 assets/Inter-Regular.otf.import create mode 100644 assets/card_base/Frame.png create mode 100644 assets/card_base/Frame.png.import create mode 100644 assets/card_base/G-OuterFill.png create mode 100644 assets/card_base/G-OuterFill.png.import create mode 100644 assets/card_base/InnerFill.png create mode 100644 assets/card_base/InnerFill.png.import create mode 100644 assets/card_base/Pill.png create mode 100644 assets/card_base/Pill.png.import create mode 100644 assets/card_base/R-OuterFill.png create mode 100644 assets/card_base/R-OuterFill.png.import create mode 100644 assets/card_base/Separator.png create mode 100644 assets/card_base/Separator.png.import create mode 100644 assets/card_base/Stroke.png create mode 100644 assets/card_base/Stroke.png.import create mode 100644 assets/energy.png create mode 100644 assets/energy.png.import create mode 100644 cards.tres rename data/cards/{ => monster}/baraga.tres (100%) rename data/cards/{ => monster}/taiman.tres (100%) delete mode 100644 data/cards/potion.tres create mode 100644 data/cards/support/potion.tres create mode 100644 test_card.gd create mode 100644 test_card.tscn create mode 100644 ui/card/GreenCard.tscn create mode 100644 ui/card/RedCard.tscn create mode 100644 ui/card/card_base.gd diff --git a/assets/Bohemian Soul.otf b/assets/Bohemian Soul.otf new file mode 100644 index 0000000..6649ff1 --- /dev/null +++ b/assets/Bohemian Soul.otf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b387796a272c26c37ff918e48271cf139755a0ecb2398039103d79af2c91c850 +size 38880 diff --git a/assets/Bohemian Soul.otf.import b/assets/Bohemian Soul.otf.import new file mode 100644 index 0000000..7e974e0 --- /dev/null +++ b/assets/Bohemian Soul.otf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://ncoq4i61plvt" +path="res://.godot/imported/Bohemian Soul.otf-321180efeec0e46d48937761716dc66f.fontdata" + +[deps] + +source_file="res://assets/Bohemian Soul.otf" +dest_files=["res://.godot/imported/Bohemian Soul.otf-321180efeec0e46d48937761716dc66f.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/assets/Inter-Regular.otf b/assets/Inter-Regular.otf new file mode 100644 index 0000000..4ed3a79 --- /dev/null +++ b/assets/Inter-Regular.otf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7e791e8f5a0fb02b65663f7fca73e1d1ca9543f772ad480cbd76f4e3fe3f8cc +size 258992 diff --git a/assets/Inter-Regular.otf.import b/assets/Inter-Regular.otf.import new file mode 100644 index 0000000..6ec3561 --- /dev/null +++ b/assets/Inter-Regular.otf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://08q3kkwmd4u6" +path="res://.godot/imported/Inter-Regular.otf-e79282422267193643bc1266eabc7aef.fontdata" + +[deps] + +source_file="res://assets/Inter-Regular.otf" +dest_files=["res://.godot/imported/Inter-Regular.otf-e79282422267193643bc1266eabc7aef.fontdata"] + +[params] + +Rendering=null +antialiasing=1 +generate_mipmaps=false +disable_embedded_bitmaps=true +multichannel_signed_distance_field=false +msdf_pixel_range=8 +msdf_size=48 +allow_system_fallback=true +force_autohinter=false +hinting=1 +subpixel_positioning=1 +oversampling=0.0 +Fallbacks=null +fallbacks=[] +Compress=null +compress=true +preload=[] +language_support={} +script_support={} +opentype_features={} diff --git a/assets/card_base/Frame.png b/assets/card_base/Frame.png new file mode 100644 index 0000000..5c7b0da --- /dev/null +++ b/assets/card_base/Frame.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2315fae148c1d73e139ad51d9d90c0dc69314de870596e52fb2b4274a2e51b1 +size 165111 diff --git a/assets/card_base/Frame.png.import b/assets/card_base/Frame.png.import new file mode 100644 index 0000000..930f4d0 --- /dev/null +++ b/assets/card_base/Frame.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://l2nxxhh0pvh8" +path="res://.godot/imported/Frame.png-2cc9ebde58565bbc3036395eb0041ae9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/Frame.png" +dest_files=["res://.godot/imported/Frame.png-2cc9ebde58565bbc3036395eb0041ae9.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/card_base/G-OuterFill.png b/assets/card_base/G-OuterFill.png new file mode 100644 index 0000000..114bbb7 --- /dev/null +++ b/assets/card_base/G-OuterFill.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e0e62d5e3d57866bfa09a4dbcd0a14a244bd704c94b8eeadb1eafb57f08562a +size 149729 diff --git a/assets/card_base/G-OuterFill.png.import b/assets/card_base/G-OuterFill.png.import new file mode 100644 index 0000000..0468b36 --- /dev/null +++ b/assets/card_base/G-OuterFill.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://liitr32ap646" +path="res://.godot/imported/G-OuterFill.png-08376930c432a32d81cb0c7a55fb089e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/G-OuterFill.png" +dest_files=["res://.godot/imported/G-OuterFill.png-08376930c432a32d81cb0c7a55fb089e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/card_base/InnerFill.png b/assets/card_base/InnerFill.png new file mode 100644 index 0000000..3beb15d --- /dev/null +++ b/assets/card_base/InnerFill.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aedb750f04941c2337bdad6c73b73399ed8fb625eaa436d6588017db9c0bee45 +size 126446 diff --git a/assets/card_base/InnerFill.png.import b/assets/card_base/InnerFill.png.import new file mode 100644 index 0000000..11ff539 --- /dev/null +++ b/assets/card_base/InnerFill.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://blejyda8mendg" +path="res://.godot/imported/InnerFill.png-75781e681a40959b716289bec2b32336.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/InnerFill.png" +dest_files=["res://.godot/imported/InnerFill.png-75781e681a40959b716289bec2b32336.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/card_base/Pill.png b/assets/card_base/Pill.png new file mode 100644 index 0000000..fb2a20d --- /dev/null +++ b/assets/card_base/Pill.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e21a3903c649abe91077ed55440eed2cd7f563f17b9c37f50430d68d322c4909 +size 846 diff --git a/assets/card_base/Pill.png.import b/assets/card_base/Pill.png.import new file mode 100644 index 0000000..51de1d3 --- /dev/null +++ b/assets/card_base/Pill.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0gxplli5krq2" +path="res://.godot/imported/Pill.png-f7a0d13f20f1ea9ba344cea7c095427a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/Pill.png" +dest_files=["res://.godot/imported/Pill.png-f7a0d13f20f1ea9ba344cea7c095427a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/card_base/R-OuterFill.png b/assets/card_base/R-OuterFill.png new file mode 100644 index 0000000..d546cac --- /dev/null +++ b/assets/card_base/R-OuterFill.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dcca3e0a0b82a518b6f0e23496a446f7d0e102b41763d35d9b3cc8c37d62afc +size 149723 diff --git a/assets/card_base/R-OuterFill.png.import b/assets/card_base/R-OuterFill.png.import new file mode 100644 index 0000000..cdfb01f --- /dev/null +++ b/assets/card_base/R-OuterFill.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ip7xjs20pd3d" +path="res://.godot/imported/R-OuterFill.png-f999c1a1aec742072b5689d6ee4573cf.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/R-OuterFill.png" +dest_files=["res://.godot/imported/R-OuterFill.png-f999c1a1aec742072b5689d6ee4573cf.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/card_base/Separator.png b/assets/card_base/Separator.png new file mode 100644 index 0000000..c722ba8 --- /dev/null +++ b/assets/card_base/Separator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f41f216767597470e7f2b0b5bbb1a28718e591ee3283ee100ec8ae7965b08f3 +size 1537 diff --git a/assets/card_base/Separator.png.import b/assets/card_base/Separator.png.import new file mode 100644 index 0000000..af841a8 --- /dev/null +++ b/assets/card_base/Separator.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://by7ws88pn4tvb" +path="res://.godot/imported/Separator.png-3ef36f6d9a7c45cb144c99255cbf2668.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/Separator.png" +dest_files=["res://.godot/imported/Separator.png-3ef36f6d9a7c45cb144c99255cbf2668.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/card_base/Stroke.png b/assets/card_base/Stroke.png new file mode 100644 index 0000000..aad94f9 --- /dev/null +++ b/assets/card_base/Stroke.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:041b63c0964cdd231d08d220cfc236e6fe4ee5643e7373701491ff5f3dc98f40 +size 3940 diff --git a/assets/card_base/Stroke.png.import b/assets/card_base/Stroke.png.import new file mode 100644 index 0000000..668eddd --- /dev/null +++ b/assets/card_base/Stroke.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://crgrple0uik7x" +path="res://.godot/imported/Stroke.png-9acc55e7647197941083043ac51c45a4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/card_base/Stroke.png" +dest_files=["res://.godot/imported/Stroke.png-9acc55e7647197941083043ac51c45a4.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/energy.png b/assets/energy.png new file mode 100644 index 0000000..29479d0 --- /dev/null +++ b/assets/energy.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d835c0519e95c077b5b4f681673b4672a0728ad47b86595726f07775993f3eb +size 482598 diff --git a/assets/energy.png.import b/assets/energy.png.import new file mode 100644 index 0000000..d8aecba --- /dev/null +++ b/assets/energy.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://rh3aswb0p7ri" +path="res://.godot/imported/energy.png-d31ae10deb2f267a25814b3eac80d643.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/energy.png" +dest_files=["res://.godot/imported/energy.png-d31ae10deb2f267a25814b3eac80d643.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/cards.tres b/cards.tres new file mode 100644 index 0000000..e4debd9 --- /dev/null +++ b/cards.tres @@ -0,0 +1,8 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://cj3vs5hq2mcbp"] + +[ext_resource type="FontFile" uid="uid://ncoq4i61plvt" path="res://assets/Bohemian Soul.otf" id="1_yowck"] + +[resource] +default_font = ExtResource("1_yowck") +Label/font_sizes/font_size = 12 +Label/fonts/font = ExtResource("1_yowck") diff --git a/data/cards/baraga.tres b/data/cards/monster/baraga.tres similarity index 100% rename from data/cards/baraga.tres rename to data/cards/monster/baraga.tres diff --git a/data/cards/taiman.tres b/data/cards/monster/taiman.tres similarity index 100% rename from data/cards/taiman.tres rename to data/cards/monster/taiman.tres diff --git a/data/cards/potion.tres b/data/cards/potion.tres deleted file mode 100644 index a68f262..0000000 --- a/data/cards/potion.tres +++ /dev/null @@ -1,16 +0,0 @@ -[gd_resource type="Resource" script_class="SupportCard" load_steps=5 format=3 uid="uid://4eod3m0vc5a8"] - -[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_alamh"] -[ext_resource type="Resource" uid="uid://cvu0rtt5nggf" path="res://data/support_effects/heal.tres" id="2_3x5mu"] -[ext_resource type="Script" path="res://tcg/card/support_card.gd" id="2_72hmi"] - -[sub_resource type="Resource" id="Resource_88lmk"] -script = ExtResource("1_alamh") -magnitude = 5 -effect = ExtResource("2_3x5mu") - -[resource] -script = ExtResource("2_72hmi") -type = "green" -priority = 0 -effects = Array[ExtResource("1_alamh")]([SubResource("Resource_88lmk")]) diff --git a/data/cards/support/potion.tres b/data/cards/support/potion.tres new file mode 100644 index 0000000..96ed2d7 --- /dev/null +++ b/data/cards/support/potion.tres @@ -0,0 +1,20 @@ +[gd_resource type="Resource" script_class="SupportCard" load_steps=6 format=3 uid="uid://4eod3m0vc5a8"] + +[ext_resource type="Script" path="res://tcg/card/support_card_effect_instance.gd" id="1_ujm0o"] +[ext_resource type="Resource" uid="uid://cvu0rtt5nggf" path="res://data/support_effects/heal.tres" id="2_k1cnl"] +[ext_resource type="Script" path="res://tcg/card/support_card.gd" id="3_6r4k4"] +[ext_resource type="Texture2D" uid="uid://rh3aswb0p7ri" path="res://assets/energy.png" id="3_kyx3v"] + +[sub_resource type="Resource" id="Resource_88lmk"] +script = ExtResource("1_ujm0o") +magnitude = 30 +effect = ExtResource("2_k1cnl") + +[resource] +script = ExtResource("3_6r4k4") +type = "green" +priority = 0 +effects = Array[ExtResource("1_ujm0o")]([SubResource("Resource_88lmk")]) +name = "Potion" +description = "Heal 30 HP" +icon = ExtResource("3_kyx3v") diff --git a/demo_game.tscn b/demo_game.tscn index e5ae8d6..b6c0ea6 100644 --- a/demo_game.tscn +++ b/demo_game.tscn @@ -4,9 +4,9 @@ [ext_resource type="Script" path="res://player_side.gd" id="2_w4tnt"] [ext_resource type="Script" path="res://tcg/card/card.gd" id="2_xuft0"] [ext_resource type="PackedScene" uid="uid://cikstg43mudkn" path="res://tcg/match/match_manager.tscn" id="3_3yhrl"] -[ext_resource type="Resource" uid="uid://cs7q8i7bvohmj" path="res://data/cards/baraga.tres" id="3_we1tk"] -[ext_resource type="Resource" uid="uid://4eod3m0vc5a8" path="res://data/cards/potion.tres" id="4_kkhfk"] -[ext_resource type="Resource" uid="uid://di76avwc0gn8e" path="res://data/cards/taiman.tres" id="5_3cm5x"] +[ext_resource type="Resource" uid="uid://cs7q8i7bvohmj" path="res://data/cards/monster/baraga.tres" id="3_we1tk"] +[ext_resource type="Resource" uid="uid://4eod3m0vc5a8" path="res://data/cards/support/potion.tres" id="4_kkhfk"] +[ext_resource type="Resource" uid="uid://di76avwc0gn8e" path="res://data/cards/monster/taiman.tres" id="5_3cm5x"] [node name="DemoGame" type="Control"] layout_mode = 3 diff --git a/tcg/card/card.gd b/tcg/card/card.gd index 5c8826b..e14ff41 100644 --- a/tcg/card/card.gd +++ b/tcg/card/card.gd @@ -1,6 +1,10 @@ extends Resource class_name Card +@export var name: String +@export var description: String +@export var icon: Texture2D + var id: String: get: return resource_path.rsplit(".", true, 1)[0].rsplit("/", true, 1)[1] diff --git a/test_card.gd b/test_card.gd new file mode 100644 index 0000000..a0b8904 --- /dev/null +++ b/test_card.gd @@ -0,0 +1,7 @@ +extends Control + +@export var card: SupportCard + +func _ready() -> void: + $Green.card = card + $Red.card = card diff --git a/test_card.tscn b/test_card.tscn new file mode 100644 index 0000000..94b6965 --- /dev/null +++ b/test_card.tscn @@ -0,0 +1,28 @@ +[gd_scene load_steps=5 format=3 uid="uid://dhm4v4r7he0op"] + +[ext_resource type="Script" path="res://test_card.gd" id="1_tqmas"] +[ext_resource type="PackedScene" uid="uid://dg5amjm1gqi06" path="res://ui/card/GreenCard.tscn" id="2_22pto"] +[ext_resource type="Resource" uid="uid://4eod3m0vc5a8" path="res://data/cards/support/potion.tres" id="2_tbbjy"] +[ext_resource type="PackedScene" uid="uid://cds50kwwhlgam" path="res://ui/card/RedCard.tscn" id="3_7wd2e"] + +[node name="TestCard" 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_tqmas") +card = ExtResource("2_tbbjy") + +[node name="Green" parent="." instance=ExtResource("2_22pto")] +offset_left = 225.0 +offset_top = 165.0 +offset_right = 445.0 +offset_bottom = 485.0 + +[node name="Red" parent="." instance=ExtResource("3_7wd2e")] +offset_left = 699.0 +offset_top = 168.0 +offset_right = 919.0 +offset_bottom = 488.0 diff --git a/ui/card/GreenCard.tscn b/ui/card/GreenCard.tscn new file mode 100644 index 0000000..019163e --- /dev/null +++ b/ui/card/GreenCard.tscn @@ -0,0 +1,165 @@ +[gd_scene load_steps=11 format=3 uid="uid://dg5amjm1gqi06"] + +[ext_resource type="Texture2D" uid="uid://l2nxxhh0pvh8" path="res://assets/card_base/Frame.png" id="1_4ivbl"] +[ext_resource type="Script" path="res://ui/card/card_base.gd" id="1_rpopv"] +[ext_resource type="Texture2D" uid="uid://liitr32ap646" path="res://assets/card_base/G-OuterFill.png" id="2_c6lcl"] +[ext_resource type="Texture2D" uid="uid://crgrple0uik7x" path="res://assets/card_base/Stroke.png" id="3_qajq3"] +[ext_resource type="Texture2D" uid="uid://blejyda8mendg" path="res://assets/card_base/InnerFill.png" id="4_pgomu"] +[ext_resource type="Texture2D" uid="uid://by7ws88pn4tvb" path="res://assets/card_base/Separator.png" id="5_501uu"] +[ext_resource type="Texture2D" uid="uid://0gxplli5krq2" path="res://assets/card_base/Pill.png" id="6_ce7hm"] +[ext_resource type="Theme" uid="uid://cj3vs5hq2mcbp" path="res://cards.tres" id="7_va1d7"] +[ext_resource type="Texture2D" uid="uid://rh3aswb0p7ri" path="res://assets/energy.png" id="8_4yq42"] +[ext_resource type="FontFile" uid="uid://08q3kkwmd4u6" path="res://assets/Inter-Regular.otf" id="10_c2ugn"] + +[node name="CardBase" type="Control" node_paths=PackedStringArray("card_name_label", "card_desc_label", "icon_rect")] +layout_mode = 3 +anchors_preset = 0 +offset_right = 220.0 +offset_bottom = 320.0 +script = ExtResource("1_rpopv") +card_name_label = NodePath("MarginContainer/Label") +card_desc_label = NodePath("MarginContainer/DescriptionLabel") +icon_rect = NodePath("MarginContainer/Icon") + +[node name="Frame" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("1_4ivbl") +expand_mode = 1 + +[node name="MarginContainer" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 4.0 +offset_top = 3.0 +offset_right = -5.0 +offset_bottom = -4.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="TextureRect" type="TextureRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("2_c6lcl") +expand_mode = 1 + +[node name="OuterStroke" type="NinePatchRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_qajq3") + +[node name="TextureRect2" type="TextureRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 62.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("4_pgomu") +expand_mode = 1 + +[node name="InnerStroke" type="NinePatchRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 62.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_qajq3") + +[node name="TextureRect3" type="TextureRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.01 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -0.0100002 +offset_top = -112.0 +offset_right = -1.0 +offset_bottom = -110.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("5_501uu") +expand_mode = 1 +metadata/_edit_use_anchors_ = true + +[node name="TextureRect4" type="NinePatchRect" parent="MarginContainer"] +modulate = Color(0.356863, 0.54902, 0.243137, 1) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = 4.5 +offset_top = 30.5 +offset_right = 90.5 +offset_bottom = 60.5 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("6_ce7hm") + +[node name="Label" type="Label" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_left = 2.0 +offset_top = 16.0 +offset_right = -3.0 +offset_bottom = 50.0 +grow_horizontal = 2 +theme = ExtResource("7_va1d7") +theme_override_colors/font_color = Color(0.576471, 0.788235, 0.819608, 1) +theme_override_font_sizes/font_size = 24 +text = "green card" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Label2" type="Label" parent="MarginContainer"] +layout_mode = 0 +offset_left = 118.0 +offset_top = 190.0 +offset_right = 188.0 +offset_bottom = 213.0 +theme = ExtResource("7_va1d7") +text = "Green card" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Icon" type="TextureRect" parent="MarginContainer"] +offset_left = 26.0 +offset_top = 74.0 +offset_right = 169.0 +offset_bottom = 179.0 +texture = ExtResource("8_4yq42") +expand_mode = 1 +stretch_mode = 6 + +[node name="DescriptionLabel" type="Label" parent="MarginContainer"] +offset_left = 11.0 +offset_top = 224.0 +offset_right = 200.0 +offset_bottom = 302.0 +theme = ExtResource("7_va1d7") +theme_override_fonts/font = ExtResource("10_c2ugn") +theme_override_font_sizes/font_size = 12 +text = "If your monster is supposed to be dead, keep it alive at 10 HP" +horizontal_alignment = 1 +autowrap_mode = 3 diff --git a/ui/card/RedCard.tscn b/ui/card/RedCard.tscn new file mode 100644 index 0000000..3744e13 --- /dev/null +++ b/ui/card/RedCard.tscn @@ -0,0 +1,167 @@ +[gd_scene load_steps=11 format=3 uid="uid://cds50kwwhlgam"] + +[ext_resource type="Script" path="res://ui/card/card_base.gd" id="1_d22a5"] +[ext_resource type="Texture2D" uid="uid://l2nxxhh0pvh8" path="res://assets/card_base/Frame.png" id="1_x5ex0"] +[ext_resource type="Texture2D" uid="uid://ip7xjs20pd3d" path="res://assets/card_base/R-OuterFill.png" id="2_xjg8y"] +[ext_resource type="Texture2D" uid="uid://crgrple0uik7x" path="res://assets/card_base/Stroke.png" id="3_q71h0"] +[ext_resource type="Texture2D" uid="uid://blejyda8mendg" path="res://assets/card_base/InnerFill.png" id="4_2fw8n"] +[ext_resource type="Texture2D" uid="uid://by7ws88pn4tvb" path="res://assets/card_base/Separator.png" id="5_n3v14"] +[ext_resource type="Texture2D" uid="uid://0gxplli5krq2" path="res://assets/card_base/Pill.png" id="6_wrd2a"] +[ext_resource type="Theme" uid="uid://cj3vs5hq2mcbp" path="res://cards.tres" id="7_fp6ys"] +[ext_resource type="FontFile" uid="uid://08q3kkwmd4u6" path="res://assets/Inter-Regular.otf" id="9_vilw6"] +[ext_resource type="Texture2D" uid="uid://rh3aswb0p7ri" path="res://assets/energy.png" id="10_2t0ey"] + +[node name="CardBase" type="Control" node_paths=PackedStringArray("card_name_label", "card_desc_label", "icon_rect")] +layout_mode = 3 +anchors_preset = 0 +offset_right = 220.0 +offset_bottom = 320.0 +script = ExtResource("1_d22a5") +card_name_label = NodePath("MarginContainer/Title") +card_desc_label = NodePath("MarginContainer/DescriptionLabel") +icon_rect = NodePath("MarginContainer/Icon") + +[node name="Frame" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("1_x5ex0") +expand_mode = 1 + +[node name="MarginContainer" type="Control" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 4.0 +offset_top = 3.0 +offset_right = -5.0 +offset_bottom = -4.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="TextureRect" type="TextureRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("2_xjg8y") +expand_mode = 1 + +[node name="OuterStroke" type="NinePatchRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_q71h0") + +[node name="TextureRect2" type="TextureRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 62.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("4_2fw8n") +expand_mode = 1 + +[node name="InnerStroke" type="NinePatchRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 62.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_q71h0") + +[node name="TextureRect3" type="TextureRect" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.01 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -0.0100002 +offset_top = -112.0 +offset_right = -1.0 +offset_bottom = -110.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("5_n3v14") +expand_mode = 1 +metadata/_edit_use_anchors_ = true + +[node name="TextureRect4" type="NinePatchRect" parent="MarginContainer"] +modulate = Color(0.54902, 0.243137, 0.243137, 1) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = 4.5 +offset_top = 30.5 +offset_right = 90.5 +offset_bottom = 60.5 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("6_wrd2a") + +[node name="Title" type="Label" parent="MarginContainer"] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_left = 2.0 +offset_top = 16.0 +offset_right = -3.0 +offset_bottom = 50.0 +grow_horizontal = 2 +theme = ExtResource("7_fp6ys") +theme_override_colors/font_color = Color(0.819608, 0.576471, 0.576471, 1) +theme_override_font_sizes/font_size = 24 +text = "red card" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="PillLabel" type="Label" parent="MarginContainer"] +layout_mode = 0 +offset_left = 118.0 +offset_top = 190.0 +offset_right = 188.0 +offset_bottom = 213.0 +theme = ExtResource("7_fp6ys") +text = "Red card" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="DescriptionLabel" type="Label" parent="MarginContainer"] +layout_mode = 0 +offset_left = 11.0 +offset_top = 224.0 +offset_right = 200.0 +offset_bottom = 302.0 +theme = ExtResource("7_fp6ys") +theme_override_fonts/font = ExtResource("9_vilw6") +theme_override_font_sizes/font_size = 12 +text = "If your monster is supposed to be dead, keep it alive at 10 HP" +horizontal_alignment = 1 +autowrap_mode = 3 + +[node name="Icon" type="TextureRect" parent="MarginContainer"] +layout_mode = 0 +offset_left = 30.0 +offset_top = 77.0 +offset_right = 173.0 +offset_bottom = 182.0 +texture = ExtResource("10_2t0ey") +expand_mode = 1 +stretch_mode = 6 diff --git a/ui/card/card_base.gd b/ui/card/card_base.gd new file mode 100644 index 0000000..12acc63 --- /dev/null +++ b/ui/card/card_base.gd @@ -0,0 +1,20 @@ +extends Control + +@export var card_name_label: Label +@export var card_desc_label: Label +@export var icon_rect: TextureRect + +var _card: SupportCard +var card: SupportCard: + get: + return _card + set(value): + _update(value) + _card = value + +func _update(card: SupportCard): + card_name_label.text = card.name + card_desc_label.text = card.description + icon_rect.texture = card.icon + +