123456789101112131415161718192021222324252627282930313233343536373839 |
- import { GameEvent } from "../../../data/const/EventConst";
- import { ViewZOrder } from "../../../data/const/ViewZOrder";
- import GameDataCenter from "../../../data/GameDataCenter";
- import ResSpine from "../../../frameWork/compment/ResSpine";
- import EventMng from "../../../manager/EventMng";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class UIClickEft extends cc.Component {
- @property(ResSpine)
- clickResSpine: ResSpine = null;
- protected onEnable(): void {
- EventMng.on(GameEvent.ON_CLICK, this.onClick, this)
- }
- protected onDisable(): void {
- EventMng.off(GameEvent.ON_CLICK, this.onClick, this)
- }
- start() {
- cc.game.addPersistRootNode(this.node)
- this.node.zIndex = ViewZOrder.ClickEft;
- this.clickResSpine.setSpineData("spine", "effect_dianji01/effect_dianji01", null, false, "animation");
- this.clickResSpine.addCompleteListener(this.OnCompleteListener.bind(this));
- this.clickResSpine.node.active = false;
- }
- onClick(event) {
- GameDataCenter.time.guideRuoTime = 0
- if (this.clickResSpine == null) {
- return
- }
- this.clickResSpine.node.active = true;
- this.clickResSpine.node.x = event.getLocationX()
- this.clickResSpine.node.y = event.getLocationY()
- this.clickResSpine.playAnimation("animation", false);
- }
- OnCompleteListener() {
- this.clickResSpine.node.active = false;
- }
- }
|