/** * 卡牌 */ import { GameType } from "../../Tools/Define"; import GameResMgr from "../../Tools/GameResMgr"; import PlayData from "../../Tools/PlayData"; const {ccclass, property} = cc._decorator; @ccclass export default class kapaiSc extends cc.Component { // @property([cc.SpriteFrame]) // kapaiSpArr:cc.SpriteFrame[] = [] @property(cc.Sprite) kapaisp:cc.Sprite = null @property(cc.Label) numstr:cc.Label = null @property(cc.Node) wenhao:cc.Node = null @property kaNum = 0 bianshu = -1 //用于挑战模式 问号卡牌 变化 // LIFE-CYCLE CALLBACKS: // onLoad () {} start(){ } //guan=0 // // 6*x + 1 = 10 //5-10 5+5*0+0 10+5*0+0 1---10 6*0 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 //11-16 5+5*1+1 10+5*1+1 7---16 6*1+1 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 //17-22 5+5*2+2 13---22 6*2+1 13, 14,15, 16, 17, 18, 19, 20, 21, 22 //23-28 5+5*3+3 /** * 设置 图 * @param id */ setKaPaiSp(id){ if(PlayData.Instance.gameType == GameType.challenge){ if(id != 0){ this.wenhao.active = !1 } this.kapaisp.spriteFrame = GameResMgr.Instance.kaSp0[id] }else if(PlayData.Instance.gameType == GameType.normal){ if(id == 0){ let yushu = 0 //id-PlayData.Instance.guanqia*6 //id%(this.kapaiSpArr.length-1) this.kapaisp.spriteFrame = GameResMgr.Instance.kaSp0[yushu] //this.kapaiSpArr[yushu] //this.wenhao.active = !0 }else{ this.wenhao.active = !1 let yushu = id-PlayData.Instance.guanqia*6 //id%(this.kapaiSpArr.length-1) this.kapaisp.spriteFrame = GameResMgr.Instance.kaSp0[yushu] //this.kapaiSpArr[yushu] } } // if(id == 0){ // let yushu = 0 //id-PlayData.Instance.guanqia*6 //id%(this.kapaiSpArr.length-1) // this.kapaisp.spriteFrame = GameResMgr.Instance.kaSp0[yushu] //this.kapaiSpArr[yushu] // this.wenhao.active = !0 // }else{ // this.wenhao.active = !1 // let yushu = id-PlayData.Instance.guanqia*6 //id%(this.kapaiSpArr.length-1) // this.kapaisp.spriteFrame = GameResMgr.Instance.kaSp0[yushu] //this.kapaiSpArr[yushu] // } } showWenHao(){ this.wenhao.active = !0 } /** * 设置数字 */ setKaNum(num){ if(PlayData.Instance.gameType == GameType.normal){ this.kaNum = num if(num == 0){ this.numstr.string = '?' }else{ this.numstr.string = '' + this.kaNum } }else if(PlayData.Instance.gameType == GameType.challenge){ this.kaNum = num this.numstr.node.active = !1 } this.setKaPaiSp(num) //this.numstr.node.active = !1 } // update (dt) {} }