From 08708f2b59a81bfa8e06ea2071c18d5d028fb0cf Mon Sep 17 00:00:00 2001 From: Nordup Date: Sat, 26 Oct 2024 07:09:25 +0400 Subject: [PATCH] gate not responding popup --- app/assets/fonts/Inter-Bold.otf.import | 1 + app/assets/fonts/Inter-BoldItalic.otf.import | 1 + app/assets/fonts/Inter-Italic.otf.import | 1 + app/assets/fonts/Inter-Regular.otf.import | 8 +- app/assets/fonts/Monospace.ttf.import | 1 + app/assets/fonts/MonospaceBold.ttf.import | 8 +- app/scenes/components/not_responding.tscn | 117 +++++++++++++++++++ app/scenes/components/search.tscn | 19 +-- app/scenes/menu.tscn | 1 - app/scenes/menu_body/world.tscn | 7 +- app/scripts/sandbox/input_sync.gd | 4 +- app/scripts/sandbox/process_checker.gd | 2 +- app/scripts/ui/world/not_responding.gd | 47 ++++++++ app/scripts/ui/world/world_ui.gd | 1 + 14 files changed, 205 insertions(+), 13 deletions(-) create mode 100644 app/scenes/components/not_responding.tscn create mode 100644 app/scripts/ui/world/not_responding.gd diff --git a/app/assets/fonts/Inter-Bold.otf.import b/app/assets/fonts/Inter-Bold.otf.import index 88b46c7..ad54dc3 100644 --- a/app/assets/fonts/Inter-Bold.otf.import +++ b/app/assets/fonts/Inter-Bold.otf.import @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Inter-Bold.otf-fed3606970d0d1ec228f8cbb3326ce Rendering=null antialiasing=1 generate_mipmaps=false +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 msdf_size=48 diff --git a/app/assets/fonts/Inter-BoldItalic.otf.import b/app/assets/fonts/Inter-BoldItalic.otf.import index 7527672..c56b53d 100644 --- a/app/assets/fonts/Inter-BoldItalic.otf.import +++ b/app/assets/fonts/Inter-BoldItalic.otf.import @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Inter-BoldItalic.otf-fc2a2d62a96e28426d3bc0af Rendering=null antialiasing=1 generate_mipmaps=false +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 msdf_size=48 diff --git a/app/assets/fonts/Inter-Italic.otf.import b/app/assets/fonts/Inter-Italic.otf.import index c794fb5..7da89e5 100644 --- a/app/assets/fonts/Inter-Italic.otf.import +++ b/app/assets/fonts/Inter-Italic.otf.import @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Inter-Italic.otf-a2ee68ef97ef9010eaa7272e19db Rendering=null antialiasing=1 generate_mipmaps=false +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 msdf_size=48 diff --git a/app/assets/fonts/Inter-Regular.otf.import b/app/assets/fonts/Inter-Regular.otf.import index 0c4a795..bd860b2 100644 --- a/app/assets/fonts/Inter-Regular.otf.import +++ b/app/assets/fonts/Inter-Regular.otf.import @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Inter-Regular.otf-f352c7616b1c2d50404f5bb3f48 Rendering=null antialiasing=1 generate_mipmaps=false +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 msdf_size=48 @@ -27,7 +28,12 @@ Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] language_support={} script_support={} opentype_features={} diff --git a/app/assets/fonts/Monospace.ttf.import b/app/assets/fonts/Monospace.ttf.import index 3a73928..d0bd784 100644 --- a/app/assets/fonts/Monospace.ttf.import +++ b/app/assets/fonts/Monospace.ttf.import @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/Monospace.ttf-84d18bc2b9fbca262f60d9ae15d1ff1 Rendering=null antialiasing=1 generate_mipmaps=false +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 msdf_size=48 diff --git a/app/assets/fonts/MonospaceBold.ttf.import b/app/assets/fonts/MonospaceBold.ttf.import index 54b37ce..987d9fb 100644 --- a/app/assets/fonts/MonospaceBold.ttf.import +++ b/app/assets/fonts/MonospaceBold.ttf.import @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/MonospaceBold.ttf-85e6bb30ac22368fdf6bd988771 Rendering=null antialiasing=1 generate_mipmaps=false +disable_embedded_bitmaps=true multichannel_signed_distance_field=false msdf_pixel_range=8 msdf_size=48 @@ -27,7 +28,12 @@ Fallbacks=null fallbacks=[] Compress=null compress=true -preload=[] +preload=[{ +"chars": [], +"glyphs": [], +"name": "New Configuration", +"size": Vector2i(16, 0) +}] language_support={} script_support={} opentype_features={} diff --git a/app/scenes/components/not_responding.tscn b/app/scenes/components/not_responding.tscn new file mode 100644 index 0000000..beb3069 --- /dev/null +++ b/app/scenes/components/not_responding.tscn @@ -0,0 +1,117 @@ +[gd_scene load_steps=6 format=3 uid="uid://c7571vjq7l0jp"] + +[ext_resource type="Script" path="res://scripts/ui/world/not_responding.gd" id="1_feqd7"] +[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_8u6e2"] +[ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="2_ugt55"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_htqsi"] +bg_color = Color(0, 0, 0, 0.5) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s6kym"] +bg_color = Color(0.156863, 0.156863, 0.156863, 1) +corner_radius_top_left = 16 +corner_radius_top_right = 16 +corner_radius_bottom_right = 16 +corner_radius_bottom_left = 16 +shadow_color = Color(0, 0, 0, 0.25) +shadow_size = 16 + +[node name="NotResponding" type="Control" node_paths=PackedStringArray("root")] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +script = ExtResource("1_feqd7") +gate_events = ExtResource("2_8u6e2") +root = NodePath("TextureButton") + +[node name="TextureButton" type="TextureButton" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Panel" type="Panel" parent="TextureButton"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_htqsi") + +[node name="Popup" type="Control" parent="TextureButton"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -229.0 +offset_top = -116.0 +offset_right = 229.0 +offset_bottom = 116.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Panel" type="Panel" parent="TextureButton/Popup"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_s6kym") + +[node name="Label" type="Label" parent="TextureButton/Popup"] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_top = 29.0 +offset_bottom = 68.0 +grow_horizontal = 2 +theme_override_fonts/font = ExtResource("2_ugt55") +theme_override_font_sizes/font_size = 32 +text = "Gate is not responding" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Label2" type="Label" parent="TextureButton/Popup"] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_left = 59.0 +offset_top = 96.0 +offset_right = -53.0 +offset_bottom = 166.0 +grow_horizontal = 2 +theme_override_colors/font_color = Color(0.621524, 0.621524, 0.621524, 1) +theme_override_constants/line_spacing = -2 +theme_override_fonts/font = ExtResource("2_ugt55") +theme_override_font_sizes/font_size = 20 +text = "Restart the page or try to wait if it responses" +autowrap_mode = 3 + +[node name="LinkButton" type="LinkButton" parent="TextureButton/Popup"] +layout_mode = 1 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -34.0 +offset_top = -50.0 +offset_right = 34.0 +offset_bottom = -25.0 +grow_horizontal = 2 +grow_vertical = 0 +theme_override_fonts/font = ExtResource("2_ugt55") +theme_override_font_sizes/font_size = 20 +text = "Get help!" +uri = "https://forms.gle/A44qmWkcE9f6cD81A" diff --git a/app/scenes/components/search.tscn b/app/scenes/components/search.tscn index afe8db1..c05b4c0 100644 --- a/app/scenes/components/search.tscn +++ b/app/scenes/components/search.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=21 format=3 uid="uid://ctam0fxigbefk"] +[gd_scene load_steps=22 format=3 uid="uid://ctam0fxigbefk"] [ext_resource type="Script" path="res://scripts/ui/search.gd" id="1_7ivk2"] +[ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="1_cimak"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_13io8"] [ext_resource type="Texture2D" uid="uid://c28surtqjf4st" path="res://assets/textures/search.svg" id="3_1rllf"] [ext_resource type="Script" path="res://scripts/ui/search/search_status.gd" id="3_3p1re"] @@ -48,6 +49,7 @@ corner_radius_bottom_left = 6 corner_detail = 10 [node name="Search" type="LineEdit" node_paths=PackedStringArray("prompt_panel")] +auto_translate_mode = 2 custom_minimum_size = Vector2(1000, 40) anchors_preset = 8 anchor_left = 0.5 @@ -60,15 +62,15 @@ offset_right = 500.0 offset_bottom = 20.0 grow_horizontal = 2 grow_vertical = 2 -auto_translate = false localize_numeral_system = false focus_next = NodePath("Prompt") focus_mode = 1 -theme_override_colors/font_color = Color(1, 1, 1, 0.8) theme_override_colors/font_placeholder_color = Color(1, 1, 1, 0.498039) +theme_override_colors/font_color = Color(1, 1, 1, 0.8) +theme_override_fonts/font = ExtResource("1_cimak") theme_override_font_sizes/font_size = 20 -theme_override_styles/normal = SubResource("StyleBoxFlat_hyysn") theme_override_styles/focus = SubResource("StyleBoxFlat_hyysn") +theme_override_styles/normal = SubResource("StyleBoxFlat_hyysn") placeholder_text = "Search or enter address" script = ExtResource("1_7ivk2") gate_events = ExtResource("2_13io8") @@ -153,6 +155,8 @@ process_mode = 0 process_priority = 0 process_physics_priority = 0 process_thread_group = 0 +physics_interpolation_mode = 2 +auto_translate_mode = 1 editor_description = "" visible = false modulate = Color(1, 1, 1, 1) @@ -190,7 +194,6 @@ pivot_offset = Vector2(20, 20) size_flags_horizontal = 1 size_flags_vertical = 1 size_flags_stretch_ratio = 1.0 -auto_translate = true localize_numeral_system = true tooltip_text = "" focus_neighbor_left = NodePath("") @@ -254,6 +257,8 @@ process_mode = 0 process_priority = 0 process_physics_priority = 0 process_thread_group = 0 +physics_interpolation_mode = 2 +auto_translate_mode = 1 editor_description = "" visible = true modulate = Color(1, 1, 1, 1) @@ -291,7 +296,6 @@ pivot_offset = Vector2(0, 0) size_flags_horizontal = 1 size_flags_vertical = 1 size_flags_stretch_ratio = 1.0 -auto_translate = true localize_numeral_system = true tooltip_text = "" focus_neighbor_left = NodePath("") @@ -335,6 +339,8 @@ process_mode = 0 process_priority = 0 process_physics_priority = 0 process_thread_group = 0 +physics_interpolation_mode = 2 +auto_translate_mode = 1 editor_description = "" visible = false modulate = Color(1, 1, 1, 1) @@ -372,7 +378,6 @@ pivot_offset = Vector2(0, 0) size_flags_horizontal = 1 size_flags_vertical = 1 size_flags_stretch_ratio = 1.0 -auto_translate = true localize_numeral_system = true tooltip_text = "" focus_neighbor_left = NodePath("") diff --git a/app/scenes/menu.tscn b/app/scenes/menu.tscn index 4eeaf08..f93644c 100644 --- a/app/scenes/menu.tscn +++ b/app/scenes/menu.tscn @@ -421,7 +421,6 @@ texture = ExtResource("1_d6dhb") expand_mode = 1 [node name="Search" parent="VBoxContainer/Top/MenuNavigation" instance=ExtResource("5_li2do")] -auto_translate_mode = 2 layout_mode = 2 size_flags_horizontal = 4 size_flags_vertical = 4 diff --git a/app/scenes/menu_body/world.tscn b/app/scenes/menu_body/world.tscn index edaa360..887d1b3 100644 --- a/app/scenes/menu_body/world.tscn +++ b/app/scenes/menu_body/world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=34 format=3 uid="uid://kywrsqro3d5i"] +[gd_scene load_steps=35 format=3 uid="uid://kywrsqro3d5i"] [ext_resource type="Script" path="res://scripts/loading/gate_loader.gd" id="1_uxhy6"] [ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://resources/gate_events.res" id="2_q7cvi"] @@ -21,6 +21,7 @@ [ext_resource type="FontFile" uid="uid://do40418waa8w3" path="res://assets/fonts/Inter-Regular.otf" id="15_1gk43"] [ext_resource type="Script" path="res://scripts/ui/world/release_focus.gd" id="16_8emm0"] [ext_resource type="FontFile" uid="uid://c14w1y1r54wgi" path="res://assets/fonts/Inter-Bold.otf" id="16_m0ubw"] +[ext_resource type="PackedScene" uid="uid://c7571vjq7l0jp" path="res://scenes/components/not_responding.tscn" id="17_kwbm3"] [ext_resource type="FontFile" uid="uid://b3xb1fpllhnf4" path="res://assets/fonts/Inter-Italic.otf" id="17_s7ouj"] [ext_resource type="FontFile" uid="uid://tfj3o1e1wytn" path="res://assets/fonts/Inter-BoldItalic.otf" id="18_qgdgb"] [ext_resource type="Script" path="res://scripts/ui/fullscreen_animation.gd" id="18_sx3kr"] @@ -467,4 +468,8 @@ script = ExtResource("18_sx3kr") ui_events = ExtResource("9_ir58h") gate_events = ExtResource("2_q7cvi") +[node name="NotResponding" parent="." instance=ExtResource("17_kwbm3")] +visible = false +layout_mode = 1 + [connection signal="pressed" from="HBoxContainer/WorldCanvas/RenderResult/HideOnPress" to="." method="hide_ui"] diff --git a/app/scripts/sandbox/input_sync.gd b/app/scripts/sandbox/input_sync.gd index 8ba18d3..db5e8a8 100644 --- a/app/scripts/sandbox/input_sync.gd +++ b/app/scripts/sandbox/input_sync.gd @@ -29,10 +29,12 @@ func on_ui_mode_changed(mode: UiEvents.UiMode) -> void: should_send = mode == UiEvents.UiMode.FULL_SCREEN -func _input(event: InputEvent) -> void: +func _input(_event: InputEvent) -> void: if input_sync == null or not should_send: return + var event = _event if event is InputEventMouse: + event = _event.duplicate() event.position = get_scaled_mouse_pos(event.position) event.global_position = get_scaled_mouse_pos(event.global_position) diff --git a/app/scripts/sandbox/process_checker.gd b/app/scripts/sandbox/process_checker.gd index c84bb68..92f3c10 100644 --- a/app/scripts/sandbox/process_checker.gd +++ b/app/scripts/sandbox/process_checker.gd @@ -6,7 +6,7 @@ extends Node # Timeout interval for child process responsiveness const BOOTUP_INTERVAL = 30 const HEARTBEAT_INTERVAL = 5 -const WAIT_INTERVAL = 30 +const WAIT_INTERVAL = 20 var timer: Timer diff --git a/app/scripts/ui/world/not_responding.gd b/app/scripts/ui/world/not_responding.gd new file mode 100644 index 0000000..16bb1fb --- /dev/null +++ b/app/scripts/ui/world/not_responding.gd @@ -0,0 +1,47 @@ +extends Control + +const SHOWN = Color(1, 1, 1, 1) +const HIDDEN = Color(1, 1, 1, 0) + +@export var gate_events: GateEvents +@export var root: TextureButton +@export var fade_in: float = 1.0 +@export var fade_out: float = 0.2 + +var tween: Tween + + +func _ready() -> void: + gate_events.not_responding.connect(show_message) + root.pressed.connect(hide_message) + + visible = true + root.hide() + root.modulate = HIDDEN + root.mouse_filter = Control.MOUSE_FILTER_PASS + + +func show_message() -> void: + if root.visible: return + + root.show() + + if is_instance_valid(tween): tween.stop() + tween = get_tree().create_tween() + tween.tween_property(root, "modulate", SHOWN, fade_in) + await tween.finished + + root.mouse_filter = Control.MOUSE_FILTER_STOP + + +func hide_message() -> void: + if not root.visible: return + + root.mouse_filter = Control.MOUSE_FILTER_PASS + + if is_instance_valid(tween): tween.stop() + tween = get_tree().create_tween() + tween.tween_property(root, "modulate", HIDDEN, fade_out) + await tween.finished + + root.hide() diff --git a/app/scripts/ui/world/world_ui.gd b/app/scripts/ui/world/world_ui.gd index 731bb50..69f46be 100644 --- a/app/scripts/ui/world/world_ui.gd +++ b/app/scripts/ui/world/world_ui.gd @@ -11,6 +11,7 @@ var _visible: bool = true func _ready() -> void: command_events.set_mouse_mode.connect(set_mouse_mode) + gate_events.not_responding.connect(func(): set_mouse_mode(Input.MOUSE_MODE_VISIBLE)) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)