Changed UI layout

This commit is contained in:
zcembbi 2024-09-14 04:16:14 +03:00
parent e116ac4769
commit 7cfc81b16c
12 changed files with 255 additions and 84 deletions

View file

@ -1,9 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://bxctpr0tfqidf"]
[gd_scene load_steps=6 format=3 uid="uid://bxctpr0tfqidf"]
[ext_resource type="Texture2D" uid="uid://dsy18stvo2pu5" path="res://ui/ui-elements.png" id="1_cx752"]
[ext_resource type="Script" path="res://ui/number.gd" id="2_ei01o"]
[ext_resource type="Texture2D" uid="uid://da07wjahj050a" path="res://ui/buildingmeny.png" id="1_xpu1e"]
[ext_resource type="Script" path="res://ui/counters.gd" id="2_ei01o"]
[ext_resource type="Texture2D" uid="uid://cnylchr2m3lx1" path="res://ui/stone_icon.png" id="2_vo570"]
[ext_resource type="Texture2D" uid="uid://baqdyxvrx4655" path="res://ui/wood_icon.png" id="3_ohuq3"]
[ext_resource type="Texture2D" uid="uid://54f6pl5653xw" path="res://ui/essence_icon.png" id="4_7fjj4"]
[node name="UI" type="MarginContainer"]
custom_minimum_size = Vector2(640, 360)
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 44.0
@ -16,90 +20,126 @@ layout_mode = 2
layout_mode = 2
size_flags_horizontal = 3
[node name="FloodLevel" type="MarginContainer" parent="HBoxContainer/LeftCounters"]
[node name="Resources" type="MarginContainer" parent="HBoxContainer/LeftCounters"]
layout_mode = 2
[node name="Background" type="NinePatchRect" parent="HBoxContainer/LeftCounters/FloodLevel"]
custom_minimum_size = Vector2(160, 40)
[node name="Background" type="NinePatchRect" parent="HBoxContainer/LeftCounters/Resources"]
custom_minimum_size = Vector2(168, 24)
layout_mode = 2
texture = ExtResource("1_cx752")
region_rect = Rect2(779.878, 10.1175, 231.253, 25.8529)
size_flags_vertical = 0
texture = ExtResource("1_xpu1e")
region_rect = Rect2(-0.458088, -0.349636, 186.046, 47.2991)
[node name="Title" type="Label" parent="HBoxContainer/LeftCounters/FloodLevel/Background"]
layout_mode = 2
offset_top = 9.0
offset_right = 112.0
offset_bottom = 32.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "Flood Level:"
horizontal_alignment = 1
[node name="StoneIcon" type="TextureRect" parent="HBoxContainer/LeftCounters/Resources/Background"]
layout_mode = 0
offset_left = 10.0
offset_right = 34.0
offset_bottom = 24.0
texture = ExtResource("2_vo570")
expand_mode = 2
[node name="Number" type="Label" parent="HBoxContainer/LeftCounters/FloodLevel/Background"]
[node name="WoodIcon" type="TextureRect" parent="HBoxContainer/LeftCounters/Resources/Background"]
layout_mode = 0
offset_left = 65.0
offset_right = 89.0
offset_bottom = 24.0
texture = ExtResource("3_ohuq3")
expand_mode = 2
[node name="EssenceIcon" type="TextureRect" parent="HBoxContainer/LeftCounters/Resources/Background"]
layout_mode = 0
offset_left = 120.0
offset_right = 144.0
offset_bottom = 24.0
texture = ExtResource("4_7fjj4")
expand_mode = 2
[node name="StoneCountLabel" type="Label" parent="HBoxContainer/LeftCounters/Resources/Background"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 112.0
offset_top = 9.0
offset_right = 148.0
offset_bottom = 32.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
offset_right = 55.0
offset_bottom = 24.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 12
text = "000"
horizontal_alignment = 2
vertical_alignment = 1
script = ExtResource("2_ei01o")
[node name="WoodCountLabel" type="Label" parent="HBoxContainer/LeftCounters/Resources/Background"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 55.0
offset_right = 110.0
offset_bottom = 24.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 12
text = "000"
horizontal_alignment = 2
vertical_alignment = 1
script = ExtResource("2_ei01o")
[node name="EssenceCountLabel" type="Label" parent="HBoxContainer/LeftCounters/Resources/Background"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 110.0
offset_right = 165.0
offset_bottom = 24.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 12
text = "000"
horizontal_alignment = 2
vertical_alignment = 1
script = ExtResource("2_ei01o")
[node name="RightCounters" type="VBoxContainer" parent="HBoxContainer"]
layout_direction = 2
layout_mode = 2
[node name="Population" type="MarginContainer" parent="HBoxContainer/RightCounters"]
[node name="RightCounters" type="MarginContainer" parent="HBoxContainer/RightCounters"]
layout_mode = 2
[node name="Background" type="NinePatchRect" parent="HBoxContainer/RightCounters/Population"]
custom_minimum_size = Vector2(160, 20)
[node name="Background" type="NinePatchRect" parent="HBoxContainer/RightCounters/RightCounters"]
custom_minimum_size = Vector2(113, 24)
layout_mode = 2
texture = ExtResource("1_cx752")
region_rect = Rect2(779.878, 10.1175, 231.253, 25.8529)
texture = ExtResource("1_xpu1e")
region_rect = Rect2(1.19859, 0.999939, 182.287, 45.1203)
[node name="Title" type="Label" parent="HBoxContainer/RightCounters/Population/Background"]
layout_mode = 2
offset_top = -2.0
offset_right = 112.0
offset_bottom = 21.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "Population:"
horizontal_alignment = 1
[node name="PopulationIcon" type="TextureRect" parent="HBoxContainer/RightCounters/RightCounters/Background"]
layout_mode = 0
offset_left = 10.0
offset_right = 34.0
offset_bottom = 24.0
expand_mode = 2
[node name="Number" type="Label" parent="HBoxContainer/RightCounters/Population/Background"]
[node name="FloodLevelIcon" type="TextureRect" parent="HBoxContainer/RightCounters/RightCounters/Background"]
layout_mode = 0
offset_left = 65.0
offset_right = 89.0
offset_bottom = 24.0
expand_mode = 2
[node name="PopulationCountLabel" type="Label" parent="HBoxContainer/RightCounters/RightCounters/Background"]
unique_name_in_owner = true
layout_mode = 2
offset_left = 112.0
offset_top = -1.0
offset_right = 148.0
offset_bottom = 22.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "10"
offset_right = 55.0
offset_bottom = 24.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 12
text = "000"
horizontal_alignment = 2
vertical_alignment = 1
script = ExtResource("2_ei01o")
[node name="Resources" type="MarginContainer" parent="HBoxContainer/RightCounters"]
[node name="FloodLevelCountLabel" type="Label" parent="HBoxContainer/RightCounters/RightCounters/Background"]
unique_name_in_owner = true
layout_mode = 2
[node name="Background" type="NinePatchRect" parent="HBoxContainer/RightCounters/Resources"]
custom_minimum_size = Vector2(160, 20)
layout_mode = 2
texture = ExtResource("1_cx752")
region_rect = Rect2(779.878, 10.1175, 231.253, 25.8529)
[node name="Title" type="Label" parent="HBoxContainer/RightCounters/Resources/Background"]
layout_mode = 2
offset_top = -2.0
offset_right = 112.0
offset_bottom = 21.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "Resources:"
horizontal_alignment = 1
[node name="Number" type="Label" parent="HBoxContainer/RightCounters/Resources/Background"]
layout_mode = 2
offset_left = 112.0
offset_top = -1.0
offset_right = 148.0
offset_bottom = 22.0
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "10"
offset_left = 55.0
offset_right = 110.0
offset_bottom = 24.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_font_sizes/font_size = 12
text = "000"
horizontal_alignment = 2
vertical_alignment = 1
script = ExtResource("2_ei01o")

BIN
ui/buildingmeny.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://da07wjahj050a"
path="res://.godot/imported/buildingmeny.png-ec30ba3f3cfa707d601ffd2165a5ab3d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ui/buildingmeny.png"
dest_files=["res://.godot/imported/buildingmeny.png-ec30ba3f3cfa707d601ffd2165a5ab3d.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

42
ui/counters.gd Normal file
View file

@ -0,0 +1,42 @@
extends Label
@onready var stone_count_label: Label = %StoneCountLabel
@onready var wood_count_label: Label = %WoodCountLabel
@onready var essence_count_label: Label = %EssenceCountLabel
@onready var population_count_label: Label = %PopulationCountLabel
@onready var flood_level_count_label: Label = %FloodLevelCountLabel
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var stone_count = 1
var wood_count = 2
var essence_count = 3
var population_count = 4
var flood_count = Persister.get_value("flood_level")
if stone_count:
stone_count_label.set_text(str(stone_count))
else:
stone_count_label.set_text(str(0))
if wood_count:
wood_count_label.set_text(str(wood_count))
else:
wood_count_label.set_text(str(0))
if essence_count:
essence_count_label.set_text(str(essence_count))
else:
essence_count_label.set_text(str(0))
if population_count:
population_count_label.set_text(str(population_count))
else:
population_count_label.set_text(str(0))
if flood_count:
flood_level_count_label.set_text(str(flood_count))
else:
flood_level_count_label.set_text(str(0))

BIN
ui/essence_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://54f6pl5653xw"
path="res://.godot/imported/essence_icon.png-2ff4decd1d74f99d981c04fec76d6306.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ui/essence_icon.png"
dest_files=["res://.godot/imported/essence_icon.png-2ff4decd1d74f99d981c04fec76d6306.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

View file

@ -1,13 +0,0 @@
extends Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var floodlevel = Persister.get_value("flood_level")
if floodlevel:
set_text(str(floodlevel))
else:
set_text(str(0))

BIN
ui/stone_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

View file

@ -2,16 +2,16 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://dsy18stvo2pu5"
path="res://.godot/imported/ui-elements.png-9343eafe24264ca7277498c1badb542f.ctex"
uid="uid://cnylchr2m3lx1"
path="res://.godot/imported/stone_icon.png-71774b19e906290b7d47dfd58bfc7e58.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ui/ui-elements.png"
dest_files=["res://.godot/imported/ui-elements.png-9343eafe24264ca7277498c1badb542f.ctex"]
source_file="res://ui/stone_icon.png"
dest_files=["res://.godot/imported/stone_icon.png-71774b19e906290b7d47dfd58bfc7e58.ctex"]
[params]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

BIN
ui/wood_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

34
ui/wood_icon.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://baqdyxvrx4655"
path="res://.godot/imported/wood_icon.png-2710b2152aec1c69f3e7c85f9132128c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ui/wood_icon.png"
dest_files=["res://.godot/imported/wood_icon.png-2710b2152aec1c69f3e7c85f9132128c.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