diverse modifications et tests.

This commit is contained in:
osquallo 2018-07-28 16:42:31 +02:00
parent 5130eaffe6
commit d3bf051b26
6 changed files with 50 additions and 25 deletions

View file

@ -27,6 +27,8 @@ enabled=PoolStringArray( "input_map_button" )
[input] [input]
ui_select=[ ] ui_select=[ ]
ui_cancel=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
]
ui_focus_next=[ ] ui_focus_next=[ ]
ui_quit=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null) ui_quit=[ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null)
] ]

View file

@ -42,32 +42,45 @@ func _on_Home_play_pressed():
# $Home/MarginContainer/Menu/Buttons/VBoxContainer/PlayButton.text = "Pause" # $Home/MarginContainer/Menu/Buttons/VBoxContainer/PlayButton.text = "Pause"
func _input(event): func _input(event):
# TODO revoir l'architecture des events.
if event.is_action_pressed("ui_test"): # deplacer le mouvement dans la scene game plutot qu'ici
print( "Event: ui_test" ) # et bloquer l'input sur ll'ui lorsqu'on est en jeu
# et inversement quand on est dans les menu (mouse free/captured).
if event.is_action_pressed("ui_quit"): # on ne dois pas naviguer dans les menu qd la souris est capturé (jeu en cours)
get_tree().quit() # et on ne dois aps avaner lorsqu'on est dans les menu
# ou que la souris est liberé pour agir sur les element du HUD?
if event.is_action_pressed("ui_reload"): if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
if not $Settings.visible: if event.is_action_pressed("ui_test"):
get_tree().reload_current_scene() print( "Event: ui_test" )
if event.is_action_pressed("ui_pause") and not event.is_echo(): if event.is_action_pressed("ui_quit"):
if not $Settings.visible: get_tree().quit()
if not get_tree().paused:
pause() if event.is_action_pressed("ui_reload"):
else: if not $Settings.visible:
play() get_tree().reload_current_scene()
if event.is_action_pressed("ui_pause") and not event.is_echo():
if not $Settings.visible:
if not get_tree().paused:
pause()
else:
play()
# accept_event()
# ---------------------------------- # ----------------------------------
# Capturing/Freeing the cursor # Capturing/Freeing the cursor
if Input.is_action_just_pressed("ui_free_cursor"): if Input.is_action_just_pressed("ui_free_cursor"):
if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE: if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
# grab_focus()
# grab_click_focus()
# release_focus()
print("Captured")
else: else:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
# ---------------------------------- # ----------------------------------
func pause(): func pause():
get_tree().paused = true get_tree().paused = true
@ -85,7 +98,6 @@ func show_menu():
func hide_menu(): func hide_menu():
$Settings.hide() $Settings.hide()
$Home.hide() $Home.hide()
$HUD.show()
$Help.show() $Help.show()
$HUD.modulate.a = 1.0 $HUD.modulate.a = 1.0
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)

View file

@ -19,7 +19,7 @@ _sections_unfolded = [ "Font", "Settings" ]
default_font = SubResource( 1 ) default_font = SubResource( 1 )
[node name="GUI" type="MarginContainer"] [node name="GUI" type="MarginContainer" index="0"]
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
@ -47,6 +47,7 @@ margin_top = 4.0
margin_right = 1020.0 margin_right = 1020.0
margin_bottom = 596.0 margin_bottom = 596.0
theme = SubResource( 2 ) theme = SubResource( 2 )
_sections_unfolded = [ "Focus", "Margin", "Mouse", "Rect", "Size Flags", "Theme", "Visibility", "custom_constants" ]
[node name="Home" parent="." index="1" instance=ExtResource( 4 )] [node name="Home" parent="." index="1" instance=ExtResource( 4 )]

View file

@ -402,7 +402,6 @@ _sections_unfolded = [ "Mouse", "Size Flags", "Textures" ]
[node name="TestBorderless" type="MarginContainer" parent="Windows" index="1"] [node name="TestBorderless" type="MarginContainer" parent="Windows" index="1"]
editor/display_folded = true
anchor_left = 0.0 anchor_left = 0.0
anchor_top = 0.0 anchor_top = 0.0
anchor_right = 0.0 anchor_right = 0.0
@ -668,7 +667,7 @@ scroll_active = true
scroll_following = true scroll_following = true
selection_enabled = true selection_enabled = true
override_selected_font_color = false override_selected_font_color = false
_sections_unfolded = [ "BBCode", "Rect", "Size Flags" ] _sections_unfolded = [ "BBCode", "Focus", "Rect", "Size Flags" ]
[node name="RichTextLabel2" type="RichTextLabel" parent="Windows/TestBorderless/VBoxContainer/Content/VBoxContainer" index="1"] [node name="RichTextLabel2" type="RichTextLabel" parent="Windows/TestBorderless/VBoxContainer/Content/VBoxContainer" index="1"]
@ -697,7 +696,7 @@ scroll_active = true
scroll_following = true scroll_following = true
selection_enabled = true selection_enabled = true
override_selected_font_color = false override_selected_font_color = false
_sections_unfolded = [ "BBCode", "Rect", "Size Flags" ] _sections_unfolded = [ "BBCode", "Focus", "Rect", "Size Flags" ]
[node name="Footer" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="2"] [node name="Footer" type="MarginContainer" parent="Windows/TestBorderless/VBoxContainer" index="2"]

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/GUI/MusicControls/Music.gd" type="Script" id=1] [ext_resource path="res://scenes/GUI/MusicControls/Music.gd" type="Script" id=1]
[ext_resource path="res://assets/test/musiques/pre-mix_khanat_main_theme_2018-07-23.ogg" type="AudioStream" id=2] [ext_resource path="res://assets/test/musiques/pre-mix_khanat_main_theme_2018-07-23.ogg" type="AudioStream" id=2]
[ext_resource path="res://assets/test/musiques/Sangakanat (short instrumental theme).ogg" type="AudioStream" id=3] [ext_resource path="res://assets/test/musiques/Sangakanat (short instrumental theme).ogg" type="AudioStream" id=3]
[ext_resource path="res://assets/test/musiques/pre-mix_Le_concours_de_tartes_aux_klums.ogg" type="AudioStream" id=4]
[node name="Music" type="VBoxContainer"] [node name="Music" type="VBoxContainer"]
@ -42,6 +42,7 @@ size_flags_vertical = 1
pause_mode = 1 pause_mode = 1
stream = ExtResource( 2 ) stream = ExtResource( 2 )
volume_db = 0.0 volume_db = 0.0
pitch_scale = 1.0
autoplay = false autoplay = false
mix_target = 0 mix_target = 0
bus = "Master" bus = "Master"
@ -52,11 +53,21 @@ _sections_unfolded = [ "Pause" ]
pause_mode = 1 pause_mode = 1
stream = ExtResource( 3 ) stream = ExtResource( 3 )
volume_db = 0.0 volume_db = 0.0
pitch_scale = 1.0
autoplay = false autoplay = false
mix_target = 0 mix_target = 0
bus = "Master" bus = "Master"
_sections_unfolded = [ "Pause" ] _sections_unfolded = [ "Pause" ]
[node name="pre-mix_Le_concours_de_tartes_aux_klums" type="AudioStreamPlayer" parent="Songs" index="2"]
stream = ExtResource( 4 )
volume_db = 0.0
pitch_scale = 1.0
autoplay = false
mix_target = 0
bus = "Master"
[node name="Title" type="Label" parent="." index="1"] [node name="Title" type="Label" parent="." index="1"]
anchor_left = 0.0 anchor_left = 0.0