cleanup, folder restructure and ui restructure

This commit is contained in:
Luca 2024-09-20 19:32:32 +02:00
parent 6ce579026b
commit b24117740b
28 changed files with 473 additions and 367 deletions

View file

@ -0,0 +1,7 @@
extends MarginContainer
class_name IngameControls
signal menu_button_clicked
func _on_menu_button_pressed() -> void:
menu_button_clicked.emit()

View file

@ -0,0 +1,73 @@
[gd_scene load_steps=7 format=3 uid="uid://1anjhvi173g3"]
[ext_resource type="Script" path="res://scenes/ui/ingame_controls.gd" id="1_iw1sp"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="1_wr5sh"]
[ext_resource type="Script" path="res://scripts/joystick.gd" id="2_pyri2"]
[ext_resource type="Texture2D" uid="uid://8anyvhkcy4ng" path="res://assets/textures/Xbox Series/Vector/xbox_button_a.svg" id="3_lgi8v"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_uoef2"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nfkty"]
bg_color = Color(0, 0, 0, 0.196078)
corner_radius_top_left = 999
corner_radius_top_right = 999
corner_radius_bottom_right = 999
corner_radius_bottom_left = 999
[node name="IngameControls" type="MarginContainer"]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -484.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 30
theme_override_constants/margin_bottom = 30
script = ExtResource("1_iw1sp")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 32
[node name="MenuButton" type="Button" parent="VBoxContainer"]
self_modulate = Color(0, 0, 0, 0.392157)
custom_minimum_size = Vector2(200, 200)
layout_mode = 2
size_flags_horizontal = 0
theme_override_styles/focus = SubResource("StyleBoxEmpty_uoef2")
icon = ExtResource("1_wr5sh")
flat = true
icon_alignment = 1
expand_icon = true
[node name="JoystickPanel" type="Panel" parent="VBoxContainer"]
custom_minimum_size = Vector2(400, 400)
layout_mode = 2
size_flags_horizontal = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_nfkty")
script = ExtResource("2_pyri2")
[node name="Thumbstick" type="TextureRect" parent="VBoxContainer/JoystickPanel"]
self_modulate = Color(0, 0, 0, 0.392157)
custom_minimum_size = Vector2(200, 200)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -32.0
offset_right = 32.0
offset_bottom = 32.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_lgi8v")
stretch_mode = 5
[connection signal="pressed" from="VBoxContainer/MenuButton" to="." method="_on_menu_button_pressed"]
[connection signal="gui_input" from="VBoxContainer/JoystickPanel" to="VBoxContainer/JoystickPanel" method="_on_gui_input"]
[connection signal="resized" from="VBoxContainer/JoystickPanel" to="VBoxContainer/JoystickPanel" method="_on_resized"]

67
scenes/ui/main_menu.tscn Normal file
View file

@ -0,0 +1,67 @@
[gd_scene load_steps=3 format=3 uid="uid://dt00rjsodtady"]
[ext_resource type="Texture2D" uid="uid://b6ylra30qxf30" path="res://assets/logo/logo.png" id="1_1fmce"]
[ext_resource type="FontFile" uid="uid://bjaavdnopfh0q" path="res://assets/fonts/aoboshi_one/AoboshiOne-Regular.ttf" id="2_aqmkw"]
[node name="MainMenu" type="Control"]
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 50
[node name="Logo" type="TextureRect" parent="VBoxContainer"]
layout_mode = 2
texture = ExtResource("1_1fmce")
expand_mode = 4
stretch_mode = 5
[node name="Label" type="Label" parent="VBoxContainer/Logo"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -23.0
grow_horizontal = 2
grow_vertical = 0
theme_override_colors/font_color = Color(0.945573, 0.745802, 0.348774, 1)
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
theme_override_constants/outline_size = 30
theme_override_fonts/font = ExtResource("2_aqmkw")
theme_override_font_sizes/font_size = 70
text = "MONSTER
FANGEN"
horizontal_alignment = 1
max_lines_visible = 2
[node name="MenuButtons" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
[node name="NewGameButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "New Game"
[node name="ContinueGameButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Continue"
[node name="OptionsButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Options"
[node name="ExitButton" type="Button" parent="VBoxContainer/MenuButtons"]
layout_mode = 2
text = "Exit"

View file

@ -0,0 +1,71 @@
[gd_scene load_steps=5 format=3 uid="uid://bbvbnrcjatkrb"]
[ext_resource type="Script" path="res://scripts/monster_list.gd" id="1_jk76e"]
[ext_resource type="FontFile" uid="uid://bjaavdnopfh0q" path="res://assets/fonts/aoboshi_one/AoboshiOne-Regular.ttf" id="2_hunv3"]
[ext_resource type="Texture2D" uid="uid://c737p2osplq2o" path="res://assets/textures/Xbox Series/Vector/xbox_button_x_outline.svg" id="3_08jy5"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_co4a0"]
bg_color = Color(0.9, 0.9, 0.9, 1)
corner_radius_top_left = 64
corner_radius_top_right = 64
corner_radius_bottom_right = 64
corner_radius_bottom_left = 64
[node name="MonsterList" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_jk76e")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 100
theme_override_constants/margin_top = 150
theme_override_constants/margin_right = 100
theme_override_constants/margin_bottom = 100
[node name="PanelContainer" type="PanelContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_co4a0")
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/PanelContainer"]
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 32
[node name="Label" type="Label" parent="MarginContainer/PanelContainer/VBoxContainer/MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_fonts/font = ExtResource("2_hunv3")
theme_override_font_sizes/font_size = 50
text = "Your Monsters"
horizontal_alignment = 1
vertical_alignment = 1
[node name="MonsterListEntryContainer" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
[node name="MarginContainer2" type="MarginContainer" parent="MarginContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_bottom = 32
[node name="CloseButton" type="Button" parent="MarginContainer/PanelContainer/VBoxContainer/MarginContainer2"]
unique_name_in_owner = true
self_modulate = Color(0, 0, 0, 1)
custom_minimum_size = Vector2(150, 150)
layout_mode = 2
size_flags_horizontal = 4
icon = ExtResource("3_08jy5")
flat = true
icon_alignment = 1
expand_icon = true
[connection signal="pressed" from="MarginContainer/PanelContainer/VBoxContainer/MarginContainer2/CloseButton" to="." method="_on_close_button_pressed"]

View file

@ -0,0 +1,28 @@
extends HBoxContainer
class_name MonsterListEntry
# 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
func populate(monster) -> void:
# thumbnail
# id
# name
# level
# health
# healthprogress
# experience
%MonsterID.text = str(0)
%MonsterName.text = monster.name
%MonsterLevel.text = "Lvl. %s" % monster.level
%HealthProgressBar.value = monster.health
%HealthProgressBar.max_value = monster.max_health
%ExperienceProgressBar.value = monster.experience
%ExperienceProgressBar.max_value = monster.experience_for_next_level

View file

@ -0,0 +1,107 @@
[gd_scene load_steps=9 format=3 uid="uid://brp2sljqnkuhe"]
[ext_resource type="Texture2D" uid="uid://b6ylra30qxf30" path="res://assets/logo/logo.png" id="1_16gb7"]
[ext_resource type="Script" path="res://scenes/ui/monster_list_entry.gd" id="1_spojl"]
[ext_resource type="Texture2D" uid="uid://2vxx2waofxpw" path="res://assets/textures/Xbox Series/Vector/xbox_button_menu_outline.svg" id="2_5n4ar"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s3mod"]
content_margin_top = 24.0
bg_color = Color(0.4, 0.5, 0.455, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_nb1sm"]
bg_color = Color(0, 0.843137, 0.466667, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fkb5g"]
content_margin_top = 12.0
bg_color = Color(0.4, 0.466667, 0.5, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_b4pov"]
bg_color = Color(0, 0.56, 0.84, 1)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x2rfb"]
[node name="MonsterListEntry" type="HBoxContainer"]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 72.0
grow_horizontal = 2
script = ExtResource("1_spojl")
[node name="Thumbnail" type="TextureRect" parent="."]
unique_name_in_owner = true
custom_minimum_size = Vector2(70, 70)
layout_mode = 2
texture = ExtResource("1_16gb7")
expand_mode = 3
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
[node name="NameAndLevelContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="MonsterID" type="Label" parent="VBoxContainer/NameAndLevelContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
text = "ID"
vertical_alignment = 1
[node name="MonsterName" type="Label" parent="VBoxContainer/NameAndLevelContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 40
text = "Name"
vertical_alignment = 1
[node name="MonsterLevel" type="Label" parent="VBoxContainer/NameAndLevelContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 8
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 40
text = "Lvl"
vertical_alignment = 1
[node name="ProgressBarContainer" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_constants/separation = 0
[node name="HealthProgressBar" type="ProgressBar" parent="VBoxContainer/ProgressBarContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme_override_styles/background = SubResource("StyleBoxFlat_s3mod")
theme_override_styles/fill = SubResource("StyleBoxFlat_nb1sm")
step = 1.0
rounded = true
show_percentage = false
[node name="ExperienceProgressBar" type="ProgressBar" parent="VBoxContainer/ProgressBarContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_fkb5g")
theme_override_styles/fill = SubResource("StyleBoxFlat_b4pov")
step = 1.0
rounded = true
show_percentage = false
[node name="SwapPositionButton" type="Button" parent="."]
unique_name_in_owner = true
self_modulate = Color(0, 0, 0, 1)
custom_minimum_size = Vector2(150, 150)
layout_mode = 2
size_flags_horizontal = 8
theme_override_styles/focus = SubResource("StyleBoxEmpty_x2rfb")
icon = ExtResource("2_5n4ar")
flat = true
icon_alignment = 1
expand_icon = true

22
scenes/ui/ui.gd Normal file
View file

@ -0,0 +1,22 @@
extends CanvasLayer
class_name UI
@onready var monster_list: MarginContainer = %MonsterList
# 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
func _on_ingame_controls_menu_button_clicked() -> void:
monster_list.visible = true
# Updates the whole UI
func _update_ui() -> void:
# Updating the monster list
monster_list._update_monster_list()
print("UI updated")

30
scenes/ui/ui.tscn Normal file
View file

@ -0,0 +1,30 @@
[gd_scene load_steps=6 format=3 uid="uid://b5y7pdfe6ougf"]
[ext_resource type="Script" path="res://scenes/ui/ui.gd" id="1_vyi3s"]
[ext_resource type="Script" path="res://scripts/camera_controls.gd" id="1_x56x6"]
[ext_resource type="PackedScene" uid="uid://dt00rjsodtady" path="res://scenes/ui/main_menu.tscn" id="3_tcmm8"]
[ext_resource type="PackedScene" uid="uid://1anjhvi173g3" path="res://scenes/ui/ingame_controls.tscn" id="4_likk0"]
[ext_resource type="PackedScene" uid="uid://bbvbnrcjatkrb" path="res://scenes/ui/monster_list.tscn" id="5_qjqu1"]
[node name="UI" type="CanvasLayer"]
script = ExtResource("1_vyi3s")
[node name="CameraControlArea" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_x56x6")
[node name="MainMenu" parent="." instance=ExtResource("3_tcmm8")]
[node name="IngameControls" parent="." instance=ExtResource("4_likk0")]
[node name="MonsterList" parent="." instance=ExtResource("5_qjqu1")]
unique_name_in_owner = true
visible = false
[connection signal="gui_input" from="CameraControlArea" to="CameraControlArea" method="_on_gui_input"]
[connection signal="menu_button_clicked" from="IngameControls" to="." method="_on_ingame_controls_menu_button_clicked"]