refactor(chat-ui): 移除HeaderContainer和SendButton,添加装饰图片,修复Enter键监听
- 删除 HeaderContainer 和 StatusLabel(状态显示) - 删除 SendButton(发送按钮) - 添加聊天框背景图和装饰图片 - 设置 TextureRect modulate 为白色,修复黑框问题 - 移除 ChatPanel 背景色,使背景透明 - 修复 is_key_pressed 错误,改用 InputEventKey 类型检查 - 移除 _update_connection_status 函数及相关调用
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bv7k2nan4xj8q"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://bv7k2nan4xj8q"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://pibdlvhb12q8" path="res://scenes/ui/ChatUI.gd" id="1"]
|
||||
[ext_resource type="Texture2D" uid="uid://flepo0gpb55h" path="res://assets/ui/chat/缩略框背景.png" id="2_7dhmv"]
|
||||
[ext_resource type="Texture2D" uid="uid://clmgyxpeh5742" path="res://assets/ui/chat/输入框背景.png" id="3_fbft8"]
|
||||
[ext_resource type="Texture2D" uid="uid://q0ijn5y0tbw3" path="res://assets/ui/chat/装饰2.png" id="4_xo31h"]
|
||||
[ext_resource type="Texture2D" uid="uid://ct0cl4h2i6ydn" path="res://assets/ui/chat/装饰.png" id="5_xlxdo"]
|
||||
|
||||
[node name="ChatUI" type="Control"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(10, 20)
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
@@ -12,18 +16,8 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 358.0
|
||||
offset_right = 460.0
|
||||
offset_bottom = 758.0
|
||||
texture = ExtResource("2_7dhmv")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="ChatPanel" type="Panel" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
@@ -35,6 +29,15 @@ offset_top = -410.0
|
||||
offset_right = 460.0
|
||||
offset_bottom = -10.0
|
||||
grow_vertical = 0
|
||||
theme_override_styles/panel = null
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="ChatPanel"]
|
||||
layout_mode = 0
|
||||
offset_right = 450.0
|
||||
offset_bottom = 400.0
|
||||
texture = ExtResource("2_7dhmv")
|
||||
expand_mode = 1
|
||||
modulate = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ChatPanel"]
|
||||
layout_mode = 1
|
||||
@@ -49,17 +52,6 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="HeaderContainer" type="HBoxContainer" parent="ChatPanel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="StatusLabel" type="Label" parent="ChatPanel/VBoxContainer/HeaderContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_colors/font_color = Color(0.5, 0.5, 0.5, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "○ 未连接"
|
||||
|
||||
[node name="ChatHistory" type="ScrollContainer" parent="ChatPanel/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
@@ -82,7 +74,30 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "输入消息..."
|
||||
|
||||
[node name="SendButton" type="Button" parent="ChatPanel/VBoxContainer/InputContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "发送"
|
||||
[node name="TextureRect" type="TextureRect" parent="ChatPanel/VBoxContainer/InputContainer/ChatInput"]
|
||||
layout_mode = 0
|
||||
offset_right = 435.0
|
||||
offset_bottom = 30.0
|
||||
texture = ExtResource("3_fbft8")
|
||||
expand_mode = 1
|
||||
modulate = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="TextureRect2" type="TextureRect" parent="ChatPanel"]
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 10.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
texture = ExtResource("4_xo31h")
|
||||
expand_mode = 1
|
||||
modulate = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="TextureRect3" type="TextureRect" parent="ChatPanel"]
|
||||
layout_mode = 0
|
||||
offset_left = 430.0
|
||||
offset_top = 340.0
|
||||
offset_right = 440.0
|
||||
offset_bottom = 350.0
|
||||
texture = ExtResource("5_xlxdo")
|
||||
expand_mode = 1
|
||||
modulate = Color(1, 1, 1, 1)
|
||||
|
||||
Reference in New Issue
Block a user