Add building menu

This commit is contained in:
Ategon 2024-09-11 22:04:24 -04:00
parent 9b6fd32480
commit 8bb05c7400
31 changed files with 541 additions and 24 deletions

BIN
Ac437_IBM_BIOS.ttf Normal file

Binary file not shown.

34
Ac437_IBM_BIOS.ttf.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://d0or8uewq7xxw"
path="res://.godot/imported/Ac437_IBM_BIOS.ttf-7a48879b7e6558f138531588615d399b.fontdata"
[deps]
source_file="res://Ac437_IBM_BIOS.ttf"
dest_files=["res://.godot/imported/Ac437_IBM_BIOS.ttf-7a48879b7e6558f138531588615d399b.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={}

60
InfoWindow.tscn Normal file
View file

@ -0,0 +1,60 @@
[gd_scene load_steps=4 format=3 uid="uid://byyyhq3x8t2d8"]
[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"]
[node name="InfoWindow" type="Control"]
layout_mode = 3
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -226.0
offset_top = -133.0
offset_right = -13.0
offset_bottom = 133.0
grow_horizontal = 0
grow_vertical = 2
theme = ExtResource("1_emusj")
script = ExtResource("1_oy31s")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.0605303, 0.0605303, 0.0605303, 1)
[node name="RichTextLabel" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -93.5
offset_top = 14.0
offset_right = 103.5
offset_bottom = 44.0
grow_horizontal = 2
theme_override_font_sizes/normal_font_size = 16
bbcode_enabled = true
text = "[center]Test Title"
[node name="RichTextLabel2" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -83.5
offset_top = 36.0
offset_right = 83.5
offset_bottom = 66.0
grow_horizontal = 2
bbcode_enabled = true
text = "[center]Test Title"
[node name="ResourceAllocation" parent="." instance=ExtResource("3_r3oy0")]
layout_mode = 1

View file

@ -1,11 +1,12 @@
[gd_scene load_steps=11 format=3 uid="uid://5ske2hm55rce"]
[gd_scene load_steps=12 format=3 uid="uid://5ske2hm55rce"]
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_xbn5h"]
[ext_resource type="Texture2D" uid="uid://bsrh0u02bckhy" path="res://iso_building.png" id="3_qa5pv"]
[ext_resource type="Texture2D" uid="uid://bvn5lewpp7pmd" path="res://iso_tile.png" id="4_7pks7"]
[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="5_6lpdu"]
[ext_resource type="Script" path="res://tile_map.gd" id="5_v47eg"]
[ext_resource type="FontFile" uid="uid://ci8skg28ntp1b" path="res://MxPlus_IBM_VGA_9x8.ttf" id="6_6xfiq"]
[ext_resource type="PackedScene" uid="uid://byyyhq3x8t2d8" path="res://InfoWindow.tscn" id="7_f4xfy"]
[ext_resource type="PackedScene" uid="uid://b22pr3istdhcv" path="res://ui/BuildingMenu.tscn" id="7_hnxcf"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dxrqb"]
texture = ExtResource("4_7pks7")
@ -57,16 +58,18 @@ position = Vector2(318, 178)
shape = SubResource("CircleShape2D_s8q4l")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(-48, -46)
offset = Vector2(50, 150)
[node name="RichTextLabel" type="RichTextLabel" parent="."]
offset_left = 254.0
offset_top = -12.0
offset_right = 615.0
offset_bottom = 28.0
theme_override_fonts/normal_font = ExtResource("6_6xfiq")
theme_override_font_sizes/normal_font_size = 9
text = "Testing 123"
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="InfoWindow" parent="CanvasLayer" instance=ExtResource("7_f4xfy")]
[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
offset_right = 40.0
offset_bottom = 40.0
[node name="BuildingMenu" parent="CanvasLayer" instance=ExtResource("7_hnxcf")]
[connection signal="clicked" from="TileMap/MouseHandler" to="TileMap" method="_on_mouse_handler_clicked"]
[connection signal="rclicked" from="TileMap/MouseHandler" to="TileMap" method="_on_mouse_handler_rclicked"]

BIN
Qubi.ttf Normal file

Binary file not shown.

34
Qubi.ttf.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cq86fc0y2nf47"
path="res://.godot/imported/Qubi.ttf-ea5af37698a332827bba1729dadf0f79.fontdata"
[deps]
source_file="res://Qubi.ttf"
dest_files=["res://.godot/imported/Qubi.ttf-ea5af37698a332827bba1729dadf0f79.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={}

61
ResourceAllocation.tscn Normal file
View file

@ -0,0 +1,61 @@
[gd_scene load_steps=3 format=3 uid="uid://bsj3th0rsn7a8"]
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_5kjyf"]
[ext_resource type="Script" path="res://resource_allocation.gd" id="2_d6ufs"]
[node name="ResourceAllocation" type="Control"]
layout_mode = 3
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -54.5
offset_top = 30.0
offset_right = 54.5
offset_bottom = 70.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_5kjyf")
script = ExtResource("2_d6ufs")
[node name="ColorRect2" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_top = -10.0
offset_right = 20.0
offset_bottom = 10.0
grow_vertical = 2
color = Color(1, 0.419608, 0.447059, 1)
[node name="RichTextLabel" 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 = -4.0
offset_right = 36.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
bbcode_enabled = true
text = "[center]X/X"
[node name="ColorRect3" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -10.0
offset_bottom = 10.0
grow_horizontal = 0
grow_vertical = 2
color = Color(0.168627, 0.745098, 0.313726, 1)

View file

@ -15,7 +15,7 @@ script = ExtResource("1_nmkwm")
shape = SubResource("RectangleShape2D_4cq27")
[node name="Sprite2D" type="Sprite2D" parent="MouseControl"]
position = Vector2(5, 5)
position = Vector2(10, 10)
texture = ExtResource("2_bjcic")
[connection signal="area_entered" from="MouseControl" to="." method="_on_mouse_control_area_entered"]

View file

@ -25,7 +25,7 @@
"state": {
"type": "markdown",
"state": {
"file": "Matine before the Great Storm.md",
"file": "Buildings/Index.md",
"mode": "source",
"source": false
}
@ -112,7 +112,7 @@
"state": {
"type": "backlink",
"state": {
"file": "Matine before the Great Storm.md",
"file": "Buildings/Index.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -129,7 +129,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "Matine before the Great Storm.md",
"file": "Buildings/Index.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
@ -152,7 +152,7 @@
"state": {
"type": "outline",
"state": {
"file": "Matine before the Great Storm.md"
"file": "Buildings/Index.md"
}
}
}
@ -165,18 +165,18 @@
},
"left-ribbon": {
"hiddenItems": {
"switcher:Abrir selector rápido": false,
"graph:Abrir vista gráfica": false,
"canvas:Crear nuevo lienzo": false,
"daily-notes:Abrir la nota de hoy": false,
"templates:Insertar plantilla": false,
"command-palette:Abrir paleta de comandos": false
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"canvas:Create new canvas": false,
"daily-notes:Open today's daily note": false,
"templates:Insert template": false,
"command-palette:Open command palette": false
}
},
"active": "ced1d8fedf6a4457",
"lastOpenFiles": [
"Buildings/Index.md",
"Matine before the Great Storm.md",
"Buildings/Index.md",
"Lore",
"Buildings",
"Bienvenido.md"

11
info_window.gd Normal file
View file

@ -0,0 +1,11 @@
extends Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View file

@ -0,0 +1,6 @@
name: Essence Compressor
type: production
resource: essence
amount: 1
time: 10
max_workers: 6

View file

@ -0,0 +1,2 @@
name: Hunter's Post
type: utility

View file

@ -0,0 +1,2 @@
name: Kitchen
type: utility

View file

@ -0,0 +1,2 @@
name: House
type: housing

View file

@ -0,0 +1,2 @@
name: Quarter
type: housing

View file

@ -1 +1,6 @@
name: Stone Miner
type: production
resource: stone
amount: 1
time: 10
max_workers: 6

View file

@ -0,0 +1,2 @@
name: Tents
type: housing

View file

@ -0,0 +1,2 @@
name: Water Processor
type: utility

View file

@ -0,0 +1,2 @@
name: Water Pump
type: utility

View file

@ -1 +1,6 @@
name: Woodcutter
name: Lumber Mill
type: production
resource: wood
amount: 1
time: 10
max_workers: 6

7
resource_allocation.gd Normal file
View file

@ -0,0 +1,7 @@
extends Control
signal amount_changed(amount: int)
var key
var amount
var max

View file

@ -1,3 +1,7 @@
[gd_resource type="Theme" format=3 uid="uid://d035h7upxrw3h"]
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://d035h7upxrw3h"]
[ext_resource type="FontFile" uid="uid://cq86fc0y2nf47" path="res://Qubi.ttf" id="1_fvh8h"]
[resource]
default_font = ExtResource("1_fvh8h")
default_font_size = 8

4
ui/BuildingIcon.tscn Normal file
View file

@ -0,0 +1,4 @@
[gd_scene format=3 uid="uid://b7o2i7tgirg64"]
[node name="BuildingIcon" type="ColorRect"]
custom_minimum_size = Vector2(32, 32)

97
ui/BuildingMenu.tscn Normal file
View file

@ -0,0 +1,97 @@
[gd_scene load_steps=7 format=3 uid="uid://b22pr3istdhcv"]
[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="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"]
[node name="BuildingMenu" type="Control"]
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -63.0
offset_right = 186.0
grow_vertical = 0
theme = ExtResource("1_2qpq4")
script = ExtResource("1_nmos7")
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
offset_right = 184.0
offset_bottom = 17.0
theme_override_constants/separation = 0
[node name="BuildingTab" parent="HBoxContainer" instance=ExtResource("3_cpcpk")]
self_modulate = Color(1, 1, 1, 0.4)
layout_mode = 2
text = "Resources"
[node name="BuildingTab2" parent="HBoxContainer" instance=ExtResource("3_cpcpk")]
self_modulate = Color(1, 1, 1, 0.101961)
layout_mode = 2
key = "housing"
text = "Housing"
width = 44.0
[node name="BuildingTab3" parent="HBoxContainer" instance=ExtResource("3_cpcpk")]
self_modulate = Color(1, 1, 1, 0.101961)
layout_mode = 2
key = "utility"
text = "Utility"
width = 38.0
[node name="Buildings" type="TextureRect" parent="."]
self_modulate = Color(1, 1, 1, 0.392157)
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -46.0
offset_right = 184.0
grow_vertical = 0
texture = ExtResource("2_tml71")
[node name="VBoxContainer" type="HBoxContainer" parent="Buildings"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 8.0
offset_top = 7.0
offset_right = -8.0
offset_bottom = -7.0
grow_horizontal = 2
grow_vertical = 2
alignment = 1
[node name="BuildingIcon" parent="Buildings/VBoxContainer" instance=ExtResource("3_ol3gk")]
layout_mode = 2
color = Color(0.674815, 0.674815, 0.674815, 1)
[node name="Spacer" parent="Buildings/VBoxContainer" instance=ExtResource("3_ji0ar")]
layout_mode = 2
[node name="BuildingIcon2" parent="Buildings/VBoxContainer" instance=ExtResource("3_ol3gk")]
layout_mode = 2
color = Color(0.674815, 0.674815, 0.674815, 1)
[node name="Spacer2" parent="Buildings/VBoxContainer" instance=ExtResource("3_ji0ar")]
layout_mode = 2
[node name="BuildingIcon3" parent="Buildings/VBoxContainer" instance=ExtResource("3_ol3gk")]
layout_mode = 2
color = Color(0.674815, 0.674815, 0.674815, 1)
[node name="Spacer3" parent="Buildings/VBoxContainer" instance=ExtResource("3_ji0ar")]
layout_mode = 2
[node name="BuildingIcon4" parent="Buildings/VBoxContainer" instance=ExtResource("3_ol3gk")]
layout_mode = 2
color = Color(0.674815, 0.674815, 0.674815, 1)
[connection signal="clicked" from="HBoxContainer/BuildingTab" to="." method="_on_building_tab_clicked"]
[connection signal="clicked" from="HBoxContainer/BuildingTab2" to="." method="_on_building_tab_2_clicked"]
[connection signal="clicked" from="HBoxContainer/BuildingTab3" to="." method="_on_building_tab_3_clicked"]

40
ui/BuildingTab.tscn Normal file
View file

@ -0,0 +1,40 @@
[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="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"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f3h14"]
size = Vector2(46, 10)
[node name="BuildingTab" type="TextureRect"]
custom_minimum_size = Vector2(66, 14)
offset_right = 66.0
offset_bottom = 14.0
theme = ExtResource("1_2kci0")
texture = ExtResource("1_j8r6a")
expand_mode = 1
script = ExtResource("2_vatnx")
width = 55.5
[node name="RichTextLabel" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -3.0
offset_bottom = 46.0
grow_horizontal = 2
grow_vertical = 2
bbcode_enabled = true
text = "[center]Resource"
[node name="MouseHandler" parent="." instance=ExtResource("2_ona0j")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="MouseHandler"]
position = Vector2(33, 7)
shape = SubResource("RectangleShape2D_f3h14")
[connection signal="clicked" from="MouseHandler" to="." method="_on_mouse_handler_clicked"]

6
ui/Spacer.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://cqfr8d1b7pd6p"]
[node name="Spacer" type="Control"]
layout_mode = 3
anchors_preset = 0
size_flags_horizontal = 3

60
ui/building_menu.gd Normal file
View file

@ -0,0 +1,60 @@
extends Control
@onready var tabs = [
$HBoxContainer/BuildingTab, $HBoxContainer/BuildingTab2, $HBoxContainer/BuildingTab3
]
@onready var building_data = Data.data.buildings.values()
@onready var v_box_container: HBoxContainer = $Buildings/VBoxContainer
@onready var icons = [
$Buildings/VBoxContainer/BuildingIcon,
$Buildings/VBoxContainer/BuildingIcon2,
$Buildings/VBoxContainer/BuildingIcon3,
$Buildings/VBoxContainer/BuildingIcon4
]
@onready var spacers = [
$Buildings/VBoxContainer/Spacer,
$Buildings/VBoxContainer/Spacer2,
$Buildings/VBoxContainer/Spacer3
]
func _ready() -> void:
swap_to_tab(0)
func swap_to_tab(index):
for i in range(0, tabs.size()):
if i == index:
tabs[i].select()
else:
tabs[i].unselect()
var buildings = building_data.filter(func(a): return a.type == tabs[index].key)
for i in range(0, icons.size()):
if i < buildings.size():
icons[i].visible = true
if i > 0:
spacers[i - 1].visible = true
else:
icons[i].visible = false
if i > 0:
spacers[i - 1].visible = false
func _on_building_tab_clicked() -> void:
swap_to_tab(0)
func _on_building_tab_2_clicked() -> void:
swap_to_tab(1)
func _on_building_tab_3_clicked() -> void:
swap_to_tab(2)

32
ui/building_tab.gd Normal file
View file

@ -0,0 +1,32 @@
extends TextureRect
signal clicked
@export var key: String = "production"
@export var text: String = "Resource"
@export var width: float = 66
@onready var rich_text_label: RichTextLabel = $RichTextLabel
@onready var collision_shape_2d: CollisionShape2D = $MouseHandler/CollisionShape2D
func _ready() -> void:
rich_text_label.text = "[center]%s" % [text]
custom_minimum_size.x = width
collision_shape_2d.shape = RectangleShape2D.new()
collision_shape_2d.shape.size = Vector2(width - 20, 10)
collision_shape_2d.position.x = 33 - ((66 - width) / 2)
func _on_mouse_handler_clicked() -> void:
clicked.emit()
func select():
rich_text_label.self_modulate = Color(1, 1, 1, 1)
self_modulate = Color(1, 1, 1, 0.4)
func unselect():
rich_text_label.self_modulate = Color(1, 1, 1, 0.4)
self_modulate = Color(1, 1, 1, 0.1)

BIN
ui/buildingmeny.aseprite Normal file

Binary file not shown.

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://brrrxrf3phkqv"
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