同步主站 Cocos 当前工程:关卡资源、运行脚本与打包工具。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,12 +28,17 @@ export function syncEmbeddedCamerasOrtho(): void {
|
||||
const halfH = getEmbeddedOrthoHalf();
|
||||
const scene = director.getScene();
|
||||
if (!scene) return;
|
||||
for (const camName of ['UICamera', 'BgCamera', 'Main Camera']) {
|
||||
for (const camName of ['UICamera', 'BgCamera']) {
|
||||
const cam = find(camName, scene)?.getComponent(Camera);
|
||||
if (cam) cam.orthoHeight = halfH;
|
||||
}
|
||||
const preserve = !!(globalThis as { __tfrhPreserveMapView?: boolean }).__tfrhPreserveMapView;
|
||||
const mainNode = find('Main Camera', scene);
|
||||
if (mainNode) mainNode.setPosition(0, 0, mainNode.position.z);
|
||||
const mainCam = mainNode?.getComponent(Camera);
|
||||
if (!preserve) {
|
||||
if (mainCam) mainCam.orthoHeight = halfH;
|
||||
if (mainNode) mainNode.setPosition(0, 0, mainNode.position.z);
|
||||
}
|
||||
(globalThis as { __tfrhSyncHudOrtho?: () => void }).__tfrhSyncHudOrtho = syncEmbeddedCamerasOrtho;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user