|
@@ -19,6 +19,9 @@ import { GlobalConfig } from '../../start/Config/GlobalConfig';
|
|
import { AdvertMgr } from '../../core_tgx/base/ad/AdvertMgr';
|
|
import { AdvertMgr } from '../../core_tgx/base/ad/AdvertMgr';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
|
|
+//动画时长
|
|
|
|
+export const ANIMATION_DURATION = 0.3;
|
|
|
|
+
|
|
@ccclass('LevelAction')
|
|
@ccclass('LevelAction')
|
|
export class LevelAction extends Component {
|
|
export class LevelAction extends Component {
|
|
|
|
|
|
@@ -304,6 +307,7 @@ export class LevelAction extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
// 处理完所有颜色后检查剩余水层
|
|
// 处理完所有颜色后检查剩余水层
|
|
|
|
+ if (!originCup.waters) return
|
|
const remaining = originCup.waters.children.filter(n => n.active).length;
|
|
const remaining = originCup.waters.children.filter(n => n.active).length;
|
|
if (hasUnprocessed || remaining > 0) {
|
|
if (hasUnprocessed || remaining > 0) {
|
|
// console.log("游戏结束:仍有未处理的水层");
|
|
// console.log("游戏结束:仍有未处理的水层");
|
|
@@ -333,7 +337,7 @@ export class LevelAction extends Component {
|
|
this.isProcessing = true;
|
|
this.isProcessing = true;
|
|
|
|
|
|
try {
|
|
try {
|
|
- const tempCupsComp = this.tempCups.getComponent(TempCups)!;
|
|
|
|
|
|
+ const tempCupsComp = this.tempCups!.getComponent(TempCups)!;
|
|
const filledCups = tempCupsComp.getFilledCups();
|
|
const filledCups = tempCupsComp.getFilledCups();
|
|
|
|
|
|
for (const tempCup of filledCups) {
|
|
for (const tempCup of filledCups) {
|
|
@@ -363,7 +367,7 @@ export class LevelAction extends Component {
|
|
if (originalPos) {
|
|
if (originalPos) {
|
|
await new Promise(resolve => {
|
|
await new Promise(resolve => {
|
|
tween(tempCup.node)
|
|
tween(tempCup.node)
|
|
- .to(0.3, { position: originalPos })
|
|
|
|
|
|
+ .to(ANIMATION_DURATION, { position: originalPos })
|
|
.call(() => {
|
|
.call(() => {
|
|
tempCup.reset();
|
|
tempCup.reset();
|
|
resolve(true);
|
|
resolve(true);
|
|
@@ -417,7 +421,7 @@ export class LevelAction extends Component {
|
|
if (this.waitArea.getCups().length > 0) {
|
|
if (this.waitArea.getCups().length > 0) {
|
|
this.outArea.getCups().concat(this.waitArea.getCups()).forEach(cup => {
|
|
this.outArea.getCups().concat(this.waitArea.getCups()).forEach(cup => {
|
|
tween(cup)
|
|
tween(cup)
|
|
- .by(0.3, { position: new Vec3(byX, 0, 0) }, { easing: 'sineOut' })
|
|
|
|
|
|
+ .by(ANIMATION_DURATION, { position: new Vec3(byX, 0, 0) }, { easing: 'sineOut' })
|
|
.start();
|
|
.start();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -448,14 +452,24 @@ export class LevelAction extends Component {
|
|
) {
|
|
) {
|
|
const targetWorldPos = target.getWorldPosition().clone();
|
|
const targetWorldPos = target.getWorldPosition().clone();
|
|
const tempRegex = /TempCup/.test(origin.name);
|
|
const tempRegex = /TempCup/.test(origin.name);
|
|
|
|
+
|
|
|
|
+ let targetPosY: number = 135;
|
|
|
|
+ if (origin.getComponent(OriginCup)) {
|
|
|
|
+ const targetCup = origin.getComponent(OriginCup)!;
|
|
|
|
+ if (targetCup.cupHeight == CupHeight.Two) {
|
|
|
|
+ targetPosY = 165;
|
|
|
|
+ } else if (targetCup.cupHeight == CupHeight.Four) {
|
|
|
|
+ targetPosY = 105;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 调整偏移量
|
|
// 调整偏移量
|
|
targetWorldPos.x -= !tempRegex ? 55 : 20;
|
|
targetWorldPos.x -= !tempRegex ? 55 : 20;
|
|
- targetWorldPos.y += !tempRegex ? 125 : 205;
|
|
|
|
|
|
+ targetWorldPos.y += !tempRegex ? targetPosY : 205;
|
|
|
|
|
|
// 移动动画到目标位置
|
|
// 移动动画到目标位置
|
|
await new Promise<void>(resolve => {
|
|
await new Promise<void>(resolve => {
|
|
tween(origin)
|
|
tween(origin)
|
|
- .to(0.5, { worldPosition: targetWorldPos })
|
|
|
|
|
|
+ .to(ANIMATION_DURATION, { worldPosition: targetWorldPos })
|
|
.call(resolve)
|
|
.call(resolve)
|
|
.start();
|
|
.start();
|
|
});
|
|
});
|