feat: add nearby social interactions

This commit is contained in:
ANG-Server
2026-07-21 22:19:41 +08:00
parent 0bab768b14
commit 9dee47492c
43 changed files with 1499 additions and 77 deletions

View File

@@ -4,10 +4,25 @@ class_name DatawhaleHonorBoard
const RANKING_PANEL_SCENE: PackedScene = preload("res://scenes/ui/datawhale_honor_ranking_panel.tscn")
const RANKING_PANEL_NAME: String = "DatawhaleHonorRankingPanel"
const INTERACTION_COLLISION_LAYER: int = 2
const InteractionAnchorUtil = preload("res://_Core/utils/InteractionAnchor.gd")
func _ready() -> void:
collision_layer = INTERACTION_COLLISION_LAYER
collision_mask = 0
add_to_group("whaletown_interactable")
func get_interaction_actions(player: Node2D) -> Array[Dictionary]:
var anchor_position: Vector2 = InteractionAnchorUtil.get_position(self)
var distance: float = anchor_position.distance_to(player.global_position)
if distance > 150.0:
return []
return [{
"id": "honor_board:%s" % get_instance_id(),
"title": "查看荣誉榜",
"distance": distance,
"priority": 35,
"callback": Callable(self, "interact"),
}]
func interact() -> void:
var root: Window = get_tree().root

View File

@@ -4,10 +4,25 @@ class_name NoticeBoard
const NOTICE_DIALOG_SCENE: PackedScene = preload("res://scenes/ui/notice_dialog.tscn")
const NOTICE_DIALOG_NAME: String = "NoticeDialog"
const INTERACTION_COLLISION_LAYER: int = 2
const InteractionAnchorUtil = preload("res://_Core/utils/InteractionAnchor.gd")
func _ready() -> void:
collision_layer = INTERACTION_COLLISION_LAYER
collision_mask = 0
add_to_group("whaletown_interactable")
func get_interaction_actions(player: Node2D) -> Array[Dictionary]:
var anchor_position: Vector2 = InteractionAnchorUtil.get_position(self)
var distance: float = anchor_position.distance_to(player.global_position)
if distance > 150.0:
return []
return [{
"id": "notice_board:%s" % get_instance_id(),
"title": "查看公告栏",
"distance": distance,
"priority": 35,
"callback": Callable(self, "interact"),
}]
func interact() -> void:
var root: Window = get_tree().root

View File

@@ -4,10 +4,25 @@ class_name WelcomeBoard
const WELCOME_DIALOG_SCENE: PackedScene = preload("res://scenes/ui/welcome_dialog.tscn")
const WELCOME_DIALOG_NAME: String = "WelcomeDialog"
const INTERACTION_COLLISION_LAYER: int = 2
const InteractionAnchorUtil = preload("res://_Core/utils/InteractionAnchor.gd")
func _ready() -> void:
collision_layer = INTERACTION_COLLISION_LAYER
collision_mask = 0
add_to_group("whaletown_interactable")
func get_interaction_actions(player: Node2D) -> Array[Dictionary]:
var anchor_position: Vector2 = InteractionAnchorUtil.get_position(self)
var distance: float = anchor_position.distance_to(player.global_position)
if distance > 150.0:
return []
return [{
"id": "welcome_board:%s" % get_instance_id(),
"title": "查看新人引导",
"distance": distance,
"priority": 35,
"callback": Callable(self, "interact"),
}]
func interact() -> void:
var root: Window = get_tree().root