2024-12-23 01:29:31 +00:00
|
|
|
extends Node
|
|
|
|
|
2024-12-27 13:32:12 +00:00
|
|
|
# SceneManager.set_camera_boundary(bg.texture.get_size())
|
|
|
|
# SceneManager.set_player_boundary(bg.texture.get_size())
|
|
|
|
|
|
|
|
|
|
|
|
func set_camera_boundary(size: Vector2) -> void:
|
|
|
|
var camera = (
|
|
|
|
get_node_or_null("/root/Main/MainPlayer/CameraFocusMarker/MainCamera") as MainCamera
|
|
|
|
)
|
|
|
|
if camera:
|
|
|
|
camera.limit_left = 0
|
|
|
|
camera.limit_right = size.x
|
|
|
|
if GlobalConfig.DEBUG:
|
|
|
|
print("set camera boundary:", size)
|
|
|
|
# camera.limit_top = -size.y / 2
|
|
|
|
# camera.limit_bottom = size.y / 2
|
|
|
|
else:
|
|
|
|
printerr("Camera node not found")
|
|
|
|
|
|
|
|
|
|
|
|
func set_player_boundary(size: Vector2) -> void:
|
|
|
|
var player = get_node_or_null("/root/Main/MainPlayer") as MainPlayer
|
|
|
|
if player:
|
|
|
|
size.x = size.x - 30
|
|
|
|
var rect = Rect2(Vector2(15, -size.y / 2), size)
|
|
|
|
player.player_movement_rect = rect
|
|
|
|
if GlobalConfig.DEBUG:
|
|
|
|
print("set player boundary:", rect)
|
|
|
|
else:
|
|
|
|
printerr("Player node not found")
|
|
|
|
|
2024-12-27 07:56:45 +00:00
|
|
|
|
|
|
|
func get_player() -> MainPlayer:
|
|
|
|
return get_node_or_null("/root/Main/MainPlayer") as MainPlayer
|
|
|
|
|
|
|
|
|
|
|
|
func get_ground_loader() -> GroundLoader:
|
|
|
|
return get_node_or_null("/root/Main/GroundLoader") as GroundLoader
|
|
|
|
|
|
|
|
|
2024-12-23 01:29:31 +00:00
|
|
|
func pop_notification(msg: String, number := 1) -> void:
|
|
|
|
var notification_node = get_node_or_null("/root/Main/UILayer/Notification")
|
|
|
|
if notification_node:
|
|
|
|
notification_node.show_notification(msg, number)
|
|
|
|
else:
|
2024-12-27 07:56:45 +00:00
|
|
|
printerr("Notification node not found")
|
|
|
|
|
|
|
|
|
|
|
|
func pop_dialog(
|
|
|
|
character: String,
|
|
|
|
content: String,
|
|
|
|
character_color := "orange",
|
|
|
|
content_color := "white",
|
|
|
|
duration := 2.5
|
|
|
|
) -> void:
|
|
|
|
var dialog_node = get_node_or_null("/root/Main/UILayer/Dialog")
|
|
|
|
if dialog_node:
|
|
|
|
dialog_node.append_dialog(character, content, character_color, content_color, duration)
|
|
|
|
else:
|
|
|
|
printerr("Dialog node not found")
|
|
|
|
|
|
|
|
|
|
|
|
func pop_note(note: String, note_color := "white", duration := 2.5) -> void:
|
|
|
|
var dialog_node = get_node_or_null("/root/Main/UILayer/Dialog")
|
|
|
|
if dialog_node:
|
|
|
|
dialog_node.append_note(note, note_color, duration)
|
|
|
|
else:
|
|
|
|
printerr("Dialog node not found")
|