123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- import { AudioMgr } from "../../main/ViewManage";
- import EventListener from "../../util/EventListener";
- import BaseEvent from "../fight/evnet/base/BaseEvent";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class DJ0102 extends BaseEvent {
- @property({
- displayName: '宝箱ID'
- })
- boxId: string = '28';
- @property({
- displayName: "钥匙ID"
- })
- keyID: number = 2001;
- @property(sp.Skeleton)
- spine: sp.Skeleton = null;
- @property({
- displayName: '靠近提示',
- type: cc.Node
- })
- closeTips: cc.Node = null;
- @property({
- displayName: '开启提示',
- type: cc.SpriteFrame
- })
- mTipsIcon: cc.SpriteFrame = null;
-
- @property({
- displayName: '控制的机关',
- type: [cc.Node],
- })
- mFenceTrigger: Array<cc.Node> = [];
- private isOpen = false;
- onLoad() {
- super.onLoad()
-
-
-
-
-
-
-
-
-
- }
-
- public onBegin(tag: number) {
- if (this.isOpen) {
- return
- }
- if (tag == 1) {
-
- this.showOpt(this.mTipsIcon, () => {
- let head = this.ff.mFFheader;
- let count = head.getTmpCount(this.keyID);
- if (count > 0) {
-
- this.pause();
- this.openBox();
- } else {
- EventListener.dispatchEvent("step_2_1");
- console.log("===没有钥匙==")
- }
- })
- }
- }
-
- public onEnd(tag: number) {
- if (tag == 1) {
- this.closeOpt()
-
- }
- }
- private openBox() {
- this.isOpen = true;
- this.closeOpt();
- this.spine.setAnimation(0, 'open', false);
- this.ff.main.playerEffectByPath(AudioMgr.box);
- this.spine.setCompleteListener(() => {
- this.resume();
- EventListener.dispatchEvent("step_2_2");
-
-
-
-
-
- });
- }
- }
|