diff --git a/assets/fonts/MKXTitle.tres b/assets/fonts/MKX_Base.tres similarity index 100% rename from assets/fonts/MKXTitle.tres rename to assets/fonts/MKX_Base.tres diff --git a/assets/fonts/kirsty/kirsty_base.tres b/assets/fonts/kirsty/kirsty_base.tres new file mode 100644 index 0000000..6066faf --- /dev/null +++ b/assets/fonts/kirsty/kirsty_base.tres @@ -0,0 +1,8 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/fonts/kirsty/kirsty rg.otf" type="DynamicFontData" id=1] + +[resource] +use_mipmaps = true +use_filter = true +font_data = ExtResource( 1 ) diff --git a/assets/fonts/kirsty/kirsty.tres b/assets/fonts/kirsty/kirsty_medium.tres similarity index 80% rename from assets/fonts/kirsty/kirsty.tres rename to assets/fonts/kirsty/kirsty_medium.tres index a9737e3..a144af9 100644 --- a/assets/fonts/kirsty/kirsty.tres +++ b/assets/fonts/kirsty/kirsty_medium.tres @@ -4,7 +4,6 @@ [resource] size = 24 -outline_color = Color( 0.894118, 0.788235, 0.0901961, 1 ) use_mipmaps = true use_filter = true font_data = ExtResource( 1 ) diff --git a/assets/fonts/kirsty/kirsty_title.tres b/assets/fonts/kirsty/kirsty_title.tres new file mode 100644 index 0000000..fd86300 --- /dev/null +++ b/assets/fonts/kirsty/kirsty_title.tres @@ -0,0 +1,9 @@ +[gd_resource type="DynamicFont" load_steps=2 format=2] + +[ext_resource path="res://assets/fonts/kirsty/kirsty bd.otf" type="DynamicFontData" id=1] + +[resource] +size = 46 +use_mipmaps = true +use_filter = true +font_data = ExtResource( 1 ) diff --git a/assets/fonts/text_outline.material b/assets/fonts/text_outline.material new file mode 100644 index 0000000..3e4d09a Binary files /dev/null and b/assets/fonts/text_outline.material differ diff --git a/assets/ui/themes/bck-hrz-grd.png b/assets/ui/themes/bck-hrz-grd.png new file mode 100644 index 0000000..51d3813 Binary files /dev/null and b/assets/ui/themes/bck-hrz-grd.png differ diff --git a/assets/ui/themes/bck-hrz-grd.png.import b/assets/ui/themes/bck-hrz-grd.png.import new file mode 100644 index 0000000..955be1d --- /dev/null +++ b/assets/ui/themes/bck-hrz-grd.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/bck-hrz-grd.png-17437e2e9b19e441183eab5176696b4e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/themes/bck-hrz-grd.png" +dest_files=[ "res://.import/bck-hrz-grd.png-17437e2e9b19e441183eab5176696b4e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=1 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/ui/themes/leather.theme b/assets/ui/themes/leather.theme index 83981d1..4a5d794 100644 Binary files a/assets/ui/themes/leather.theme and b/assets/ui/themes/leather.theme differ diff --git a/assets/ui/themes/loading-bare.png b/assets/ui/themes/loading-bare.png new file mode 100644 index 0000000..6e5f69f Binary files /dev/null and b/assets/ui/themes/loading-bare.png differ diff --git a/assets/ui/themes/loading-bare.png.import b/assets/ui/themes/loading-bare.png.import new file mode 100644 index 0000000..f975b27 --- /dev/null +++ b/assets/ui/themes/loading-bare.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/loading-bare.png-aa43f63a35052a61dc0b1a46ec243493.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/ui/themes/loading-bare.png" +dest_files=[ "res://.import/loading-bare.png-aa43f63a35052a61dc0b1a46ec243493.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/project.godot b/project.godot index 4ade6d5..f64fa7c 100644 --- a/project.godot +++ b/project.godot @@ -212,6 +212,8 @@ Global="*res://scenes/Global.gd" gddb_constants="*res://addons/godot_db_manager/core/GDDBConstants.gd" gddb_types="*res://addons/godot_db_manager/core/GDDBTypes.gd" gddb_globals="*res://addons/godot_db_manager/core/GDDBGlobals.gd" +Setting="*res://scripts/Setting.gd" +Event="*res://scripts/Event.gd" [debug] @@ -262,6 +264,7 @@ common/enable_pause_aware_picking=true [rendering] quality/driver/fallback_to_gles2=true +threads/thread_model=2 vram_compression/import_etc=true quality/shading/force_vertex_shading.mobile=false quality/lightmapping/use_bicubic_sampling.mobile=true diff --git a/scenes/Global.gd b/scenes/Global.gd index d57c2e0..66f51de 100644 --- a/scenes/Global.gd +++ b/scenes/Global.gd @@ -7,92 +7,37 @@ onready var current_scene_int = null onready var loader = null onready var wait_frames = 1 onready var database = null -onready var table_levels = null - -var msetting = preload("res://db/MSetting.gd") -var setting = null +onready var loaded = false +onready var animation = Loading.get_node("AnimLoading") func _ready(): - _initialize_database() - _initialize_setting() + database = load("res://scripts/Database.gd").new().initialize() + _initialize_current_scene() + _initialize_loading_scene() -func _initialize_setting(): - setting = msetting.new() +func _initialize_loading_scene(): + print("[global#goto_scene] establish signal before") - apply_language(translate_int_to_locale(get_setting_language())) - apply_resolution() - apply_fullscreen() - -func translate_int_to_locale(id): - var lang = "en_GB" - - if id == 0: - lang = "en_GB" - - if id == 1: - lang = "fr_FR" - - return lang - -func apply_language(local): - TranslationServer.set_locale(local) - -func apply_resolution(): - var screen_size = Vector2(get_setting_resolution()[0], get_setting_resolution()[1]) - var margin_size = Vector2(0, 0) - get_viewport().set_size_override(true, screen_size, margin_size) - -func apply_fullscreen(): - OS.set_window_fullscreen(get_setting_fullscreen()) + animation.connect("animation_started", Event, "_loading_is_started") + animation.connect("animation_finished", Event, "_loading_is_finished") func goto_scene(path): - print("[global#goto_scene] : "+String(path)) + print("[global#goto_scene] : load scene "+String(path)) loader = ResourceLoader.load_interactive(path) if loader == null: print("Error loading ....") return + + Loading.show() + animation.play("BorderAnim") set_process(true) current_scene.queue_free() wait_frames = 1 - Loading.get_node("VBoxContainer/ProgressBar").set_max(loader.get_stage_count()) - -func get_setting_language(): - return setting.get_langue() - -func set_setting_language(value): - setting.set_langue(value) - apply_language(translate_int_to_locale(value)) - -func get_setting_gyrosocpe(): - return setting.get_gyroscope() - -func set_setting_gyroscope(value): - setting.set_gyroscope(value) - -func get_setting_ambient_sound(): - return setting.get_ambient_sound() - -func set_setting_ambient_sound(value): - setting.set_ambient_sound(value) - -func get_setting_resolution(): - return setting.get_resolution() - -func set_setting_resolution(value): - setting.set_resolution(value) - apply_resolution() - -func get_setting_fullscreen(): - return setting.get_fullscreen() - -func set_setting_fullscreen(value): - setting.set_fullscreen(value) - apply_fullscreen() + Loading.get_node("LoadingBare/VBoxContainer/HBoxContainer/ProgressBar").set_max(loader.get_stage_count()) func _process(_delta): - print("[global#_process]") if loader == null: set_process(false) return @@ -104,16 +49,17 @@ func _process(_delta): # Use "TICKS_TIME_MAX" to control for how long we block this thread while OS.get_ticks_msec() < tick + TICKS_TIME_MAX: - var err = loader.poll() + if loaded: + var err = loader.poll() - if err == ERR_FILE_EOF: # Finished loading. - _set_new_scene() - break - elif err == OK: - _update_progress() - else: - loader = null - break + if err == ERR_FILE_EOF: # Finished loading. + _set_new_scene() + break + elif err == OK: + _update_progress() + else: + loader = null + break ## PRIVATE func _initialize_current_scene(): @@ -124,29 +70,13 @@ func _initialize_current_scene(): if current_scene.name != "Main": get_node("/root/Loading").hide() -func _initialize_database(): - print("[global#_initialize_database]") - var database_manager = load(gddb_constants.c_addon_main_path + "core/db_man.gd").new() - var db_id = database_manager.load_database("res://db/ahog.json") - - if db_id == gddb_types.e_db_invalid_file: - print("[global#_initialize_database] Error invalid database file !") - OS.set_exit_code(1) - - if db_id == gddb_types.e_db_invalid_ver: - print("[global#_initialize_database] Error invalid database version !") - OS.set_exit_code(1) - - database = database_manager.get_db_by_id(db_id) - table_levels = database.get_table_by_name("levels") - func _update_progress(): Loading.visible = true - Loading.get_node("VBoxContainer/ProgressBar").set_value(loader.get_stage()) + Loading.get_node("LoadingBare/VBoxContainer/HBoxContainer/ProgressBar").set_value(loader.get_stage()) func _set_new_scene(): var resource = loader.get_resource() loader = null current_scene = resource.instance() get_node("/root").add_child(current_scene) - get_node("/root/Loading").hide() + Loading.hide() diff --git a/scenes/UI/Background.tscn b/scenes/UI/Background.tscn new file mode 100644 index 0000000..76ebed9 --- /dev/null +++ b/scenes/UI/Background.tscn @@ -0,0 +1,62 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://assets/ui/themes/bck.jpg" type="Texture" id=1] + +[sub_resource type="VisualShaderNodeInput" id=1] +input_name = "screen_uv" + +[sub_resource type="VisualShaderNodeTexture" id=2] +texture = ExtResource( 1 ) +texture_type = 1 + +[sub_resource type="VisualShaderNodeInput" id=3] +input_name = "screen_texture" + +[sub_resource type="VisualShader" id=4] +code = "shader_type canvas_item; +uniform sampler2D tex_frg_4 : hint_albedo; + + + +void vertex() { +// Output:0 + +} + +void fragment() { +// Texture:4 + vec4 tex_frg_4_read = texture(tex_frg_4, UV.xy); + vec3 n_out4p0 = tex_frg_4_read.rgb; + float n_out4p1 = tex_frg_4_read.a; + +// Output:0 + COLOR.rgb = n_out4p0; + +} + +void light() { +// Output:0 + +} +" +graph_offset = Vector2( -1049.92, -300 ) +mode = 1 +flags/light_only = false +nodes/fragment/3/node = SubResource( 1 ) +nodes/fragment/3/position = Vector2( -840, 460 ) +nodes/fragment/4/node = SubResource( 2 ) +nodes/fragment/4/position = Vector2( -80, 60 ) +nodes/fragment/5/node = SubResource( 3 ) +nodes/fragment/5/position = Vector2( -1000, 20 ) +nodes/fragment/connections = PoolIntArray( 4, 0, 0, 0 ) + +[sub_resource type="ShaderMaterial" id=5] +shader = SubResource( 4 ) + +[node name="BackgroundPicture" type="Panel"] +material = SubResource( 5 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/scenes/UI/UI_summary.tscn b/scenes/UI/UI_summary.tscn index 99957c2..6cb8f8a 100644 --- a/scenes/UI/UI_summary.tscn +++ b/scenes/UI/UI_summary.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=2] +[gd_scene load_steps=27 format=2] [ext_resource path="res://assets/ui/themes/button-summary.jpg" type="Texture" id=1] [ext_resource path="res://assets/ui/themes/bck-vert-grd.png" type="Texture" id=2] @@ -6,7 +6,9 @@ [ext_resource path="res://assets/ui/themes/wood-tile.jpg" type="Texture" id=4] [ext_resource path="res://assets/ui/themes/button-summary-hover.jpg" type="Texture" id=5] [ext_resource path="res://assets/ui/icones/treasure-hover.png" type="Texture" id=6] -[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=7] +[ext_resource path="res://assets/fonts/kirsty/kirsty_base.tres" type="DynamicFont" id=7] +[ext_resource path="res://assets/fonts/text_outline.material" type="Material" id=8] +[ext_resource path="res://assets/fonts/kirsty/kirsty_title.tres" type="DynamicFont" id=9] [sub_resource type="VisualShaderNodeVectorOp" id=1] operator = 3 @@ -194,15 +196,14 @@ __meta__ = { [node name="CenterContainer" type="CenterContainer" parent="PanelWood/VBoxContainer"] margin_right = 350.0 -margin_bottom = 147.0 +margin_bottom = 128.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="TextureRect" type="TextureButton" parent="PanelWood/VBoxContainer/CenterContainer"] margin_left = 111.0 -margin_top = 9.0 margin_right = 239.0 -margin_bottom = 137.0 +margin_bottom = 128.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 4 size_flags_vertical = 4 @@ -212,9 +213,9 @@ texture_focused = ExtResource( 6 ) stretch_mode = 3 [node name="ButtonPuzzle" type="TextureButton" parent="PanelWood/VBoxContainer"] -margin_top = 177.0 +margin_top = 158.0 margin_right = 350.0 -margin_bottom = 254.0 +margin_bottom = 235.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 0 @@ -226,13 +227,15 @@ __meta__ = { } [node name="Label" type="Label" parent="PanelWood/VBoxContainer/ButtonPuzzle"] +material = ExtResource( 8 ) anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 size_flags_horizontal = 7 size_flags_vertical = 3 -custom_fonts/font = ExtResource( 7 ) -custom_colors/font_color = Color( 0, 0, 0, 1 ) -text = "Puzz" +custom_fonts/font = ExtResource( 9 ) +text = "Puzzles" align = 1 valign = 1 __meta__ = { @@ -241,9 +244,9 @@ __meta__ = { } [node name="ButtonSetting" type="TextureButton" parent="PanelWood/VBoxContainer"] -margin_top = 284.0 +margin_top = 265.0 margin_right = 350.0 -margin_bottom = 361.0 +margin_bottom = 342.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 0 @@ -255,13 +258,44 @@ __meta__ = { } [node name="Label" type="Label" parent="PanelWood/VBoxContainer/ButtonSetting"] +material = ExtResource( 8 ) anchor_right = 1.0 anchor_bottom = 1.0 size_flags_horizontal = 7 size_flags_vertical = 3 -custom_fonts/font = ExtResource( 7 ) +custom_fonts/font = ExtResource( 9 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) -text = "Param" +text = "Paramètres" +align = 1 +valign = 1 +__meta__ = { +"_edit_use_anchors_": false, +"_editor_description_": "" +} + +[node name="ButtonCredits" type="TextureButton" parent="PanelWood/VBoxContainer"] +margin_top = 372.0 +margin_right = 350.0 +margin_bottom = 449.0 +mouse_default_cursor_shape = 2 +size_flags_horizontal = 0 +size_flags_vertical = 0 +texture_normal = ExtResource( 1 ) +texture_hover = ExtResource( 5 ) +texture_focused = ExtResource( 5 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="PanelWood/VBoxContainer/ButtonCredits"] +material = ExtResource( 8 ) +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 7 +size_flags_vertical = 3 +custom_fonts/font = ExtResource( 9 ) +custom_colors/font_color = Color( 0, 0, 0, 1 ) +text = "Crédits" align = 1 valign = 1 __meta__ = { @@ -270,15 +304,15 @@ __meta__ = { } [node name="MarginContainer" type="MarginContainer" parent="PanelWood/VBoxContainer"] -margin_top = 391.0 +margin_top = 479.0 margin_right = 350.0 -margin_bottom = 539.0 +margin_bottom = 533.0 size_flags_vertical = 3 [node name="ButtonQuit" type="TextureButton" parent="PanelWood/VBoxContainer"] -margin_top = 569.0 +margin_top = 563.0 margin_right = 350.0 -margin_bottom = 646.0 +margin_bottom = 640.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 0 @@ -289,11 +323,12 @@ __meta__ = { } [node name="Label" type="Label" parent="PanelWood/VBoxContainer/ButtonQuit"] +material = ExtResource( 8 ) anchor_right = 1.0 anchor_bottom = 1.0 size_flags_horizontal = 7 size_flags_vertical = 3 -custom_fonts/font = ExtResource( 7 ) +custom_fonts/font = ExtResource( 9 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) text = "Quit" align = 1 @@ -303,14 +338,33 @@ __meta__ = { "_editor_description_": "" } -[node name="LabelVersion" type="Label" parent="PanelWood/VBoxContainer"] -margin_top = 676.0 +[node name="ContainerVersion" type="HBoxContainer" parent="PanelWood/VBoxContainer"] +margin_top = 670.0 margin_right = 350.0 margin_bottom = 690.0 + +[node name="MarginLeft" type="MarginContainer" parent="PanelWood/VBoxContainer/ContainerVersion"] +margin_right = 283.0 +margin_bottom = 20.0 +size_flags_horizontal = 3 + +[node name="LabelVersion" type="Label" parent="PanelWood/VBoxContainer/ContainerVersion"] +margin_left = 287.0 +margin_right = 334.0 +margin_bottom = 20.0 size_flags_vertical = 0 -text = "v XX.XX" +custom_fonts/font = ExtResource( 7 ) +custom_colors/font_color = Color( 0.741176, 0.478431, 0.372549, 1 ) +text = "v 0.0.0" align = 2 +[node name="MarginRight" type="MarginContainer" parent="PanelWood/VBoxContainer/ContainerVersion"] +margin_left = 338.0 +margin_right = 350.0 +margin_bottom = 20.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.04 + [node name="MarginContainerBottom" type="MarginContainer" parent="PanelWood/VBoxContainer"] margin_top = 720.0 margin_right = 350.0 diff --git a/scenes/UI/choose_scenes/ChooseScene.gd b/scenes/UI/choose_scenes/ChooseScene.gd index 8b2f495..ebb3f1f 100644 --- a/scenes/UI/choose_scenes/ChooseScene.gd +++ b/scenes/UI/choose_scenes/ChooseScene.gd @@ -7,21 +7,9 @@ onready var mlevel = load("res://db/MLevel.gd") func _ready(): _apply_scenes() -# Load scene warcraft -func _on_warcraft_pressed(): - Global.current_scene_int = 0 - Global.goto_scene("res://scenes/levels/warcraft/WarCraft.tscn") - -func _on_reset_level(level, node, index): - Global.current_scene_int = index - level.reset() - _configure_reset(level, node, index) - _configure_counter(level, node) - Global.current_scene_int = null - ## PRIVATE func _apply_scenes(): - for row_index in range(0, Global.table_levels.m_rows_count): + for row_index in range(0, Global.database.get_table_by_name("levels").m_rows_count): _apply_scene(mlevel.new(row_index), 0) func _build_path(name): @@ -51,18 +39,18 @@ func _configure_select(level, node): var select = get_node(node+"/TextureRect/TextureButton") select.set_normal_texture(_load_texture(level.thumbnail())) - select.connect("pressed", self, _build_method(level.name())) + select.connect("pressed", Event, _build_method(level.name())) func _configure_reset(level, node, index): var reset = get_node(node+"/VBoxContainer/MarginContainer/ButtonReset") if int(level.object_finding()) == 0: reset.set_disabled(true) - if reset.has_signal("pressed"): - reset.disconnect("pressed", self, "_on_reset_level") + if reset.is_connected("pressed", Event, "_on_reset_level"): + reset.disconnect("pressed", Event, "_on_reset_level") else: reset.set_disabled(false) - reset.connect("pressed", self, "_on_reset_level", [level, node, index]) + reset.connect("pressed", Event, "_on_reset_level", [level, node, index, self]) func _configure_counter(level, node): var count = get_node(node+"/VBoxContainer/MarginContainer2/ButtonCount/Label") diff --git a/scenes/UI/choose_scenes/ChooseScene.tscn b/scenes/UI/choose_scenes/ChooseScene.tscn index 6c55c4b..5ca4041 100644 --- a/scenes/UI/choose_scenes/ChooseScene.tscn +++ b/scenes/UI/choose_scenes/ChooseScene.tscn @@ -44,7 +44,4 @@ visible = false margin_right = 200.0 margin_bottom = 284.0 -[node name="ButtonReset" parent="MarginContainer/HBoxContainer/example/VBoxContainer/MarginContainer" index="0"] -enabled_focus_mode = 0 - [editable path="MarginContainer/HBoxContainer/example"] diff --git a/scenes/UI/ending.tscn b/scenes/UI/ending.tscn index 8813ed3..63805c1 100644 --- a/scenes/UI/ending.tscn +++ b/scenes/UI/ending.tscn @@ -29,20 +29,19 @@ size_flags_horizontal = 3 size_flags_vertical = 3 color = Color( 0, 0, 0, 1 ) -[node name="VBoxContainer" type="VBoxContainer" parent="ColorRect"] -margin_right = 1280.0 -margin_bottom = 360.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -alignment = 1 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="Timer" type="Timer" parent="."] +wait_time = 4.31 +autostart = true -[node name="Label" type="Label" parent="ColorRect/VBoxContainer"] -margin_top = 95.0 -margin_right = 1280.0 -margin_bottom = 264.0 +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 2 ) +volume_db = -29.411 + +[node name="Label" type="Label" parent="."] +margin_left = 477.0 +margin_top = 275.0 +margin_right = 802.0 +margin_bottom = 444.0 custom_fonts/font = SubResource( 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 ) text = "aHog !!! @@ -52,12 +51,4 @@ bravo vous avez gagné." align = 1 valign = 1 -[node name="Timer" type="Timer" parent="."] -wait_time = 4.31 -autostart = true - -[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] -stream = ExtResource( 2 ) -volume_db = -29.411 - [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] diff --git a/scenes/UI/list_ho/ObjectListFirst.tscn b/scenes/UI/list_ho/ObjectListFirst.tscn index 0861ead..fa3206e 100644 --- a/scenes/UI/list_ho/ObjectListFirst.tscn +++ b/scenes/UI/list_ho/ObjectListFirst.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-first-hover.png" type="Texture" id=1] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-first.png" type="Texture" id=2] -[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=3] +[ext_resource path="res://assets/fonts/kirsty/kirsty_base.tres" type="DynamicFont" id=3] [node name="TextureButton" type="TextureButton"] margin_right = 196.0 diff --git a/scenes/UI/list_ho/ObjectListLast.tscn b/scenes/UI/list_ho/ObjectListLast.tscn index 3d01f3a..4d062be 100644 --- a/scenes/UI/list_ho/ObjectListLast.tscn +++ b/scenes/UI/list_ho/ObjectListLast.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://assets/ui/themes/leather.theme" type="Theme" id=1] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-last.png" type="Texture" id=2] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-last-hover.png" type="Texture" id=3] -[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=4] +[ext_resource path="res://assets/fonts/kirsty/kirsty_base.tres" type="DynamicFont" id=4] [node name="TextureButton" type="TextureButton"] margin_right = 196.0 diff --git a/scenes/UI/list_ho/ObjectListStd.tscn b/scenes/UI/list_ho/ObjectListStd.tscn index e045afb..964b10a 100644 --- a/scenes/UI/list_ho/ObjectListStd.tscn +++ b/scenes/UI/list_ho/ObjectListStd.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-hover.png" type="Texture" id=1] -[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=2] +[ext_resource path="res://assets/fonts/kirsty/kirsty_base.tres" type="DynamicFont" id=2] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList.png" type="Texture" id=3] [node name="TextureButton" type="TextureButton"] diff --git a/scenes/UI/list_ho/UI_list_ho.tscn b/scenes/UI/list_ho/UI_list_ho.tscn index 540f3ce..7e95122 100644 --- a/scenes/UI/list_ho/UI_list_ho.tscn +++ b/scenes/UI/list_ho/UI_list_ho.tscn @@ -5,19 +5,21 @@ [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-last.png" type="Texture" id=3] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList.png" type="Texture" id=4] [ext_resource path="res://assets/ui/themes/leather.theme" type="Theme" id=5] -[ext_resource path="res://assets/fonts/kirsty/kirsty.tres" type="DynamicFont" id=6] +[ext_resource path="res://assets/fonts/kirsty/kirsty_base.tres" type="DynamicFont" id=6] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-hover.png" type="Texture" id=7] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-first-hover.png" type="Texture" id=8] [ext_resource path="res://assets/ui/themes/UI-Button-ItemsList-last-hover.png" type="Texture" id=9] [node name="Control" type="MarginContainer"] anchor_left = 1.0 +anchor_top = 0.5 anchor_right = 1.0 -anchor_bottom = 1.0 +anchor_bottom = 0.5 margin_left = -196.0 +margin_top = -450.0 +margin_bottom = 450.0 grow_horizontal = 0 grow_vertical = 2 -rect_min_size = Vector2( 196, 900 ) size_flags_vertical = 3 __meta__ = { "_edit_use_anchors_": false @@ -35,6 +37,7 @@ custom_constants/separation = -10 visible = false margin_right = 196.0 margin_bottom = 81.0 +focus_mode = 0 texture_normal = ExtResource( 2 ) texture_hover = ExtResource( 8 ) texture_focused = ExtResource( 8 ) @@ -54,6 +57,7 @@ __meta__ = { visible = false margin_right = 196.0 margin_bottom = 81.0 +focus_mode = 0 texture_normal = ExtResource( 4 ) texture_hover = ExtResource( 7 ) texture_focused = ExtResource( 7 ) @@ -73,6 +77,7 @@ __meta__ = { visible = false margin_right = 196.0 margin_bottom = 81.0 +focus_mode = 0 texture_normal = ExtResource( 3 ) texture_hover = ExtResource( 9 ) texture_focused = ExtResource( 9 ) diff --git a/scenes/UI/loading/Loading.gd b/scenes/UI/loading/Loading.gd index 94f02e5..71ee549 100644 --- a/scenes/UI/loading/Loading.gd +++ b/scenes/UI/loading/Loading.gd @@ -1,4 +1,4 @@ extends Control func _ready(): - $VBoxContainer/Label.text = tr("LOADING") + get_node("LabelLoading").text = tr("LOADING") diff --git a/scenes/UI/loading/Loading.tscn b/scenes/UI/loading/Loading.tscn index b3f3417..d098bdd 100644 --- a/scenes/UI/loading/Loading.tscn +++ b/scenes/UI/loading/Loading.tscn @@ -1,54 +1,58 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=5 format=2] -[ext_resource path="res://scenes/UI/loading/Loading.gd" type="Script" id=1] +[ext_resource path="res://scenes/UI/loading/parts/LoadingBare.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/UI/loading/parts/TopPart.tscn" type="PackedScene" id=2] +[ext_resource path="res://scenes/UI/Background.tscn" type="PackedScene" id=3] -[node name="Control" type="CenterContainer"] +[sub_resource type="Animation" id=1] +resource_name = "BorderAnim" +tracks/0/type = "bezier" +tracks/0/path = NodePath("LoadingTopBorder:rect_position:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"points": PoolRealArray( ), +"times": PoolRealArray( ) +} +tracks/1/type = "bezier" +tracks/1/path = NodePath("LoadingTopBorder:rect_position:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"points": PoolRealArray( -768, -0.25, 0, 1.01154, 306.838, -160.174, -1.02203, -283.071, 0.439946, 60.9141, -27.6065, -0.45336, -19.562, 0.536352, 17.1993, 0.362091, -0.538766, -0.968613, 0.25, 0 ), +"times": PoolRealArray( 0.1, 0.3, 0.6, 0.9 ) +} +tracks/2/type = "bezier" +tracks/2/path = NodePath("LoadingBare:modulate:a") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"points": PoolRealArray( 0, -0.25, 0, 1.10651, 0.716757, 1, -1.59408, -0.0328361, 0.25, 0 ), +"times": PoolRealArray( 0, 0.4 ) +} + +[node name="Control" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 -script = ExtResource( 1 ) __meta__ = { "_edit_use_anchors_": false } -[node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_left = 687.0 -margin_top = 432.0 -margin_right = 752.0 -margin_bottom = 468.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -alignment = 1 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="BackgroundPicture" parent="." instance=ExtResource( 3 )] -[node name="Label" type="Label" parent="VBoxContainer"] -margin_right = 65.0 -margin_bottom = 14.0 -text = "Loading ..." -align = 1 +[node name="LoadingTopBorder" parent="." instance=ExtResource( 2 )] +margin_top = 0.362091 +margin_bottom = 0.362061 -[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"] -margin_top = 18.0 -margin_right = 65.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 +[node name="LoadingBare" parent="." instance=ExtResource( 1 )] +margin_top = 360.0 -[node name="ProgressBar" type="ProgressBar" parent="VBoxContainer"] -margin_top = 22.0 -margin_right = 65.0 -margin_bottom = 36.0 -max_value = 1.0 -step = 0.1 -rounded = true - -[node name="ColorRect" type="ColorRect" parent="."] -margin_left = 720.0 -margin_top = 450.0 -margin_right = 720.0 -margin_bottom = 450.0 -color = Color( 0, 0, 0, 1 ) -__meta__ = { -"_edit_use_anchors_": false -} +[node name="AnimLoading" type="AnimationPlayer" parent="."] +method_call_mode = 1 +anims/BorderAnim = SubResource( 1 ) diff --git a/scenes/UI/loading/parts/BorderColor.tscn b/scenes/UI/loading/parts/BorderColor.tscn new file mode 100644 index 0000000..4fd5411 --- /dev/null +++ b/scenes/UI/loading/parts/BorderColor.tscn @@ -0,0 +1,28 @@ +[gd_scene format=2] + +[node name="Tile" type="VBoxContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +size_flags_horizontal = 3 + +[node name="MarginContainer" type="MarginContainer" parent="."] +margin_right = 1280.0 +margin_bottom = 237.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="BorderLeft" type="ColorRect" parent="."] +margin_top = 241.0 +margin_right = 1280.0 +margin_bottom = 478.0 +rect_min_size = Vector2( 0, 8 ) +size_flags_horizontal = 3 +size_flags_vertical = 3 +color = Color( 0.74902, 0.701961, 0.65098, 1 ) + +[node name="MarginContainer2" type="MarginContainer" parent="."] +margin_top = 482.0 +margin_right = 1280.0 +margin_bottom = 720.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 diff --git a/scenes/UI/loading/parts/LabelLoading.tscn b/scenes/UI/loading/parts/LabelLoading.tscn new file mode 100644 index 0000000..02a881f --- /dev/null +++ b/scenes/UI/loading/parts/LabelLoading.tscn @@ -0,0 +1,32 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/fonts/kirsty/kirsty_title.tres" type="DynamicFont" id=1] +[ext_resource path="res://scenes/UI/loading/Loading.gd" type="Script" id=2] + +[node name="VBoxLoading" type="VBoxContainer"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -96.5 +margin_top = -28.0 +margin_right = 96.5 +margin_bottom = 28.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +custom_constants/separation = 0 +alignment = 1 +script = ExtResource( 2 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="LabelLoading" type="Label" parent="."] +margin_right = 193.0 +margin_bottom = 56.0 +custom_fonts/font = ExtResource( 1 ) +custom_colors/font_color = Color( 0.74902, 0.701961, 0.65098, 1 ) +text = "loading" +align = 1 +valign = 2 +uppercase = true diff --git a/scenes/UI/loading/parts/LoadingBare.tscn b/scenes/UI/loading/parts/LoadingBare.tscn new file mode 100644 index 0000000..47bf0a2 --- /dev/null +++ b/scenes/UI/loading/parts/LoadingBare.tscn @@ -0,0 +1,61 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://assets/ui/themes/leather.theme" type="Theme" id=1] + +[node name="LoadingBare" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"] +margin_right = 1280.0 +margin_bottom = 237.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 241.0 +margin_right = 1280.0 +margin_bottom = 478.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="HSplitContainer" type="HSplitContainer" parent="VBoxContainer/HBoxContainer"] +margin_right = 238.0 +margin_bottom = 237.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.3 + +[node name="ProgressBar" type="ProgressBar" parent="VBoxContainer/HBoxContainer"] +margin_left = 242.0 +margin_right = 1037.0 +margin_bottom = 237.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme = ExtResource( 1 ) +max_value = 1.0 +step = 0.1 +rounded = true + +[node name="HSplitContainer2" type="HSplitContainer" parent="VBoxContainer/HBoxContainer"] +margin_left = 1041.0 +margin_right = 1280.0 +margin_bottom = 237.0 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 0.3 + +[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer"] +margin_top = 482.0 +margin_right = 1280.0 +margin_bottom = 720.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 diff --git a/scenes/UI/loading/parts/TopPart.tscn b/scenes/UI/loading/parts/TopPart.tscn new file mode 100644 index 0000000..17d1bc5 --- /dev/null +++ b/scenes/UI/loading/parts/TopPart.tscn @@ -0,0 +1,87 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://scenes/UI/loading/parts/LabelLoading.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/UI/loading/parts/BorderColor.tscn" type="PackedScene" id=2] +[ext_resource path="res://assets/ui/themes/bck-hrz-grd.png" type="Texture" id=3] + +[node name="LoadingBorder" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_vertical = 2 +rect_clip_content = true +size_flags_horizontal = 3 +size_flags_vertical = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BackgroundGradient" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +custom_constants/separation = 0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BlackColor" type="ColorRect" parent="BackgroundGradient"] +margin_right = 1280.0 +margin_bottom = 240.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +color = Color( 0, 0, 0, 1 ) + +[node name="ColorRect" type="TextureRect" parent="BackgroundGradient"] +margin_top = 240.0 +margin_right = 1280.0 +margin_bottom = 480.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +texture = ExtResource( 3 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="MarginContainer" type="MarginContainer" parent="BackgroundGradient"] +margin_top = 480.0 +margin_right = 1280.0 +margin_bottom = 720.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="LabelAndBorder" type="HBoxContainer" parent="."] +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_top = -30.0 +margin_bottom = 30.0 +rect_clip_content = true +size_flags_vertical = 5 +custom_constants/separation = 20 +alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="BorderLeft" parent="LabelAndBorder" instance=ExtResource( 2 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_right = 523.0 +margin_bottom = 60.0 + +[node name="LabelLoading" parent="LabelAndBorder" instance=ExtResource( 1 )] +anchor_left = 0.0 +anchor_top = 0.0 +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 543.0 +margin_top = 0.0 +margin_right = 736.0 +margin_bottom = 56.0 + +[node name="BorderRight" parent="LabelAndBorder" instance=ExtResource( 2 )] +anchor_right = 0.0 +anchor_bottom = 0.0 +margin_left = 756.0 +margin_right = 1280.0 +margin_bottom = 60.0 diff --git a/scenes/UI/settings/Settings.gd b/scenes/UI/settings/Settings.gd index 1ba6044..219f95f 100644 --- a/scenes/UI/settings/Settings.gd +++ b/scenes/UI/settings/Settings.gd @@ -19,13 +19,13 @@ func _apply_settings_language(): data.add_item("English", load("res://assets/ui/flags/english.png"), true) # id : 0 data.add_item("Français", load("res://assets/ui/flags/french.png"), true) # id : 1 - data.select(Global.get_setting_language()) + data.select(Setting.get_setting_language()) func _apply_settings_gyroscope(): - $VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(Global.get_setting_gyrosocpe()) + $VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(Setting.get_setting_gyrosocpe()) func _apply_settings_sound_ambient(): - $VBoxContainer/ambient_sound/HBoxContainer/data.set_pressed(Global.get_setting_ambient_sound()) + $VBoxContainer/ambient_sound/HBoxContainer/data.set_pressed(Setting.get_setting_ambient_sound()) func _apply_settings_resolution(): var data = $VBoxContainer/resolution/VBoxContainer/data @@ -36,23 +36,23 @@ func _apply_settings_resolution(): data.add_item("854 x 576", null, true) # id : 3 for index in range(4): - if data.get_item_text(index).split(' x ') == Global.get_setting_resolution(): + if data.get_item_text(index).split(' x ') == Setting.get_setting_resolution(): data.select(index) func _apply_settings_fullscreen(): - $VBoxContainer/fullscreen/HBoxContainer/data.set_pressed(Global.get_setting_fullscreen()) + $VBoxContainer/fullscreen/HBoxContainer/data.set_pressed(Setting.get_setting_fullscreen()) func _on_gyroscope_pressed(): - Global.set_setting_gyroscope(int($VBoxContainer/gyroscope/HBoxContainer/data.pressed)) + Setting.set_setting_gyroscope(int($VBoxContainer/gyroscope/HBoxContainer/data.pressed)) func _on_ambient_sound_pressed(): - Global.set_setting_ambient_sound(int($VBoxContainer/ambient_sound/HBoxContainer/data.pressed)) + Setting.set_setting_ambient_sound(int($VBoxContainer/ambient_sound/HBoxContainer/data.pressed)) func _on_langue_item_selected(index): - Global.set_setting_language(index) + Setting.set_setting_language(index) func _on_resolution_item_selected(index): - Global.set_setting_resolution($VBoxContainer/resolution/VBoxContainer/data.get_item_text(index)) + Setting.set_setting_resolution($VBoxContainer/resolution/VBoxContainer/data.get_item_text(index)) func _on_fullscreen_item_selected(): - Global.set_setting_fullscreen(int($VBoxContainer/fullscreen/HBoxContainer/data.pressed)) + Setting.set_setting_fullscreen(int($VBoxContainer/fullscreen/HBoxContainer/data.pressed)) diff --git a/scenes/UI/settings/Settings.tscn b/scenes/UI/settings/Settings.tscn index cf14ff7..54edf7c 100644 --- a/scenes/UI/settings/Settings.tscn +++ b/scenes/UI/settings/Settings.tscn @@ -41,6 +41,7 @@ align = 1 margin_top = 18.0 margin_right = 50.0 margin_bottom = 27.0 +focus_mode = 0 auto_height = true max_columns = 2 same_column_width = true @@ -113,6 +114,7 @@ text = "Resolution :" margin_top = 18.0 margin_right = 76.0 margin_bottom = 27.0 +focus_mode = 0 size_flags_horizontal = 3 size_flags_vertical = 3 auto_height = true diff --git a/scenes/levels/Template.tscn b/scenes/levels/Template.tscn index 1871eee..7b32df8 100644 --- a/scenes/levels/Template.tscn +++ b/scenes/levels/Template.tscn @@ -27,6 +27,7 @@ margin_left = 25.0 margin_top = 25.0 margin_right = 40.0 margin_bottom = 40.0 +focus_mode = 0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 size_flags_vertical = 3 @@ -51,6 +52,7 @@ size_flags_horizontal = 3 margin_left = 9.0 margin_right = 89.0 margin_bottom = 80.0 +focus_mode = 0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 disabled = true @@ -69,6 +71,7 @@ size_flags_horizontal = 3 margin_left = 9.0 margin_right = 89.0 margin_bottom = 80.0 +focus_mode = 0 mouse_default_cursor_shape = 2 size_flags_horizontal = 3 texture_normal = ExtResource( 2 ) diff --git a/scenes/levels/levels.gd b/scenes/levels/levels.gd index 50ae030..b41ac62 100644 --- a/scenes/levels/levels.gd +++ b/scenes/levels/levels.gd @@ -81,7 +81,7 @@ func _action_pressed(action): return Input.is_action_pressed(action) func _action_gyroscope(action, gyroscope): - if Global.get_setting_gyrosocpe(): + if Setting.get_setting_gyrosocpe(): var expression = Expression.new() expression.parse("_gyroscope_changed_"+action+"(gyroscope)", ["gyroscope"]) diff --git a/scenes/levels/warcraft/WarCraft.gd b/scenes/levels/warcraft/WarCraft.gd index 1001080..2527dae 100644 --- a/scenes/levels/warcraft/WarCraft.gd +++ b/scenes/levels/warcraft/WarCraft.gd @@ -50,6 +50,6 @@ func _create_button_info(scene, counter, label_counter): last_btn = btn func _play_ambient_sound(): - if Global.get_setting_ambient_sound(): + if Setting.get_setting_ambient_sound(): $AmbientSound.play() $AmbientSound.stream_paused = false diff --git a/scenes/levels/warcraft/WarCraft.tscn b/scenes/levels/warcraft/WarCraft.tscn index 0f9e53b..77749f2 100644 --- a/scenes/levels/warcraft/WarCraft.tscn +++ b/scenes/levels/warcraft/WarCraft.tscn @@ -270,7 +270,7 @@ cell_center_y = false cell_center_z = false baked_meshes = [ SubResource( 4 ) ] data = { -"cells": PoolIntArray( 0, 0, 0, 65531, 0, -1610612733, 65532, 0, 0, 65533, 0, -1610612736, 65534, 0, 0, 65535, 0, 0, 0, 1, 0, 65531, 1, 3, 65532, 1, 0, 65533, 1, 0, 65534, 1, 0, 65535, 1, 0, 0, 2, 0, 65531, 2, 3, 65532, 2, 0, 65533, 2, 0, 65534, 2, 0, 65535, 2, 0, 0, 65533, 0, 65532, 65533, 0, 65533, 65533, 0, 65534, 65533, 0, 65535, 65533, 0, 0, 65534, 0, 65531, 65534, 3, 65532, 65534, 0, 65533, 65534, 0, 65534, 65534, 0, 65535, 65534, 0, 0, 65535, 0, 65531, 65535, 1073741827, 65532, 65535, 0, 65533, 65535, 0, 65534, 65535, 0, 65535, 65535, 0 ) +"cells": PoolIntArray( 0, 0, -1610612736, 65531, 0, 3, 65532, 0, 0, 65533, 0, 0, 65534, 0, 0, 65535, 0, 0, 0, 1, 0, 65531, 1, 3, 65532, 1, 0, 65533, 1, 0, 65534, 1, 0, 65535, 1, 0, 0, 2, 0, 65531, 2, 3, 65532, 2, 0, 65533, 2, 0, 65534, 2, 0, 65535, 2, 1073741824, 0, 65533, 0, 65532, 65533, 0, 65533, 65533, 0, 65534, 65533, 0, 65535, 65533, 0, 0, 65534, 0, 65531, 65534, 3, 65532, 65534, 0, 65533, 65534, 0, 65534, 65534, 0, 65535, 65534, 0, 0, 65535, 0, 65531, 65535, 3, 65532, 65535, 0, 65533, 65535, 0, 65534, 65535, 0, 65535, 65535, 0 ) } __meta__ = { "_editor_clip_": 0, diff --git a/scenes/main.gd b/scenes/main.gd index 4182327..8a15e17 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -4,11 +4,13 @@ export (PackedScene) var settings = load("res://scenes/UI/settings/Settings.tscn export (PackedScene) var scenes = load("res://scenes/UI/choose_scenes/ChooseScene.tscn") onready var current_scene = "title" -onready var stream_button= preload("res://assets/sounds/click-button.ogg") +onready var stream_button = preload("res://assets/sounds/click-button.ogg") +onready var home = $MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect func _ready(): _translation() - $MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect.grab_focus() + home.set_focus_mode(2) + home.grab_focus() _apply_scene("Title") _configure_sound() diff --git a/scenes/main.tscn b/scenes/main.tscn index 46e2836..db6431e 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,78 +1,22 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=7 format=2] [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/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://scenes/UI/Background.tscn" type="PackedScene" id=5] [ext_resource path="res://scenes/UI/UI_summary.tscn" type="PackedScene" id=8] -[sub_resource type="VisualShaderNodeInput" id=1] -input_name = "screen_uv" - -[sub_resource type="VisualShaderNodeTexture" id=2] -texture = ExtResource( 6 ) -texture_type = 1 - -[sub_resource type="VisualShaderNodeInput" id=3] -input_name = "screen_texture" - -[sub_resource type="VisualShader" id=4] -code = "shader_type canvas_item; -uniform sampler2D tex_frg_4 : hint_albedo; - - - -void vertex() { -// Output:0 - -} - -void fragment() { -// Texture:4 - vec4 tex_frg_4_read = texture(tex_frg_4, UV.xy); - vec3 n_out4p0 = tex_frg_4_read.rgb; - float n_out4p1 = tex_frg_4_read.a; - -// Output:0 - COLOR.rgb = n_out4p0; - -} - -void light() { -// Output:0 - -} -" -graph_offset = Vector2( -1049.92, -300 ) -mode = 1 -flags/light_only = false -nodes/fragment/3/node = SubResource( 1 ) -nodes/fragment/3/position = Vector2( -840, 460 ) -nodes/fragment/4/node = SubResource( 2 ) -nodes/fragment/4/position = Vector2( -80, 60 ) -nodes/fragment/5/node = SubResource( 3 ) -nodes/fragment/5/position = Vector2( -1000, 20 ) -nodes/fragment/connections = PoolIntArray( 4, 0, 0, 0 ) - -[sub_resource type="ShaderMaterial" id=5] -shader = SubResource( 4 ) - [node name="Main" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource( 1 ) __meta__ = { +"_edit_lock_": true, "_edit_use_anchors_": false } -[node name="BackgroundPicture" type="Panel" parent="."] -material = SubResource( 5 ) -anchor_right = 1.0 -anchor_bottom = 1.0 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="BackgroundPicture" parent="." instance=ExtResource( 5 )] [node name="MarginContainer" type="MarginContainer" parent="."] anchor_right = 1.0 @@ -92,6 +36,18 @@ margin_bottom = 720.0 size_flags_horizontal = 0 size_flags_vertical = 3 +[node name="TextureRect" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer" index="0"] +focus_mode = 0 + +[node name="ButtonPuzzle" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="1"] +focus_mode = 0 + +[node name="ButtonSetting" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="2"] +focus_mode = 0 + +[node name="ButtonQuit" parent="MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer" index="5"] +focus_mode = 0 + [node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer"] margin_left = 450.0 margin_right = 1280.0 diff --git a/scripts/Database.gd b/scripts/Database.gd new file mode 100644 index 0000000..b03f191 --- /dev/null +++ b/scripts/Database.gd @@ -0,0 +1,15 @@ +extends Node + +func initialize(): + var database_manager = load(gddb_constants.c_addon_main_path + "core/db_man.gd").new() + var db_id = database_manager.load_database("res://db/ahog.json") + + if db_id == gddb_types.e_db_invalid_file: + print("[global#_initialize_database] Error invalid database file !") + OS.set_exit_code(1) + + if db_id == gddb_types.e_db_invalid_ver: + print("[global#_initialize_database] Error invalid database version !") + OS.set_exit_code(1) + + return database_manager.get_db_by_id(db_id) diff --git a/scripts/Event.gd b/scripts/Event.gd new file mode 100644 index 0000000..e27537b --- /dev/null +++ b/scripts/Event.gd @@ -0,0 +1,24 @@ +extends Node + +## Events for loading scene +#### +func _loading_is_started(_anim_name): + print("[Event#_loading_is_started]") + Global.loaded = false + +func _loading_is_finished(_anim_name): + print("[Evenst#_loading_is_finished]") + Global.loaded = true + +# events for load scene level +#### +func _on_warcraft_pressed(): + Global.current_scene_int = 0 + Global.goto_scene("res://scenes/levels/warcraft/WarCraft.tscn") + +func _on_reset_level(level, node, index, parent): + Global.current_scene_int = index + level.reset() + parent.configure_reset(level, node, index) + parent.configure_counter(level, node) + Global.current_scene_int = null diff --git a/scripts/Setting.gd b/scripts/Setting.gd new file mode 100644 index 0000000..f89a768 --- /dev/null +++ b/scripts/Setting.gd @@ -0,0 +1,63 @@ +extends Node + +onready var setting = load("res://db/MSetting.gd").new() + +func _ready(): + apply_language(translate_int_to_locale(get_setting_language())) + apply_resolution() + apply_fullscreen() + +func apply_language(local): + TranslationServer.set_locale(local) + +func translate_int_to_locale(id): + var lang = "en_GB" + + if id == 0: + lang = "en_GB" + + if id == 1: + lang = "fr_FR" + + return lang + +func apply_resolution(): + var screen_size = Vector2(get_setting_resolution()[0], get_setting_resolution()[1]) + var margin_size = Vector2(0, 0) + get_viewport().set_size_override(true, screen_size, margin_size) + +func apply_fullscreen(): + OS.set_window_fullscreen(get_setting_fullscreen()) + +func get_setting_language(): + return setting.get_langue() + +func set_setting_language(value): + setting.set_langue(value) + apply_language(setting.translate_int_to_locale(value)) + +func get_setting_gyrosocpe(): + return setting.get_gyroscope() + +func set_setting_gyroscope(value): + setting.set_gyroscope(value) + +func get_setting_ambient_sound(): + return setting.get_ambient_sound() + +func set_setting_ambient_sound(value): + setting.set_ambient_sound(value) + +func get_setting_resolution(): + return setting.get_resolution() + +func set_setting_resolution(value): + setting.set_resolution(value) + apply_resolution() + +func get_setting_fullscreen(): + return setting.get_fullscreen() + +func set_setting_fullscreen(value): + setting.set_fullscreen(value) + apply_fullscreen()