forked from xiangwang25/whale-town-front-v2
feat: polish personal space editor
This commit is contained in:
@@ -371,6 +371,19 @@ func _create_friend_row(friend: Dictionary) -> Control:
|
||||
dot.add_theme_stylebox_override("panel", _create_dot_style(ONLINE_COLOR if online else OFFLINE_COLOR))
|
||||
row.add_child(dot)
|
||||
|
||||
if bool(friend.get("room_visitable", false)):
|
||||
var visit_button := _create_small_button("房间", ACCENT_COLOR)
|
||||
visit_button.name = "VisitRoomButton"
|
||||
visit_button.custom_minimum_size = Vector2(56, 30)
|
||||
visit_button.set_anchors_preset(Control.PRESET_CENTER_RIGHT)
|
||||
visit_button.offset_left = -68
|
||||
visit_button.offset_top = -15
|
||||
visit_button.offset_right = -12
|
||||
visit_button.offset_bottom = 15
|
||||
visit_button.z_index = 2
|
||||
visit_button.pressed.connect(func() -> void: _visit_friend_room(userId, username))
|
||||
button.add_child(visit_button)
|
||||
|
||||
return button
|
||||
|
||||
func _create_request_row(request: Dictionary) -> Control:
|
||||
@@ -417,6 +430,13 @@ func _select_friend(userId: String, username: String, _online: bool) -> void:
|
||||
"username": username
|
||||
})
|
||||
|
||||
func _visit_friend_room(userId: String, username: String) -> void:
|
||||
if userId.strip_edges().is_empty():
|
||||
return
|
||||
var social_manager := get_node_or_null("/root/SocialManager")
|
||||
if social_manager != null and social_manager.has_method("visit_room"):
|
||||
social_manager.call("visit_room", userId, username)
|
||||
|
||||
func _respond_request(userId: String, username: String, accepted: bool) -> void:
|
||||
if userId.strip_edges().is_empty():
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user