Merge branch 'top_ui'
This commit is contained in:
commit
d994deb90f
12 changed files with 205 additions and 9 deletions
|
@ -3,7 +3,7 @@
|
|||
[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="PackedScene" uid="uid://bsj3th0rsn7a8" path="res://ResourceAllocation.tscn" id="3_r3oy0"]
|
||||
[ext_resource type="Texture2D" uid="uid://brrrxrf3phkqv" path="res://ui/buildingmeny.png" id="3_wsa04"]
|
||||
[ext_resource type="Texture2D" uid="uid://cd205j7rs5ph7" path="res://ui/buildingmeny.png" id="3_wsa04"]
|
||||
|
||||
[node name="InfoWindow" type="Control"]
|
||||
layout_mode = 3
|
||||
|
|
13
Main.tscn
13
Main.tscn
|
@ -1,5 +1,7 @@
|
|||
[gd_scene load_steps=8 format=4 uid="uid://5ske2hm55rce"]
|
||||
[gd_scene load_steps=10 format=4 uid="uid://5ske2hm55rce"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://n2lpy72tkyc8" path="res://storm/StormManager.tscn" id="1_gcxt1"]
|
||||
[ext_resource type="PackedScene" uid="uid://bxctpr0tfqidf" path="res://ui/UI.tscn" id="1_ve2mn"]
|
||||
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_xbn5h"]
|
||||
[ext_resource type="TileSet" uid="uid://dhy53lakrlutm" path="res://TIleSet.tres" id="2_68wnv"]
|
||||
[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="5_6lpdu"]
|
||||
|
@ -12,6 +14,8 @@ size = Vector2(324, 314)
|
|||
|
||||
[node name="Main" type="Node2D"]
|
||||
|
||||
[node name="StormManager" parent="." instance=ExtResource("1_gcxt1")]
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
|
@ -65,6 +69,13 @@ shape = SubResource("RectangleShape2D_57goo")
|
|||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="UI" parent="CanvasLayer" instance=ExtResource("1_ve2mn")]
|
||||
anchors_preset = 15
|
||||
anchor_bottom = 1.0
|
||||
offset_bottom = 0.0
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_xbn5h")
|
||||
|
||||
[node name="InfoWindow" parent="CanvasLayer" instance=ExtResource("7_f4xfy")]
|
||||
pivot_offset = Vector2(114, 128)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ extends Node
|
|||
|
||||
@onready var globals = Data.data.globals
|
||||
|
||||
|
||||
var game_time = 0
|
||||
var last_flood_time = 0
|
||||
var current_flood_state = 0
|
||||
|
|
|
@ -85,7 +85,7 @@ func _process(delta):
|
|||
|
||||
for x in GridSize:
|
||||
for y in GridSize:
|
||||
if !Dic[str(Vector2(x,y))].get("Placed"):
|
||||
if Dic.has(str(Vector2(x,y))) and !Dic[str(Vector2(x,y))].get("Placed"):
|
||||
erase_cell(Dic[str(Vector2(x,y))].get("Layer"), Vector2(x,y))
|
||||
|
||||
if Dic.has(str(tile)):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_2qpq4"]
|
||||
[ext_resource type="Script" path="res://ui/building_menu.gd" id="1_nmos7"]
|
||||
[ext_resource type="Texture2D" uid="uid://brrrxrf3phkqv" path="res://ui/buildingmeny.png" id="2_tml71"]
|
||||
[ext_resource type="Texture2D" uid="uid://cd205j7rs5ph7" path="res://ui/buildingmeny.png" id="2_tml71"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqvue0h7wc0mx" path="res://ui/BuildingTab.tscn" id="3_cpcpk"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqfr8d1b7pd6p" path="res://ui/Spacer.tscn" id="3_ji0ar"]
|
||||
[ext_resource type="PackedScene" uid="uid://b7o2i7tgirg64" path="res://ui/BuildingIcon.tscn" id="3_ol3gk"]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bqvue0h7wc0mx"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_2kci0"]
|
||||
[ext_resource type="Texture2D" uid="uid://brrrxrf3phkqv" path="res://ui/buildingmeny.png" id="1_j8r6a"]
|
||||
[ext_resource type="Texture2D" uid="uid://cd205j7rs5ph7" path="res://ui/buildingmeny.png" id="1_j8r6a"]
|
||||
[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="2_ona0j"]
|
||||
[ext_resource type="Script" path="res://ui/building_tab.gd" id="2_vatnx"]
|
||||
|
||||
|
|
142
ui/UI.tscn
Normal file
142
ui/UI.tscn
Normal file
|
@ -0,0 +1,142 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bxctpr0tfqidf"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_fcqle"]
|
||||
[ext_resource type="Texture2D" uid="uid://cd205j7rs5ph7" 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://6bpdb3npejtx" path="res://ui/stone_icon.png" id="2_vo570"]
|
||||
[ext_resource type="Texture2D" uid="uid://byx0ivnwice1e" path="res://ui/wood_icon.png" id="3_ohuq3"]
|
||||
[ext_resource type="Texture2D" uid="uid://rtrb5p3o61i4" 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
|
||||
grow_horizontal = 2
|
||||
theme = ExtResource("1_fcqle")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LeftCounters" type="HBoxContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Resources" type="MarginContainer" parent="HBoxContainer/LeftCounters"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Background" type="NinePatchRect" parent="HBoxContainer/LeftCounters/Resources"]
|
||||
custom_minimum_size = Vector2(168, 24)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
texture = ExtResource("1_xpu1e")
|
||||
region_rect = Rect2(-0.458088, -0.349636, 186.046, 47.2991)
|
||||
|
||||
[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="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_right = 55.0
|
||||
offset_bottom = 24.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
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)
|
||||
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)
|
||||
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="RightCounters" type="MarginContainer" parent="HBoxContainer/RightCounters"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Background" type="NinePatchRect" parent="HBoxContainer/RightCounters/RightCounters"]
|
||||
custom_minimum_size = Vector2(113, 24)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("1_xpu1e")
|
||||
region_rect = Rect2(1.19859, 0.999939, 182.287, 45.1203)
|
||||
|
||||
[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="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_right = 55.0
|
||||
offset_bottom = 24.0
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
text = "000"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("2_ei01o")
|
||||
|
||||
[node name="FloodLevelCountLabel" type="Label" parent="HBoxContainer/RightCounters/RightCounters/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)
|
||||
text = "000"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("2_ei01o")
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://brrrxrf3phkqv"
|
||||
uid="uid://cd205j7rs5ph7"
|
||||
path="res://.godot/imported/buildingmeny.png-ec30ba3f3cfa707d601ffd2165a5ab3d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
42
ui/counters.gd
Normal file
42
ui/counters.gd
Normal 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))
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://baxweme4kyald"
|
||||
uid="uid://rtrb5p3o61i4"
|
||||
path="res://.godot/imported/essence_icon.png-2ff4decd1d74f99d981c04fec76d6306.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cngxjjfl3i0b3"
|
||||
uid="uid://6bpdb3npejtx"
|
||||
path="res://.godot/imported/stone_icon.png-71774b19e906290b7d47dfd58bfc7e58.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c554jwofq0tdf"
|
||||
uid="uid://byx0ivnwice1e"
|
||||
path="res://.godot/imported/wood_icon.png-2710b2152aec1c69f3e7c85f9132128c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
|
Loading…
Reference in a new issue