|
@@ -2,6 +2,7 @@ import { _decorator, Camera, Component, Node, RenderTexture, Sprite, SpriteFrame
|
|
|
import { AliensGlobalInstance } from '../AliensGlobalInstance';
|
|
|
import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
|
|
|
import { GameEvent } from '../Enum/GameEvent';
|
|
|
+import { GameUtil } from '../GameUtil';
|
|
|
const { ccclass, property } = _decorator;
|
|
|
/** 截图组件脚本*/
|
|
|
@ccclass('ScreenShotComponent')
|
|
@@ -19,8 +20,8 @@ export class ScreenShotComponent extends Component {
|
|
|
async start() {
|
|
|
this.registerEvent();
|
|
|
//获取相机组件
|
|
|
- const camera = await this.getSceneCamera();
|
|
|
- this._originalTargetTexture = camera.targetTexture;
|
|
|
+ // const camera = await this.getSceneCamera();
|
|
|
+ // this._originalTargetTexture = camera.targetTexture;
|
|
|
}
|
|
|
|
|
|
private registerEvent(){
|
|
@@ -84,7 +85,7 @@ export class ScreenShotComponent extends Component {
|
|
|
camera.node.setRotationFromEuler(this._originalCameraRotation);
|
|
|
// 强制更新材质
|
|
|
this.sprite.markForUpdateRenderData();
|
|
|
- }, 0.1); // 稍微延长等待时间确保渲染完成
|
|
|
+ }, 0.1);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -112,6 +113,7 @@ export class ScreenShotComponent extends Component {
|
|
|
public saveCameraState(pos:Vec3,rotation:Vec3){
|
|
|
this._originalCameraPosition = pos;
|
|
|
this._originalCameraRotation = rotation;
|
|
|
+ console.log('保存相机最新的位置和旋转角度:',pos,',',rotation);
|
|
|
}
|
|
|
|
|
|
protected onDestroy(): void {
|