|
@@ -5,6 +5,7 @@ import { LineDrawer } from './LineDrawer';
|
|
import { EnemyComponent } from './Components/EnemyComponent';
|
|
import { EnemyComponent } from './Components/EnemyComponent';
|
|
import { AliensGlobalInstance } from './AliensGlobalInstance';
|
|
import { AliensGlobalInstance } from './AliensGlobalInstance';
|
|
import { ScreenShotComponent } from './Components/ScreenShotComponent';
|
|
import { ScreenShotComponent } from './Components/ScreenShotComponent';
|
|
|
|
+import { GameUtil } from './GameUtil';
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@@ -49,6 +50,7 @@ export class LevelAction extends Component {
|
|
|
|
|
|
start() {
|
|
start() {
|
|
this.initilizeUI();
|
|
this.initilizeUI();
|
|
|
|
+ this.saveCameraState();
|
|
}
|
|
}
|
|
|
|
|
|
private initilizeUI(){
|
|
private initilizeUI(){
|
|
@@ -168,7 +170,7 @@ export class LevelAction extends Component {
|
|
this._originalRotation = this.camera.node.eulerAngles.clone();
|
|
this._originalRotation = this.camera.node.eulerAngles.clone();
|
|
}
|
|
}
|
|
|
|
|
|
- private _onTouchMove(event: EventTouch) {
|
|
|
|
|
|
+ private async _onTouchMove(event: EventTouch) {
|
|
if (!this._isDragging) return;
|
|
if (!this._isDragging) return;
|
|
|
|
|
|
const currentPos = event.getLocation();
|
|
const currentPos = event.getLocation();
|
|
@@ -185,11 +187,11 @@ export class LevelAction extends Component {
|
|
newRotation.y = Math.max(this.minYRotation, Math.min(this.maxYRotation, newRotation.y));
|
|
newRotation.y = Math.max(this.minYRotation, Math.min(this.maxYRotation, newRotation.y));
|
|
|
|
|
|
this.camera.node.setRotationFromEuler(newRotation);
|
|
this.camera.node.setRotationFromEuler(newRotation);
|
|
- this.saveCameraState();
|
|
|
|
|
|
+ await this.saveCameraState();
|
|
}
|
|
}
|
|
|
|
|
|
//保存相机的位置和旋转角度
|
|
//保存相机的位置和旋转角度
|
|
- private saveCameraState() {
|
|
|
|
|
|
+ private async saveCameraState() {
|
|
const cameraOriginalPos = this.camera.node.worldPosition.clone();
|
|
const cameraOriginalPos = this.camera.node.worldPosition.clone();
|
|
const originalRotation = this.camera.node.eulerAngles.clone();
|
|
const originalRotation = this.camera.node.eulerAngles.clone();
|
|
const screenShot = AliensGlobalInstance.instance.renderNode.getComponent(ScreenShotComponent)!;
|
|
const screenShot = AliensGlobalInstance.instance.renderNode.getComponent(ScreenShotComponent)!;
|