From 19794d896e41d01f558f1aad35ab4a001824e1a0 Mon Sep 17 00:00:00 2001 From: xiangwang Date: Sat, 7 Feb 2026 20:01:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=AC=A2=E8=BF=8E?= =?UTF-8?q?=E6=9D=BF=E5=92=8C=E9=80=9A=E7=9F=A5=E6=9D=BF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98=20-=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AC=A2=E8=BF=8E=E6=9D=BF=E5=92=8C=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=9D=BF=E5=BD=93=E5=89=8D=E8=A2=ABChatUI=20=E6=8A=A2?= =?UTF-8?q?=E5=8D=A0=E9=BC=A0=E6=A0=87=E9=97=AE=E9=A2=98=EF=BC=8C=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E8=AE=BE=E7=BD=AE=E5=90=AF=E5=8A=A8=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E6=97=B6ChatUI=20=E6=A0=B9=E8=8A=82=E7=82=B9=20mouse=5Ffilter?= =?UTF-8?q?=20=E4=B8=B4=E6=97=B6=E6=94=B9=E4=B8=BA=20IGNORE=E6=9D=A5?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20-=20ToDo:=20=E5=90=8E=E7=BB=AD=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E8=A7=84=E5=88=92=E4=BA=8B=E4=BB=B6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/Maps/square.tscn | 4 +++- scenes/prefabs/items/welcome_board.tscn | 4 +--- scenes/ui/NoticeDialog.gd | 27 +++++++++++++++++++++++ scenes/ui/WelcomeDialog.gd | 29 +++++++++++++++++++++++++ scenes/ui/welcome_dialog.tscn | 2 +- 5 files changed, 61 insertions(+), 5 deletions(-) diff --git a/scenes/Maps/square.tscn b/scenes/Maps/square.tscn index 951045f..17d9328 100644 --- a/scenes/Maps/square.tscn +++ b/scenes/Maps/square.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=39 format=4 uid="uid://5cc0c6cpnhe8"] +[gd_scene load_steps=40 format=4 uid="uid://5cc0c6cpnhe8"] [ext_resource type="Script" uid="uid://b43tvo8cykfrq" path="res://scenes/Maps/BaseLevel.gd" id="1_m4als"] [ext_resource type="Texture2D" uid="uid://baa5wkuyqouh6" path="res://assets/sprites/environment/standard_brick_128_128.jpg" id="1_rb5kq"] @@ -18,6 +18,7 @@ [ext_resource type="PackedScene" uid="uid://c7k8yay002w4" path="res://scenes/prefabs/items/welcome_board.tscn" id="16_edt5w"] [ext_resource type="PackedScene" uid="uid://bvfyllcy5fi8o" path="res://scenes/Maps/datawhale_home.tscn" id="16_m4als"] [ext_resource type="PackedScene" uid="uid://rdmrm7j4iokr" path="res://scenes/prefabs/items/notice_board.tscn" id="16_rixdf"] +[ext_resource type="Script" uid="uid://d2od22agputjt" path="res://scenes/prefabs/items/WelcomeBoard.gd" id="16_u1t8b"] [ext_resource type="Script" uid="uid://rlkavptfhr4y" path="res://scenes/Maps/DoorTeleport.gd" id="18_0xqio"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7nixu"] @@ -1086,6 +1087,7 @@ position = Vector2(-184, -76) z_index = 1 y_sort_enabled = true position = Vector2(128, -80) +script = ExtResource("16_u1t8b") [node name="DefaultSpawn" type="Marker2D" parent="."] y_sort_enabled = true diff --git a/scenes/prefabs/items/welcome_board.tscn b/scenes/prefabs/items/welcome_board.tscn index b91c8f5..6fcf63b 100644 --- a/scenes/prefabs/items/welcome_board.tscn +++ b/scenes/prefabs/items/welcome_board.tscn @@ -1,6 +1,5 @@ -[gd_scene load_steps=4 format=3 uid="uid://c7k8yay002w4"] +[gd_scene load_steps=3 format=3 uid="uid://c7k8yay002w4"] -[ext_resource type="Script" uid="uid://d2od22agputjt" path="res://scenes/prefabs/items/WelcomeBoard.gd" id="1_script"] [ext_resource type="Texture2D" uid="uid://v7loa3smfkrd" path="res://assets/materials/WelcomeBoard.png" id="2_sprite"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_board"] @@ -8,7 +7,6 @@ size = Vector2(112, 26.5) [node name="WelcomeBoard" type="StaticBody2D"] collision_layer = 3 -script = ExtResource("1_script") [node name="Sprite2D" type="Sprite2D" parent="."] scale = Vector2(0.25, 0.25) diff --git a/scenes/ui/NoticeDialog.gd b/scenes/ui/NoticeDialog.gd index 8fb95a2..394e000 100644 --- a/scenes/ui/NoticeDialog.gd +++ b/scenes/ui/NoticeDialog.gd @@ -31,10 +31,14 @@ var pages = [ var current_page = 0 var tween: Tween var mock_pages = [] +var _chat_ui: Control +var _chat_ui_prev_mouse_filter: int = Control.MOUSE_FILTER_STOP +var _chat_ui_mouse_disabled: bool = false func _ready(): # Pause the game get_tree().paused = true + _disable_chat_ui_mouse_input() $CenterContainer/PanelContainer/VBoxContainer/Header/RightContainer/CloseButton.pressed.connect(_on_close_pressed) prev_btn.pressed.connect(_on_prev_pressed) @@ -50,6 +54,9 @@ func _ready(): _setup_dots() _update_ui(false) +func _exit_tree(): + _restore_chat_ui_mouse_input() + func _on_notices_response(success: bool, data: Dictionary, _error_info: Dictionary): var new_pages = [] if success and data.has("data") and data["data"] is Array: @@ -154,3 +161,23 @@ func _on_close_pressed(): # Unpause the game get_tree().paused = false queue_free() + +func _disable_chat_ui_mouse_input(): + var current_scene = get_tree().current_scene + if current_scene: + _chat_ui = current_scene.get_node_or_null("UILayer/ChatUI") as Control + + if _chat_ui == null: + _chat_ui = get_tree().root.find_child("ChatUI", true, false) as Control + + if _chat_ui: + _chat_ui_prev_mouse_filter = _chat_ui.mouse_filter + _chat_ui.mouse_filter = Control.MOUSE_FILTER_IGNORE + _chat_ui_mouse_disabled = true + +func _restore_chat_ui_mouse_input(): + if _chat_ui_mouse_disabled and is_instance_valid(_chat_ui): + _chat_ui.mouse_filter = _chat_ui_prev_mouse_filter + + _chat_ui_mouse_disabled = false + _chat_ui = null diff --git a/scenes/ui/WelcomeDialog.gd b/scenes/ui/WelcomeDialog.gd index 154b799..bf17bb4 100644 --- a/scenes/ui/WelcomeDialog.gd +++ b/scenes/ui/WelcomeDialog.gd @@ -1,6 +1,12 @@ extends CanvasLayer +var _chat_ui: Control +var _chat_ui_prev_mouse_filter: int = Control.MOUSE_FILTER_STOP +var _chat_ui_mouse_disabled: bool = false + func _ready(): + _disable_chat_ui_mouse_input() + # Connect close button (X) var header_close = find_child("CloseButton", true, false) if header_close: @@ -11,6 +17,9 @@ func _ready(): if start_btn: start_btn.pressed.connect(_on_close_pressed) +func _exit_tree(): + _restore_chat_ui_mouse_input() + func _on_close_pressed(): queue_free() @@ -18,3 +27,23 @@ func _input(event): # Allow ESC to close if event.is_action_pressed("ui_cancel"): queue_free() + +func _disable_chat_ui_mouse_input(): + var current_scene = get_tree().current_scene + if current_scene: + _chat_ui = current_scene.get_node_or_null("UILayer/ChatUI") as Control + + if _chat_ui == null: + _chat_ui = get_tree().root.find_child("ChatUI", true, false) as Control + + if _chat_ui: + _chat_ui_prev_mouse_filter = _chat_ui.mouse_filter + _chat_ui.mouse_filter = Control.MOUSE_FILTER_IGNORE + _chat_ui_mouse_disabled = true + +func _restore_chat_ui_mouse_input(): + if _chat_ui_mouse_disabled and is_instance_valid(_chat_ui): + _chat_ui.mouse_filter = _chat_ui_prev_mouse_filter + + _chat_ui_mouse_disabled = false + _chat_ui = null diff --git a/scenes/ui/welcome_dialog.tscn b/scenes/ui/welcome_dialog.tscn index 0ce8033..0699bfa 100644 --- a/scenes/ui/welcome_dialog.tscn +++ b/scenes/ui/welcome_dialog.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=3 uid="uid://d8mam0n1a3b5"] -[ext_resource type="Script" uid="uid://cohijfo0yeo34" path="res://scenes/prefabs/ui/WelcomeDialog.gd" id="1_vs5b1"] +[ext_resource type="Script" uid="uid://cohijfo0yeo34" path="res://scenes/ui/WelcomeDialog.gd" id="1_vs5b1"] [ext_resource type="Texture2D" uid="uid://v7loa3smfkrd" path="res://assets/materials/WelcomeBoard.png" id="2_dy5hw"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_card"]