Polish info window
This commit is contained in:
parent
3047e14916
commit
4c2ae4da13
7 changed files with 351 additions and 34 deletions
|
@ -143,7 +143,8 @@ func place_building():
|
||||||
Persister.persist_data("building_mode", false)
|
Persister.persist_data("building_mode", false)
|
||||||
building_data[tile] = {
|
building_data[tile] = {
|
||||||
"key": Persister.get_value("building_key"),
|
"key": Persister.get_value("building_key"),
|
||||||
"rand": rand
|
"rand": rand,
|
||||||
|
"level": level
|
||||||
}
|
}
|
||||||
|
|
||||||
var build_data = Data.data.buildings[Persister.get_value("building_key")]
|
var build_data = Data.data.buildings[Persister.get_value("building_key")]
|
||||||
|
@ -157,6 +158,10 @@ func place_building():
|
||||||
if build_data.type == "housing":
|
if build_data.type == "housing":
|
||||||
Persister.change_value("max_population", int(build_data.amount))
|
Persister.change_value("max_population", int(build_data.amount))
|
||||||
building_data[tile].max_population = int(build_data.amount)
|
building_data[tile].max_population = int(build_data.amount)
|
||||||
|
else:
|
||||||
|
building_data[tile].workers = 0
|
||||||
|
building_data[tile].max_workers = 6
|
||||||
|
building_data[tile].efficiency = 100
|
||||||
|
|
||||||
Persister.persist_data("drag_mode", false)
|
Persister.persist_data("drag_mode", false)
|
||||||
|
|
||||||
|
|
230
InfoWindow.tscn
230
InfoWindow.tscn
|
@ -1,9 +1,13 @@
|
||||||
[gd_scene load_steps=5 format=3 uid="uid://byyyhq3x8t2d8"]
|
[gd_scene load_steps=7 format=3 uid="uid://byyyhq3x8t2d8"]
|
||||||
|
|
||||||
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_emusj"]
|
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_emusj"]
|
||||||
[ext_resource type="Script" path="res://info_window.gd" id="1_oy31s"]
|
[ext_resource type="Script" path="res://info_window.gd" id="1_oy31s"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bsj3th0rsn7a8" path="res://ResourceAllocation.tscn" id="3_r3oy0"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cd205j7rs5ph7" path="res://ui/buildingmeny.png" id="3_wsa04"]
|
[ext_resource type="Texture2D" uid="uid://cd205j7rs5ph7" path="res://ui/buildingmeny.png" id="3_wsa04"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://gaiht2weca4g" path="res://parts/buildings/images/woodcutter.png" id="4_sb142"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="5_38jqb"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fnpfc"]
|
||||||
|
size = Vector2(15, 16)
|
||||||
|
|
||||||
[node name="InfoWindow" type="Control"]
|
[node name="InfoWindow" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
@ -42,7 +46,7 @@ offset_right = -2.0
|
||||||
offset_bottom = -2.0
|
offset_bottom = -2.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(0, 0, 0, 0.662745)
|
color = Color(0, 0, 0, 0.231373)
|
||||||
|
|
||||||
[node name="Icon" type="TextureRect" parent="."]
|
[node name="Icon" type="TextureRect" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@ -54,8 +58,10 @@ offset_top = 14.0
|
||||||
offset_right = 16.0
|
offset_right = 16.0
|
||||||
offset_bottom = 46.0
|
offset_bottom = 46.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
|
texture = ExtResource("4_sb142")
|
||||||
|
|
||||||
[node name="Title" type="RichTextLabel" parent="."]
|
[node name="Title" type="RichTextLabel" parent="."]
|
||||||
|
clip_contents = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 5
|
anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -65,11 +71,13 @@ offset_top = 53.0
|
||||||
offset_right = 120.5
|
offset_right = 120.5
|
||||||
offset_bottom = 83.0
|
offset_bottom = 83.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/outline_size = 6
|
||||||
theme_override_font_sizes/normal_font_size = 16
|
theme_override_font_sizes/normal_font_size = 16
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[center]Test Title"
|
text = "[center]Test Title"
|
||||||
|
|
||||||
[node name="Subtitle" type="RichTextLabel" parent="."]
|
[node name="Subtitle" type="RichTextLabel" parent="."]
|
||||||
|
clip_contents = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 5
|
anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -79,21 +87,229 @@ offset_top = 75.0
|
||||||
offset_right = 83.5
|
offset_right = 83.5
|
||||||
offset_bottom = 105.0
|
offset_bottom = 105.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[center]Test Title"
|
text = "[center]Test Title"
|
||||||
|
|
||||||
[node name="Description" type="RichTextLabel" parent="."]
|
[node name="Description" type="RichTextLabel" parent="."]
|
||||||
|
clip_contents = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 5
|
anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
offset_left = -83.5
|
offset_left = -83.5
|
||||||
offset_top = 90.0
|
offset_top = 105.0
|
||||||
offset_right = 83.5
|
offset_right = 83.5
|
||||||
offset_bottom = 162.0
|
offset_bottom = 177.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[center]Test Title"
|
|
||||||
|
|
||||||
[node name="ResourceAllocation" parent="." instance=ExtResource("3_r3oy0")]
|
[node name="ColorRect5" type="ColorRect" parent="."]
|
||||||
|
self_modulate = Color(1, 1, 1, 0.647059)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 192.0
|
||||||
|
offset_top = -128.0
|
||||||
|
offset_right = 208.0
|
||||||
|
offset_bottom = -112.0
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(8, 9)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="ColorRect5"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 2.0
|
||||||
|
offset_top = 5.0
|
||||||
|
offset_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]X"
|
||||||
|
|
||||||
|
[node name="MouseHandler3" parent="ColorRect5" instance=ExtResource("5_38jqb")]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ColorRect5/MouseHandler3"]
|
||||||
|
position = Vector2(8, 8)
|
||||||
|
shape = SubResource("RectangleShape2D_fnpfc")
|
||||||
|
|
||||||
|
[node name="ResourceAllocation" type="Control" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = 3.0
|
||||||
|
offset_top = 26.0
|
||||||
|
offset_right = 69.0
|
||||||
|
offset_bottom = 66.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme = ExtResource("1_emusj")
|
||||||
|
|
||||||
|
[node name="RichTextLabel2" type="RichTextLabel" parent="ResourceAllocation"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -36.0
|
||||||
|
offset_top = -3.0
|
||||||
|
offset_right = 36.0
|
||||||
|
offset_bottom = 21.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]X/X"
|
||||||
|
|
||||||
|
[node name="ColorRect2" type="ColorRect" parent="ResourceAllocation"]
|
||||||
|
self_modulate = Color(1, 1, 1, 0.647059)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_top = -8.0
|
||||||
|
offset_right = 16.0
|
||||||
|
offset_bottom = 8.0
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(7.5, 8)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="ResourceAllocation/ColorRect2"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 2.0
|
||||||
|
offset_top = 6.0
|
||||||
|
offset_bottom = 2.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]-"
|
||||||
|
|
||||||
|
[node name="MouseHandler" parent="ResourceAllocation/ColorRect2" instance=ExtResource("5_38jqb")]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ResourceAllocation/ColorRect2/MouseHandler"]
|
||||||
|
position = Vector2(8, 8)
|
||||||
|
shape = SubResource("RectangleShape2D_fnpfc")
|
||||||
|
|
||||||
|
[node name="ColorRect3" type="ColorRect" parent="ResourceAllocation"]
|
||||||
|
self_modulate = Color(1, 1, 1, 0.647059)
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 6
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -16.0
|
||||||
|
offset_top = -8.0
|
||||||
|
offset_bottom = 8.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
pivot_offset = Vector2(8.5, 8)
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="ResourceAllocation/ColorRect3"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
offset_left = 2.0
|
||||||
|
offset_top = 6.0
|
||||||
|
offset_bottom = 2.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]+"
|
||||||
|
|
||||||
|
[node name="MouseHandler2" parent="ResourceAllocation/ColorRect3" instance=ExtResource("5_38jqb")]
|
||||||
|
position = Vector2(-50, 0)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ResourceAllocation/ColorRect3/MouseHandler2"]
|
||||||
|
position = Vector2(8, 8)
|
||||||
|
shape = SubResource("RectangleShape2D_fnpfc")
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="ResourceAllocation"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -86.0
|
||||||
|
offset_top = -4.0
|
||||||
|
offset_right = -14.0
|
||||||
|
offset_bottom = 20.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "Workers"
|
||||||
|
|
||||||
|
[node name="Description2" type="RichTextLabel" parent="ResourceAllocation"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -119.5
|
||||||
|
offset_top = 46.0
|
||||||
|
offset_right = 47.5
|
||||||
|
offset_bottom = 118.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]STATUS: STOPPED"
|
||||||
|
|
||||||
|
[node name="Description3" type="RichTextLabel" parent="ResourceAllocation"]
|
||||||
|
clip_contents = false
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -119.5
|
||||||
|
offset_top = 61.0
|
||||||
|
offset_right = 47.5
|
||||||
|
offset_bottom = 133.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_constants/outline_size = 3
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]EFFICIENCY: 0%"
|
||||||
|
|
||||||
|
[node name="ColorRect4" type="ColorRect" parent="ResourceAllocation"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -105.5
|
||||||
|
offset_top = 78.0
|
||||||
|
offset_right = 33.5
|
||||||
|
offset_bottom = 80.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
|
||||||
|
[connection signal="clicked" from="ColorRect5/MouseHandler3" to="." method="_on_mouse_handler_3_clicked"]
|
||||||
|
[connection signal="hovered" from="ColorRect5/MouseHandler3" to="." method="_on_mouse_handler_3_hovered"]
|
||||||
|
[connection signal="unhovered" from="ColorRect5/MouseHandler3" to="." method="_on_mouse_handler_3_unhovered"]
|
||||||
|
[connection signal="clicked" from="ResourceAllocation/ColorRect2/MouseHandler" to="." method="_on_mouse_handler_clicked"]
|
||||||
|
[connection signal="hovered" from="ResourceAllocation/ColorRect2/MouseHandler" to="." method="_on_mouse_handler_hovered"]
|
||||||
|
[connection signal="unhovered" from="ResourceAllocation/ColorRect2/MouseHandler" to="." method="_on_mouse_handler_unhovered"]
|
||||||
|
[connection signal="clicked" from="ResourceAllocation/ColorRect3/MouseHandler2" to="." method="_on_mouse_handler_2_clicked"]
|
||||||
|
[connection signal="hovered" from="ResourceAllocation/ColorRect3/MouseHandler2" to="." method="_on_mouse_handler_2_hovered"]
|
||||||
|
[connection signal="unhovered" from="ResourceAllocation/ColorRect3/MouseHandler2" to="." method="_on_mouse_handler_2_unhovered"]
|
||||||
|
|
14
Main.tscn
14
Main.tscn
|
@ -496,9 +496,8 @@ key = "essence"
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="CanvasLayer/UI/Background"]
|
[node name="Control" type="Control" parent="CanvasLayer/UI/Background"]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = -28.0
|
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 12.0
|
offset_bottom = 40.0
|
||||||
|
|
||||||
[node name="WoodIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control"]
|
[node name="WoodIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
|
@ -526,9 +525,8 @@ key = "wood"
|
||||||
[node name="Control3" type="Control" parent="CanvasLayer/UI/Background"]
|
[node name="Control3" type="Control" parent="CanvasLayer/UI/Background"]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_left = 41.0
|
offset_left = 41.0
|
||||||
offset_top = -28.0
|
|
||||||
offset_right = 81.0
|
offset_right = 81.0
|
||||||
offset_bottom = 12.0
|
offset_bottom = 40.0
|
||||||
|
|
||||||
[node name="WoodIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control3"]
|
[node name="WoodIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control3"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
|
@ -554,9 +552,8 @@ script = ExtResource("16_knn3d")
|
||||||
|
|
||||||
[node name="Control2" type="Control" parent="CanvasLayer/UI/Background"]
|
[node name="Control2" type="Control" parent="CanvasLayer/UI/Background"]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_top = -28.0
|
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 12.0
|
offset_bottom = 40.0
|
||||||
|
|
||||||
[node name="StoneIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control2"]
|
[node name="StoneIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control2"]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
|
@ -635,12 +632,11 @@ script = ExtResource("13_fqswr")
|
||||||
key = "flood_level"
|
key = "flood_level"
|
||||||
|
|
||||||
[node name="InfoWindow" parent="CanvasLayer" instance=ExtResource("7_f4xfy")]
|
[node name="InfoWindow" parent="CanvasLayer" instance=ExtResource("7_f4xfy")]
|
||||||
visible = false
|
|
||||||
pivot_offset = Vector2(114, 128)
|
pivot_offset = Vector2(114, 128)
|
||||||
|
|
||||||
[node name="BuildingMenu" parent="CanvasLayer" instance=ExtResource("7_hnxcf")]
|
[node name="BuildingMenu" parent="CanvasLayer" instance=ExtResource("7_hnxcf")]
|
||||||
offset_top = 3.755
|
offset_top = 5.04999
|
||||||
offset_bottom = 66.755
|
offset_bottom = 68.05
|
||||||
|
|
||||||
[node name="Night" parent="CanvasLayer" instance=ExtResource("13_8fvl0")]
|
[node name="Night" parent="CanvasLayer" instance=ExtResource("13_8fvl0")]
|
||||||
modulate = Color(1, 1, 1, 0)
|
modulate = Color(1, 1, 1, 0)
|
||||||
|
|
|
@ -19,6 +19,22 @@ grow_vertical = 2
|
||||||
theme = ExtResource("1_5kjyf")
|
theme = ExtResource("1_5kjyf")
|
||||||
script = ExtResource("2_d6ufs")
|
script = ExtResource("2_d6ufs")
|
||||||
|
|
||||||
|
[node name="RichTextLabel2" type="RichTextLabel" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -36.0
|
||||||
|
offset_top = -3.0
|
||||||
|
offset_right = 36.0
|
||||||
|
offset_bottom = 21.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "[center]X/X"
|
||||||
|
|
||||||
[node name="ColorRect2" type="ColorRect" parent="."]
|
[node name="ColorRect2" type="ColorRect" parent="."]
|
||||||
self_modulate = Color(1, 1, 1, 0.647059)
|
self_modulate = Color(1, 1, 1, 0.647059)
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@ -79,11 +95,11 @@ anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = -36.0
|
offset_left = -86.0
|
||||||
offset_top = -3.0
|
offset_top = -4.0
|
||||||
offset_right = 36.0
|
offset_right = -14.0
|
||||||
offset_bottom = 21.0
|
offset_bottom = 20.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[center]X/X"
|
text = "Workers"
|
||||||
|
|
|
@ -6,12 +6,31 @@ var window_tween
|
||||||
@onready var title: RichTextLabel = $Title
|
@onready var title: RichTextLabel = $Title
|
||||||
@onready var subtitle: RichTextLabel = $Subtitle
|
@onready var subtitle: RichTextLabel = $Subtitle
|
||||||
@onready var description: RichTextLabel = $Description
|
@onready var description: RichTextLabel = $Description
|
||||||
|
@onready var rich_text_label_2: RichTextLabel = $ResourceAllocation/RichTextLabel2
|
||||||
|
@onready var resource_allocation: Control = $ResourceAllocation
|
||||||
|
@onready var description_3: RichTextLabel = $ResourceAllocation/Description3
|
||||||
|
@onready var color_rect_5: ColorRect = $ColorRect5
|
||||||
|
@onready var color_rect_2: ColorRect = $ResourceAllocation/ColorRect2
|
||||||
|
@onready var color_rect_3: ColorRect = $ResourceAllocation/ColorRect3
|
||||||
|
|
||||||
|
var recent_data
|
||||||
|
|
||||||
|
var close_tween
|
||||||
|
var minus_tween
|
||||||
|
var plus_tween
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Triggerer.listen("show_info", _show_info_window)
|
Triggerer.listen("show_info", _show_info_window)
|
||||||
Triggerer.listen("hide_info", _hide_info_window)
|
Triggerer.listen("hide_info", _hide_info_window)
|
||||||
scale = Vector2.ZERO
|
scale = Vector2.ZERO
|
||||||
|
Triggerer.listen("flood_level", _on_flood_level)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_flood_level(data):
|
||||||
|
var value = int(data.value)
|
||||||
|
|
||||||
|
if value >= recent_data.level:
|
||||||
|
Triggerer.trigger("hide_info")
|
||||||
|
|
||||||
|
|
||||||
func _show_info_window(data):
|
func _show_info_window(data):
|
||||||
|
@ -29,6 +48,15 @@ func _show_info_window(data):
|
||||||
window_tween.tween_property(self, "scale", Vector2.ZERO, 0.25)
|
window_tween.tween_property(self, "scale", Vector2.ZERO, 0.25)
|
||||||
window_tween.tween_callback(func():
|
window_tween.tween_callback(func():
|
||||||
title.text = "[center]%s" % [building_data.name]
|
title.text = "[center]%s" % [building_data.name]
|
||||||
|
icon.texture = Data.data.images[data.key]
|
||||||
|
subtitle.text = "[center]%s" % [building_data.short]
|
||||||
|
if data.has("workers"):
|
||||||
|
rich_text_label_2.text = "[center]%d/%d" % [data.workers, data.max_workers]
|
||||||
|
description_3.text = "[center]EFFICIENCY: %d%" % [data.efficiency]
|
||||||
|
resource_allocation.visible = true
|
||||||
|
else:
|
||||||
|
resource_allocation.visible = false
|
||||||
|
recent_data = data
|
||||||
)
|
)
|
||||||
window_tween.set_ease(Tween.EASE_OUT)
|
window_tween.set_ease(Tween.EASE_OUT)
|
||||||
window_tween.set_trans(Tween.TRANS_BACK)
|
window_tween.set_trans(Tween.TRANS_BACK)
|
||||||
|
@ -48,3 +76,59 @@ func _hide_info_window(_data):
|
||||||
window_tween.set_ease(Tween.EASE_IN)
|
window_tween.set_ease(Tween.EASE_IN)
|
||||||
window_tween.set_trans(Tween.TRANS_QUAD)
|
window_tween.set_trans(Tween.TRANS_QUAD)
|
||||||
window_tween.tween_property(self, "scale", Vector2.ZERO, 0.25)
|
window_tween.tween_property(self, "scale", Vector2.ZERO, 0.25)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_clicked() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_hovered() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_unhovered() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_2_clicked() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_2_hovered() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_2_unhovered() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_3_clicked() -> void:
|
||||||
|
Triggerer.trigger("hide_info")
|
||||||
|
|
||||||
|
if close_tween:
|
||||||
|
close_tween.kill()
|
||||||
|
|
||||||
|
close_tween = create_tween()
|
||||||
|
close_tween.set_trans(Tween.TRANS_QUAD)
|
||||||
|
close_tween.tween_property(color_rect_5, "scale", Vector2.ONE * 0.95, 0.125)
|
||||||
|
close_tween.tween_property(color_rect_5, "scale", Vector2.ONE, 0.125)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_3_hovered() -> void:
|
||||||
|
if close_tween:
|
||||||
|
close_tween.kill()
|
||||||
|
|
||||||
|
close_tween = create_tween()
|
||||||
|
close_tween.set_ease(Tween.EASE_OUT)
|
||||||
|
close_tween.set_trans(Tween.TRANS_BACK)
|
||||||
|
close_tween.tween_property(color_rect_5, "scale", Vector2.ONE * 1.05, 0.25)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_handler_3_unhovered() -> void:
|
||||||
|
if close_tween:
|
||||||
|
close_tween.kill()
|
||||||
|
|
||||||
|
close_tween = create_tween()
|
||||||
|
close_tween.set_ease(Tween.EASE_OUT)
|
||||||
|
close_tween.set_trans(Tween.TRANS_QUAD)
|
||||||
|
close_tween.tween_property(color_rect_5, "scale", Vector2.ONE, 0.25)
|
||||||
|
|
|
@ -22,8 +22,8 @@ func _process_custom_fx(char_fx: CharFXTransform) -> bool:
|
||||||
color_time += 1
|
color_time += 1
|
||||||
|
|
||||||
|
|
||||||
char_fx.color.a = (sin(color_time / 5 * PI)) * 0.3 + 0.7
|
char_fx.color.a = (sin(color_time / 5 * PI)) * 0.15 + 0.85
|
||||||
else:
|
else:
|
||||||
char_fx.color.a = 0.7
|
char_fx.color.a = 0.85
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -46,13 +46,13 @@ anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
offset_left = -42.0
|
offset_left = -42.0
|
||||||
offset_top = -34.0
|
offset_top = -36.0
|
||||||
offset_right = 42.0
|
offset_right = 42.0
|
||||||
offset_bottom = -3.0
|
offset_bottom = -3.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
scale = Vector2(1e-05, 1e-05)
|
scale = Vector2(1e-05, 1e-05)
|
||||||
pivot_offset = Vector2(42, 15)
|
pivot_offset = Vector2(42, 15)
|
||||||
color = Color(0, 0, 0, 0.47451)
|
color = Color(0.311223, 0.367304, 0.380485, 0.768627)
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="ColorRect"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="ColorRect"]
|
||||||
modulate = Color(1, 0.85098, 0.776471, 1)
|
modulate = Color(1, 0.85098, 0.776471, 1)
|
||||||
|
@ -62,9 +62,9 @@ anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
offset_left = -43.0
|
offset_left = -43.0
|
||||||
offset_top = 1.0
|
offset_top = 2.0
|
||||||
offset_right = 43.0
|
offset_right = 43.0
|
||||||
offset_bottom = 41.0
|
offset_bottom = 42.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_constants/outline_size = 3
|
theme_override_constants/outline_size = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
@ -78,9 +78,9 @@ anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
offset_left = -43.0
|
offset_left = -43.0
|
||||||
offset_top = 8.0
|
offset_top = 9.0
|
||||||
offset_right = 43.0
|
offset_right = 43.0
|
||||||
offset_bottom = 48.0
|
offset_bottom = 49.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_constants/outline_size = 3
|
theme_override_constants/outline_size = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
@ -93,9 +93,9 @@ anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
offset_left = -43.0
|
offset_left = -43.0
|
||||||
offset_top = 15.0
|
offset_top = 16.0
|
||||||
offset_right = 43.0
|
offset_right = 43.0
|
||||||
offset_bottom = 55.0
|
offset_bottom = 56.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_constants/outline_size = 3
|
theme_override_constants/outline_size = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
@ -107,9 +107,9 @@ anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
offset_left = -43.0
|
offset_left = -43.0
|
||||||
offset_top = 22.0
|
offset_top = 23.0
|
||||||
offset_right = 43.0
|
offset_right = 43.0
|
||||||
offset_bottom = 62.0
|
offset_bottom = 63.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
theme_override_constants/outline_size = 3
|
theme_override_constants/outline_size = 3
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
|
|
Loading…
Reference in a new issue