1、清理仓库
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
// foo: {
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// to a node for the first time
|
||||
// url: cc.Texture2D, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// visible: true, // optional, default is true
|
||||
// displayName: 'Foo', // optional
|
||||
// readonly: false, // optional, default is false
|
||||
// },
|
||||
// ...
|
||||
atlas: {
|
||||
default: null,
|
||||
type: cc.SpriteAtlas
|
||||
},
|
||||
beimi0: {
|
||||
default: null,
|
||||
type: cc.SpriteAtlas
|
||||
},
|
||||
cardvalue:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
target:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
init:function(cvalue){
|
||||
this.value = cvalue ;
|
||||
let cardframe ;
|
||||
let cardcolors = parseInt(this.value/4 ) ;
|
||||
let cardtype = parseInt(cardcolors / 9);
|
||||
let deskcard ;
|
||||
if(cardcolors < 0){
|
||||
deskcard = "wind"+(cardcolors + 8) ; //东南西北风 , 中发白
|
||||
}else{
|
||||
if(cardtype == 0){ //万
|
||||
deskcard = "wan"+ (parseInt((this.value%36)/4)+1) ;
|
||||
}else if(cardtype == 1){ //筒
|
||||
deskcard = "tong"+ (parseInt((this.value%36)/4)+1) ;
|
||||
}else if(cardtype == 2){ //条
|
||||
deskcard = "suo"+ (parseInt((this.value%36)/4)+1) ;
|
||||
}
|
||||
}
|
||||
cardframe = this.atlas.getSpriteFrame('牌面-'+deskcard);
|
||||
this.cardvalue.getComponent(cc.Sprite).spriteFrame = cardframe;
|
||||
},
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "b8da79b5-a3a9-4e9e-965b-01135cbaab7f",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
// foo: {
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// to a node for the first time
|
||||
// url: cc.Texture2D, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// visible: true, // optional, default is true
|
||||
// displayName: 'Foo', // optional
|
||||
// readonly: false, // optional, default is false
|
||||
// },
|
||||
// ...
|
||||
atlas: {
|
||||
default: null,
|
||||
type: cc.SpriteAtlas
|
||||
},
|
||||
beimi0: {
|
||||
default: null,
|
||||
type: cc.SpriteAtlas
|
||||
},
|
||||
cardvalue:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
target:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.lastonecard = false ;
|
||||
this.take = false ;
|
||||
this.node.on('mousedown', function ( event ) {
|
||||
console.log('Hello!');
|
||||
});
|
||||
this.node.on('mousemove', function ( event ) {
|
||||
console.log('Hello Mover!');
|
||||
});
|
||||
},
|
||||
init:function(cvalue){
|
||||
this.value = cvalue ;
|
||||
let cardframe ;
|
||||
let cardcolors = parseInt(this.value/4 ) ;
|
||||
let cardtype = parseInt(cardcolors / 9);
|
||||
|
||||
this.mjtype = cardtype ;
|
||||
this.mjvalue = parseInt((this.value%36)/4 ) ;
|
||||
|
||||
let deskcard ;
|
||||
this.lastonecard = false;
|
||||
if(cardcolors < 0){
|
||||
deskcard = "wind"+(cardcolors + 8) ; //东南西北风 , 中发白
|
||||
}else{
|
||||
if(cardtype == 0){ //万
|
||||
deskcard = "wan"+ (parseInt((this.value%36)/4)+1) ;
|
||||
}else if(cardtype == 1){ //筒
|
||||
deskcard = "tong"+ (parseInt((this.value%36)/4)+1) ;
|
||||
}else if(cardtype == 2){ //条
|
||||
deskcard = "suo"+ (parseInt((this.value%36)/4)+1) ;
|
||||
}
|
||||
}
|
||||
if(deskcard == "suo2"){
|
||||
cardframe = this.beimi0.getSpriteFrame('牌面-'+deskcard);
|
||||
}else{
|
||||
cardframe = this.atlas.getSpriteFrame('牌面-'+deskcard);
|
||||
}
|
||||
this.cardvalue.getComponent(cc.Sprite).spriteFrame = cardframe;
|
||||
|
||||
var anim = this.getComponent(cc.Animation);
|
||||
anim.play("majiang_current");
|
||||
},
|
||||
lastone:function(){
|
||||
if(this.lastonecard == false){
|
||||
this.lastonecard = true;
|
||||
this.target.width = this.target.width + 30 ;
|
||||
}
|
||||
},
|
||||
selected:function(){
|
||||
this.target.opacity = 168 ;
|
||||
this.selectcolor = true ;
|
||||
},
|
||||
relastone:function(){
|
||||
if(this.lastonecard == true){
|
||||
this.lastonecard = false;
|
||||
this.target.width = this.target.width - 30 ;
|
||||
}
|
||||
},
|
||||
reinit:function(){
|
||||
this.relastone();
|
||||
|
||||
this.lastonecard = false;
|
||||
|
||||
this.selectcolor = false ;
|
||||
this.target.opacity = 255 ;
|
||||
|
||||
if(this.take){
|
||||
this.target.y = this.target.y - 30 ;
|
||||
this.take = false ;
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "ea828edc-e749-4c29-bfc0-7dbff2518151",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
// foo: {
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// to a node for the first time
|
||||
// url: cc.Texture2D, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// visible: true, // optional, default is true
|
||||
// displayName: 'Foo', // optional
|
||||
// readonly: false, // optional, default is false
|
||||
// },
|
||||
// ...
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
/**
|
||||
* 记录牌的 特殊属性, 是否刚抓起来的牌,已经玩家位置 , 右、上、左
|
||||
* @param spec
|
||||
* @param inx
|
||||
*/
|
||||
init:function(spec , inx){
|
||||
this.spec = spec ;
|
||||
this.inx = inx ;
|
||||
if(this.spec == true){
|
||||
if(this.inx == 0 || this.inx == 2){
|
||||
this.node.height = this.node.height + 50;
|
||||
}else{
|
||||
this.node.width = this.node.width + 30 ;
|
||||
}
|
||||
}
|
||||
},
|
||||
reinit:function(){
|
||||
if(this.spec == true){
|
||||
if(this.inx == 0 || this.inx == 2){
|
||||
this.node.height = this.node.height - 50;
|
||||
}else{
|
||||
this.node.width = this.node.width - 30 ;
|
||||
}
|
||||
}
|
||||
this.spec = false ;
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "92a2d51d-2450-4329-bf09-4d684cc8666e",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
// foo: {
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// to a node for the first time
|
||||
// url: cc.Texture2D, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// visible: true, // optional, default is true
|
||||
// displayName: 'Foo', // optional
|
||||
// readonly: false, // optional, default is false
|
||||
// },
|
||||
// ...
|
||||
target:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.clickstate = false ;
|
||||
},
|
||||
onClick:function(){
|
||||
let handCards = this.target.getComponent("HandCards")
|
||||
let self = this ;
|
||||
if(this.clickstate == true){
|
||||
//出牌
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom('takecard', true) );
|
||||
}else{
|
||||
if(handCards.take == true){
|
||||
handCards.take = false ;
|
||||
this.target.y = this.target.y - 30 ;
|
||||
}else{
|
||||
handCards.take = true;
|
||||
this.target.y = this.target.y + 30 ;
|
||||
}
|
||||
this.clickstate = true ;
|
||||
setTimeout(function(){ //双击算法
|
||||
self.clickstate = false ;
|
||||
} , 500) ;
|
||||
}
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "09db6a98-d71f-48ac-876f-57754501873c",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
Reference in New Issue
Block a user