Fix tower menu layout & Add game stats layout

This commit is contained in:
Moe Poi ~ 2023-10-07 17:21:58 +07:00
parent 06d2a6bb94
commit dd21191eb3
10 changed files with 239 additions and 32 deletions

BIN
assets/icons/health.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View file

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

BIN
assets/icons/label_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

View file

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

BIN
assets/icons/pause.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://derifasksdfub"
path="res://.godot/imported/pause.png-379e7f6da7dfcf892b36c0ac65c6e5bc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/icons/pause.png"
dest_files=["res://.godot/imported/pause.png-379e7f6da7dfcf892b36c0ac65c6e5bc.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,10 +1,11 @@
[gd_scene load_steps=11 format=3 uid="uid://btdewn34d67m"]
[gd_scene load_steps=12 format=3 uid="uid://btdewn34d67m"]
[ext_resource type="Script" path="res://scripts/stages/1/game_manager.gd" id="1_aosti"]
[ext_resource type="Texture2D" uid="uid://cnxj0mf3luxo" path="res://assets/tileset/ashlands/tf_A5_ashlands_3.png" id="2_1njjc"]
[ext_resource type="Texture2D" uid="uid://danbfdqmqu23q" path="res://assets/tileset/ashlands/tf_B_ashlands_3.png" id="3_l5wod"]
[ext_resource type="Script" path="res://scripts/stages/1/summon.gd" id="4_gt08o"]
[ext_resource type="PackedScene" uid="uid://cd5r1v6f8hahx" path="res://scenes/ui/tower_menu.tscn" id="5_3w5lp"]
[ext_resource type="PackedScene" uid="uid://cy88k4uxt1v37" path="res://scenes/ui/game_stats.tscn" id="6_hbxxi"]
[ext_resource type="PackedScene" uid="uid://bvoenhbaqiqj2" path="res://scenes/towers/placement/placement.tscn" id="6_mao4r"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7yb1o"]
@ -550,6 +551,8 @@ one_shot = true
[node name="TowerMenu" parent="CanvasLayer" instance=ExtResource("5_3w5lp")]
visible = false
[node name="GameStats" parent="CanvasLayer" instance=ExtResource("6_hbxxi")]
[node name="Placements" type="Node2D" parent="."]
[node name="placement" parent="Placements" instance=ExtResource("6_mao4r")]

91
scenes/ui/game_stats.tscn Normal file
View file

@ -0,0 +1,91 @@
[gd_scene load_steps=4 format=3 uid="uid://cy88k4uxt1v37"]
[ext_resource type="Texture2D" uid="uid://d2d7ab8q2vik4" path="res://assets/icons/label_bg.png" id="1_1gxsd"]
[ext_resource type="Texture2D" uid="uid://derifasksdfub" path="res://assets/icons/pause.png" id="2_imq5h"]
[ext_resource type="Texture2D" uid="uid://e8dmiy1xr5g3" path="res://assets/icons/health.png" id="3_r1i66"]
[node name="GameStats" type="Control"]
layout_mode = 3
anchors_preset = 10
anchor_right = 1.0
offset_right = -2.0
offset_bottom = 51.0
grow_horizontal = 2
[node name="Resources" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 981.0
offset_top = 7.0
offset_right = 1125.0
offset_bottom = 42.0
texture = ExtResource("1_1gxsd")
[node name="Label" type="Label" parent="Resources"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
text = "999999999"
horizontal_alignment = 1
vertical_alignment = 1
[node name="PauseButton" type="TextureButton" 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 = -20.0
offset_top = -22.5
offset_right = 2028.0
offset_bottom = 2025.5
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.02, 0.02)
texture_normal = ExtResource("2_imq5h")
[node name="Health" type="NinePatchRect" parent="."]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 17.0
offset_top = -14.5
offset_right = 238.0
offset_bottom = 20.5
grow_vertical = 2
texture = ExtResource("1_1gxsd")
[node name="GridContainer" type="GridContainer" parent="Health"]
layout_mode = 0
offset_right = 3608.0
offset_bottom = 1200.0
scale = Vector2(0.03, 0.03)
columns = 6
[node name="Health" type="TextureRect" parent="Health/GridContainer"]
layout_mode = 2
texture = ExtResource("3_r1i66")
[node name="Health2" type="TextureRect" parent="Health/GridContainer"]
layout_mode = 2
texture = ExtResource("3_r1i66")
[node name="Health3" type="TextureRect" parent="Health/GridContainer"]
layout_mode = 2
texture = ExtResource("3_r1i66")
[node name="Health4" type="TextureRect" parent="Health/GridContainer"]
layout_mode = 2
texture = ExtResource("3_r1i66")
[node name="Health5" type="TextureRect" parent="Health/GridContainer"]
layout_mode = 2
texture = ExtResource("3_r1i66")
[node name="Health6" type="TextureRect" parent="Health/GridContainer"]
layout_mode = 2
texture = ExtResource("3_r1i66")

View file

@ -39,69 +39,80 @@ grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_55n31")
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
[node name="MarginContainer" type="MarginContainer" parent="Panel"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"]
layout_mode = 2
theme = ExtResource("1_s4ty6")
theme_override_constants/separation = 30
[node name="Top" type="HBoxContainer" parent="Panel/VBoxContainer"]
[node name="Top" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 125
[node name="MenuTitle" type="Label" parent="Panel/VBoxContainer/Top"]
[node name="MenuTitle" type="Label" parent="Panel/MarginContainer/VBoxContainer/Top"]
layout_mode = 2
size_flags_horizontal = 3
text = " Build/Upgrade Tower"
[node name="Close" type="Button" parent="Panel/VBoxContainer/Top"]
[node name="Close" type="Button" parent="Panel/MarginContainer/VBoxContainer/Top"]
layout_mode = 2
text = "X"
flat = true
[node name="Middle" type="HBoxContainer" parent="Panel/VBoxContainer"]
[node name="Middle" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="TowerOption" type="TextureButton" parent="Panel/VBoxContainer/Middle"]
[node name="TowerOption" type="TextureButton" parent="Panel/MarginContainer/VBoxContainer/Middle"]
layout_mode = 2
size_flags_horizontal = 6
theme = SubResource("Theme_6r0bt")
texture_normal = ExtResource("3_3pes3")
[node name="TowerOption2" type="TextureButton" parent="Panel/VBoxContainer/Middle"]
[node name="TowerOption2" type="TextureButton" parent="Panel/MarginContainer/VBoxContainer/Middle"]
layout_mode = 2
size_flags_horizontal = 6
theme = SubResource("Theme_6r0bt")
texture_normal = ExtResource("4_8q3ud")
[node name="Bottom" type="HBoxContainer" parent="Panel/VBoxContainer"]
[node name="Bottom" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 60
alignment = 1
[node name="TowerName" type="Label" parent="Panel/VBoxContainer/Bottom"]
[node name="TowerName" type="Label" parent="Panel/MarginContainer/VBoxContainer/Bottom"]
layout_mode = 2
size_flags_horizontal = 6
text = "Cannon"
[node name="TowerName2" type="Label" parent="Panel/VBoxContainer/Bottom"]
[node name="TowerName2" type="Label" parent="Panel/MarginContainer/VBoxContainer/Bottom"]
layout_mode = 2
size_flags_horizontal = 6
text = "Railgun"
[node name="Nether" type="HBoxContainer" parent="Panel/VBoxContainer"]
[node name="Nether" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 75
alignment = 1
[node name="TowerPrice" type="Label" parent="Panel/VBoxContainer/Nether"]
[node name="TowerPrice" type="Label" parent="Panel/MarginContainer/VBoxContainer/Nether"]
layout_mode = 2
size_flags_horizontal = 6
text = "10000"
[node name="TowerPrice2" type="Label" parent="Panel/VBoxContainer/Nether"]
[node name="TowerPrice2" type="Label" parent="Panel/MarginContainer/VBoxContainer/Nether"]
layout_mode = 2
size_flags_horizontal = 6
text = "20000"
[connection signal="pressed" from="Panel/VBoxContainer/Top/Close" to="." method="_on_close_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/Middle/TowerOption" to="." method="_on_tower_option_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/Middle/TowerOption2" to="." method="_on_tower_option_2_pressed"]
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/Top/Close" to="." method="_on_close_pressed"]
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/Middle/TowerOption" to="." method="_on_tower_option_pressed"]
[connection signal="pressed" from="Panel/MarginContainer/VBoxContainer/Middle/TowerOption2" to="." method="_on_tower_option_2_pressed"]

View file

@ -39,28 +39,28 @@ func show_menu(tower_id, pos, tower_placement_id, disabled, disabled_2):
if tower_id != null:
current_tower_id = tower_id
$Panel/VBoxContainer/Middle/TowerOption2.hide()
$Panel/VBoxContainer/Bottom/TowerName2.hide()
$Panel/VBoxContainer/Nether/TowerPrice2.hide()
$Panel/MarginContainer/VBoxContainer/Middle/TowerOption2.hide()
$Panel/MarginContainer/VBoxContainer/Bottom/TowerName2.hide()
$Panel/MarginContainer/VBoxContainer/Nether/TowerPrice2.hide()
else:
$Panel/VBoxContainer/Middle/TowerOption2.show()
$Panel/VBoxContainer/Bottom/TowerName2.show()
$Panel/VBoxContainer/Nether/TowerPrice2.show()
$Panel/MarginContainer/VBoxContainer/Middle/TowerOption2.show()
$Panel/MarginContainer/VBoxContainer/Bottom/TowerName2.show()
$Panel/MarginContainer/VBoxContainer/Nether/TowerPrice2.show()
var image = config.menu[current_tower_id]['image']
if current_disabled:
image = config.menu[current_tower_id]['image_disabled']
$Panel/VBoxContainer/Middle/TowerOption.set_texture_normal(image)
$Panel/VBoxContainer/Bottom/TowerName.text = config.menu[current_tower_id]['name']
$Panel/VBoxContainer/Nether/TowerPrice.text = str(config.menu[current_tower_id]['price'])
$Panel/MarginContainer/VBoxContainer/Middle/TowerOption.set_texture_normal(image)
$Panel/MarginContainer/VBoxContainer/Bottom/TowerName.text = config.menu[current_tower_id]['name']
$Panel/MarginContainer/VBoxContainer/Nether/TowerPrice.text = str(config.menu[current_tower_id]['price'])
var image_2 = config.menu[current_tower_id_2]['image']
if current_disabled_2:
image_2 = config.menu[current_tower_id_2]['image_disabled']
$Panel/VBoxContainer/Middle/TowerOption2.set_texture_normal(image_2)
$Panel/VBoxContainer/Bottom/TowerName2.text = config.menu[current_tower_id_2]['name']
$Panel/VBoxContainer/Nether/TowerPrice2.text = str(config.menu[current_tower_id_2]['price'])
$Panel/MarginContainer/VBoxContainer/Middle/TowerOption2.set_texture_normal(image_2)
$Panel/MarginContainer/VBoxContainer/Bottom/TowerName2.text = config.menu[current_tower_id_2]['name']
$Panel/MarginContainer/VBoxContainer/Nether/TowerPrice2.text = str(config.menu[current_tower_id_2]['price'])
show()