/* * @Author: WoNiu * @Date: 2024-03-21 13:28:47 * @LastEditTime: 2024-03-23 20:26:10 * @LastEditors: WoNiu * @Description: */ /* * @Author: WoNiu * @Date: 2024-03-21 13:28:47 * @LastEditTime: 2024-03-22 21:24:13 * @LastEditors: WoNiu * @Description: 顺序选择卡片节点 */ import { _decorator, Node, } from "cc"; import { BaseSprite } from "../../GlobalScript/CommonComponent/BaseSprite"; import { NpkImage } from "../../Tool/NPKImage"; import { BaseButtonAction } from "../../GlobalScript/CommonComponent/BaseButtonAction"; import { CardNode } from "./CardNode"; import { TimingProgressBar } from "../Common/TimingProgressBar"; const { ccclass, property } = _decorator; /// 选择顺序卡牌Node @ccclass("SelectNumberNode") export class SelectNumberNode extends Node { oneCard: CardNode; twoCard: CardNode; threeCard: CardNode; constructor() { super(); this.initBackground(); this.initCards(); this.initTiming(); } initBackground() { const node = new Node(); node.setPosition(184.5, -181.5); const bs = node.addComponent(BaseSprite); bs.updateSpriteFrame(NpkImage.ingame, 46); this.addChild(node); } initCards() { this.oneCard = new CardNode(); this.oneCard.setPosition(250, -220); this.addChild(this.oneCard); const Onebba = this.oneCard.addComponent(BaseButtonAction); Onebba.onMouseLeftDown = ()=>{ this.onMouseLeftDown(0) }; this.twoCard = new CardNode(); this.twoCard.setPosition(444.5, -220); this.addChild(this.twoCard); const twoBba = this.twoCard.addComponent(BaseButtonAction); twoBba.onMouseLeftDown = ()=>{ this.onMouseLeftDown(1) }; this.threeCard = new CardNode(); this.threeCard.setPosition(639, -220); this.addChild(this.threeCard); const threeBba = this.threeCard.addComponent(BaseButtonAction); threeBba.onMouseLeftDown = ()=>{ this.onMouseLeftDown(2) }; } initTiming(){ const time = new TimingProgressBar(); this.addChild(time); time.tweenerStart(3,()=>{ console.log('缓动完成'); }); } onMouseLeftDown(tag:number){ const cards = [this.oneCard,this.twoCard,this.threeCard]; cards.forEach((card)=>{ card.Disable = true; }); }; update(deltaTime: number) {} }