import FqLogin from "../../../../login/FqLogin"; import { AudioMgr } from "../../../../main/ViewManage"; import BaseEvent from "../base/BaseEvent"; /** * 打开机关 */ const { ccclass, property } = cc._decorator; @ccclass export default class FOpenDoorVineEx extends BaseEvent { @property({ displayName: '提示图标', type: cc.SpriteFrame }) mTipsIcon: cc.SpriteFrame = null; /** * 控制的栅栏 */ @property([cc.Node]) mFenceTrigger: Array = []; @property([cc.Node]) guides: Array = [];//引导标识 private isOver = false; /** * 主角进入碰撞区域 * @param tag 碰撞组件编号 */ public onBegin(tag: number) { if (this.isOver) { return } this.showOpt(this.mTipsIcon, () => { this.closeOpt() this.pause() let target = this.node.children[0].children[0] cc.tween(target).sequence( cc.moveBy(0.2, cc.v2(0, -20)), cc.moveBy(0.2, cc.v2(0, 20)), cc.moveBy(0.2, cc.v2(0, -20)), cc.moveBy(0.2, cc.v2(0, 20)), cc.moveBy(0.5, cc.v2(0, 200)), cc.callFunc(() => { 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]; this.showFence(element, 'close'); } this.ff.main.playerEffectByPath(AudioMgr.openDoor); }), cc.delayTime(1), cc.callFunc(() => { this.resume() FqLogin.commitEvent(this.node.name, '', ''); for (let i = 0; i < this.mFenceTrigger.length; i++) { const element = this.mFenceTrigger[i]; element.destroy() } this.node.destroy() }) ).start(); }) }) ).start() }) } private showFence(element, action) { let nodes = element.children; for (let i = 0; i < nodes.length; i++) { const element = nodes[i]; let spine = element.getComponent(sp.Skeleton); if (spine) { spine.setAnimation(0, action, false); } } } }