rework game settings

master
Fabien Freling 2020-06-04 18:17:35 +02:00
parent e08bf5deef
commit 5f84111cdd
8 changed files with 137 additions and 37 deletions

View File

@ -0,0 +1,8 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[sub_resource type="DynamicFontData" id=1]
font_path = "res://assets/fonts/OpenSans-ExtraBold.ttf"
[resource]
size = 28
font_data = SubResource( 1 )

Binary file not shown.

View File

@ -0,0 +1,8 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[sub_resource type="DynamicFontData" id=1]
font_path = "res://assets/fonts/OpenSans-SemiBold.ttf"
[resource]
size = 24
font_data = SubResource( 1 )

Binary file not shown.

View File

@ -21,6 +21,9 @@ anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Button" type="Button" parent="."]
anchor_right = 1.0

View File

@ -74,7 +74,6 @@ rect_min_size = Vector2( 0, 70 )
text = "Hints"
[node name="NewGamePanel" parent="." instance=ExtResource( 3 )]
visible = false
rect_pivot_offset = Vector2( 4, 4 )
[connection signal="state_changed" from="GridContainer/Taquin" to="." method="_on_Taquin_state_changed"]
[connection signal="pressed" from="GridContainer/VBoxContainer/New Game" to="." method="_on_New_game_pressed"]

View File

@ -27,11 +27,14 @@ onready var popup = $"."
onready var panel = $Panel
onready var edit_panel = $EditPanel
onready var tween = $Tween
onready var easy_button = $Panel/Difficulty/Easy
onready var normal_button = $Panel/Difficulty/Normal
onready var hard_button = $Panel/Difficulty/Hard
onready var custom_button = $Panel/Difficulty/Custom
onready var difficulty_container = $Panel/VBoxContainer/Difficulty
onready var easy_button = $Panel/VBoxContainer/Difficulty/Easy
onready var normal_button = $Panel/VBoxContainer/Difficulty/Normal
onready var hard_button = $Panel/VBoxContainer/Difficulty/Hard
onready var custom_button = $Panel/VBoxContainer/HBoxContainer/Custom
onready var edit_button = $Panel/Edit
onready var columns_spinbox = $EditPanel/VBoxContainer/Columns/SpinBox
onready var rows_spinbox = $EditPanel/VBoxContainer/Rows/SpinBox
onready var iterations_spinbox = $EditPanel/VBoxContainer/Iterations/SpinBox
@ -57,6 +60,14 @@ func _ready():
panel.show()
edit_panel.hide()
edit_button.hide()
var button_max_width: int = $EditPanel/VBoxContainer.rect_size.x / 4
var button_width := min(200, button_max_width)
print_debug("button max width = ", button_max_width)
easy_button.rect_min_size.x = button_width
normal_button.rect_min_size.x = button_width
hard_button.rect_min_size.x = button_width
custom_button.rect_min_size.x = button_width
func fade_in():
rect_pivot_offset = rect_size / 2
@ -112,7 +123,30 @@ func _update_description():
rows = rows_spinbox.value as int
iterations = iterations_spinbox.value as int
$Panel/Description.text = "Dimension: %d x %d\nIterations: %d" % [columns, rows, iterations]
var desc: RichTextLabel = $Panel/VBoxContainer/HBoxContainer/Description
# $Panel/Description.text = "Dimension: %d x %d\nIterations: %d" % [columns, rows, iterations]
desc.clear()
desc.push_align(RichTextLabel.ALIGN_CENTER)
desc.add_text("Board: ")
desc.push_bold()
desc.add_text("%d" % [columns])
desc.pop()
desc.add_text(" x ")
desc.push_bold()
desc.add_text("%d" % [rows])
desc.pop()
desc.newline()
desc.add_text("Shuffle: ")
desc.push_bold()
desc.add_text("%d" % [iterations])
desc.pop()
#
# Signals

View File

@ -1,19 +1,24 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://assets/taqin_theme.tres" type="Theme" id=1]
[ext_resource path="res://src/difficulty_buttongroup.tres" type="ButtonGroup" id=2]
[ext_resource path="res://src/NewGamePanel.gd" type="Script" id=3]
[ext_resource path="res://src/DepthButton.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets/fonts/OpenSans-SemiBold-24.tres" type="DynamicFont" id=5]
[ext_resource path="res://assets/fonts/OpenSans-ExtraBold-28.tres" type="DynamicFont" id=6]
[sub_resource type="StyleBoxFlat" id=1]
[sub_resource type="StyleBoxFlat" id=4]
bg_color = Color( 1, 0.831373, 0.639216, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
[sub_resource type="StyleBoxEmpty" id=2]
[sub_resource type="StyleBoxEmpty" id=3]
[node name="NewGamePanel" type="PopupPanel"]
visible = true
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 512, 300 )
@ -31,71 +36,109 @@ margin_left = 4.0
margin_top = 4.0
margin_right = -4.0
margin_bottom = -4.0
custom_styles/panel = SubResource( 1 )
rect_clip_content = true
custom_styles/panel = SubResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Difficulty" type="HBoxContainer" parent="Panel"]
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
anchor_right = 1.0
margin_top = 20.0
anchor_bottom = 1.0
margin_left = 15.0
margin_top = 15.0
margin_right = -15.0
margin_bottom = -15.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Difficulty" type="HBoxContainer" parent="Panel/VBoxContainer"]
margin_right = 986.0
margin_bottom = 70.0
rect_min_size = Vector2( 0, 70 )
rect_clip_content = true
size_flags_horizontal = 3
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Easy" parent="Panel/Difficulty" instance=ExtResource( 4 )]
[node name="Easy" parent="Panel/VBoxContainer/Difficulty" instance=ExtResource( 4 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 96.0
margin_right = 296.0
margin_bottom = 80.0
margin_left = 185.0
margin_right = 385.0
margin_bottom = 70.0
rect_min_size = Vector2( 200, 70 )
text = "Easy"
corner_type = 1
toggle_mode = true
group = ExtResource( 2 )
[node name="Normal" parent="Panel/Difficulty" instance=ExtResource( 4 )]
[node name="Normal" parent="Panel/VBoxContainer/Difficulty" instance=ExtResource( 4 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 304.0
margin_right = 504.0
margin_bottom = 80.0
margin_left = 393.0
margin_right = 593.0
margin_bottom = 70.0
rect_min_size = Vector2( 200, 70 )
text = "Normal"
corner_type = 2
toggle_mode = true
group = ExtResource( 2 )
[node name="Hard" parent="Panel/Difficulty" instance=ExtResource( 4 )]
[node name="Hard" parent="Panel/VBoxContainer/Difficulty" instance=ExtResource( 4 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 512.0
margin_right = 712.0
margin_bottom = 80.0
margin_left = 601.0
margin_right = 801.0
margin_bottom = 70.0
rect_min_size = Vector2( 200, 70 )
text = "Hard"
corner_type = 2
corner_type = 3
toggle_mode = true
group = ExtResource( 2 )
[node name="Custom" parent="Panel/Difficulty" instance=ExtResource( 4 )]
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"]
margin_top = 78.0
margin_right = 986.0
margin_bottom = 148.0
[node name="Description" type="RichTextLabel" parent="Panel/VBoxContainer/HBoxContainer"]
modulate = Color( 0.733333, 0.34902, 0.0666667, 1 )
margin_right = 778.0
margin_bottom = 70.0
rect_min_size = Vector2( 200, 0 )
size_flags_horizontal = 3
custom_fonts/bold_font = ExtResource( 6 )
custom_fonts/normal_font = ExtResource( 5 )
custom_constants/line_separation = -8
text = "Dimensions: 5 x x 3
Iterations: 10"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Custom" parent="Panel/VBoxContainer/HBoxContainer" instance=ExtResource( 4 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 720.0
margin_right = 920.0
margin_bottom = 80.0
margin_left = 786.0
margin_right = 986.0
margin_bottom = 70.0
rect_min_size = Vector2( 200, 70 )
text = "Custom"
corner_type = 3
toggle_mode = true
group = ExtResource( 2 )
[node name="Start" parent="Panel" instance=ExtResource( 4 )]
anchor_left = 1.0
anchor_top = 1.0
margin_left = -235.0
margin_top = -138.0
margin_left = -220.0
margin_top = -90.0
margin_right = -20.0
margin_bottom = -20.0
rect_min_size = Vector2( 200, 70 )
text = "Start"
[node name="Cancel" type="Button" parent="Panel"]
@ -106,6 +149,8 @@ margin_top = -90.0
margin_right = 220.0
margin_bottom = -20.0
rect_min_size = Vector2( 200, 70 )
custom_styles/pressed = SubResource( 2 )
custom_styles/focus = SubResource( 3 )
text = "Cancel"
flat = true
__meta__ = {
@ -113,10 +158,13 @@ __meta__ = {
}
[node name="Description" type="Label" parent="Panel"]
visible = false
margin_left = 95.676
margin_top = 144.404
margin_right = 135.676
margin_bottom = 189.404
rect_min_size = Vector2( 400, 0 )
custom_fonts/font = ExtResource( 5 )
text = "Dimension: 4x4
Iterations: 5"
__meta__ = {
@ -139,7 +187,7 @@ margin_left = 4.0
margin_top = 4.0
margin_right = -4.0
margin_bottom = -4.0
custom_styles/panel = SubResource( 1 )
custom_styles/panel = SubResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
@ -261,10 +309,10 @@ __meta__ = {
[node name="Tween" type="Tween" parent="."]
[connection signal="about_to_show" from="." to="." method="_on_NewGamePanel_about_to_show"]
[connection signal="pressed" from="Panel/Difficulty/Easy" to="." method="_on_Easy_pressed"]
[connection signal="pressed" from="Panel/Difficulty/Normal" to="." method="_on_Normal_pressed"]
[connection signal="pressed" from="Panel/Difficulty/Hard" to="." method="_on_Hard_pressed"]
[connection signal="toggled" from="Panel/Difficulty/Custom" to="." method="_on_Custom_toggled"]
[connection signal="pressed" from="Panel/VBoxContainer/Difficulty/Easy" to="." method="_on_Easy_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/Difficulty/Normal" to="." method="_on_Normal_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/Difficulty/Hard" to="." method="_on_Hard_pressed"]
[connection signal="toggled" from="Panel/VBoxContainer/HBoxContainer/Custom" to="." method="_on_Custom_toggled"]
[connection signal="pressed" from="Panel/Start" to="." method="_on_Start_pressed"]
[connection signal="pressed" from="Panel/Cancel" to="." method="_on_Cancel_pressed"]
[connection signal="pressed" from="Panel/Edit" to="." method="_on_Edit_pressed"]