Merge branch 'develop'

This commit is contained in:
erkkon 2023-07-20 22:18:26 +02:00
commit b455203cad
3 changed files with 56 additions and 18 deletions

View file

@ -29,6 +29,10 @@ window/size/borderless=true
window/stretch/mode="viewport" window/stretch/mode="viewport"
window/stretch/aspect="expand" window/stretch/aspect="expand"
[gui]
theme/default_theme_scale=4.0
[input] [input]
left={ left={

View file

@ -13,40 +13,50 @@ script = ExtResource("1_lgjmg")
[node name="MarginContainer" type="MarginContainer" parent="."] [node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 0 layout_mode = 0
offset_right = 40.0 offset_right = 83.0
offset_bottom = 40.0 offset_bottom = 151.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2 layout_mode = 2
[node name="Play" type="Button" parent="MarginContainer/VBoxContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
[node name="Play" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Play" text = "Play"
[node name="ResolutionLabel" type="Label" parent="MarginContainer/VBoxContainer"] [node name="ResolutionLabel" type="Label" parent="MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Resolution" text = "Resolution"
[node name="QualitySlider" type="HSlider" parent="MarginContainer/VBoxContainer"] [node name="QualitySlider" type="HSlider" parent="MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
min_value = 0.25 min_value = 0.25
max_value = 2.0 max_value = 2.0
step = 0.05 step = 0.05
value = 1.0 value = 1.0
[node name="Options" type="Button" parent="MarginContainer/VBoxContainer"] [node name="Options" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Options" text = "Options"
[node name="OptionButton" type="OptionButton" parent="MarginContainer/VBoxContainer"] [node name="OptionButton" type="OptionButton" parent="MarginContainer/HBoxContainer/VBoxContainer"]
visible = false visible = false
layout_mode = 2 layout_mode = 2
[node name="Quit" type="Button" parent="MarginContainer/VBoxContainer"] [node name="Quit" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Quit" text = "Quit"
[connection signal="pressed" from="MarginContainer/VBoxContainer/Play" to="." method="_on_play_pressed"] [node name="VBoxContainer2" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
[connection signal="value_changed" from="MarginContainer/VBoxContainer/QualitySlider" to="." method="_on_quality_slider_value_changed"] layout_mode = 2
[connection signal="item_selected" from="MarginContainer/VBoxContainer/OptionButton" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"] [node name="Control" type="Control" parent="."]
layout_mode = 2
anchors_preset = 0
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer/Play" to="." method="_on_play_pressed"]
[connection signal="value_changed" from="MarginContainer/HBoxContainer/VBoxContainer/QualitySlider" to="." method="_on_quality_slider_value_changed"]
[connection signal="item_selected" from="MarginContainer/HBoxContainer/VBoxContainer/OptionButton" to="." method="_on_option_button_item_selected"]
[connection signal="pressed" from="MarginContainer/HBoxContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

View file

@ -1,8 +1,8 @@
extends Control extends Control
@onready var ResOptionButton = $MarginContainer/VBoxContainer/OptionButton @onready var ResOptionButton = $MarginContainer/HBoxContainer/VBoxContainer/OptionButton
@onready var resolution_label := $MarginContainer/VBoxContainer/ResolutionLabel @onready var resolution_label := $MarginContainer/HBoxContainer/VBoxContainer/ResolutionLabel
@onready var gamelist := $MarginContainer/HBoxContainer/VBoxContainer2
#var Resoltuions: Dictionary = { #var Resoltuions: Dictionary = {
# "3840x2160" : Vector2(3840,2160), # "3840x2160" : Vector2(3840,2160),
@ -10,12 +10,35 @@ extends Control
# "1920x1080" : Vector2(1920,1080) # "1920x1080" : Vector2(1920,1080)
# } # }
var models3d = [
"3d_head_level_v1",
"3d_multiple_basic_targets_movement_v1",
"3d_multiple_basic_targets_v1",
"3d_multiple_medium_targets_v1"
]
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
# AddResolutions() # AddResolutions()
AddGames()
get_viewport().size_changed.connect(self.update_resolution_label) get_viewport().size_changed.connect(self.update_resolution_label)
update_resolution_label() update_resolution_label()
func AddGames():
for model in models3d:
var button = Button.new()
# button.texture = preload("assets/images/" + model)
button.text = model
button.name = model
button.pressed.connect(startTraining.bind(button.name))
gamelist.add_child(button)
func startTraining(type):
Global.game_type = type
get_tree().change_scene_to_file("res://scenes/levels/World.tscn")
#func AddResolutions(): #func AddResolutions():
# var count = 0 # var count = 0
# for resolution in Resoltuions: # for resolution in Resoltuions:
@ -36,8 +59,9 @@ func update_resolution_label() -> void:
func _on_play_pressed(): func _on_play_pressed():
get_tree().change_scene_to_file("res://scenes/levels/World.tscn") var random_index = randi() % models3d.size()
Global.game_type = "3d_multiple_basic_targets_movement_v1" var random_element = models3d[random_index]
startTraining(random_element)
#func _on_option_button_item_selected(index): #func _on_option_button_item_selected(index):