diff --git a/components/UI/FeedCard.tscn b/components/UI/FeedCard.tscn new file mode 100644 index 0000000..ba80c4e --- /dev/null +++ b/components/UI/FeedCard.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=4 format=3 uid="uid://b4cwipt17nh7g"] + +[ext_resource type="Script" path="res://scripts/Structs/Feed.gd" id="1_2ea75"] +[ext_resource type="Texture2D" uid="uid://b7vxserbhskol" path="res://resources/feeds/banana.svg" id="1_jonms"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_n2ewr"] +content_margin_left = 30.0 +content_margin_top = 20.0 +content_margin_right = 30.0 +content_margin_bottom = 20.0 +bg_color = Color(0, 0, 0, 0.5) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0, 0, 0, 0.75) +corner_radius_top_left = 5 +corner_radius_top_right = 5 +corner_radius_bottom_right = 5 +corner_radius_bottom_left = 5 + +[node name="FeedCard" type="PanelContainer"] +offset_right = 200.0 +offset_bottom = 300.0 +theme_override_styles/panel = SubResource("StyleBoxFlat_n2ewr") +script = ExtResource("1_2ea75") + +[node name="container" type="VBoxContainer" parent="."] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="info" type="VBoxContainer" parent="container"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="avatar" type="TextureRect" parent="container/info"] +custom_minimum_size = Vector2(75, 75) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture = ExtResource("1_jonms") + +[node name="name" type="Label" parent="container/info"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "香蕉" + +[node name="fields" type="VBoxContainer" parent="container"] +layout_mode = 2 + +[node name="costs" type="GridContainer" parent="container"] +layout_mode = 2 +theme_override_constants/h_separation = 10 +theme_override_constants/v_separation = 10 +columns = 2 diff --git a/components/UI/FieldShow.tscn b/components/UI/FieldShow.tscn new file mode 100644 index 0000000..8f8c9d0 --- /dev/null +++ b/components/UI/FieldShow.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=2 format=3 uid="uid://cw5ip3rw4r3pp"] + +[ext_resource type="Script" path="res://scripts/Statemachine/FieldShow.gd" id="1_gwocj"] + +[node name="FieldShow" type="HBoxContainer"] +script = ExtResource("1_gwocj") +value = "0" + +[node name="name" type="Label" parent="."] +unique_name_in_owner = true +layout_mode = 2 +text = "最大生命值" + +[node name="value" type="Label" parent="."] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 10 +text = "0" diff --git a/components/UI/ItemShow.tscn b/components/UI/ItemShow.tscn new file mode 100644 index 0000000..d602939 --- /dev/null +++ b/components/UI/ItemShow.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=3 format=3 uid="uid://bbm8l3hr4ihar"] + +[ext_resource type="Script" path="res://scripts/Statemachine/ItemShow.gd" id="1_2dhsb"] +[ext_resource type="Texture2D" uid="uid://bks8jmctleina" path="res://resources/items/baseball.svg" id="1_hyowb"] + +[node name="ItemShow" type="HBoxContainer"] +script = ExtResource("1_2dhsb") + +[node name="avatar" type="TextureRect" parent="."] +unique_name_in_owner = true +custom_minimum_size = Vector2(20, 20) +layout_mode = 2 +size_flags_horizontal = 0 +size_flags_vertical = 4 +texture = ExtResource("1_hyowb") +expand_mode = 1 + +[node name="count" type="Label" parent="."] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 10 +text = "0" diff --git a/resources/feeds/banana.svg b/resources/feeds/banana.svg new file mode 100644 index 0000000..237c428 --- /dev/null +++ b/resources/feeds/banana.svg @@ -0,0 +1,23 @@ + + + Slice 1 + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/feeds/banana.svg.import b/resources/feeds/banana.svg.import new file mode 100644 index 0000000..2448d6d --- /dev/null +++ b/resources/feeds/banana.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7vxserbhskol" +path="res://.godot/imported/banana.svg-4e9a5958a2d683095b10d4c718bca679.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/feeds/banana.svg" +dest_files=["res://.godot/imported/banana.svg-4e9a5958a2d683095b10d4c718bca679.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/resources/items/baseball.svg b/resources/items/baseball.svg new file mode 100644 index 0000000..1b5231f --- /dev/null +++ b/resources/items/baseball.svg @@ -0,0 +1,35 @@ + + + + Slice 1 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/items/baseball.svg.import b/resources/items/baseball.svg.import new file mode 100644 index 0000000..26fc21b --- /dev/null +++ b/resources/items/baseball.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bks8jmctleina" +path="res://.godot/imported/baseball.svg-1901705de42f4cc5a44a1e5f8046c228.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/items/baseball.svg" +dest_files=["res://.godot/imported/baseball.svg-1901705de42f4cc5a44a1e5f8046c228.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/resources/items/basketball.svg b/resources/items/basketball.svg new file mode 100644 index 0000000..0126643 --- /dev/null +++ b/resources/items/basketball.svg @@ -0,0 +1,18 @@ + + + + Slice 1 + Created with Sketch. + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/items/basketball.svg.import b/resources/items/basketball.svg.import new file mode 100644 index 0000000..ebffac0 --- /dev/null +++ b/resources/items/basketball.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://i42hs74gw5q5" +path="res://.godot/imported/basketball.svg-841211645b0b095ba7071de154659e69.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resources/items/basketball.svg" +dest_files=["res://.godot/imported/basketball.svg-841211645b0b095ba7071de154659e69.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 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/scripts/Statemachine/FieldShow.gd b/scripts/Statemachine/FieldShow.gd new file mode 100644 index 0000000..9bcf0b3 --- /dev/null +++ b/scripts/Statemachine/FieldShow.gd @@ -0,0 +1,12 @@ +@tool +extends HBoxContainer + +@export var field: FieldStore.Entity = FieldStore.Entity.MAX_HEALTH +@export var value: String = "" + +@onready var nameLabel: Label = $"%name" +@onready var valueLabel: Label = $"%value" + +func _process(_delta): + nameLabel.text = FieldStore.entityMap[field] + valueLabel.text = value diff --git a/scripts/Statemachine/ItemShow.gd b/scripts/Statemachine/ItemShow.gd new file mode 100644 index 0000000..e3380cd --- /dev/null +++ b/scripts/Statemachine/ItemShow.gd @@ -0,0 +1,12 @@ +@tool +extends HBoxContainer + +@export var type: ItemStore.ItemType = ItemStore.ItemType.BASEBALL +@export var count: int = 0 + +@onready var avatarTexture: TextureRect = $"%avatar" +@onready var countLabel: Label = $"%count" + +func _process(_delta): + avatarTexture.texture = load("res://resources/items/%s.svg" % ItemStore.idMap[type]) + countLabel.text = str(count) diff --git a/scripts/Structs/Feed.gd b/scripts/Structs/Feed.gd new file mode 100644 index 0000000..ab062ec --- /dev/null +++ b/scripts/Structs/Feed.gd @@ -0,0 +1,3 @@ +@tool +extends PanelContainer +class_name Feed \ No newline at end of file diff --git a/scripts/Tools/FieldStore.gd b/scripts/Tools/FieldStore.gd index 290d80a..d703520 100644 --- a/scripts/Tools/FieldStore.gd +++ b/scripts/Tools/FieldStore.gd @@ -1,3 +1,4 @@ +@tool class_name FieldStore enum Entity { diff --git a/scripts/Tools/ItemStore.gd b/scripts/Tools/ItemStore.gd new file mode 100644 index 0000000..538a0bd --- /dev/null +++ b/scripts/Tools/ItemStore.gd @@ -0,0 +1,15 @@ +@tool +class_name ItemStore + +enum ItemType { + BASEBALL, + BASKETBALL +} +static var nameMap = { + ItemType.BASEBALL: "棒球", + ItemType.BASKETBALL: "篮球" +} +static var idMap = { + ItemType.BASEBALL: "baseball", + ItemType.BASKETBALL: "basketball" +} \ No newline at end of file