feat: polish personal space editor
This commit is contained in:
@@ -47,6 +47,7 @@ const DEFAULT_SETTINGS: Dictionary = {
|
||||
"allow_nearby_private": true,
|
||||
"allow_nearby_friend_requests": true,
|
||||
"allow_nearby_profile": true,
|
||||
"room_visit_policy": "friends",
|
||||
"mute_ui_sfx": false,
|
||||
}
|
||||
|
||||
@@ -388,6 +389,9 @@ func _render_chat_content() -> void:
|
||||
_create_toggle_row("chat", "允许附近私聊", "allow_nearby_private", "附近玩家按 E 可以发起悄悄话"),
|
||||
_create_toggle_row("account", "允许好友申请", "allow_nearby_friend_requests", "附近玩家可通过互动列表发送好友申请"),
|
||||
]))
|
||||
_content.add_child(_create_section("个人空间访问", [
|
||||
_create_room_visit_policy_row(),
|
||||
]))
|
||||
|
||||
func _render_controls_content() -> void:
|
||||
_content.add_child(_create_section("操作说明", [
|
||||
@@ -526,6 +530,58 @@ func _create_toggle_row(iconName: String, labelText: String, key: String, detail
|
||||
|
||||
return row
|
||||
|
||||
func _create_room_visit_policy_row() -> Control:
|
||||
var row := HBoxContainer.new()
|
||||
row.custom_minimum_size = Vector2(0, 54)
|
||||
row.add_theme_constant_override("separation", 16)
|
||||
row.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
|
||||
var icon := ICON_SCRIPT.new() as Control
|
||||
icon.set("iconName", "account")
|
||||
icon.set("active", true)
|
||||
icon.custom_minimum_size = Vector2(34, 34)
|
||||
row.add_child(icon)
|
||||
|
||||
var text_box := VBoxContainer.new()
|
||||
text_box.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
text_box.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
text_box.add_theme_constant_override("separation", 2)
|
||||
row.add_child(text_box)
|
||||
|
||||
var label := Label.new()
|
||||
label.text = "谁可以参观我的房间"
|
||||
label.add_theme_color_override("font_color", TEXT_COLOR)
|
||||
label.add_theme_font_size_override("font_size", 17)
|
||||
text_box.add_child(label)
|
||||
|
||||
var detail := Label.new()
|
||||
detail.text = "拉黑关系始终无法访问;房主始终可编辑。"
|
||||
detail.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
|
||||
detail.add_theme_color_override("font_color", MUTED_COLOR)
|
||||
detail.add_theme_font_size_override("font_size", 13)
|
||||
text_box.add_child(detail)
|
||||
|
||||
var selector := OptionButton.new()
|
||||
selector.custom_minimum_size = Vector2(126, 38)
|
||||
selector.focus_mode = Control.FOCUS_NONE
|
||||
selector.add_item("仅好友")
|
||||
selector.set_item_metadata(0, "friends")
|
||||
selector.add_item("公开")
|
||||
selector.set_item_metadata(1, "public")
|
||||
selector.add_item("关闭访问")
|
||||
selector.set_item_metadata(2, "closed")
|
||||
var current_policy: String = str(_settings.get("room_visit_policy", "friends"))
|
||||
for index in range(selector.item_count):
|
||||
if str(selector.get_item_metadata(index)) == current_policy:
|
||||
selector.select(index)
|
||||
break
|
||||
selector.item_selected.connect(func(index: int) -> void:
|
||||
_settings["room_visit_policy"] = str(selector.get_item_metadata(index))
|
||||
_apply_preview_settings()
|
||||
)
|
||||
row.add_child(selector)
|
||||
return row
|
||||
|
||||
func _create_scale_row() -> Control:
|
||||
var row := HBoxContainer.new()
|
||||
row.custom_minimum_size = Vector2(0, 48)
|
||||
|
||||
Reference in New Issue
Block a user