diff --git a/assets/gui/Text.tres b/assets/gui/Text.tres new file mode 100644 index 0000000..1744770 --- /dev/null +++ b/assets/gui/Text.tres @@ -0,0 +1,6 @@ +[gd_resource type="Theme" load_steps=2 format=3 uid="uid://dnebunkx13tbr"] + +[ext_resource type="FontFile" uid="uid://bny4vcd35yk8v" path="res://assets/gui/fonts/AgenorNeue-Regular.otf" id="1_txdd2"] + +[resource] +default_font = ExtResource("1_txdd2") diff --git a/assets/gui/fonts/AgenorNeue-Regular.otf b/assets/gui/fonts/AgenorNeue-Regular.otf new file mode 100644 index 0000000..ab75820 Binary files /dev/null and b/assets/gui/fonts/AgenorNeue-Regular.otf differ diff --git a/assets/gui/fonts/AgenorNeue-Regular.otf.import b/assets/gui/fonts/AgenorNeue-Regular.otf.import new file mode 100644 index 0000000..c6b4b48 --- /dev/null +++ b/assets/gui/fonts/AgenorNeue-Regular.otf.import @@ -0,0 +1,34 @@ +[remap] + +importer="font_data_dynamic" +type="FontFile" +uid="uid://bny4vcd35yk8v" +path="res://.godot/imported/AgenorNeue-Regular.otf-4c5e971acc828a669de3aa30498ba51c.fontdata" + +[deps] + +source_file="res://assets/gui/fonts/AgenorNeue-Regular.otf" +dest_files=["res://.godot/imported/AgenorNeue-Regular.otf-4c5e971acc828a669de3aa30498ba51c.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/gui/icons/soil-alt.svg b/assets/gui/icons/soil-alt.svg new file mode 100644 index 0000000..e3485f3 --- /dev/null +++ b/assets/gui/icons/soil-alt.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + diff --git a/assets/gui/icons/soil-alt.svg.import b/assets/gui/icons/soil-alt.svg.import new file mode 100644 index 0000000..faf8556 --- /dev/null +++ b/assets/gui/icons/soil-alt.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dgo81cisfryi1" +path="res://.godot/imported/soil-alt.svg-fe8fe6cd3f43bd71db54f40c87d8a896.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/gui/icons/soil-alt.svg" +dest_files=["res://.godot/imported/soil-alt.svg-fe8fe6cd3f43bd71db54f40c87d8a896.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/assets/gui/icons/tree.svg b/assets/gui/icons/tree.svg new file mode 100644 index 0000000..cf28717 --- /dev/null +++ b/assets/gui/icons/tree.svg @@ -0,0 +1,69 @@ + + + + + + + + + diff --git a/assets/gui/icons/tree.svg.import b/assets/gui/icons/tree.svg.import new file mode 100644 index 0000000..7e52054 --- /dev/null +++ b/assets/gui/icons/tree.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bdg3ep75da6xd" +path="res://.godot/imported/tree.svg-a9a11b8669ea4c40b43b0767f9245964.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/gui/icons/tree.svg" +dest_files=["res://.godot/imported/tree.svg-a9a11b8669ea4c40b43b0767f9245964.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/assets/gui/icons/watering-soil.svg b/assets/gui/icons/watering-soil.svg new file mode 100644 index 0000000..b2d14f2 --- /dev/null +++ b/assets/gui/icons/watering-soil.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + diff --git a/assets/gui/icons/watering-soil.svg.import b/assets/gui/icons/watering-soil.svg.import new file mode 100644 index 0000000..4b02749 --- /dev/null +++ b/assets/gui/icons/watering-soil.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dpfe11wn04ntd" +path="res://.godot/imported/watering-soil.svg-65f2a38ec58e9e944c44f681c3ffc681.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/gui/icons/watering-soil.svg" +dest_files=["res://.godot/imported/watering-soil.svg-65f2a38ec58e9e944c44f681c3ffc681.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/objects/gui/Scanner_modes.tscn b/objects/gui/Scanner_modes.tscn index 5175101..75ecaa8 100644 --- a/objects/gui/Scanner_modes.tscn +++ b/objects/gui/Scanner_modes.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=2 format=3 uid="uid://0so4tpnkk8t2"] +[gd_scene load_steps=3 format=3 uid="uid://0so4tpnkk8t2"] [ext_resource type="Script" path="res://scripts/gui/scanner_modes.gd" id="1_synac"] +[ext_resource type="Theme" uid="uid://dnebunkx13tbr" path="res://assets/gui/Text.tres" id="2_3kvh5"] [node name="ScannerModes" type="Control"] layout_mode = 3 @@ -18,6 +19,7 @@ offset_left = -60.5 offset_right = 60.5 offset_bottom = 40.0 grow_horizontal = 2 +theme = ExtResource("2_3kvh5") selected = 0 item_count = 4 popup/item_0/text = "No Scanner" diff --git a/objects/gui/Seed_card.tscn b/objects/gui/Seed_card.tscn index 58d9595..811e40c 100644 --- a/objects/gui/Seed_card.tscn +++ b/objects/gui/Seed_card.tscn @@ -1,13 +1,21 @@ -[gd_scene load_steps=5 format=3 uid="uid://iaf4md4cbwqh"] +[gd_scene load_steps=12 format=3 uid="uid://iaf4md4cbwqh"] [ext_resource type="Script" path="res://scripts/gui/seed_card.gd" id="1_ecgsq"] +[ext_resource type="Theme" uid="uid://dnebunkx13tbr" path="res://assets/gui/Text.tres" id="2_n5opx"] +[ext_resource type="Texture2D" uid="uid://dpfe11wn04ntd" path="res://assets/gui/icons/watering-soil.svg" id="3_4sryb"] +[ext_resource type="Texture2D" uid="uid://be2uusaqcpcpd" path="res://assets/gradients/Fertility.tres" id="4_5omu3"] +[ext_resource type="PackedScene" uid="uid://qjwtbyq2c87m" path="res://objects/gui/Stats_area.tscn" id="4_wwqbk"] +[ext_resource type="Texture2D" uid="uid://cwowpvsoo3dey" path="res://assets/gradients/Water.tres" id="5_hwfmn"] +[ext_resource type="Texture2D" uid="uid://dgo81cisfryi1" path="res://assets/gui/icons/soil-alt.svg" id="6_4k6c3"] +[ext_resource type="Texture2D" uid="uid://bdg3ep75da6xd" path="res://assets/gui/icons/tree.svg" id="8_i3l01"] +[ext_resource type="Texture2D" uid="uid://biti1wmdsg7xr" path="res://assets/gradients/Presence.tres" id="9_w0o2o"] -[sub_resource type="Gradient" id="Gradient_lissx"] -offsets = PackedFloat32Array(1) -colors = PackedColorArray(0.125911, 0.125911, 0.125911, 1) - -[sub_resource type="GradientTexture1D" id="GradientTexture1D_aglhv"] -gradient = SubResource("Gradient_lissx") +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8gji7"] +draw_center = false +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 [sub_resource type="NoiseTexture2D" id="NoiseTexture2D_kiud1"] @@ -25,15 +33,14 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -100.0 -offset_top = -181.0 +offset_left = -277.0 +offset_top = -280.0 grow_horizontal = 0 grow_vertical = 0 -[node name="TextureRect" type="TextureRect" parent="Card"] +[node name="TextureRect" type="Panel" parent="Card"] layout_mode = 2 -texture = SubResource("GradientTexture1D_aglhv") -expand_mode = 1 +theme_override_styles/panel = SubResource("StyleBoxFlat_8gji7") [node name="MarginContainer" type="MarginContainer" parent="Card"] layout_mode = 2 @@ -47,6 +54,8 @@ layout_mode = 2 [node name="Nom" type="Label" parent="Card/MarginContainer/VBoxContainer"] layout_mode = 2 +theme = ExtResource("2_n5opx") +theme_override_font_sizes/font_size = 30 text = "Chène" horizontal_alignment = 1 vertical_alignment = 1 @@ -58,15 +67,145 @@ texture = SubResource("NoiseTexture2D_kiud1") expand_mode = 3 stretch_mode = 5 -[node name="Besoins" type="Label" parent="Card/MarginContainer/VBoxContainer"] +[node name="Needs" type="Label" parent="Card/MarginContainer/VBoxContainer"] layout_mode = 2 -text = "Besoins" +theme = ExtResource("2_n5opx") +theme_override_font_sizes/font_size = 20 +text = "Needs" horizontal_alignment = 1 vertical_alignment = 1 +[node name="WaterNeeds" type="HFlowContainer" parent="Card/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 20 +alignment = 2 + +[node name="IconLabel" type="HBoxContainer" parent="Card/MarginContainer/VBoxContainer/WaterNeeds"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="TextureRect" type="TextureRect" parent="Card/MarginContainer/VBoxContainer/WaterNeeds/IconLabel"] +layout_mode = 2 +texture = ExtResource("3_4sryb") + +[node name="Label" type="Label" parent="Card/MarginContainer/VBoxContainer/WaterNeeds/IconLabel"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +text = "Water" + +[node name="StatsArea" parent="Card/MarginContainer/VBoxContainer/WaterNeeds" instance=ExtResource("4_wwqbk")] +layout_mode = 2 +gradient = ExtResource("5_hwfmn") + +[node name="FertilityNeeds" type="HFlowContainer" parent="Card/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 20 +alignment = 2 + +[node name="IconLabel" type="HBoxContainer" parent="Card/MarginContainer/VBoxContainer/FertilityNeeds"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="TextureRect" type="TextureRect" parent="Card/MarginContainer/VBoxContainer/FertilityNeeds/IconLabel"] +layout_mode = 2 +texture = ExtResource("6_4k6c3") + +[node name="Label" type="Label" parent="Card/MarginContainer/VBoxContainer/FertilityNeeds/IconLabel"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +text = "Fertility" + +[node name="StatsArea" parent="Card/MarginContainer/VBoxContainer/FertilityNeeds" instance=ExtResource("4_wwqbk")] +layout_mode = 2 +gradient = ExtResource("4_5omu3") + +[node name="Population" type="HFlowContainer" parent="Card/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 20 +alignment = 2 + +[node name="IconLabel" type="HBoxContainer" parent="Card/MarginContainer/VBoxContainer/Population"] +layout_mode = 2 +theme_override_constants/separation = 10 + +[node name="TextureRect" type="TextureRect" parent="Card/MarginContainer/VBoxContainer/Population/IconLabel"] +layout_mode = 2 +texture = ExtResource("8_i3l01") + +[node name="Label" type="Label" parent="Card/MarginContainer/VBoxContainer/Population/IconLabel"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +text = "Population" + +[node name="StatsArea" parent="Card/MarginContainer/VBoxContainer/Population" instance=ExtResource("4_wwqbk")] +layout_mode = 2 +gradient = ExtResource("9_w0o2o") + [node name="Apports" type="Label" parent="Card/MarginContainer/VBoxContainer"] layout_mode = 2 -text = "Apports +theme = ExtResource("2_n5opx") +theme_override_font_sizes/font_size = 20 +text = "Supply " horizontal_alignment = 1 vertical_alignment = 1 + +[node name="WaterSupply" type="HBoxContainer" parent="Card/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 +alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="Card/MarginContainer/VBoxContainer/WaterSupply"] +layout_mode = 2 +texture = ExtResource("3_4sryb") + +[node name="Label" type="Label" parent="Card/MarginContainer/VBoxContainer/WaterSupply"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +text = "Water" + +[node name="Supply" type="Label" parent="Card/MarginContainer/VBoxContainer/WaterSupply"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +theme_override_font_sizes/font_size = 20 +text = "1" + +[node name="FertilitySupply" type="HBoxContainer" parent="Card/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 +alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="Card/MarginContainer/VBoxContainer/FertilitySupply"] +layout_mode = 2 +texture = ExtResource("6_4k6c3") + +[node name="Label" type="Label" parent="Card/MarginContainer/VBoxContainer/FertilitySupply"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +text = "Fertility" + +[node name="Supply" type="Label" parent="Card/MarginContainer/VBoxContainer/FertilitySupply"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +theme_override_font_sizes/font_size = 20 +text = "1" + +[node name="PopulationSupply" type="HBoxContainer" parent="Card/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 10 +alignment = 1 + +[node name="TextureRect" type="TextureRect" parent="Card/MarginContainer/VBoxContainer/PopulationSupply"] +layout_mode = 2 +texture = ExtResource("8_i3l01") + +[node name="Label" type="Label" parent="Card/MarginContainer/VBoxContainer/PopulationSupply"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +text = "Population" + +[node name="Supply" type="Label" parent="Card/MarginContainer/VBoxContainer/PopulationSupply"] +layout_mode = 2 +theme = ExtResource("2_n5opx") +theme_override_font_sizes/font_size = 20 +text = "1" diff --git a/objects/gui/Seed_queue.tscn b/objects/gui/Seed_queue.tscn index b0c9dd4..9042c66 100644 --- a/objects/gui/Seed_queue.tscn +++ b/objects/gui/Seed_queue.tscn @@ -23,29 +23,19 @@ grow_horizontal = 2 grow_vertical = 0 theme_override_constants/separation = 10 +[node name="NextSeed" type="TextureRect" parent="HBoxContainer"] +custom_minimum_size = Vector2(100, 100) +layout_mode = 2 +texture = SubResource("NoiseTexture2D_reedq") +expand_mode = 2 + [node name="Queue" type="HBoxContainer" parent="HBoxContainer"] layout_mode = 2 theme_override_constants/separation = 10 alignment = 2 -[node name="Seed1" type="TextureRect" parent="HBoxContainer/Queue"] -custom_minimum_size = Vector2(40, 40) -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 8 -texture = SubResource("NoiseTexture2D_reedq") -expand_mode = 2 - -[node name="Seed2" type="TextureRect" parent="HBoxContainer/Queue"] -custom_minimum_size = Vector2(40, 40) -layout_mode = 2 -size_flags_horizontal = 4 -size_flags_vertical = 8 -texture = SubResource("NoiseTexture2D_reedq") -expand_mode = 2 - -[node name="Seed3" type="TextureRect" parent="HBoxContainer/Queue"] -custom_minimum_size = Vector2(40, 40) +[node name="Seed5" type="TextureRect" parent="HBoxContainer/Queue"] +custom_minimum_size = Vector2(50, 50) layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 8 @@ -53,23 +43,33 @@ texture = SubResource("NoiseTexture2D_reedq") expand_mode = 2 [node name="Seed4" type="TextureRect" parent="HBoxContainer/Queue"] -custom_minimum_size = Vector2(40, 40) +custom_minimum_size = Vector2(50, 50) layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 8 texture = SubResource("NoiseTexture2D_reedq") expand_mode = 2 -[node name="Seed5" type="TextureRect" parent="HBoxContainer/Queue"] -custom_minimum_size = Vector2(40, 40) +[node name="Seed3" type="TextureRect" parent="HBoxContainer/Queue"] +custom_minimum_size = Vector2(50, 50) layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 8 texture = SubResource("NoiseTexture2D_reedq") expand_mode = 2 -[node name="NextSeed" type="TextureRect" parent="HBoxContainer"] -custom_minimum_size = Vector2(80, 80) +[node name="Seed2" type="TextureRect" parent="HBoxContainer/Queue"] +custom_minimum_size = Vector2(50, 50) layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 8 +texture = SubResource("NoiseTexture2D_reedq") +expand_mode = 2 + +[node name="Seed1" type="TextureRect" parent="HBoxContainer/Queue"] +custom_minimum_size = Vector2(50, 50) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 8 texture = SubResource("NoiseTexture2D_reedq") expand_mode = 2 diff --git a/objects/gui/Stats_area.tscn b/objects/gui/Stats_area.tscn new file mode 100644 index 0000000..ed8cfd3 --- /dev/null +++ b/objects/gui/Stats_area.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=3 uid="uid://qjwtbyq2c87m"] + +[ext_resource type="Script" path="res://scripts/gui/stats_area.gd" id="1_il8so"] +[ext_resource type="Texture2D" uid="uid://be2uusaqcpcpd" path="res://assets/gradients/Fertility.tres" id="1_qy7fg"] + +[sub_resource type="Gradient" id="Gradient_8q55d"] +interpolation_mode = 1 +offsets = PackedFloat32Array(0, 0.319527, 0.718935) +colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_tb5qg"] +gradient = SubResource("Gradient_8q55d") + +[node name="StatsArea" type="CenterContainer"] +script = ExtResource("1_il8so") + +[node name="Gradient" type="TextureRect" parent="."] +custom_minimum_size = Vector2(100, 10) +layout_mode = 2 +texture = ExtResource("1_qy7fg") +expand_mode = 2 + +[node name="Zone" type="TextureRect" parent="."] +custom_minimum_size = Vector2(100, 10) +layout_mode = 2 +texture = SubResource("GradientTexture1D_tb5qg") +expand_mode = 2 diff --git a/scripts/gui/seed_card.gd b/scripts/gui/seed_card.gd index 7ca96db..21cb044 100644 --- a/scripts/gui/seed_card.gd +++ b/scripts/gui/seed_card.gd @@ -2,8 +2,15 @@ extends Control @onready var nom: Label = $Card/MarginContainer/VBoxContainer/Nom @onready var image: TextureRect = $Card/MarginContainer/VBoxContainer/Image -@onready var besoins: Label = $Card/MarginContainer/VBoxContainer/Besoins -@onready var apports: Label = $Card/MarginContainer/VBoxContainer/Apports + +@onready var waterNeeds : StatsArea = $Card/MarginContainer/VBoxContainer/WaterNeeds/StatsArea +@onready var fertilityNeeds : StatsArea = $Card/MarginContainer/VBoxContainer/FertilityNeeds/StatsArea +@onready var populationNeeds : StatsArea = $Card/MarginContainer/VBoxContainer/Population/StatsArea + +@onready var waterSupply : Label = $Card/MarginContainer/VBoxContainer/WaterSupply/Supply +@onready var fertilitySupply : Label = $Card/MarginContainer/VBoxContainer/FertilitySupply/Supply +@onready var populationSupply : Label = $Card/MarginContainer/VBoxContainer/PopulationSupply/Supply + var planter: Planter @@ -11,5 +18,14 @@ func update_card(): var next_seed_param := planter.get_plant_from_queue() nom.text = next_seed_param.type image.texture = next_seed_param.sprite_frames.get_frame_texture("GROWN", 0) - besoins.text = "w: [" + str(next_seed_param.water_need[0]) + ", " + str(next_seed_param.water_need[1]) + "]\nf: [" + str(next_seed_param.fertility_need[0]) + ", " + str(next_seed_param.fertility_need[1]) + "]" - apports.text = "w: " + str(next_seed_param.water_prod) + "\nf: " + str(next_seed_param.fertility_prod) + + waterNeeds.set_area(next_seed_param.water_need) + fertilityNeeds.set_area(next_seed_param.fertility_need) + var real_presence_need = next_seed_param.presence_need.map( + func(value): return value - GameTerrain.LEVELS_NUMBER/2 + ) + populationNeeds.set_area(real_presence_need) + + waterSupply.text = str(next_seed_param.water_prod) + fertilitySupply.text = str(next_seed_param.fertility_prod) + populationSupply.text = str(next_seed_param.presence_prod) diff --git a/scripts/gui/seed_queue.gd b/scripts/gui/seed_queue.gd index 3997352..3c0554f 100644 --- a/scripts/gui/seed_queue.gd +++ b/scripts/gui/seed_queue.gd @@ -1,7 +1,14 @@ extends Control @onready var next_seed: TextureRect = $HBoxContainer/NextSeed -@onready var queue: HBoxContainer = $HBoxContainer/Queue + +@onready var queue_image := [ + $HBoxContainer/Queue/Seed1, + $HBoxContainer/Queue/Seed2, + $HBoxContainer/Queue/Seed3, + $HBoxContainer/Queue/Seed4, + $HBoxContainer/Queue/Seed5, +] var planter: Planter @@ -9,7 +16,7 @@ func update_queue(): var next_seed_param := planter.get_plant_from_queue() next_seed.texture = next_seed_param.seed_sprite var index := 0 - for child in queue.get_children(): + for child in queue_image: var seed_param := planter.get_plant_from_queue(index) child.texture = seed_param.seed_sprite index += 1 diff --git a/scripts/gui/stats_area.gd b/scripts/gui/stats_area.gd new file mode 100644 index 0000000..924e666 --- /dev/null +++ b/scripts/gui/stats_area.gd @@ -0,0 +1,28 @@ +class_name StatsArea +extends CenterContainer + +@export var gradient : GradientTexture1D + +# Called when the node enters the scene tree for the first time. +func _ready(): + $Gradient.texture = gradient + +func set_area(need : Array): + var zone_grad := Gradient.new() + + zone_grad.interpolation_mode = Gradient.GRADIENT_INTERPOLATE_CONSTANT + + zone_grad.set_color(0, Color.BLACK) + zone_grad.set_color(1, Color.BLACK) + + var min = (float(need[0]) + GameTerrain.LEVELS_NUMBER/2)/GameTerrain.LEVELS_NUMBER + var max = (float(need[1]) + GameTerrain.LEVELS_NUMBER/2)/GameTerrain.LEVELS_NUMBER + + zone_grad.add_point(min, Color(0,0,0,0)) + zone_grad.add_point(max, Color.BLACK) + + var texture := GradientTexture1D.new() + + texture.gradient = zone_grad + + $Zone.texture = texture