connect missing options in menu
This commit is contained in:
34
Gui.tscn
34
Gui.tscn
@@ -1,16 +1,6 @@
|
|||||||
[gd_scene load_steps=4 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Oswald-Bold.otf" type="DynamicFontData" id=1]
|
[ext_resource path="res://font.tres" type="DynamicFont" id=1]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
|
||||||
size = 19
|
|
||||||
font_data = ExtResource( 1 )
|
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=2]
|
|
||||||
size = 34
|
|
||||||
outline_size = 2
|
|
||||||
outline_color = Color( 0.25098, 0.25098, 0.25098, 1 )
|
|
||||||
font_data = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="GUI" type="MarginContainer"]
|
[node name="GUI" type="MarginContainer"]
|
||||||
margin_left = 10.5631
|
margin_left = 10.5631
|
||||||
@@ -19,20 +9,18 @@ margin_right = 159.563
|
|||||||
margin_bottom = 59.2427
|
margin_bottom = 59.2427
|
||||||
|
|
||||||
[node name="Laps" type="HBoxContainer" parent="."]
|
[node name="Laps" type="HBoxContainer" parent="."]
|
||||||
margin_right = 148.0
|
margin_right = 155.0
|
||||||
margin_bottom = 50.0
|
margin_bottom = 66.0
|
||||||
|
|
||||||
[node name="Text" type="Label" parent="Laps"]
|
[node name="Text" type="Label" parent="Laps"]
|
||||||
margin_top = 11.0
|
margin_right = 125.0
|
||||||
margin_right = 50.0
|
margin_bottom = 66.0
|
||||||
margin_bottom = 38.0
|
custom_fonts/font = ExtResource( 1 )
|
||||||
custom_fonts/font = SubResource( 1 )
|
|
||||||
text = "Laps : "
|
text = "Laps : "
|
||||||
|
|
||||||
[node name="Value" type="Label" parent="Laps"]
|
[node name="Value" type="Label" parent="Laps"]
|
||||||
margin_left = 54.0
|
margin_left = 129.0
|
||||||
margin_top = 1.0
|
margin_right = 155.0
|
||||||
margin_right = 72.0
|
margin_bottom = 66.0
|
||||||
margin_bottom = 49.0
|
custom_fonts/font = ExtResource( 1 )
|
||||||
custom_fonts/font = SubResource( 2 )
|
|
||||||
text = "0"
|
text = "0"
|
||||||
|
|||||||
@@ -21,6 +21,5 @@ visible = false
|
|||||||
delay = 3
|
delay = 3
|
||||||
|
|
||||||
[node name="GUI" parent="." instance=ExtResource( 5 )]
|
[node name="GUI" parent="." instance=ExtResource( 5 )]
|
||||||
visible = false
|
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
[connection signal="game_started" from="Menu" to="." method="start_game"]
|
[connection signal="game_started" from="Menu" to="." method="start_game"]
|
||||||
|
|||||||
40
Menu.gd
40
Menu.gd
@@ -11,10 +11,10 @@ enum Actions {
|
|||||||
PREV_TRACK,
|
PREV_TRACK,
|
||||||
# PREV_SKIN,
|
# PREV_SKIN,
|
||||||
# NEXT_SKIN,
|
# NEXT_SKIN,
|
||||||
# PREV_INPUT_MODE,
|
PREV_INPUT_MODE,
|
||||||
# NEXT_INPUT_MODE,
|
NEXT_INPUT_MODE,
|
||||||
# PREV_GAME_MODE,
|
PREV_GAME_MODE,
|
||||||
# NEXT_GAME_MODE,
|
NEXT_GAME_MODE,
|
||||||
QUIT,
|
QUIT,
|
||||||
}
|
}
|
||||||
var actions = {} # Registered actions
|
var actions = {} # Registered actions
|
||||||
@@ -29,6 +29,11 @@ func _ready():
|
|||||||
_connect_action("Options/Return", Actions.EXIT_OPTIONS)
|
_connect_action("Options/Return", Actions.EXIT_OPTIONS)
|
||||||
_connect_action("Options/TrackSelection/LeftArrow", Actions.PREV_TRACK)
|
_connect_action("Options/TrackSelection/LeftArrow", Actions.PREV_TRACK)
|
||||||
_connect_action("Options/TrackSelection/RightArrow", Actions.NEXT_TRACK)
|
_connect_action("Options/TrackSelection/RightArrow", Actions.NEXT_TRACK)
|
||||||
|
_connect_action("Options/GameMode/LeftArrow", Actions.PREV_GAME_MODE)
|
||||||
|
_connect_action("Options/GameMode/RightArrow", Actions.NEXT_GAME_MODE)
|
||||||
|
_connect_action("Options/InputMode/LeftArrow", Actions.PREV_INPUT_MODE)
|
||||||
|
_connect_action("Options/InputMode/RightArrow", Actions.NEXT_INPUT_MODE)
|
||||||
|
_update_options_values()
|
||||||
|
|
||||||
TrackSelection.connect("track_changed", self, "_on_track_changed")
|
TrackSelection.connect("track_changed", self, "_on_track_changed")
|
||||||
_on_track_changed()
|
_on_track_changed()
|
||||||
@@ -53,6 +58,20 @@ func _input(event):
|
|||||||
TrackSelection.set_previous_track()
|
TrackSelection.set_previous_track()
|
||||||
Actions.NEXT_TRACK:
|
Actions.NEXT_TRACK:
|
||||||
TrackSelection.set_next_track()
|
TrackSelection.set_next_track()
|
||||||
|
Actions.NEXT_GAME_MODE,Actions.PREV_GAME_MODE:
|
||||||
|
if Global.settings.game_mode == Global.GameMode.TRAIN:
|
||||||
|
Global.settings.game_mode = Global.GameMode.EASY
|
||||||
|
else:
|
||||||
|
Global.settings.game_mode = Global.GameMode.TRAIN
|
||||||
|
_update_options_values()
|
||||||
|
|
||||||
|
Actions.NEXT_INPUT_MODE,Actions.PREV_INPUT_MODE:
|
||||||
|
if Global.settings.input_mode == Global.InputMode.MOUSE:
|
||||||
|
Global.settings.input_mode = Global.InputMode.KEYBOARD
|
||||||
|
else:
|
||||||
|
Global.settings.input_mode = Global.InputMode.MOUSE
|
||||||
|
_update_options_values()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_track_changed():
|
func _on_track_changed():
|
||||||
@@ -80,3 +99,16 @@ func _set_active(is_active, node):
|
|||||||
# Updates the focus effect for node
|
# Updates the focus effect for node
|
||||||
var color = Color.orange if is_active else Color.white
|
var color = Color.orange if is_active else Color.white
|
||||||
node.set("custom_colors/font_color", color)
|
node.set("custom_colors/font_color", color)
|
||||||
|
|
||||||
|
|
||||||
|
func _update_options_values():
|
||||||
|
var new_text
|
||||||
|
match Global.settings.game_mode:
|
||||||
|
Global.GameMode.EASY: new_text = "Facile"
|
||||||
|
Global.GameMode.TRAIN: new_text = "Entraînement"
|
||||||
|
get_node("Options/GameMode/Value").set_text(new_text)
|
||||||
|
|
||||||
|
match Global.settings.input_mode:
|
||||||
|
Global.InputMode.MOUSE: new_text = "Souris"
|
||||||
|
Global.InputMode.KEYBOARD: new_text = "Clavier"
|
||||||
|
get_node("Options/InputMode/Value").set_text(new_text)
|
||||||
@@ -38,6 +38,7 @@ margin_bottom = 421.063
|
|||||||
rect_scale = Vector2( 2, 2 )
|
rect_scale = Vector2( 2, 2 )
|
||||||
|
|
||||||
[node name="TrackSelection" type="HBoxContainer" parent="Options"]
|
[node name="TrackSelection" type="HBoxContainer" parent="Options"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_right = 960.0
|
margin_right = 960.0
|
||||||
margin_bottom = 66.0
|
margin_bottom = 66.0
|
||||||
custom_constants/separation = 20
|
custom_constants/separation = 20
|
||||||
@@ -83,6 +84,7 @@ custom_constants/shadow_offset_y = 3
|
|||||||
text = ">"
|
text = ">"
|
||||||
|
|
||||||
[node name="GameMode" type="HBoxContainer" parent="Options"]
|
[node name="GameMode" type="HBoxContainer" parent="Options"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_top = 70.0
|
margin_top = 70.0
|
||||||
margin_right = 960.0
|
margin_right = 960.0
|
||||||
margin_bottom = 136.0
|
margin_bottom = 136.0
|
||||||
@@ -129,6 +131,7 @@ custom_constants/shadow_offset_y = 3
|
|||||||
text = ">"
|
text = ">"
|
||||||
|
|
||||||
[node name="InputMode" type="HBoxContainer" parent="Options"]
|
[node name="InputMode" type="HBoxContainer" parent="Options"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_top = 140.0
|
margin_top = 140.0
|
||||||
margin_right = 960.0
|
margin_right = 960.0
|
||||||
margin_bottom = 206.0
|
margin_bottom = 206.0
|
||||||
|
|||||||
Reference in New Issue
Block a user