const Tile_Color = cc.Enum({ COLOR_DIAMOND:1, COLOR_CLUB:2, COLOR_HEART:3, COLOR_SPADE:4, }); const Tile_Num = cc.Enum({ Num_A:1, Num_2:2, Num_3:3, Num_4:4, Num_5:5, Num_6:6, Num_7:7, Num_8:8, Num_9:9, }); //module.exports = { // Card_Color:Card_Color, // Card_Num:Card_Num, //}; cc.Class({ extends: cc.Component, properties: { m_nCardId:0, }, statics:{ MakeCardID : function(Color,Num){ return (Color<<4) + Num; }, //CreateCard : function(type, Id){ // return cc.instantiate(this.PreHandCard0); //}, }, setId:function(id) { this.m_nCardId = id; }, tileId:function () { return this.m_nCardId; }, tileColor:function () { return ((this.m_nCardId>>4) & 0x0F); }, tileNum:function () { return (this.m_nCardId & 0x0F); }, tileName:function () { const colorname = ["方块","梅花","红桃","黑桃"] ; var name = ""; var color = this.Tile_Color(); var num = this.tileNum(); switch (color) { case Tile_Color.COLOR_DIAMOND: case Tile_Color.COLOR_CLUB: case Tile_Color.COLOR_HEART: case Tile_Color.COLOR_SPADE: { name = colorname[color] + num.toString(); } break; default: break; } return name; }, // update (dt) {}, });