Quellcode durchsuchen

:lipstick: Configure la navigation clavier pour le choix de niveau

DricomDragon vor 8 Monaten
Ursprung
Commit
2d4e1d311a

+ 70 - 10
godot/composants/interface/choix_niveau/choix_niveau.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=23 format=3 uid="uid://cnbv6y2ikfysg"]
+[gd_scene load_steps=24 format=3 uid="uid://cnbv6y2ikfysg"]
 
 [ext_resource type="Script" path="res://composants/interface/choix_niveau/systeme_solaire.gd" id="1_1jmyy"]
 [ext_resource type="Script" path="res://composants/interface/choix_niveau/choix_niveau.gd" id="1_nhye5"]
@@ -7,6 +7,7 @@
 [ext_resource type="Texture2D" uid="uid://dciyah6rngop4" path="res://composants/interface/planete/images/07.png" id="5_ato7s"]
 [ext_resource type="Script" path="res://composants/interface/planete/planete.gd" id="5_hm38a"]
 [ext_resource type="PackedScene" uid="uid://18mfasfcx418" path="res://exec/niveaux/mini_centre.tscn" id="6_0v56c"]
+[ext_resource type="Texture2D" uid="uid://cp1rni66n6xjx" path="res://composants/interface/planete/images/focus.png" id="6_hvk07"]
 [ext_resource type="Texture2D" uid="uid://7npljbrmgqur" path="res://composants/interface/planete/images/11.png" id="7_63ppw"]
 [ext_resource type="PackedScene" uid="uid://b11cxtgl8mwvm" path="res://exec/niveaux/blob_facile.tscn" id="8_coqpc"]
 [ext_resource type="Texture2D" uid="uid://cu1l78e0v6ia3" path="res://composants/interface/planete/images/01.png" id="9_mgdr1"]
@@ -44,7 +45,13 @@ offset_left = -18.0
 offset_top = 72.0
 offset_right = 205.0
 offset_bottom = 216.0
+focus_neighbor_right = NodePath("../PlaneteTerre")
+focus_neighbor_bottom = NodePath("../PlaneteRouge")
+focus_next = NodePath("../PlaneteTerre")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("5_ato7s")
+texture_focused = ExtResource("6_hvk07")
+ignore_texture_size = true
 script = ExtResource("5_hm38a")
 niveau = ExtResource("6_0v56c")
 
@@ -54,26 +61,31 @@ offset_left = 208.0
 offset_top = 157.0
 offset_right = 431.0
 offset_bottom = 301.0
+focus_neighbor_left = NodePath("../PlaneteRouge")
+focus_neighbor_top = NodePath("../PlaneteNaine")
+focus_neighbor_bottom = NodePath("../PlaneteLibre")
+focus_next = NodePath("../PlaneteRouge")
+focus_previous = NodePath("../PlaneteNaine")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("2_1herl")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("8_coqpc")
 
-[node name="PlaneteSismique" type="TextureButton" parent="DefilementNiveaux/SystemeSolaire"]
-layout_mode = 0
-offset_top = 502.0
-offset_right = 223.0
-offset_bottom = 646.0
-texture_normal = ExtResource("9_r0gfp")
-script = ExtResource("5_hm38a")
-niveau = ExtResource("10_iuts0")
-
 [node name="PlaneteRouge" type="TextureButton" parent="DefilementNiveaux/SystemeSolaire"]
 layout_mode = 0
 offset_left = -40.0
 offset_top = 211.0
 offset_right = 183.0
 offset_bottom = 355.0
+focus_neighbor_top = NodePath("../PlaneteNaine")
+focus_neighbor_right = NodePath("../PlaneteTerre")
+focus_neighbor_bottom = NodePath("../PlaneteSpectrale")
+focus_next = NodePath("../PlaneteLibre")
+focus_previous = NodePath("../PlaneteTerre")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("9_mgdr1")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("10_m6fgg")
 
@@ -83,7 +95,14 @@ offset_left = 239.0
 offset_top = 320.0
 offset_right = 462.0
 offset_bottom = 464.0
+focus_neighbor_left = NodePath("../PlaneteSpectrale")
+focus_neighbor_top = NodePath("../PlaneteTerre")
+focus_neighbor_bottom = NodePath("../PlaneteGravite")
+focus_next = NodePath("../PlaneteSpectrale")
+focus_previous = NodePath("../PlaneteRouge")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("7_63ppw")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("12_5dpbk")
 
@@ -93,7 +112,14 @@ offset_left = 28.0
 offset_top = 338.0
 offset_right = 251.0
 offset_bottom = 482.0
+focus_neighbor_top = NodePath("../PlaneteRouge")
+focus_neighbor_right = NodePath("../PlaneteLibre")
+focus_neighbor_bottom = NodePath("../PlaneteSismique")
+focus_next = NodePath("../PlaneteGravite")
+focus_previous = NodePath("../PlaneteLibre")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("13_s2a0u")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("14_gw0xo")
 
@@ -103,17 +129,46 @@ offset_left = 180.0
 offset_top = 454.0
 offset_right = 403.0
 offset_bottom = 598.0
+focus_neighbor_left = NodePath("../PlaneteSismique")
+focus_neighbor_top = NodePath("../PlaneteLibre")
+focus_neighbor_bottom = NodePath("../PlaneteIodee")
+focus_next = NodePath("../PlaneteSismique")
+focus_previous = NodePath("../PlaneteSpectrale")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("15_6imjs")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("16_qdyvs")
 
+[node name="PlaneteSismique" type="TextureButton" parent="DefilementNiveaux/SystemeSolaire"]
+layout_mode = 0
+offset_top = 502.0
+offset_right = 223.0
+offset_bottom = 646.0
+focus_neighbor_top = NodePath("../PlaneteSpectrale")
+focus_neighbor_right = NodePath("../PlaneteGravite")
+focus_neighbor_bottom = NodePath("../PlaneteGlacee")
+focus_next = NodePath("../PlaneteIodee")
+focus_previous = NodePath("../PlaneteGravite")
+mouse_default_cursor_shape = 13
+texture_normal = ExtResource("9_r0gfp")
+texture_focused = ExtResource("6_hvk07")
+script = ExtResource("5_hm38a")
+niveau = ExtResource("10_iuts0")
+
 [node name="PlaneteIodee" type="TextureButton" parent="DefilementNiveaux/SystemeSolaire"]
 layout_mode = 0
 offset_left = 240.0
 offset_top = 582.0
 offset_right = 463.0
 offset_bottom = 726.0
+focus_neighbor_left = NodePath("../PlaneteGlacee")
+focus_neighbor_top = NodePath("../PlaneteGravite")
+focus_next = NodePath("../PlaneteGlacee")
+focus_previous = NodePath("../PlaneteSismique")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("19_m5si6")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("20_c2041")
 
@@ -123,7 +178,12 @@ offset_left = -30.0
 offset_top = 646.0
 offset_right = 193.0
 offset_bottom = 790.0
+focus_neighbor_top = NodePath("../PlaneteSismique")
+focus_neighbor_right = NodePath("../PlaneteIodee")
+focus_previous = NodePath("../PlaneteIodee")
+mouse_default_cursor_shape = 13
 texture_normal = ExtResource("21_ni03u")
+texture_focused = ExtResource("6_hvk07")
 script = ExtResource("5_hm38a")
 niveau = ExtResource("22_7dn12")
 

+ 11 - 0
godot/composants/interface/choix_niveau/systeme_solaire.gd

@@ -5,7 +5,18 @@ extends Node
 
 
 func _ready() -> void:
+	_connecter_choix_niveau()
+	_focus_premier_niveau()
+
+
+func _connecter_choix_niveau() -> void:
 	for child in get_children():
 		assert(child is Planete, "Seules les planetes sont autorisees dans le systeme")
 		var planete: Planete = child as Planete
 		planete.niveau_choisi.connect(choix_niveau.demarrer_niveau)
+
+
+func _focus_premier_niveau() -> void:
+	assert(get_child_count() > 0, "Au moins un niveau doit exister dans le jeu")
+	var premier_niveau: Planete = get_children().front() as Planete
+	premier_niveau.grab_focus()

BIN
godot/composants/interface/planete/images/focus.png


+ 34 - 0
godot/composants/interface/planete/images/focus.png.import

@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://cp1rni66n6xjx"
+path="res://.godot/imported/focus.png-62aa6211b0f0b016fc44dae10ac44839.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://composants/interface/planete/images/focus.png"
+dest_files=["res://.godot/imported/focus.png-62aa6211b0f0b016fc44dae10ac44839.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1