|
@@ -3,14 +3,8 @@ import { AudioMgr } from "../../main/ViewManage";
|
|
|
import BaseEvent from "../fight/evnet/base/BaseEvent";
|
|
|
|
|
|
|
|
|
-const SpineName = {
|
|
|
- CLOSE: "close",
|
|
|
- OPEN: "open"
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
- * 多组按钮控制开门
|
|
|
+ * 多组按钮控制开门-解救宠物剧情
|
|
|
*/
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
|
@@ -53,10 +47,14 @@ export default class JG0111_1 extends BaseEvent {
|
|
|
})
|
|
|
mFenceTrigger: Array<cc.Node> = [];
|
|
|
|
|
|
- /**
|
|
|
- * 是否选中
|
|
|
- */
|
|
|
- public isHang = false;
|
|
|
+ @property({
|
|
|
+ displayName: '困住的宠物',
|
|
|
+ type: cc.Node,
|
|
|
+ })
|
|
|
+ mPet: cc.Node = null;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 机关是否已经结束
|
|
|
*/
|
|
@@ -88,48 +86,35 @@ export default class JG0111_1 extends BaseEvent {
|
|
|
}
|
|
|
|
|
|
onBegin(tag: number) {
|
|
|
- this.isHang = true;
|
|
|
this.mIcon.spriteFrame = this.mIcon1;
|
|
|
this.checkOpen();
|
|
|
}
|
|
|
|
|
|
onEnd(tag: number) {
|
|
|
- // this.isHang = false
|
|
|
- // this.mIcon.spriteFrame = this.mIcon0
|
|
|
- // this.isOver = false;
|
|
|
- // for (let i = 0; i < this.mFenceTrigger.length; i++) {
|
|
|
- // const element = this.mFenceTrigger[i];
|
|
|
- // // element.active = true;
|
|
|
- // this.showFence(element, SpineName.CLOSE);
|
|
|
- // element.getComponent(cc.PhysicsBoxCollider).enabled = true;
|
|
|
- // }
|
|
|
}
|
|
|
|
|
|
private checkOpen() {
|
|
|
if (this.isOver) {
|
|
|
return
|
|
|
}
|
|
|
- //检查其它开关是否打开
|
|
|
- for (let i = 0; i < this.mButtons.length; i++) {
|
|
|
- const element = this.mButtons[i];
|
|
|
- let fdb = element.getComponent(JG0111_1)
|
|
|
- if (!fdb.isHang) return
|
|
|
- }
|
|
|
this.isOver = true;
|
|
|
this.pause();
|
|
|
this.moveCamera(this.mFenceTrigger[0].getPosition(), 1, () => {
|
|
|
cc.tween(this.node).sequence(
|
|
|
cc.callFunc(() => {
|
|
|
- for (let i = 0; i < this.mFenceTrigger.length; i++) {
|
|
|
- const element = this.mFenceTrigger[i];
|
|
|
- element.active = false
|
|
|
- // this.showFence(element, SpineName.OPEN);
|
|
|
+ this.showFence(this.mFenceTrigger[0], 'down');
|
|
|
+ let nodes = this.mFenceTrigger[1].children
|
|
|
+ for (let i = 0; i < nodes.length; i++) {
|
|
|
+ const element = nodes[i];
|
|
|
+ this.showFence(element, 'down');
|
|
|
}
|
|
|
this.ff.main.playerEffectByPath(AudioMgr.openDoor);
|
|
|
}),
|
|
|
cc.delayTime(1),
|
|
|
cc.callFunc(() => {
|
|
|
this.resume()
|
|
|
+ this.mFenceTrigger[0].getComponent(cc.PhysicsBoxCollider).enabled = false;
|
|
|
+
|
|
|
// for (let i = 0; i < this.mFenceTrigger.length; i++) {
|
|
|
// const element = this.mFenceTrigger[i];
|
|
|
// // element.active = false;
|
|
@@ -137,7 +122,17 @@ export default class JG0111_1 extends BaseEvent {
|
|
|
// }
|
|
|
})
|
|
|
).start();
|
|
|
-
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ private showFence(element, action) {
|
|
|
+ let nodes = element.children;
|
|
|
+ for (let i = 0; i < nodes.length; i++) {
|
|
|
+ const element = nodes[i];
|
|
|
+ let spine:sp.Skeleton = element.getComponent(sp.Skeleton);
|
|
|
+ if (spine) {
|
|
|
+ spine.setAnimation(0, action, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|