1、清理仓库
This commit is contained in:
67
client/version/chess/.gitignore
vendored
Normal file
67
client/version/chess/.gitignore
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Fireball Projects
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
library/
|
||||
temp/
|
||||
local/
|
||||
build/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Logs and databases
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# files for debugger
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.sln
|
||||
*.csproj
|
||||
*.pidb
|
||||
*.unityproj
|
||||
*.suo
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# OS generated files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# exvim files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*UnityVS.meta
|
||||
*.err
|
||||
*.err.meta
|
||||
*.exvim
|
||||
*.exvim.meta
|
||||
*.vimentry
|
||||
*.vimentry.meta
|
||||
*.vimproject
|
||||
*.vimproject.meta
|
||||
.vimfiles.*/
|
||||
.exvim.*/
|
||||
quick_gen_project_*_autogen.bat
|
||||
quick_gen_project_*_autogen.bat.meta
|
||||
quick_gen_project_*_autogen.sh
|
||||
quick_gen_project_*_autogen.sh.meta
|
||||
.exvim.app
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# webstorm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.idea/
|
||||
|
||||
#//////////////////////////
|
||||
# VS Code
|
||||
#//////////////////////////
|
||||
|
||||
.vscode/
|
||||
6
client/version/chess/assets/module.meta
Normal file
6
client/version/chess/assets/module.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "7fc2a827-f7c1-4925-968f-dc3050171c47",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
5
client/version/chess/assets/module/game.meta
Normal file
5
client/version/chess/assets/module/game.meta
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "2d39a076-e310-40a3-9e2f-2ff7a8ccd178",
|
||||
"subMetas": {}
|
||||
}
|
||||
6
client/version/chess/assets/module/game/dizhu.meta
Normal file
6
client/version/chess/assets/module/game/dizhu.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "45d608f9-4552-4a2e-bb7b-178f861b3afa",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
client/version/chess/assets/module/game/dizhu/scene.meta
Normal file
6
client/version/chess/assets/module/game/dizhu/scene.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "0c5b333b-55c4-4c2f-997b-20244b006f90",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6019
client/version/chess/assets/module/game/dizhu/scene/dizhu.fire
Normal file
6019
client/version/chess/assets/module/game/dizhu/scene/dizhu.fire
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "3b4ff929-bc06-435a-bfe1-fe24f5ed184f",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "2d9504ad-0209-455a-b4ec-54a939aa8fb1",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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 () {
|
||||
|
||||
},
|
||||
onBegin:function(){
|
||||
/**
|
||||
* 发射事件到 上一级 处理
|
||||
*/
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom("begin", true) );
|
||||
},
|
||||
opendeal:function(){
|
||||
/**
|
||||
* 发射事件到 上一级 处理
|
||||
*/
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom("opendeal", true) );
|
||||
},
|
||||
onClose:function(){
|
||||
/**
|
||||
* 发射事件到 上一级 处理
|
||||
*/
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom("close", true) );
|
||||
},
|
||||
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "4e98004f-1cfb-4282-8cc9-84ec3cf0b65e",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,879 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
gamebtn: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
continuegamebtn:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
poker: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
lastCardsPanel: { //底牌
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
waitting: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
ratio:{ //底牌
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
summary_win:{
|
||||
default:null ,
|
||||
type : cc.Prefab
|
||||
},
|
||||
summary:{
|
||||
default:null ,
|
||||
type : cc.Prefab
|
||||
},
|
||||
inviteplayer:{
|
||||
default:null ,
|
||||
type : cc.Prefab
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
/**
|
||||
* 适配屏幕尺寸
|
||||
*/
|
||||
this.resize();
|
||||
|
||||
this.player = new Array() ; //存放玩家数据
|
||||
this.pokercards = new Array();
|
||||
this.lastcards = new Array();
|
||||
this.lastCardsPanel.active = false ;
|
||||
this.summarypage = null ;
|
||||
this.inited = false ;
|
||||
this.lasttip = null ;
|
||||
if(cc.beimi!=null){
|
||||
if(cc.beimi.gamestatus!=null && cc.beimi.gamestatus == "playing"){
|
||||
//恢复数据
|
||||
this.recovery() ;
|
||||
}else if(cc.beimi.extparams!=null && cc.beimi.extparams.gamemodel == "room"){
|
||||
/**
|
||||
* 房卡模式,开始启动游戏,当前玩家进入等待游戏的状态,显示邀请好友游戏,并分配 6位数字的房间号码
|
||||
*/
|
||||
/**
|
||||
* 处理完毕,清理掉全局变量
|
||||
* @type {null}
|
||||
*/
|
||||
this.invite = cc.instantiate(this.inviteplayer) ;
|
||||
}
|
||||
this.initgame();
|
||||
}
|
||||
},
|
||||
begin:function(){
|
||||
if(cc.beimi.data!=null && cc.beimi.data.enableai == true){
|
||||
this.statictimer("正在匹配玩家" , cc.beimi.data.waittime) ;
|
||||
}else{
|
||||
this.statictimer("正在匹配玩家,请稍候" , cc.beimi.data.noaiwaitime) ;
|
||||
}
|
||||
this.startgame("false") ;
|
||||
},
|
||||
opendeal:function(){
|
||||
if(cc.beimi.data!=null && cc.beimi.data.enableai == true){
|
||||
this.statictimer("正在匹配玩家" , cc.beimi.data.waittime) ;
|
||||
}else{
|
||||
this.statictimer("正在匹配玩家,请稍候" , cc.beimi.data.noaiwaitime) ;
|
||||
}
|
||||
this.startgame("true") ;
|
||||
},
|
||||
recovery:function(){
|
||||
this.statictimer("正在恢复数据,请稍候" , cc.beimi.data.waittime) ;
|
||||
},
|
||||
initgame:function(){
|
||||
let self = this ;
|
||||
this.gamebtn.active = true ;
|
||||
this.continuegamebtn.active = false ;
|
||||
if(this.ready()) {
|
||||
let socket = this.socket();
|
||||
|
||||
|
||||
|
||||
this.game = this.getCommon("DizhuDataBind");
|
||||
|
||||
this.map("joinroom" , this.joinroom_event) ; //加入房价
|
||||
this.map("players" , this.players_event) ; //接受玩家列表
|
||||
this.map("catch" , this.catch_event) ; //叫地主
|
||||
this.map("catchresult" , this.catchresult_event) ; //最终抢到地主的玩家
|
||||
this.map("lasthands" , this.lasthands_event) ; //翻底牌
|
||||
this.map("takecards" , this.takecards_event) ; //出牌信息
|
||||
this.map("ratio" , this.ratio_event) ; //有炸
|
||||
this.map("play" , this.play_event) ; //接受玩家列表
|
||||
this.map("allcards" , this.allcards_event) ; //我出的牌
|
||||
this.map("cardtips" , this.cardtips_event) ; //提示
|
||||
this.map("roomready" , this.roomready_event) ; //提示
|
||||
|
||||
this.map("playeready" , this.playeready_event) ; //玩家点击了开始游戏 , 即准备就绪
|
||||
|
||||
this.map("cardtips" , this.cardtips_event) ; //提示
|
||||
|
||||
this.map("recovery" , this.recovery_event) ; //恢复牌局数据
|
||||
|
||||
socket.on("command" , function(result){
|
||||
cc.beimi.gamestatus = "playing" ;
|
||||
if(self.inited == true){
|
||||
var data = self.parse(result) ;
|
||||
self.route(data.command)(data , self);
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 心跳检查,服务端发起的事件,服务端可以设置 PING的时长和 PING的 TimeOut
|
||||
*/
|
||||
socket.on("ping" , function(){
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 此处有个问题:游戏中,如果点击了返回,进入过其他游戏,这个 cc.beimi.extparams.playway
|
||||
* 就发生了改变,会导致当前游戏结束后,继续游戏的时候会出现问题
|
||||
* @type {{token: (*|null), playway, orgi, extparams: *}}
|
||||
*/
|
||||
var param = {
|
||||
token:cc.beimi.authorization,
|
||||
playway:cc.beimi.extparams.playway,
|
||||
orgi:cc.beimi.user.orgi,
|
||||
extparams:cc.beimi.extparams
|
||||
} ;
|
||||
socket.emit("joinroom" ,JSON.stringify(param)) ;
|
||||
|
||||
this.inited = true ;
|
||||
}
|
||||
|
||||
},
|
||||
/**
|
||||
* 新创建牌局,首个玩家加入,进入等待状态,等待其他玩家加入,服务端会推送 players数据
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
joinroom_event:function(data , context){
|
||||
|
||||
if(data.cardroom == true && context.inviteplayer!=null){
|
||||
let script = context.invite.getComponent("BeiMiQR")
|
||||
script.init(data.roomid);
|
||||
context.invite.parent = context.root() ;
|
||||
}
|
||||
|
||||
|
||||
//显示 匹配中,并计时间,超过设定的倒计时时间即AI加入,根据当前的 玩家数量 匹配机器人
|
||||
if(data.player.id && data.player.id == cc.beimi.user.id){
|
||||
//本人,开始计时
|
||||
//console.log("本人") ;
|
||||
//self.player[0] = data ;
|
||||
context.index = data.index ; //当前玩家所在位置
|
||||
}else{
|
||||
//其他玩家加入,初始化
|
||||
var inroom = false ;
|
||||
for(var i = 0 ; i < context.player.length ; i++){
|
||||
var player = context.player[i].getComponent("PlayerRender") ;
|
||||
if(player.userid == data.player.id){
|
||||
inroom = true ;
|
||||
}
|
||||
}
|
||||
if(inroom == false){
|
||||
context.newplayer(context.player.length , context , data.player , context.index + 1 == data.index) ;
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 房卡模式下,邀请的好友人到齐了
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
roomready_event:function(data , context){
|
||||
if(data.cardroom == true && context.invite!=null){
|
||||
context.invite.destroy();
|
||||
}
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
playeready_event:function(data , context){
|
||||
if(data.userid == cc.beimi.user.id){
|
||||
context.gamebtn.active = false ;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 推送的 玩家数据,根据玩家数据 恢复牌局 , 玩家座位排列方式 , 和麻将统一, 都是东南西北方式 排列
|
||||
* 0是首位玩家
|
||||
* 1是右侧玩家
|
||||
* 2是左侧玩家
|
||||
* 麻将还有一个对家
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
players_event:function(data,context){
|
||||
var inx = -1 ;
|
||||
for(var i = 0 ; i<data.player.length ; i++){
|
||||
if(data.player[i].id == cc.beimi.user.id){
|
||||
inx = i ; break ;
|
||||
}
|
||||
}
|
||||
if(data.player.length > 1 && inx >=0){
|
||||
var pos = inx+1 ;
|
||||
while(true){
|
||||
if(pos == data.player.length){pos = 0 ;}
|
||||
if(context.playerexist(data.player[pos], context) == false){
|
||||
context.newplayer(context.player.length , context , data.player[pos] , context.player.length == 0 && !(pos == 0 && data.player.length < data.maxplayers) ) ;
|
||||
}
|
||||
if(pos == inx){break ;}
|
||||
pos = pos + 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
playerexist:function(player,context){
|
||||
var inroom = false ;
|
||||
if(player.id == cc.beimi.user.id){
|
||||
inroom = true ;
|
||||
}else{
|
||||
for(var j = 0 ; j < context.player.length ; j++){
|
||||
if(context.player[j].id == player.id){
|
||||
inroom = true ; break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return inroom ;
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 推送的 玩家数据,根据玩家数据 恢复牌局
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
catch_event:function(data,context){
|
||||
/**
|
||||
* 修改倍率
|
||||
*/
|
||||
if(context.ratio){
|
||||
context.ratio.string = data.ratio+"倍" ;
|
||||
}
|
||||
if(data.userid == cc.beimi.user.id){ //该我抢
|
||||
context.game.catchtimer(15);
|
||||
}else{ //该别人抢
|
||||
for(var inx =0 ; inx<context.player.length ; inx++){
|
||||
var render = context.player[inx].getComponent("PlayerRender") ;
|
||||
if(render.userid && render.userid == data.userid){
|
||||
render.catchtimer(15);
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 恢复牌局的数据 恢复牌局
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
recovery_event:function(data,context){
|
||||
var mycards = context.decode(data.player.cards);
|
||||
if(context.waittimer != null){
|
||||
let timer = context.waittimer.getComponent("BeiMiTimer");
|
||||
if(timer){
|
||||
timer.stop(context.waittimer) ;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理掉 extparam;
|
||||
* @type {boolean}
|
||||
*/
|
||||
|
||||
context.gamebtn.active = false ;
|
||||
|
||||
if(context.ratio){
|
||||
context.ratio.string = data.ratio+"倍" ;
|
||||
}
|
||||
|
||||
context.doLastCards(context.game , context , 3 , 0);
|
||||
for(var inx =0 ; inx < mycards.length ; inx++){
|
||||
let pokencard = context.playcards(context.game , context, inx * 50-300 , mycards[inx]);
|
||||
context.registerProxy(pokencard);
|
||||
}
|
||||
/**
|
||||
* 赋值,解码牌面
|
||||
*/
|
||||
for(var i=0 ; i<context.pokercards.length ; i++){
|
||||
var pokencard = context.pokercards[i];
|
||||
pokencard.getComponent("BeiMiCard").order();
|
||||
}
|
||||
context.lastCardsPanel.active = true ;
|
||||
|
||||
if(data.lasthands){
|
||||
var lasthands = context.decode(data.lasthands);
|
||||
/**
|
||||
* 底牌 , 顶部的 三张底牌显示区域
|
||||
*/
|
||||
for(var i=0 ; i<context.lastcards.length ; i++){
|
||||
var last = context.lastcards[i].getComponent("BeiMiCard") ;
|
||||
last.setCard(lasthands[i]);
|
||||
last.order();
|
||||
}
|
||||
/**
|
||||
* 设置地主标志
|
||||
*/
|
||||
if(data.banker.userid == cc.beimi.user.id){
|
||||
context.game.lasthands(context , context.game , data.data ) ;
|
||||
}else{
|
||||
context.getPlayer(data.banker.userid).setDizhuFlag(data.data);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 恢复最后出的牌
|
||||
*/
|
||||
if(data.last != null){
|
||||
let lastcards = context.decode(data.last.cards); //解析牌型
|
||||
if (data.last.userid == cc.beimi.user.id) {
|
||||
context.game.lasttakecards(context.game, context, data.last.cardsnum, lastcards , data.last);
|
||||
} else {
|
||||
context.getPlayer(data.last.userid).lasttakecards(context.game, context, data.last.cardsnum, lastcards , data.last);
|
||||
}
|
||||
|
||||
if (data.nextplayer == cc.beimi.user.id) {
|
||||
context.game.playtimer(context.game, 25 , data.automic);
|
||||
} else {
|
||||
context.getPlayer(data.nextplayer).playtimer(context.game, 25);
|
||||
}
|
||||
}
|
||||
if(data.cardsnum!=null && data.cardsnum.length > 0){
|
||||
for(var i =0 ; i<data.cardsnum.length ; i++){
|
||||
context.getPlayer(data.cardsnum[i].userid).resetcards(data.cardsnum[i].cardsnum);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 有玩家出炸
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
ratio_event:function(data,context){
|
||||
/**
|
||||
* 修改倍率
|
||||
*/
|
||||
|
||||
if(data.king == true){
|
||||
//王炸,播放音效
|
||||
}else if(data.bomb == true){
|
||||
//普通炸弹,播放音效
|
||||
}
|
||||
if(context.ratio){
|
||||
context.ratio.string = data.ratio+"倍" ;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 推送的 玩家数据,根据玩家数据 恢复牌局
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
catchresult_event:function(data,context){
|
||||
/**
|
||||
* 修改倍率
|
||||
*/
|
||||
if(context.ratio){
|
||||
context.ratio.string = data.ratio+"倍" ;
|
||||
}
|
||||
if(data.userid == cc.beimi.user.id){ //该我抢
|
||||
context.game.catchresult(data);
|
||||
}else{ //该别人抢
|
||||
setTimeout(function(){
|
||||
context.getPlayer(data.userid).catchresult(data);
|
||||
},1500) ;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 推送的 玩家数据,根据玩家数据 恢复牌局
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
lasthands_event:function(data,context){
|
||||
var lasthands = context.decode(data.lasthands);
|
||||
/**
|
||||
* 底牌 , 顶部的 三张底牌显示区域
|
||||
*/
|
||||
for(var i=0 ; i<context.lastcards.length ; i++){
|
||||
var last = context.lastcards[i].getComponent("BeiMiCard") ;
|
||||
last.setCard(lasthands[i]);
|
||||
last.order();
|
||||
}
|
||||
/**
|
||||
* 当前玩家的 底牌处理
|
||||
*/
|
||||
if(data.userid == cc.beimi.user.id) {
|
||||
context.game.lasthands(context , context.game , data ) ;
|
||||
/**
|
||||
* 隐藏 其他玩家的 抢地主/不抢地主的 提示信息
|
||||
*/
|
||||
for(var inx =0 ; inx<context.player.length ; inx++){
|
||||
var render = context.player[inx].getComponent("PlayerRender") ;
|
||||
render.hideresult();
|
||||
}
|
||||
|
||||
for(var i=0 ; i<lasthands.length ; i++){
|
||||
let func = null ;
|
||||
if(i == (lasthands.length - 1)){
|
||||
func = cc.callFunc(function (target , data) {
|
||||
if(data.tempcontext){
|
||||
data.tempcontext.layout(data.tempcontext.poker , function(fir , sec){
|
||||
return fir.zIndex - sec.zIndex ;
|
||||
});
|
||||
}
|
||||
}, this , {tempcontext: context});
|
||||
}
|
||||
let pc = context.current(context.game , context ,2 * 300 + (6 + i) * 50-300, lasthands[i] , func) ;
|
||||
var beiMiCard = pc.getComponent("BeiMiCard") ;
|
||||
beiMiCard.order();
|
||||
context.registerProxy(pc);
|
||||
}
|
||||
|
||||
context.game.playtimer(context.game,25 , true);
|
||||
}else{
|
||||
context.game.hideresult();
|
||||
for(var inx =0 ; inx<context.player.length ; inx++){
|
||||
var render = context.player[inx].getComponent("PlayerRender") ;
|
||||
render.hideresult();
|
||||
}
|
||||
context.getPlayer(data.userid).lasthands(context,context.game,data);
|
||||
context.getPlayer(data.userid).playtimer(context.game , 25);
|
||||
}
|
||||
for(var inx =0 ; inx<context.pokercards.length ; inx++){
|
||||
var pc = context.pokercards[inx] ;
|
||||
pc.zIndex = 54 - pc.card ;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 推送的 玩家数据,根据玩家数据 恢复牌局
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
takecards_event:function(data,context){
|
||||
context.lasttip = null ;
|
||||
if(data.allow == true) {
|
||||
var lastcards ;
|
||||
if(data.donot == false){
|
||||
lastcards = context.decode(data.cards); //解析牌型
|
||||
}
|
||||
if (data.userid == cc.beimi.user.id) {
|
||||
context.game.unselected(context , context.game) ;
|
||||
context.game.lasttakecards(context.game, context, data.cardsnum, lastcards , data);
|
||||
} else {
|
||||
context.getPlayer(data.userid).lasttakecards(context.game, context, data.cardsnum, lastcards , data);
|
||||
}
|
||||
|
||||
context.game.selectedcards.splice(0 ,context.game.selectedcards.length );//清空
|
||||
if(data.over == false){
|
||||
if (data.nextplayer == cc.beimi.user.id) {
|
||||
context.game.playtimer(context.game, 25 , data.automic);
|
||||
} else {
|
||||
context.getPlayer(data.nextplayer).playtimer(context.game, 25);
|
||||
}
|
||||
}
|
||||
}else{//出牌不符合规则,需要进行提示
|
||||
context.game.notallow.active = true ;
|
||||
setTimeout(function(){
|
||||
context.game.notallow.active = false ;
|
||||
} , 2000);
|
||||
context.game.unselected(context , context.game);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 出牌提示信息
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
cardtips_event:function(data,context){
|
||||
context.game.unselected(context , context.game) ;
|
||||
if(data.allow == true) {
|
||||
var tipcards = context.decode(data.cards); //解析牌型
|
||||
context.lasttip = tipcards.join(",") ;
|
||||
for(var inx = 0 ; inx < tipcards.length ; inx++){
|
||||
context.game.cardtips(context , tipcards[inx] , tipcards) ;
|
||||
}
|
||||
}else{//出牌不符合规则,需要进行提示
|
||||
context.game.cardtipsfornot(context , context.game);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 接收到服务端的 推送的 玩家数据,根据玩家数据 恢复牌局
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
play_event:function(data,context){
|
||||
/**
|
||||
* 增加了全局变量,gamestatus , 用于控制当前玩家退出后恢复数据
|
||||
* @type {string}
|
||||
*/
|
||||
cc.beimi.gamestatus = "playing" ;
|
||||
var mycards = context.decode(data.player.cards);
|
||||
if(context.waittimer){
|
||||
let timer = context.waittimer.getComponent("BeiMiTimer");
|
||||
if(timer){
|
||||
timer.stop(context.waittimer) ;
|
||||
}
|
||||
}
|
||||
|
||||
let center = context.game.pokerpool.get();
|
||||
let left = context.game.pokerpool.get(),right = context.game.pokerpool.get();
|
||||
center.parent = context.root() ;
|
||||
left.parent = context.root() ;
|
||||
right.parent = context.root() ;
|
||||
center.setPosition(0,200);
|
||||
left.setPosition(0,200);
|
||||
right.setPosition(0,200);
|
||||
|
||||
let finished = cc.callFunc(function (target , data) {
|
||||
if(data.game){
|
||||
data.game.pokerpool.put(data.current) ;
|
||||
data.game.pokerpool.put(data.left);
|
||||
data.game.pokerpool.put(data.right);
|
||||
|
||||
/**
|
||||
* 赋值,解码牌面
|
||||
*/
|
||||
for(var i=0 ; i<data.self.pokercards.length ; i++){
|
||||
var pokencard = data.self.pokercards[i];
|
||||
pokencard.getComponent("BeiMiCard").order();
|
||||
}
|
||||
|
||||
data.self.lastCardsPanel.active = true ;
|
||||
}
|
||||
}, this , {game : context.game , self: context, left :left , right : right , current : center});
|
||||
|
||||
context.doLastCards(context.game , context , 3 , 0);
|
||||
|
||||
/**
|
||||
* 发牌动作,每次6张,本人保留总计17张,其他人发完即回收
|
||||
*/
|
||||
setTimeout(function() {
|
||||
context.dealing(context.game , 6 , context , 0 , left , right , mycards) ;
|
||||
setTimeout(function(){
|
||||
context.dealing(context.game , 6 , context , 1, left , right , mycards) ;
|
||||
setTimeout(function(){
|
||||
context.dealing(context.game , 5 , context , 2, left , right , mycards , finished) ;
|
||||
context.reordering(context);
|
||||
},500) ;
|
||||
},500) ;
|
||||
}, 0);
|
||||
},
|
||||
/**
|
||||
* 打完牌,进入结算界面,结算界面流程:
|
||||
* 1、提示你赢/输了
|
||||
* 2、1秒后所有玩家的牌翻出来,显示剩余的牌
|
||||
* 3、2秒后显示结算界面
|
||||
* 4、玩家点选明牌开始还是继续游戏
|
||||
* @param data
|
||||
* @param context
|
||||
*/
|
||||
allcards_event:function(data , context){
|
||||
/**
|
||||
* 全局变量控制,用于恢复数据
|
||||
* @type {string}
|
||||
*/
|
||||
cc.beimi.gamestatus = "notready" ;
|
||||
//结算界面,
|
||||
let player ;
|
||||
for(var i=0 ; i<data.players.length ; i++){
|
||||
var temp = data.players[i] ;
|
||||
if(temp.userid != cc.beimi.user.id){
|
||||
var cards = context.decode(temp.cards); //解析牌型
|
||||
var tempscript = context.getPlayer(temp.userid) ;
|
||||
for(var inx = 0 ; inx < cards.length ; inx++) {
|
||||
//tempscript.lasttakecards(context.game, context, cards.length, cards, data);
|
||||
/**
|
||||
* 最后牌局结束以后,显示所有玩家的手牌
|
||||
*/
|
||||
}
|
||||
}else{
|
||||
player = temp ;
|
||||
}
|
||||
}
|
||||
if(player!=null) {
|
||||
/**
|
||||
* 更新个人账号资产信息
|
||||
*/
|
||||
context.pva("gold" , player.balance);
|
||||
/**
|
||||
* 刷新个人资产显示 , 可以增加相关动画显示,duang的一声,显示的金币变成金光闪闪的,然后再变回去
|
||||
*/
|
||||
context.updatepva() ;
|
||||
}
|
||||
setTimeout(function(){
|
||||
if(player!=null){
|
||||
if(player.win == true){
|
||||
context.summarypage = cc.instantiate(context.summary_win) ;
|
||||
}else{
|
||||
context.summarypage = cc.instantiate(context.summary) ;
|
||||
}
|
||||
context.summarypage.parent = context.root() ;
|
||||
let temp = context.summarypage.getComponent("SummaryDetail") ;
|
||||
temp.create(context , data);
|
||||
}
|
||||
/**
|
||||
* 隐藏顶部的 底牌 显示区域
|
||||
* @type {boolean}
|
||||
*/
|
||||
context.lastCardsPanel.active = false ;
|
||||
|
||||
if(data.gameRoomOver == true){//房间解散
|
||||
for(var inx = 0 ; inx<context.player.length ; inx++){
|
||||
context.player[inx].destroy();
|
||||
}
|
||||
context.player.splice(0 , context.player.length) ;//房间解散,释放资源
|
||||
context.player = new Array();
|
||||
context.clean();
|
||||
}
|
||||
} , 2000);
|
||||
|
||||
},
|
||||
getPlayer:function(userid){
|
||||
var tempRender;
|
||||
for(var inx =0 ; inx<this.player.length ; inx++){
|
||||
var render = this.player[inx].getComponent("PlayerRender") ;
|
||||
if(render.userid && render.userid == userid){
|
||||
tempRender = render ; break ;
|
||||
}
|
||||
}
|
||||
return tempRender ;
|
||||
},
|
||||
dealing:function(game , num , self , times , left , right , cards , finished){
|
||||
/**
|
||||
* 处理当前玩家的 牌, 发牌 , 17张牌, 分三次动作处理完成
|
||||
*/
|
||||
for(var i=0 ; i<num ; i++){
|
||||
var myCards = self.current(game , self ,times * 300 + i * 50-300, cards[times * 6 + i] , finished) ;
|
||||
this.registerProxy(myCards);
|
||||
}
|
||||
self.otherplayer(left , 0 , num ,game , self) ;
|
||||
self.otherplayer(right , 1 , num ,game , self) ;
|
||||
|
||||
},
|
||||
otherplayer:function(currpoker , inx, num ,game , self){
|
||||
if(inx == 0){
|
||||
let seq = cc.sequence(
|
||||
cc.spawn(cc.moveTo(0.2, -350, 50) , cc.scaleTo(0.2, 0.3, 0.3)) , cc.moveTo(0 , 0 , 200) , cc.scaleTo(0, 1, 1)
|
||||
);
|
||||
currpoker.runAction(seq);
|
||||
}else{
|
||||
let seq = cc.sequence(
|
||||
cc.spawn(cc.moveTo(0.2, 350, 50) , cc.scaleTo(0.2, 0.3, 0.3)) , cc.moveTo(0 , 0 , 200) , cc.scaleTo(0, 1, 1)
|
||||
);
|
||||
currpoker.runAction(seq);
|
||||
}
|
||||
//currpoker.setScale(1);
|
||||
var render = self.player[inx].getComponent("PlayerRender") ;
|
||||
for(var i=0 ; i<num ; i++){
|
||||
render.countcards(1);
|
||||
}
|
||||
},
|
||||
doLastCards:function(game , self , num , card){//发三张底牌
|
||||
for(var i=0 ; i<num ; i++){
|
||||
var width = i * 80 - 80;
|
||||
let currpoker = game.minpokerpool.get() ;
|
||||
currpoker.getComponent("BeiMiCard").setCard(card) ;
|
||||
currpoker.card = card ;
|
||||
currpoker.parent = this.lastCardsPanel;
|
||||
currpoker.setPosition(width , 0);
|
||||
|
||||
self.lastcards[self.lastcards.length] = currpoker ;
|
||||
}
|
||||
},
|
||||
registerProxy:function(myCard){
|
||||
if(myCard){
|
||||
var beiMiCard = myCard.getComponent("BeiMiCard") ;
|
||||
beiMiCard.proxy(this.game);
|
||||
}
|
||||
},
|
||||
playcards:function(game , self , posx , card){
|
||||
return self.current(game ,self , posx , card , null);
|
||||
},
|
||||
current:function(game , self , posx , card , func){
|
||||
let currpoker = game.pokerpool.get() ;
|
||||
var beiMiCard = currpoker.getComponent("BeiMiCard") ;
|
||||
beiMiCard.setCard(card) ;
|
||||
currpoker.card = card ;
|
||||
currpoker.parent = self.poker ;
|
||||
currpoker.setPosition(0,200);
|
||||
|
||||
currpoker.setScale(1,1);
|
||||
currpoker.zIndex = 100 - card ;
|
||||
|
||||
self.pokercards.push(currpoker);
|
||||
|
||||
if(func!=null){
|
||||
let seq = cc.sequence(cc.moveTo(0.2, posx, -180) , func);
|
||||
currpoker.runAction(seq);
|
||||
}else{
|
||||
let action = cc.moveTo(0.2, posx, -180) ;
|
||||
currpoker.runAction(action);
|
||||
}
|
||||
return currpoker;
|
||||
},
|
||||
reordering:function(self){
|
||||
for(var i=0 ; i<self.pokercards.length ; i++){
|
||||
self.pokercards[i].parent = self.poker ;
|
||||
}
|
||||
},
|
||||
newplayer:function(inx , self , data , isRight){
|
||||
var pos = cc.v2(520, 100) ;
|
||||
if(isRight == false){
|
||||
pos = cc.v2(-520,100) ;
|
||||
}
|
||||
let game = self.getCommon("DizhuDataBind");
|
||||
if(game && game.playerspool.size() > 0){
|
||||
self.player[inx] = game.playerspool.get() ;
|
||||
self.player[inx].parent = self.root() ;
|
||||
self.player[inx].setPosition(pos);
|
||||
var render = self.player[inx].getComponent("PlayerRender") ;
|
||||
render.initplayer(data , isRight);
|
||||
}
|
||||
},
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
/**
|
||||
* 不抢/叫地主
|
||||
*/
|
||||
givup:function(){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("giveup","giveup");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 开始游戏
|
||||
*/
|
||||
startgame:function(opendeal){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("start",opendeal);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 不抢/叫地主
|
||||
*/
|
||||
cardtips:function(){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
|
||||
if(this.lasttip!=null){
|
||||
socket.emit("cardtips",this.lasttip);
|
||||
}else{
|
||||
socket.emit("cardtips","");
|
||||
}
|
||||
this.lasttip = null ;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 抢/叫地主触发事件
|
||||
*/
|
||||
docatch:function(){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("docatch","docatch");
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 出牌
|
||||
*/
|
||||
doPlayCards:function(){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
this.game.selectedcards.splice(0 , this.game.selectedcards.length) ;
|
||||
for(var i=0 ; i<this.pokercards.length ; i++){
|
||||
var card = this.pokercards[i] ;
|
||||
var temp = card.getComponent("BeiMiCard");
|
||||
if(temp.selected == true){
|
||||
this.game.selectedcards.push(temp.card) ;
|
||||
}
|
||||
}
|
||||
socket.emit("doplaycards" , this.game.selectedcards.join());
|
||||
}
|
||||
this.lasttip = null ;
|
||||
},
|
||||
/**
|
||||
* 不出牌
|
||||
*/
|
||||
noCards:function(){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("nocards","nocards");
|
||||
}
|
||||
this.lasttip = null ;
|
||||
},
|
||||
clean:function(){
|
||||
for(var inx = 0 ; inx<this.pokercards.length ; inx++){
|
||||
let pc = this.pokercards[inx] ;
|
||||
this.game.pokerpool.put(pc) ;//回收回去
|
||||
}
|
||||
this.pokercards.splice(0 , this.pokercards.length ) ;
|
||||
for(var i=0 ; i<this.lastcards.length ; i++){
|
||||
this.game.minpokerpool.put(this.lastcards[i]);
|
||||
}
|
||||
|
||||
this.lastcards.splice( 0 , this.lastcards.length) ;
|
||||
|
||||
for(var i = 0 ; i < this.player.length ; i++){
|
||||
var player = this.player[i].getComponent("PlayerRender") ;
|
||||
player.clean(this.game);
|
||||
}
|
||||
this.player.splice(0 , this.player.length) ;
|
||||
|
||||
this.game.clean(this);
|
||||
this.ratio.string = "15倍" ;
|
||||
},
|
||||
onCloseClick:function(){
|
||||
this.continuegamebtn.active = true ;
|
||||
},
|
||||
restart:function(command){
|
||||
this.game.restart();
|
||||
this.statictimer("正在匹配玩家" , 5) ;
|
||||
/**
|
||||
* 系统资源回收完毕,发送一个 重新开启游戏的 通知
|
||||
*/
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("restart" , command);
|
||||
}
|
||||
},
|
||||
continuegame:function(){
|
||||
this.continuegamebtn.active = false ;
|
||||
this.restart("begin");
|
||||
},
|
||||
statictimer:function(message , time){
|
||||
this.waittimer = cc.instantiate(this.waitting);
|
||||
this.waittimer.parent = this.root();
|
||||
|
||||
let timer = this.waittimer.getComponent("BeiMiTimer");
|
||||
if(timer){
|
||||
timer.init(message , time , this.waittimer);
|
||||
}
|
||||
},
|
||||
onDestroy:function(){
|
||||
this.inited = false ;
|
||||
this.cleanmap();
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("leave","leave");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "cc4147da-7f1d-447c-8121-75f5407ac9d6",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
back:function(){
|
||||
this.loadding();
|
||||
let self = this ;
|
||||
setTimeout(function(){
|
||||
self.scene(cc.beimi.gametype , self);
|
||||
} , 500)
|
||||
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "74593989-ba8b-43d1-8fc7-ff28e575f02c",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,425 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
goldcoins: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
cards: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
poker: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
poker_min: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
myself: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
atlas: {
|
||||
default: null,
|
||||
type: cc.SpriteAtlas
|
||||
},
|
||||
catchbtn: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
timer: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
timer_num:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
lastcards:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
playbtn:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
notallow:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
operesult:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
donottake:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
cardtipmsg:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
let self = this ;
|
||||
if(this.timer){
|
||||
this.timer.active = false ;
|
||||
}
|
||||
if(this.catchbtn){
|
||||
this.catchbtn.active = false ;
|
||||
}
|
||||
if(this.playbtn){
|
||||
this.playbtn.active = false ;
|
||||
}
|
||||
if(this.notallow){
|
||||
this.notallow.active = false ;
|
||||
}
|
||||
if(this.operesult){
|
||||
this.operesult.active = false ;
|
||||
}
|
||||
if(this.cardtipmsg){
|
||||
this.cardtipmsg.active = false ;
|
||||
}
|
||||
|
||||
|
||||
this.playerspool = new cc.NodePool();
|
||||
this.myselfpool = new cc.NodePool();
|
||||
this.pokerpool = new cc.NodePool(); //背面
|
||||
this.minpokerpool = new cc.NodePool(); //背面
|
||||
|
||||
|
||||
this.selectedcards = new Array(); //存放当前玩家 选中 的牌
|
||||
|
||||
this.cardslist = new Array();
|
||||
|
||||
for(i=0 ; i<2 ; i++){
|
||||
this.playerspool.put(cc.instantiate(this.player)); // 创建节点
|
||||
}
|
||||
for(i =0 ; i<25 ; i++){
|
||||
this.pokerpool.put(cc.instantiate(this.poker)); //牌-背面
|
||||
}
|
||||
for(i =0 ; i<60 ; i++){
|
||||
this.minpokerpool.put(cc.instantiate(this.poker_min)); //牌-背面
|
||||
}
|
||||
this.myselfpool.put(cc.instantiate(this.myself));
|
||||
|
||||
if(this.ready()){
|
||||
this.pva_format(cc.beimi.user.goldcoins , cc.beimi.user.cards , cc.beimi.user.diamonds , self);
|
||||
this.pvalistener(self , function (context) {
|
||||
context.pva_format(cc.beimi.user.goldcoins , cc.beimi.user.cards , cc.beimi.user.diamonds , context) ;
|
||||
});
|
||||
}
|
||||
if(this.myselfpool.size() > 0 && cc.beimi != null){
|
||||
this.playermysql = this.myselfpool.get();
|
||||
this.playermysql.parent = this.root() ;
|
||||
this.playermysql.setPosition(-520,-180);
|
||||
var render = this.playermysql.getComponent("PlayerRender") ;
|
||||
render.initplayer(cc.beimi.user);
|
||||
}
|
||||
},
|
||||
pva_format:function(coins, cards , diamonds , object){
|
||||
if(coins > 9999){
|
||||
var num = coins / 10000 ;
|
||||
object.goldcoins.string = num.toFixed(2) + '万';
|
||||
}else{
|
||||
object.goldcoins.string = coins;
|
||||
}
|
||||
object.cards.string = cards + "张" ;
|
||||
},
|
||||
catchtimer:function(times){
|
||||
|
||||
if(this.playbtn){
|
||||
this.playbtn.active = false ;
|
||||
}
|
||||
if(this.timer){
|
||||
this.timer.active = true ;
|
||||
}
|
||||
if(this.catchbtn){
|
||||
this.catchbtn.active = true ;
|
||||
}
|
||||
if(this.operesult){
|
||||
this.operesult.active = false ;
|
||||
}
|
||||
|
||||
let self = this ;
|
||||
var gameTimer = require("GameTimer");
|
||||
this.beimitimer = new gameTimer();
|
||||
this.timesrc = this.beimitimer.runtimer(this , this.timer , this.atlas , this.timer_num , this.timer_num , times);
|
||||
},
|
||||
catchresult:function(data){
|
||||
if(this.timer){
|
||||
this.timer.active = false ;
|
||||
}
|
||||
if(this.catchbtn){
|
||||
this.catchbtn.active = false ;
|
||||
}
|
||||
if(this.playbtn){
|
||||
this.playbtn.active = false ;
|
||||
}
|
||||
if(this.timesrc){
|
||||
this.beimitimer.stoptimer(this , this.timer , this.timesrc);
|
||||
}
|
||||
this.doOperatorResult("catch" , data.docatch , false) ;
|
||||
},
|
||||
hideresult:function(){
|
||||
if(this.operesult){
|
||||
this.operesult.active = false ;
|
||||
}
|
||||
},
|
||||
lasthands:function(self, game,data){ //设置地主
|
||||
this.setDizhuFlag(data) ;
|
||||
if(this.operesult){
|
||||
this.operesult.active = false ;
|
||||
}
|
||||
},
|
||||
setDizhuFlag:function(data){
|
||||
var render = this.playermysql.getComponent("PlayerRender") ;
|
||||
render.setDizhuFlag(data);
|
||||
},
|
||||
lasttakecards:function(game , self , cardsnum ,lastcards , data){
|
||||
if(this.result){
|
||||
this.result.active = false ;
|
||||
}
|
||||
if(this.playbtn){
|
||||
this.playbtn.active = false ;
|
||||
}
|
||||
if(this.catchbtn){
|
||||
this.catchbtn.active = false;
|
||||
}
|
||||
if(this.jsq){
|
||||
this.jsq.active = false ;
|
||||
}
|
||||
if(this.lastcards){
|
||||
this.lastcards.active = true ;
|
||||
}
|
||||
if(this.timesrc){
|
||||
this.beimitimer.stoptimer(this , this.timer , this.timesrc);
|
||||
}
|
||||
for(var i=0 ; i<this.cardslist.length ; i++){
|
||||
this.pokerpool.put(this.cardslist[i]) ;//回收回去
|
||||
}
|
||||
this.cardslist.splice(0,this.cardslist.length) ;//删除数组里的所有内容
|
||||
if (data.donot == false) { //选择出牌或默认出牌
|
||||
for(var i=0 ; i<lastcards.length ; i++){
|
||||
this.playcards(self , i , lastcards[i] , lastcards) ;
|
||||
}
|
||||
this.layout(this.lastcards , function(fir , sec){
|
||||
return fir.zIndex - sec.zIndex ;
|
||||
});
|
||||
}else{
|
||||
this.doOperatorResult("lasttakecards" , true , data.sameside) ;
|
||||
}
|
||||
},
|
||||
cardtips:function(self , card , tipcards){
|
||||
var cacheCard ;
|
||||
for(var inx = 0 ; inx<self.pokercards.length ; inx++){
|
||||
let pc = self.pokercards[inx] ;
|
||||
if(pc.getComponent("BeiMiCard").card == card){
|
||||
cacheCard = pc ; break ;
|
||||
}
|
||||
}
|
||||
if(cacheCard != null){
|
||||
cacheCard.getComponent("BeiMiCard").doselect();
|
||||
}
|
||||
},
|
||||
cardtipsfornot:function(self , game){
|
||||
game.cardtipmsg.active = true ;
|
||||
setTimeout(function(){
|
||||
game.cardtipmsg.active = false ;
|
||||
} , 1000);
|
||||
game.unselected(self , game) ;
|
||||
},
|
||||
unselected:function( self , game){
|
||||
for(var inx = 0 ; inx<self.pokercards.length ; inx++){
|
||||
let pc = self.pokercards[inx] ;
|
||||
pc.getComponent("BeiMiCard").unselected();
|
||||
}
|
||||
},
|
||||
playcards:function(self , index , card , lastcards){
|
||||
var cacheCard ;
|
||||
for(var inx = 0 ; inx<self.pokercards.length ; inx++){
|
||||
let pc = self.pokercards[inx] ;
|
||||
if(pc.card == card){
|
||||
cacheCard = pc ; break ;
|
||||
}
|
||||
}
|
||||
if(cacheCard != null){
|
||||
cacheCard.getComponent("BeiMiCard").unselected();
|
||||
cacheCard.x = index * 30 - 30 ;
|
||||
cacheCard.y = 0;
|
||||
|
||||
var zIndex = this.countcard(card , lastcards) ;
|
||||
|
||||
cacheCard.zIndex = 4 - zIndex ;
|
||||
// cacheCard.zIndex = zIndex;
|
||||
|
||||
cacheCard.setScale(0.5,0.5);
|
||||
|
||||
cacheCard.parent = this.lastcards ;
|
||||
|
||||
|
||||
this.cardslist.push(cacheCard) ;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 按照张数最大的牌排序
|
||||
* @param card
|
||||
* @param lastcards
|
||||
* @returns {number}
|
||||
*/
|
||||
countcard:function(card , lastcards){
|
||||
let value = parseInt(card / 4);
|
||||
let count = 0 ;
|
||||
for(var i = 0 ;i<lastcards.length ; i++){
|
||||
let temp = parseInt(lastcards[i] / 4) ;
|
||||
if(value == temp){
|
||||
count = count + 1 ;
|
||||
}
|
||||
}
|
||||
return count ;
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param game
|
||||
* @param times
|
||||
* @param automic 不允许 不出
|
||||
*/
|
||||
playtimer:function(game , times , automic){
|
||||
if(this.timer){
|
||||
this.timer.active = true ;
|
||||
}
|
||||
if(this.playbtn){
|
||||
this.playbtn.active = true ;
|
||||
}
|
||||
if(this.catchbtn){
|
||||
this.catchbtn.active = false;
|
||||
}
|
||||
if(this.lastcards){
|
||||
this.lastcards.active = false ;
|
||||
}
|
||||
if(this.operesult){
|
||||
this.operesult.active = false ;
|
||||
}
|
||||
|
||||
if(automic == true){
|
||||
this.donottake.active = false ;
|
||||
}else{
|
||||
this.donottake.active = true ;
|
||||
}
|
||||
|
||||
for(var i=0 ; i<this.cardslist.length ; i++){
|
||||
game.pokerpool.put(this.cardslist[i]) ;//回收回去
|
||||
}
|
||||
let self = this ;
|
||||
var gameTimer = require("GameTimer");
|
||||
this.beimitimer = new gameTimer();
|
||||
this.timesrc = this.beimitimer.runtimer(this , this.timer , this.atlas , this.timer_num , this.timer_num , times);
|
||||
},
|
||||
doOperatorResult:function(oper , resvalue , sameside){
|
||||
this.operesult.active = true ;
|
||||
if(oper == "catch"){
|
||||
if(resvalue == true){
|
||||
for(var i=0 ; i<this.operesult.children.length ; i++){
|
||||
this.operesult.children[i].active = false ;
|
||||
if(this.operesult.children[i].name == "提示_抢地主"){
|
||||
this.operesult.children[i].active = true ;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
for (var i = 0; i < this.operesult.children.length; i++) {
|
||||
this.operesult.children[i].active = false;
|
||||
if (this.operesult.children[i].name == "提示_不抢") {
|
||||
this.operesult.children[i].active = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else if(oper == "lasttakecards"){
|
||||
if(sameside == true){
|
||||
for (var i = 0; i < this.operesult.children.length; i++) {
|
||||
this.operesult.children[i].active = false;
|
||||
if (this.operesult.children[i].name == "不要") {
|
||||
this.operesult.children[i].active = true;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (var i = 0; i < this.operesult.children.length; i++) {
|
||||
this.operesult.children[i].active = false;
|
||||
if (this.operesult.children[i].name == "要不起") {
|
||||
this.operesult.children[i].active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
doSelectCard:function(card){
|
||||
var existcard = this.selectedcards.find(function(pokercard){
|
||||
pokercard.card == card
|
||||
});
|
||||
if(existcard == undefined){
|
||||
this.selectedcards.push(card) ;
|
||||
}
|
||||
},
|
||||
doUnSelectCard:function(card){
|
||||
var inx = this.selectedcards.indexOf(card);
|
||||
if(inx >= 0){
|
||||
this.selectedcards.splice(inx , inx+1) ;
|
||||
}
|
||||
},
|
||||
clean:function(context){
|
||||
if(this.catchbtn){
|
||||
this.catchbtn.active = false;
|
||||
}
|
||||
if(this.lastcards){
|
||||
this.lastcards.active = false ;
|
||||
}
|
||||
if(this.operesult){
|
||||
this.operesult.active = false ;
|
||||
}
|
||||
var render = this.playermysql.getComponent("PlayerRender") ;
|
||||
render.clean(context) ;
|
||||
},
|
||||
restart:function(){
|
||||
for(var i=0 ; i<2 ; i++){
|
||||
this.playerspool.put(cc.instantiate(this.player)); // 创建节点
|
||||
}
|
||||
|
||||
/**
|
||||
* 费劲巴拉的收集起来,然后又给销毁了,浪费资源!!!
|
||||
*/
|
||||
this.pokerpool.clear();
|
||||
this.minpokerpool.clear();
|
||||
|
||||
for(var inx =0 ; inx<25 ; inx++){
|
||||
this.pokerpool.put(cc.instantiate(this.poker)); //牌-背面
|
||||
}
|
||||
for(var inx=0 ; inx<60 ; inx++){
|
||||
this.minpokerpool.put(cc.instantiate(this.poker_min)); //牌-背面
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "eb412ac9-8a52-4f16-8fde-68b568d9ecba",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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 () {
|
||||
|
||||
},
|
||||
back:function(){
|
||||
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "8ed13591-a0be-4cbf-b7cb-c8d18b1d5a6e",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
posy:cc.Integer,
|
||||
card:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.posy = this.card.y ;
|
||||
},
|
||||
takecard:function(event){
|
||||
var beiMiCard = event.target.parent.getComponent("BeiMiCard") ;
|
||||
if(beiMiCard.game != null){
|
||||
if(event.target.y == this.posy){
|
||||
event.target.y = event.target.y + 30 ;
|
||||
beiMiCard.selected = true ;
|
||||
}else{
|
||||
event.target.y = event.target.y - 30 ;
|
||||
beiMiCard.selected = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "0da62514-88a1-42cb-a523-99b5e81f9e77",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
onClick:function(event , data){
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
socket.emit("selectcolor" , data);
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "f832747c-8051-4b8b-bd90-726f48129490",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
workitem:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
myscore:{ //底牌
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
myflag:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_1:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_1_flag:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_1_name:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player_1_score:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player_2:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_2_flag:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_2_name:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player_2_score:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
let self = this ;
|
||||
/**
|
||||
* SummaryClick发射的事件,方便统一处理 / 开始
|
||||
*/
|
||||
this.workitem.on("begin",function(event){
|
||||
if(self.context !=null){
|
||||
self.context.summarypage.destroy();
|
||||
/**
|
||||
* 恢复桌面
|
||||
*/
|
||||
self.context.restart("begin");
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
/**
|
||||
* SummaryClick发射的事件,方便统一处理 / 明牌开始
|
||||
*/
|
||||
this.workitem.on("opendeal",function(event){
|
||||
if(self.context !=null){
|
||||
self.context.summarypage.destroy();
|
||||
/**
|
||||
* 恢复桌面,然后发送消息给服务端
|
||||
*/
|
||||
self.context.restart("opendeal");
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
/**
|
||||
* SummaryClick发射的事件,方便统一处理 / 开始
|
||||
*/
|
||||
this.workitem.on("close",function(event){
|
||||
if(self.context !=null){
|
||||
/**
|
||||
* 显示操作按钮
|
||||
*/
|
||||
self.context.onCloseClick();
|
||||
self.context.summarypage.destroy();
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
create:function(context , data){
|
||||
this.context = context ;
|
||||
var index = 0 ;
|
||||
for(var inx = 0 ; inx < data.players.length ; inx++){
|
||||
var player = data.players[inx] ;
|
||||
if(player.userid == cc.beimi.user.id){//
|
||||
this.process(player , null , this.myscore, this.myflag) ;
|
||||
}else{
|
||||
if(index == 0){
|
||||
this.process(player ,this.player_1_name , this.player_1_score , this.player_1_flag ) ;
|
||||
}else if(index == 1){
|
||||
this.process(player ,this.player_2_name , this.player_2_score , this.player_2_flag ) ;
|
||||
}
|
||||
index = index + 1 ;
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 显示已经处理完毕的结算信息
|
||||
* @param player
|
||||
* @param username
|
||||
* @param score
|
||||
* @param flag
|
||||
*/
|
||||
process:function(player , username , score , flag){
|
||||
if(username != null){
|
||||
username.string = player.username ;
|
||||
}
|
||||
if(player.win == true){
|
||||
score.string = player.score ;
|
||||
}else{
|
||||
score.string = "-"+player.score ;
|
||||
}
|
||||
|
||||
if(player.dizhu == true){
|
||||
flag.active = true ;
|
||||
}else{
|
||||
flag.active = false ;
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "4b94def9-b352-4c94-b838-5289019afb54",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
client/version/chess/assets/module/game/majiang.meta
Normal file
6
client/version/chess/assets/module/game/majiang.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "dd3c3b0b-d7f6-4961-a58e-cb5402f47ca1",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "89689a34-44cb-4c01-a5cf-4c665008db18",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
9701
client/version/chess/assets/module/game/majiang/scene/majiang.fire
Normal file
9701
client/version/chess/assets/module/game/majiang/scene/majiang.fire
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "238fd6b5-635c-40db-b741-b5a9a176d6ed",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "41c59ebf-5a65-401c-b22a-d0c52b3fdefe",
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
onBackClick:function(){
|
||||
this.scene(cc.beimi.gametype , this);
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "ce2c10a4-5961-41b0-ae26-770defe7f9f6",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
username:{
|
||||
default:null ,
|
||||
type:cc.Label
|
||||
},
|
||||
goldcoins:{
|
||||
default:null ,
|
||||
type:cc.Label
|
||||
},
|
||||
selected:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
},
|
||||
creator:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
},
|
||||
selectcards:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
},
|
||||
selectcolor:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.selected.active = false ;
|
||||
this.creator.active = false ;
|
||||
},
|
||||
init:function(playerdata , inx , tablepos){
|
||||
this.data = playerdata ; //存放玩家数据
|
||||
this.tablepos = tablepos ;
|
||||
if(inx == 0){
|
||||
this.selectcards.parent.x = this.selectcards.parent.x * -1 ;
|
||||
}else if(inx == 1){
|
||||
this.selectcards.parent.x = this.selectcards.parent.x * -1 ;
|
||||
}
|
||||
|
||||
this.username.string = playerdata.username ;
|
||||
this.goldcoins.string = playerdata.goldcoins ;
|
||||
},
|
||||
banker:function(){
|
||||
this.creator.active = true ;
|
||||
},
|
||||
selecting:function(){
|
||||
if(this.data.id != cc.beimi.user.id){
|
||||
this.selectcards.active = true ;
|
||||
let ani = this.selectcolor.getComponent(cc.Animation);
|
||||
this.animState = ani.play("majiang_select") ;
|
||||
// 设置循环模式为 Loop
|
||||
this.animState.wrapMode = cc.WrapMode.Loop;
|
||||
this.animState.repeatCount = 20; //最大不超过 20次
|
||||
}
|
||||
},
|
||||
selectresult:function(data){
|
||||
for(var i = 0 ; i < this.selected.children.length ; i++){
|
||||
this.selected.children[i].active = false ;
|
||||
if(this.selected.children[i].name == data.color){
|
||||
this.selected.children[i].active = true;
|
||||
}
|
||||
}
|
||||
this.selected.active = true ;
|
||||
if(this.data.id != cc.beimi.user.id) {
|
||||
if (this.animState != null) {
|
||||
this.animState.stop("majiang_select");
|
||||
}
|
||||
}
|
||||
},
|
||||
clean:function(){
|
||||
this.creator.active = false ;
|
||||
for(var i = 0 ; i < this.selected.children.length ; i++){
|
||||
this.selected.children[i].active = false ;
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "e9538de1-8e41-48d0-b853-8b1a9e319439",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
workitem:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
myscore:{ //底牌
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
myflag:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_1:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_1_flag:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_1_name:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player_1_score:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player_2:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_2_flag:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
player_2_name:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
player_2_score:{
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
let self = this ;
|
||||
/**
|
||||
* SummaryClick发射的事件,方便统一处理 / 开始
|
||||
*/
|
||||
this.workitem.on("begin",function(event){
|
||||
if(self.context !=null){
|
||||
self.context.summarypage.destroy();
|
||||
self.context.restart();
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
/**
|
||||
* SummaryClick发射的事件,方便统一处理 / 开始
|
||||
*/
|
||||
this.workitem.on("close",function(event){
|
||||
if(self.context !=null){
|
||||
self.context.summarypage.destroy();
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
create:function(context , data){
|
||||
this.context = context ;
|
||||
var index = 0 ;
|
||||
for(var inx = 0 ; inx < data.players.length ; inx++){
|
||||
var player = data.players[inx] ;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "1d5bec6d-3bec-40aa-908c-394a3126041b",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "d95a894a-b49a-493f-8d8f-0e9fa8608253",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
onClick:function(event){
|
||||
let majiang = this.target.getComponent("MajiangDataBind");
|
||||
majiang.startgame();
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "752c7ebd-e862-44d5-b9cb-001d99008106",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "130c6394-44b5-468d-b252-c3705e9c7d3f",
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -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": {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "5b755497-d1a4-4bcf-b747-240914de35ed",
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
onClick:function(event , data){
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom(data, true) );
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "6cec8d44-eb1a-4985-af64-2c6b218dd93c",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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 () {
|
||||
|
||||
},
|
||||
|
||||
onAnimCompleted: function () {
|
||||
this.node.destroy();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "ed85c3ba-c050-4ed6-86b8-56b0df8b783b",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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 () {
|
||||
|
||||
},
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "43eb63d3-e657-4268-a25a-7899fbcd5c78",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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 () {
|
||||
|
||||
},
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "f88a1787-87db-42b2-a7cf-6398157fefc0",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "0e135109-2877-44c9-a867-efc40957cb86",
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
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
|
||||
},
|
||||
card_one:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
card_two:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
card_three:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
card_four:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
card_last:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
target:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
init:function(cvalue , gang){
|
||||
this.value = cvalue ;
|
||||
|
||||
let cardcolors = parseInt(this.value/4 ) ;
|
||||
let cardtype = parseInt(cardcolors / 9);
|
||||
|
||||
this.mjtype = cardtype ;
|
||||
this.mjvalue = parseInt((this.value%36)/4 ) ;
|
||||
|
||||
let deskcard , cardframe ;
|
||||
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.card_one.getComponent(cc.Sprite).spriteFrame = cardframe;
|
||||
if(this.card_two){
|
||||
this.card_two.getComponent(cc.Sprite).spriteFrame = cardframe;
|
||||
}
|
||||
if(this.card_three){
|
||||
this.card_three.getComponent(cc.Sprite).spriteFrame = cardframe;
|
||||
}
|
||||
if(this.card_four){
|
||||
this.card_four.getComponent(cc.Sprite).spriteFrame = cardframe;
|
||||
}
|
||||
if(this.card_last){
|
||||
if(gang == false){
|
||||
this.card_last.active = false ;
|
||||
}else{
|
||||
this.card_last.active = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "0fe6725e-70ca-4bcf-9186-0ab46da72d03",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "107048a1-3452-468b-9766-4f89f70650e0",
|
||||
"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 event
|
||||
*/
|
||||
onBGClick:function(event){
|
||||
event.stopPropagation();
|
||||
},
|
||||
/**
|
||||
* 结算页面上的关闭按钮 的 点击事件 , 关闭按钮 和 继续按钮 功能是一样的,都是继续游戏
|
||||
*/
|
||||
onCloseClick:function(){
|
||||
/**
|
||||
* 发射事件到 上一级 处理
|
||||
*/
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom("close", true) );
|
||||
},
|
||||
/**
|
||||
* 结算页面上的关闭按钮 的 点击事件 , 关闭按钮 和 继续按钮 功能是一样的,都是继续游戏
|
||||
*/
|
||||
onBeginClick:function(){
|
||||
/**
|
||||
* 发射事件到 上一级 处理
|
||||
*/
|
||||
this.node.dispatchEvent( new cc.Event.EventCustom("begin", true) );
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "72e3d27d-f87c-4edf-abfc-e7e046ffae1a",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
client/version/chess/assets/module/hall.meta
Normal file
6
client/version/chess/assets/module/hall.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "750485fe-d1cd-46dd-9c48-bffc2e84ee33",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
client/version/chess/assets/module/hall/scene.meta
Normal file
6
client/version/chess/assets/module/hall/scene.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "e7de6cb0-26e2-4e83-a646-9a30897845f0",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
2475
client/version/chess/assets/module/hall/scene/hall.fire
Normal file
2475
client/version/chess/assets/module/hall/scene/hall.fire
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "301d325d-3d3f-4714-9cb1-44c47c3f7c00",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
2382
client/version/chess/assets/module/hall/scene/room.fire
Normal file
2382
client/version/chess/assets/module/hall/scene/room.fire
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.0",
|
||||
"uuid": "ec23e860-35c3-4c9c-b8d7-023f87ba29d2",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
6
client/version/chess/assets/module/hall/script.meta
Normal file
6
client/version/chess/assets/module/hall/script.meta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "676bd6a2-075f-404a-aede-df1114f4190c",
|
||||
"isGroup": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
username: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
goldcoins: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
cards: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
}
|
||||
,
|
||||
girl:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
let self = this ;
|
||||
if(this.ready()){
|
||||
this.username.string = cc.beimi.user.username ;
|
||||
this.pva_format(cc.beimi.user.goldcoins , cc.beimi.user.cards , cc.beimi.user.diamonds , self);
|
||||
this.pvalistener(self , function (context) {
|
||||
context.pva_format(cc.beimi.user.goldcoins , cc.beimi.user.cards , cc.beimi.user.diamonds , context) ;
|
||||
});
|
||||
}
|
||||
},
|
||||
pva_format:function(coins, cards , diamonds , object){
|
||||
if(coins > 9999){
|
||||
var num = coins / 10000 ;
|
||||
object.goldcoins.string = num.toFixed(2) + '万';
|
||||
}else{
|
||||
object.goldcoins.string = coins;
|
||||
}
|
||||
object.cards.string = cards + "张" ;
|
||||
},
|
||||
playToLeft:function(){
|
||||
this._girlAnimCtrl = this.girl.getComponent(cc.Animation);
|
||||
this._girlAnimCtrl.play("girl_to_left");
|
||||
},
|
||||
playToRight:function(){
|
||||
this._girlAnimCtrl = this.girl.getComponent(cc.Animation);
|
||||
this._girlAnimCtrl.play("girl_to_right");
|
||||
},
|
||||
onDestroy:function(){
|
||||
this.cleanpvalistener() ;
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "4b325584-d64a-484e-8535-def8ddc027dd",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
44
client/version/chess/assets/module/hall/script/GameRoom.js
Normal file
44
client/version/chess/assets/module/hall/script/GameRoom.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
roomidDialog: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
onClick:function(event, data){
|
||||
this.loadding();
|
||||
let object = this ;
|
||||
setTimeout(function(){
|
||||
object.scene(data , object) ;
|
||||
} , 200);
|
||||
},
|
||||
onClickJoinRoom:function(){
|
||||
if(this.roomidDialog){
|
||||
cc.beimi.openwin = cc.instantiate(this.roomidDialog) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
}
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "e9bfbd50-2624-401c-964c-67528f0e9a87",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
37
client/version/chess/assets/module/hall/script/PlayGame.js
Normal file
37
client/version/chess/assets/module/hall/script/PlayGame.js
Normal file
@@ -0,0 +1,37 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
/**
|
||||
* 适配屏幕尺寸
|
||||
*/
|
||||
this.resize();
|
||||
},
|
||||
onClickDizhu:function(){
|
||||
this.loadding();
|
||||
let object = this ;
|
||||
setTimeout(function(){
|
||||
object.scene("dizhu" , object) ;
|
||||
} , 200);
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "6643c6e4-fba3-47e1-a574-b858b3d0a3e1",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
80
client/version/chess/assets/module/hall/script/Playway.js
Normal file
80
client/version/chess/assets/module/hall/script/Playway.js
Normal file
@@ -0,0 +1,80 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
tag: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
score: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
onlineusers: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
scorelimit: {
|
||||
default: null,
|
||||
type: cc.Label
|
||||
},
|
||||
atlas: {
|
||||
default: null,
|
||||
type: cc.SpriteAtlas
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
init:function(playway){
|
||||
/**
|
||||
* 需要预先请求 在线人数
|
||||
*/
|
||||
if(playway){
|
||||
var frameName = "初级";
|
||||
if(playway.level == '2'){
|
||||
frameName = "高级"
|
||||
}
|
||||
this.data = playway ;
|
||||
|
||||
if(playway.shuffle == false){
|
||||
this.tag.active = false ;
|
||||
}else{
|
||||
this.tag.active = true;
|
||||
}
|
||||
|
||||
frameName = frameName + playway.skin ;
|
||||
|
||||
this.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame(frameName);
|
||||
|
||||
this.onlineusers.string = playway.onlineusers + " 人 " ;
|
||||
var min = parseInt(playway.mincoins/1000)+"千" ;
|
||||
if(playway.mincoins >= 10000){
|
||||
min = parseInt(playway.mincoins / 10000)+"万" ;
|
||||
}
|
||||
var max = parseInt(playway.maxcoins/1000)+"千" ;
|
||||
if(playway.maxcoins >= 10000){
|
||||
max = parseInt(playway.maxcoins / 10000)+"万" ;
|
||||
}
|
||||
this.scorelimit.string = min + "-" + max ;
|
||||
|
||||
this.score.string = playway.score ;
|
||||
}
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "bc63746d-dd76-4d1e-ad25-aa0f02e65611",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ..
|
||||
playway:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
onClick:function(){
|
||||
let self = this ;
|
||||
|
||||
var selectPlayway = this.getCommon("SelectPlayway");
|
||||
|
||||
let thisplayway = this.playway.getComponent("Playway");
|
||||
|
||||
let extparams = {
|
||||
gametype : thisplayway.data.code ,
|
||||
playway : thisplayway.data.id
|
||||
} ;
|
||||
this.closeOpenWin();
|
||||
this.preload(extparams , self);
|
||||
},
|
||||
createRoom:function(event,data){
|
||||
let self = this ;
|
||||
this.loadding();
|
||||
setTimeout(function(){
|
||||
self.scene(data, self) ;
|
||||
},200);
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "917d5098-f678-4083-873a-929d209e2b27",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
51
client/version/chess/assets/module/hall/script/Room.js
Normal file
51
client/version/chess/assets/module/hall/script/Room.js
Normal file
@@ -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
|
||||
// },
|
||||
// ...
|
||||
playway: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.playwaypool = new cc.NodePool();
|
||||
for(var i=0 ; i<5 ; i++){ //最大玩法数量不能超过20种
|
||||
this.playwaypool.put(cc.instantiate(this.playway));
|
||||
}
|
||||
this.playwayarray = new Array();
|
||||
},
|
||||
init:function(){
|
||||
/**
|
||||
* 加载预制的 玩法
|
||||
*/
|
||||
var gametype = cc.beimi.game.type(data);
|
||||
if(gametype!=null){
|
||||
for(var inx =0 ; inx < gametype.playways.length ; inx++){
|
||||
/**
|
||||
* 此处需要做判断,检查 对象池有足够的对象可以使用
|
||||
*/
|
||||
var playway = this.playwaypool.get();
|
||||
var script = playway.getComponent("Playway") ;
|
||||
script.init(gametype.playways[inx]);
|
||||
playway.parent = this.content ;
|
||||
this.playwayarray.push(playway) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "ad97901d-2e7f-4277-a161-c18d05e512b3",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
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
|
||||
},
|
||||
gametype:{
|
||||
default:null ,
|
||||
type : cc.Node
|
||||
},
|
||||
roomoption:{
|
||||
default:null ,
|
||||
type : cc.Prefab
|
||||
}
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
init:function(playway){
|
||||
/**
|
||||
* 需要预先请求 在线人数
|
||||
*/
|
||||
if(playway){
|
||||
this.data = playway ;
|
||||
}
|
||||
if(playway.code == "dizhu"){
|
||||
this.gametype.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame("斗地主");
|
||||
}else if(playway.code == "majiang"){
|
||||
this.gametype.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame("广东麻将");
|
||||
}else if(playway.code == "poker"){
|
||||
this.gametype.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame("德州扑克");
|
||||
}
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "3086de3f-aa9e-45b3-8947-676d9c2baf07",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
160
client/version/chess/assets/module/hall/script/SelectPlayway.js
Normal file
160
client/version/chess/assets/module/hall/script/SelectPlayway.js
Normal file
@@ -0,0 +1,160 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
first: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
second: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
gamepoint:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
title:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
global: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
playway: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
content: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
if(cc.beimi != null && cc.beimi.user != null){
|
||||
this.disMenu("first") ;
|
||||
this.playwaypool = new cc.NodePool();
|
||||
for(var i=0 ; i<20 ; i++){ //最大玩法数量不能超过20种
|
||||
this.playwaypool.put(cc.instantiate(this.playway));
|
||||
}
|
||||
this.playwayarray = new Array();
|
||||
if(this.gamepoint && cc.beimi!=null && cc.beimi.games !=null){
|
||||
for(var inx=0 ; inx < this.gamepoint.children.length ; inx++){
|
||||
let name = this.gamepoint.children[inx].name ;
|
||||
var gameenable = false ;
|
||||
for(var i=0 ; i<cc.beimi.games.length ; i++){
|
||||
var gamemodel = cc.beimi.games[i] ;
|
||||
for(var j=0 ; j<gamemodel.types.length ; j++){
|
||||
let gametype = gamemodel.types[j] ;
|
||||
if(gametype.code == name){
|
||||
gameenable = true ; break ;
|
||||
}
|
||||
}
|
||||
if(gameenable == true){break ;}
|
||||
}
|
||||
if(gameenable == true){
|
||||
this.gamepoint.children[inx].active = true ;
|
||||
}else{
|
||||
this.gamepoint.children[inx].active = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onClick:function(event, data){
|
||||
this.disMenu("second") ;
|
||||
var girlAni = this.global.getComponent("DefaultHallDataBind");
|
||||
girlAni.playToLeft();
|
||||
this._secondAnimCtrl = this.second.getComponent(cc.Animation);
|
||||
this._secondAnimCtrl.play("playway_display");
|
||||
|
||||
if(this.title){
|
||||
for(var inx = 0 ; inx<this.title.children.length ; inx++){
|
||||
if(this.title.children[inx].name == data){
|
||||
this.title.children[inx].active = true ;
|
||||
}else{
|
||||
this.title.children[inx].active = false ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 加载预制的 玩法
|
||||
*/
|
||||
var gametype = cc.beimi.game.type(data);
|
||||
if(gametype!=null){
|
||||
for(var inx =0 ; inx < gametype.playways.length ; inx++){
|
||||
/**
|
||||
* 此处需要做判断,检查 对象池有足够的对象可以使用
|
||||
*/
|
||||
var playway = this.playwaypool.get();
|
||||
var script = playway.getComponent("Playway") ;
|
||||
if(script == null){
|
||||
script = playway.getComponent("RoomPlayway") ;
|
||||
}
|
||||
script.init(gametype.playways[inx]);
|
||||
playway.parent = this.content ;
|
||||
this.playwayarray.push(playway) ;
|
||||
}
|
||||
}
|
||||
},
|
||||
onRoomClick:function(){
|
||||
this.disMenu("third") ;
|
||||
this._menuDisplay = this.third.getComponent(cc.Animation);
|
||||
this._menuDisplay.play("play_room_display");
|
||||
},
|
||||
onSecondBack:function(event ,data){
|
||||
var girlAni = this.global.getComponent("DefaultHallDataBind");
|
||||
girlAni.playToRight();
|
||||
this.collect();
|
||||
this.disMenu("first") ;
|
||||
},
|
||||
onThirddBack:function(event ,data){
|
||||
this.disMenu("first") ;
|
||||
},
|
||||
collect:function(){
|
||||
for(var inx =0 ; inx < this.playwayarray.length ; inx++){
|
||||
this.playwaypool.put(this.playwayarray[inx]);
|
||||
}
|
||||
this.playwayarray.splice(0 ,this.playwayarray.length );
|
||||
},
|
||||
disMenu:function(order){
|
||||
if(order == 'first'){
|
||||
this.first.active = true ;
|
||||
this.second.active = false ;
|
||||
if(this.third != null){
|
||||
this.third.active = false ;
|
||||
}
|
||||
}else if(order == 'second'){
|
||||
this.first.active = false;
|
||||
this.second.active = true;
|
||||
if(this.third != null){
|
||||
this.third.active = false ;
|
||||
}
|
||||
}else if(order == 'third'){
|
||||
this.first.active = false;
|
||||
this.second.active = false;
|
||||
if(this.third != null){
|
||||
this.third.active = true ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "b0664a0c-9c79-4e2b-9a24-798594619fc1",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
5
client/version/chess/assets/module/hall/script/menu.meta
Normal file
5
client/version/chess/assets/module/hall/script/menu.meta
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "5eb96024-b535-4368-a952-3c9f9e9d503d",
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
onClick:function(event){
|
||||
event.stopPropagation();
|
||||
},
|
||||
onCloseClick:function(){
|
||||
this.closeOpenWin();
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "a07b35cb-8b05-4193-9445-cc799de741b1",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Learn cc.Class:
|
||||
// - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
|
||||
// Learn Attribute:
|
||||
// - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
|
||||
// Learn life-cycle callbacks:
|
||||
// - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
|
||||
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
// foo: {
|
||||
// // ATTRIBUTES:
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// // to a node for the first time
|
||||
// type: cc.SpriteFrame, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// },
|
||||
// bar: {
|
||||
// get () {
|
||||
// return this._bar;
|
||||
// },
|
||||
// set (value) {
|
||||
// this._bar = value;
|
||||
// }
|
||||
// },
|
||||
title_feedback: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
title_reply: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
onLoad : function() {
|
||||
this.title_feedback.active = true ;
|
||||
|
||||
this.title_reply.active = false ;
|
||||
/**
|
||||
* 从远程加载数据,如果加载数据失败,则显示提示消息,并注册拖动刷新事件
|
||||
*/
|
||||
},
|
||||
onFeedBack:function(){
|
||||
this.title_feedback.active = true ;
|
||||
|
||||
this.title_reply.active = false ;
|
||||
},
|
||||
onReply:function(){
|
||||
this.title_feedback.active = false ;
|
||||
|
||||
this.title_reply.active = true ;
|
||||
}
|
||||
|
||||
|
||||
// update (dt) {},
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "789dc0da-871b-45a1-a1da-000c92f392b7",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
properties: {
|
||||
// foo: {
|
||||
// // ATTRIBUTES:
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// // to a node for the first time
|
||||
// type: cc.SpriteFrame, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// },
|
||||
// bar: {
|
||||
// get () {
|
||||
// return this._bar;
|
||||
// },
|
||||
// set (value) {
|
||||
// this._bar = value;
|
||||
// }
|
||||
// },
|
||||
numdata: {
|
||||
default:null,
|
||||
type:cc.Node
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
onLoad : function () {
|
||||
this.roomid = new Array() ;
|
||||
},
|
||||
onClick:function(event,data){
|
||||
if(this.roomid.length < 6){
|
||||
this.roomid.push(data);
|
||||
this.disRoomId();
|
||||
}
|
||||
if(this.roomid.length == 6){
|
||||
this.closeOpenWin();
|
||||
/**
|
||||
* 查询服务端的房间号码 , 然后通过房间号码找到对应的房间游戏类型,玩法等信息
|
||||
*/
|
||||
if(this.ready()){
|
||||
let socket = this.socket();
|
||||
/**
|
||||
* 发送 room请求
|
||||
*/
|
||||
var param = {
|
||||
token:cc.beimi.authorization,
|
||||
roomid:this.roomid.join(""),
|
||||
orgi:cc.beimi.user.orgi,
|
||||
userid:cc.beimi.user.id
|
||||
} ;
|
||||
socket.emit("searchroom" , JSON.stringify(param));
|
||||
this.registercallback(this.roomCallBack);
|
||||
}
|
||||
this.loadding();
|
||||
}
|
||||
},
|
||||
roomCallBack:function(result , self){
|
||||
var data = self.parse(result) ;
|
||||
if(data.result == "ok"){
|
||||
var extparams = {
|
||||
gametype : data.code ,
|
||||
playway : data.id ,
|
||||
gamemodel : "room"
|
||||
} ;
|
||||
/**
|
||||
* 发送创建房间开始游戏的请求
|
||||
*/
|
||||
self.preload(extparams , self) ;
|
||||
}else if(data.result == "notexist"){
|
||||
self.alert("房间号不存在。");
|
||||
}else if(data.result == "full"){
|
||||
self.alert("房间已满员。");
|
||||
}
|
||||
},
|
||||
onDeleteClick:function(){
|
||||
this.roomid.splice(this.roomid.length-1 , this.roomid.length) ;
|
||||
this.disRoomId();
|
||||
},
|
||||
onCleanClick:function(){
|
||||
this.roomid.splice(0 , this.roomid.length) ;
|
||||
this.disRoomId();
|
||||
},
|
||||
disRoomId:function(){
|
||||
let children = this.numdata.children ;
|
||||
for(var inx = 0 ; inx < 6 ; inx ++){
|
||||
if(inx < this.roomid.length){
|
||||
children[inx].children[0].getComponent(cc.Label).string = this.roomid[inx] ;
|
||||
}else{
|
||||
children[inx].children[0].getComponent(cc.Label).string = "" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
// update (dt) {},
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "dca01e44-3a44-43f1-be61-92135c017914",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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 () {
|
||||
|
||||
},
|
||||
onClick:function(){
|
||||
this.logout();
|
||||
this.scene("login", this) ;
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "c02c1c2a-7b42-45ae-b4a9-872d007a4eb6",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
var beiMiCommon = require("BeiMiCommon");
|
||||
cc.Class({
|
||||
extends: beiMiCommon,
|
||||
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
setting: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
message: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
share: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
playway: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
},
|
||||
feedback: {
|
||||
default: null,
|
||||
type: cc.Prefab
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
|
||||
},
|
||||
onSettingClick:function(){
|
||||
cc.beimi.openwin = cc.instantiate(this.setting) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
},
|
||||
onMessageClick:function(){
|
||||
cc.beimi.openwin = cc.instantiate(this.message) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
},
|
||||
onShareClick:function(){
|
||||
cc.beimi.openwin = cc.instantiate(this.share) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
},
|
||||
onPlaywayClick:function(){
|
||||
cc.beimi.openwin = cc.instantiate(this.playway) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
},
|
||||
onRecordClick:function(){
|
||||
cc.beimi.openwin = cc.instantiate(this.playway) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
},
|
||||
onFeedBackClick:function(){
|
||||
cc.beimi.openwin = cc.instantiate(this.feedback) ;
|
||||
cc.beimi.openwin.parent = this.root();
|
||||
}
|
||||
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "4ee594c6-0775-4564-b42e-ba36af982c46",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Learn cc.Class:
|
||||
// - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
|
||||
// Learn Attribute:
|
||||
// - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
|
||||
// Learn life-cycle callbacks:
|
||||
// - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
|
||||
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
// foo: {
|
||||
// // ATTRIBUTES:
|
||||
// default: null, // The default value will be used only when the component attaching
|
||||
// // to a node for the first time
|
||||
// type: cc.SpriteFrame, // optional, default is typeof default
|
||||
// serializable: true, // optional, default is true
|
||||
// },
|
||||
// bar: {
|
||||
// get () {
|
||||
// return this._bar;
|
||||
// },
|
||||
// set (value) {
|
||||
// this._bar = value;
|
||||
// }
|
||||
// },
|
||||
title_message: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
title_contact: {
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
onLoad : function() {
|
||||
this.title_contact.active = false ;
|
||||
|
||||
this.title_message.active = true ;
|
||||
/**
|
||||
* 从远程加载数据,如果加载数据失败,则显示提示消息,并注册拖动刷新事件
|
||||
*/
|
||||
},
|
||||
onContacts:function(){
|
||||
this.title_contact.active = true ;
|
||||
|
||||
this.title_message.active = false ;
|
||||
},
|
||||
onMessage:function(){
|
||||
this.title_contact.active = false ;
|
||||
|
||||
this.title_message.active = true ;
|
||||
}
|
||||
|
||||
|
||||
// update (dt) {},
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "c56ed1cf-991a-4449-92b7-f1d85133c0f1",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
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
|
||||
// },
|
||||
// ...
|
||||
music:{
|
||||
default: null,
|
||||
type: cc.Sprite
|
||||
},
|
||||
musicSlider:{
|
||||
default: null,
|
||||
type: cc.Slider
|
||||
},
|
||||
sound:{
|
||||
default: null,
|
||||
type: cc.Sprite
|
||||
},
|
||||
soundSlider:{
|
||||
default: null,
|
||||
type: cc.Slider
|
||||
},
|
||||
musicon:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
musicoff:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
soundon:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
soundoff:{
|
||||
default: null,
|
||||
type: cc.Node
|
||||
},
|
||||
},
|
||||
|
||||
// use this for initialization
|
||||
onLoad: function () {
|
||||
this.musicSlider.progress = cc.beimi.audio.bgVolume;
|
||||
this.music.fillRange = cc.beimi.audio.bgVolume ;
|
||||
|
||||
if(cc.beimi.audio.getState() == cc.audioEngine.AudioState.PLAYING){
|
||||
this.musicon.active = true ;
|
||||
this.musicoff.active = false;
|
||||
}else{
|
||||
this.musicon.active = false ;
|
||||
this.musicoff.active = true
|
||||
}
|
||||
|
||||
},
|
||||
onMusicSlide:function(slider){
|
||||
this.music.fillRange = slider.progress ;
|
||||
cc.beimi.audio.setBGMVolume(slider.progress) ;
|
||||
this.musicon.active = true ;
|
||||
this.musicoff.active = false;
|
||||
},
|
||||
onSoundSlide:function(slider){
|
||||
this.sound.fillRange = slider.progress ;
|
||||
},
|
||||
onMusiceBtnClick:function(){
|
||||
if(cc.beimi.audio.getState() == cc.audioEngine.AudioState.PLAYING){
|
||||
this.musicon.active = false ;
|
||||
this.musicoff.active = true;
|
||||
cc.beimi.audio.pauseAll();
|
||||
}else{
|
||||
this.musicon.active = true ;
|
||||
this.musicoff.active = false;
|
||||
cc.beimi.audio.resumeAll();
|
||||
}
|
||||
}
|
||||
// called every frame, uncomment this function to activate update callback
|
||||
// update: function (dt) {
|
||||
|
||||
// },
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user