Fix interaction menu

This commit is contained in:
Vaillant Jeremy
2021-05-15 00:35:15 +02:00
parent 2ce155385c
commit e5110d8d4f
7 changed files with 103 additions and 79 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ func goto_scene(path):
set_process(true) set_process(true)
current_scene.queue_free() current_scene.queue_free()
wait_frames = 1 wait_frames = 1
Loading.get_node("ColorRect/CenterContainer/VBoxContainer/ProgressBar").set_max(loader.get_stage_count()) Loading.get_node("VBoxContainer/ProgressBar").set_max(loader.get_stage_count())
func gyroscope_enabled(): func gyroscope_enabled():
if _gyroscope_enabled(): if _gyroscope_enabled():
@@ -106,7 +106,7 @@ func _gyroscope_enabled():
func _update_progress(): func _update_progress():
print("[global#update_progress]") print("[global#update_progress]")
Loading.visible = true Loading.visible = true
Loading.get_node("ColorRect/CenterContainer/VBoxContainer/ProgressBar").set_value(loader.get_stage()) Loading.get_node("VBoxContainer/ProgressBar").set_value(loader.get_stage())
func _set_new_scene(): func _set_new_scene():
print("[global#set_new_scene]") print("[global#set_new_scene]")
+52 -51
View File
@@ -7,52 +7,52 @@
[ext_resource path="res://assets/ui/themes/button-summary-hover.jpg" type="Texture" id=5] [ext_resource path="res://assets/ui/themes/button-summary-hover.jpg" type="Texture" id=5]
[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=7] [ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=7]
[sub_resource type="VisualShaderNodeVectorOp" id=12] [sub_resource type="VisualShaderNodeVectorOp" id=1]
operator = 3 operator = 3
[sub_resource type="VisualShaderNodeInput" id=14]
input_name = "screen_uv"
[sub_resource type="VisualShaderNodeVectorDecompose" id=15]
output_port_for_preview = 1
[sub_resource type="VisualShaderNodeVectorScalarMix" id=16]
[sub_resource type="VisualShaderNodeColorConstant" id=17]
constant = Color( 0.2, 0.155, 0.11, 1 )
[sub_resource type="VisualShaderNodeColorOp" id=18]
[sub_resource type="VisualShaderNodeVectorScalarMix" id=19]
[sub_resource type="VisualShaderNodeScalarOp" id=20]
default_input_values = [ 0, 0.0, 1, 0.2 ]
operator = 2
[sub_resource type="VisualShaderNodeScalarOp" id=21]
default_input_values = [ 0, 0.0, 1, -1.0 ]
operator = 2
[sub_resource type="VisualShaderNodeInput" id=2] [sub_resource type="VisualShaderNodeInput" id=2]
input_name = "screen_uv" input_name = "screen_uv"
[sub_resource type="VisualShaderNodeTexture" id=3] [sub_resource type="VisualShaderNodeVectorDecompose" id=3]
output_port_for_preview = 1
[sub_resource type="VisualShaderNodeVectorScalarMix" id=4]
[sub_resource type="VisualShaderNodeColorConstant" id=5]
constant = Color( 0.2, 0.155, 0.11, 1 )
[sub_resource type="VisualShaderNodeColorOp" id=6]
[sub_resource type="VisualShaderNodeVectorScalarMix" id=7]
[sub_resource type="VisualShaderNodeScalarOp" id=8]
default_input_values = [ 0, 0.0, 1, 0.2 ]
operator = 2
[sub_resource type="VisualShaderNodeScalarOp" id=9]
default_input_values = [ 0, 0.0, 1, -1.0 ]
operator = 2
[sub_resource type="VisualShaderNodeInput" id=10]
input_name = "screen_uv"
[sub_resource type="VisualShaderNodeTexture" id=11]
texture = ExtResource( 4 ) texture = ExtResource( 4 )
texture_type = 1 texture_type = 1
[sub_resource type="VisualShaderNodeVectorCompose" id=6] [sub_resource type="VisualShaderNodeVectorCompose" id=12]
default_input_values = [ 0, 0.0, 1, 0.0, 2, 1.0 ] default_input_values = [ 0, 0.0, 1, 0.0, 2, 1.0 ]
[sub_resource type="VisualShaderNodeScalarConstant" id=7] [sub_resource type="VisualShaderNodeScalarConstant" id=13]
constant = 0.4 constant = 0.4
[sub_resource type="VisualShaderNodeVectorDecompose" id=8] [sub_resource type="VisualShaderNodeVectorDecompose" id=14]
[sub_resource type="VisualShaderNodeScalarOp" id=9] [sub_resource type="VisualShaderNodeScalarOp" id=15]
default_input_values = [ 0, 0.0, 1, 1.6 ] default_input_values = [ 0, 0.0, 1, 1.6 ]
operator = 3 operator = 3
[sub_resource type="VisualShader" id=4] [sub_resource type="VisualShader" id=16]
code = "shader_type canvas_item; code = "shader_type canvas_item;
uniform sampler2D tex_frg_4 : hint_albedo; uniform sampler2D tex_frg_4 : hint_albedo;
@@ -130,40 +130,40 @@ graph_offset = Vector2( -1049.92, -110.97 )
mode = 1 mode = 1
flags/light_only = false flags/light_only = false
nodes/fragment/0/position = Vector2( 2300, 540 ) nodes/fragment/0/position = Vector2( 2300, 540 )
nodes/fragment/3/node = SubResource( 2 ) nodes/fragment/3/node = SubResource( 10 )
nodes/fragment/3/position = Vector2( -2320, 660 ) nodes/fragment/3/position = Vector2( -2320, 660 )
nodes/fragment/4/node = SubResource( 3 ) nodes/fragment/4/node = SubResource( 11 )
nodes/fragment/4/position = Vector2( 60, 160 ) nodes/fragment/4/position = Vector2( 60, 160 )
nodes/fragment/5/node = SubResource( 6 ) nodes/fragment/5/node = SubResource( 12 )
nodes/fragment/5/position = Vector2( -580, 720 ) nodes/fragment/5/position = Vector2( -580, 720 )
nodes/fragment/6/node = SubResource( 7 ) nodes/fragment/6/node = SubResource( 13 )
nodes/fragment/6/position = Vector2( -2300, 800 ) nodes/fragment/6/position = Vector2( -2300, 800 )
nodes/fragment/7/node = SubResource( 8 ) nodes/fragment/7/node = SubResource( 14 )
nodes/fragment/7/position = Vector2( -1480, 700 ) nodes/fragment/7/position = Vector2( -1480, 700 )
nodes/fragment/8/node = SubResource( 9 ) nodes/fragment/8/node = SubResource( 15 )
nodes/fragment/8/position = Vector2( -960, 820 ) nodes/fragment/8/position = Vector2( -960, 820 )
nodes/fragment/11/node = SubResource( 12 ) nodes/fragment/11/node = SubResource( 1 )
nodes/fragment/11/position = Vector2( -1860, 700 ) nodes/fragment/11/position = Vector2( -1860, 700 )
nodes/fragment/14/node = SubResource( 14 ) nodes/fragment/14/node = SubResource( 2 )
nodes/fragment/14/position = Vector2( 140, 980 ) nodes/fragment/14/position = Vector2( 140, 980 )
nodes/fragment/15/node = SubResource( 15 ) nodes/fragment/15/node = SubResource( 3 )
nodes/fragment/15/position = Vector2( 580, 960 ) nodes/fragment/15/position = Vector2( 580, 960 )
nodes/fragment/17/node = SubResource( 16 ) nodes/fragment/17/node = SubResource( 4 )
nodes/fragment/17/position = Vector2( 1240, 560 ) nodes/fragment/17/position = Vector2( 1240, 560 )
nodes/fragment/18/node = SubResource( 17 ) nodes/fragment/18/node = SubResource( 5 )
nodes/fragment/18/position = Vector2( 520, 620 ) nodes/fragment/18/position = Vector2( 520, 620 )
nodes/fragment/19/node = SubResource( 18 ) nodes/fragment/19/node = SubResource( 6 )
nodes/fragment/19/position = Vector2( 840, 580 ) nodes/fragment/19/position = Vector2( 840, 580 )
nodes/fragment/20/node = SubResource( 19 ) nodes/fragment/20/node = SubResource( 7 )
nodes/fragment/20/position = Vector2( 1780, 660 ) nodes/fragment/20/position = Vector2( 1780, 660 )
nodes/fragment/22/node = SubResource( 20 ) nodes/fragment/22/node = SubResource( 8 )
nodes/fragment/22/position = Vector2( 1260, 780 ) nodes/fragment/22/position = Vector2( 1260, 780 )
nodes/fragment/23/node = SubResource( 21 ) nodes/fragment/23/node = SubResource( 9 )
nodes/fragment/23/position = Vector2( 1080, 1080 ) nodes/fragment/23/position = Vector2( 1080, 1080 )
nodes/fragment/connections = PoolIntArray( 8, 0, 5, 1, 7, 1, 8, 0, 7, 0, 5, 0, 5, 0, 4, 0, 3, 0, 11, 0, 6, 0, 11, 1, 11, 0, 7, 0, 14, 0, 15, 0, 4, 0, 17, 0, 15, 1, 17, 2, 4, 0, 19, 1, 18, 0, 19, 0, 19, 0, 17, 1, 4, 0, 22, 0, 20, 0, 0, 0, 15, 1, 23, 0, 22, 0, 20, 0, 15, 1, 20, 2, 17, 0, 20, 1 ) nodes/fragment/connections = PoolIntArray( 8, 0, 5, 1, 7, 1, 8, 0, 7, 0, 5, 0, 5, 0, 4, 0, 3, 0, 11, 0, 6, 0, 11, 1, 11, 0, 7, 0, 14, 0, 15, 0, 4, 0, 17, 0, 15, 1, 17, 2, 4, 0, 19, 1, 18, 0, 19, 0, 19, 0, 17, 1, 4, 0, 22, 0, 20, 0, 0, 0, 15, 1, 23, 0, 22, 0, 20, 0, 15, 1, 20, 2, 17, 0, 20, 1 )
[sub_resource type="ShaderMaterial" id=5] [sub_resource type="ShaderMaterial" id=17]
shader = SubResource( 4 ) shader = SubResource( 16 )
[node name="Summary" type="HBoxContainer"] [node name="Summary" type="HBoxContainer"]
anchor_bottom = 1.0 anchor_bottom = 1.0
@@ -174,7 +174,7 @@ __meta__ = {
} }
[node name="PanelWood" type="Panel" parent="."] [node name="PanelWood" type="Panel" parent="."]
material = SubResource( 5 ) material = SubResource( 17 )
margin_right = 350.0 margin_right = 350.0
margin_bottom = 900.0 margin_bottom = 900.0
rect_min_size = Vector2( 350, 0 ) rect_min_size = Vector2( 350, 0 )
@@ -197,16 +197,15 @@ margin_bottom = 237.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="TextureRect" type="TextureRect" parent="PanelWood/VBoxContainer/CenterContainer"] [node name="TextureRect" type="TextureButton" parent="PanelWood/VBoxContainer/CenterContainer"]
margin_left = 111.0 margin_left = 111.0
margin_top = 54.0 margin_top = 54.0
margin_right = 239.0 margin_right = 239.0
margin_bottom = 182.0 margin_bottom = 182.0
size_flags_horizontal = 4 size_flags_horizontal = 4
size_flags_vertical = 4 size_flags_vertical = 4
texture = ExtResource( 3 ) texture_normal = ExtResource( 3 )
stretch_mode = 3 stretch_mode = 3
flip_h = true
[node name="ButtonPuzzle" type="TextureButton" parent="PanelWood/VBoxContainer"] [node name="ButtonPuzzle" type="TextureButton" parent="PanelWood/VBoxContainer"]
margin_top = 267.0 margin_top = 267.0
@@ -216,6 +215,7 @@ size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
texture_normal = ExtResource( 1 ) texture_normal = ExtResource( 1 )
texture_hover = ExtResource( 5 ) texture_hover = ExtResource( 5 )
texture_focused = ExtResource( 5 )
__meta__ = { __meta__ = {
"_editor_description_": "" "_editor_description_": ""
} }
@@ -243,6 +243,7 @@ size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
texture_normal = ExtResource( 1 ) texture_normal = ExtResource( 1 )
texture_hover = ExtResource( 5 ) texture_hover = ExtResource( 5 )
texture_focused = ExtResource( 5 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
+3 -3
View File
@@ -56,9 +56,9 @@ func _get_resource(index, table, datas):
return datas[index].get_data() return datas[index].get_data()
func _apply_scene(name, thumb, resource): func _apply_scene(name, thumb, resource):
$games/Container/HBoxContainer.add_child(_configure_vbox()) $Container/HBoxContainer.add_child(_configure_vbox())
_configure_button(thumb, resource, name) _configure_button(thumb, resource, name)
$games/Container/HBoxContainer/VBoxContainer.add_child(_configure_label(name)) $Container/HBoxContainer/VBoxContainer.add_child(_configure_label(name))
func _configure_vbox(): func _configure_vbox():
var vbox = VBoxContainer.new() var vbox = VBoxContainer.new()
@@ -74,7 +74,7 @@ func _configure_label(name):
func _configure_button(thumb, _resource, name): func _configure_button(thumb, _resource, name):
var thumbnail = TextureButton.new() var thumbnail = TextureButton.new()
$games/Container/HBoxContainer/VBoxContainer.add_child(thumbnail) $Container/HBoxContainer/VBoxContainer.add_child(thumbnail)
thumbnail.set_normal_texture(load(thumb)) thumbnail.set_normal_texture(load(thumb))
thumbnail.connect("pressed", self, "_on_"+name.to_lower()+"_pressed") thumbnail.connect("pressed", self, "_on_"+name.to_lower()+"_pressed")
+4 -2
View File
@@ -12,6 +12,7 @@ __meta__ = {
} }
[node name="GridContainer" type="GridContainer" parent="."] [node name="GridContainer" type="GridContainer" parent="."]
visible = false
margin_left = 645.0 margin_left = 645.0
margin_top = 298.0 margin_top = 298.0
margin_right = 795.0 margin_right = 795.0
@@ -48,8 +49,9 @@ margin_right = 720.0
margin_bottom = 450.0 margin_bottom = 450.0
[node name="HBoxContainer" type="VBoxContainer" parent="Container"] [node name="HBoxContainer" type="VBoxContainer" parent="Container"]
margin_right = 824.0 __meta__ = {
margin_bottom = 300.0 "_edit_use_anchors_": false
}
[connection signal="pressed" from="GridContainer/WarCraft" to="." method="_on_WarCraft_pressed"] [connection signal="pressed" from="GridContainer/WarCraft" to="." method="_on_WarCraft_pressed"]
[connection signal="pressed" from="GridContainer/Lightmap" to="." method="_on_Lightmap_pressed"] [connection signal="pressed" from="GridContainer/Lightmap" to="." method="_on_Lightmap_pressed"]
+2 -2
View File
@@ -20,8 +20,8 @@ func _apply_settings():
var lang = _get_settings_data("langue", Global.table_settings, Global.data_settings) var lang = _get_settings_data("langue", Global.table_settings, Global.data_settings)
var gyro = _get_settings_data("gyroscope", Global.table_settings, Global.data_settings) var gyro = _get_settings_data("gyroscope", Global.table_settings, Global.data_settings)
$CenterContainer/VBoxContainer/Langue/HBoxContainer/data.set_text(lang) #$CenterContainer/VBoxContainer/Langue/HBoxContainer/data.set_text(lang)
$CenterContainer/VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(int(gyro) as bool) #$CenterContainer/VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(int(gyro) as bool)
func _get_settings_data(name, table, datas): func _get_settings_data(name, table, datas):
for index in range(0, Global.table_settings.get_props_count()): for index in range(0, Global.table_settings.get_props_count()):
+20 -16
View File
@@ -1,15 +1,14 @@
extends Node extends Node
export (PackedScene) var settings = load("res://scenes/UI/Settings.tscn") export (PackedScene) var settings = load("res://scenes/UI/settings/Settings.tscn")
export (PackedScene) var scenes = load("res://scenes/UI/ChooseScene.tscn") export (PackedScene) var scenes = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
const max_diff = 0.08 onready var current_scene = "title"
onready var scene_instance = $MarginContainer/HBoxContainer/MarginContainer/scene_instance
var current_scene = null
var value_old = Vector2(0, 0)
func _ready(): func _ready():
_translation() _translation()
_apply_scene("Title")
## PRIVATE ## PRIVATE
func _translation(): func _translation():
@@ -17,22 +16,27 @@ func _translation():
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonSetting/Label.text = tr("MAIN_BUTTON_SETTINGS") $MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonSetting/Label.text = tr("MAIN_BUTTON_SETTINGS")
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonQuit/Label.text = tr("MAIN_BUTTON_QUIT") $MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonQuit/Label.text = tr("MAIN_BUTTON_QUIT")
func _prepare_change_scene(): func _apply_scene(actual_scene):
if (current_scene != null): var node = "MarginContainer/HBoxContainer/MarginContainer/"
remove_child(current_scene)
current_scene.call_deferred("free") for scene in ["Title", "Settings", "ChooseScene"]:
get_node(node + scene).visible = true
if actual_scene == scene:
get_node(node + scene).visible = true
else:
get_node(node + scene).visible = false
# Load scene for select game # Load scene for select game
func _on_ButtonPuzzle_pressed(): func _on_ButtonPuzzle_pressed():
_prepare_change_scene() _apply_scene("ChooseScene")
current_scene = scenes.instance()
add_child(current_scene)
# Load scene settings # Load scene settings
func _on_ButtonSetting_pressed(): func _on_ButtonSetting_pressed():
_prepare_change_scene() _apply_scene("Settings")
current_scene = settings.instance()
add_child(current_scene) # Click to icon game
func _on_TextureRect_pressed():
_apply_scene("Title")
# Quit the game # Quit the game
func _on_ButtonQuit_pressed(): func _on_ButtonQuit_pressed():
+20 -3
View File
@@ -1,7 +1,9 @@
[gd_scene load_steps=10 format=2] [gd_scene load_steps=12 format=2]
[ext_resource path="res://scenes/main.gd" type="Script" id=1] [ext_resource path="res://scenes/main.gd" type="Script" id=1]
[ext_resource path="res://scenes/UI/title/UI_title.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/UI/title/UI_title.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/UI/choose_scenes/ChooseScene.tscn" type="PackedScene" id=3]
[ext_resource path="res://scenes/UI/settings/Settings.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets/ui/themes/bck.jpg" type="Texture" id=6] [ext_resource path="res://assets/ui/themes/bck.jpg" type="Texture" id=6]
[ext_resource path="res://scenes/UI/UI_summary.tscn" type="PackedScene" id=8] [ext_resource path="res://scenes/UI/UI_summary.tscn" type="PackedScene" id=8]
@@ -90,19 +92,34 @@ margin_bottom = 900.0
size_flags_horizontal = 0 size_flags_horizontal = 0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="CenterContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer"] [node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer"]
margin_left = 450.0 margin_left = 450.0
margin_right = 1440.0 margin_right = 1440.0
margin_bottom = 900.0 margin_bottom = 900.0
size_flags_horizontal = 7 size_flags_horizontal = 7
size_flags_vertical = 3 size_flags_vertical = 3
[node name="scene_instance" parent="MarginContainer/HBoxContainer/CenterContainer" instance=ExtResource( 2 )] [node name="Title" parent="MarginContainer/HBoxContainer/MarginContainer" instance=ExtResource( 2 )]
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_right = 990.0 margin_right = 990.0
margin_bottom = 900.0 margin_bottom = 900.0
[node name="Settings" parent="MarginContainer/HBoxContainer/MarginContainer" instance=ExtResource( 4 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 990.0
margin_bottom = 900.0
[node name="ChooseScene" parent="MarginContainer/HBoxContainer/MarginContainer" instance=ExtResource( 3 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 990.0
margin_bottom = 900.0
[connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect" to="." method="_on_TextureRect_pressed"]
[connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonPuzzle" to="." method="_on_ButtonPuzzle_pressed"] [connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonPuzzle" to="." method="_on_ButtonPuzzle_pressed"]
[connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonSetting" to="." method="_on_ButtonSetting_pressed"] [connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonSetting" to="." method="_on_ButtonSetting_pressed"]
[connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonQuit" to="." method="_on_ButtonQuit_pressed"] [connection signal="pressed" from="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonQuit" to="." method="_on_ButtonQuit_pressed"]