|
@@ -1,4 +1,4 @@
|
|
-import { _decorator, CCInteger, Component, Enum, find, Node, sp, tween, UITransform, Vec3 } from 'cc';
|
|
|
|
|
|
+import { _decorator, CCInteger, Component, Enum, find, Node, sp, tween, UITransform, Vec3, view } from 'cc';
|
|
import { CupHeight, TakeGobletGlobalInstance, WaterColors } from '../TakeGobletGlobalInstance';
|
|
import { CupHeight, TakeGobletGlobalInstance, WaterColors } from '../TakeGobletGlobalInstance';
|
|
import { LevelAction } from '../LevelAction';
|
|
import { LevelAction } from '../LevelAction';
|
|
import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
|
|
import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
|
|
@@ -183,16 +183,22 @@ export class OriginCup extends Component {
|
|
this.marks.active = bool;
|
|
this.marks.active = bool;
|
|
}
|
|
}
|
|
|
|
|
|
- destroyOriginCup() {
|
|
|
|
|
|
+ async destroyOriginCup() {
|
|
const id = this.node.uuid;
|
|
const id = this.node.uuid;
|
|
- // console.log('销毁原浆杯id : ', id);
|
|
|
|
- tween(this.node)
|
|
|
|
- .to(0.3, { scale: Vec3.ZERO })
|
|
|
|
- .call(() => {
|
|
|
|
- EventDispatcher.instance.emit(GameEvent.EVENT_ORIGIN_CUP_DESTROYED, id);
|
|
|
|
- this.node.destroy();
|
|
|
|
- })
|
|
|
|
- .start();
|
|
|
|
|
|
+ const uiTransform = this.node.getComponent(UITransform)!;
|
|
|
|
+ const screenWidth = view.getVisibleSize().width;
|
|
|
|
+ const targetX = -screenWidth - uiTransform.width * 1.5;
|
|
|
|
+
|
|
|
|
+ await new Promise<void>(resolve => {
|
|
|
|
+ tween(this.node)
|
|
|
|
+ .to(0.2, { position: new Vec3(targetX, this.node.position.y, 0) }, { easing: 'sineIn' })
|
|
|
|
+ .call(async () => {
|
|
|
|
+ EventDispatcher.instance.emit(GameEvent.EVENT_ORIGIN_CUP_DESTROYED, id);
|
|
|
|
+ this.node.destroy();
|
|
|
|
+ resolve();
|
|
|
|
+ })
|
|
|
|
+ .start();
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|