Phaser CE resizeWorld() undefined symbol

/ datonghuolongsharedclient
项目语言:JAVASCRIPT
权限:read-only(如需更高权限请先加入项目)
datonghuolongsharedclient/
Index: JSHelp.js
===================================================================
Index: CenterInfoUI.js
===================================================================
--- CenterInfoUI.js (revision 0)
+++ CenterInfoUI.js (revision 2)
@@ -0,0 +1,45 @@
+ * Created by 李腾飞 on .
+//居中信息提示UI
+function CenterInfoUI(game)
Phaser.Group.call(this,game);
this.game =
this.visible =
var width = game.world.
var height = game.world.
//黑色背景
var bitData = game.add.bitmapData(width,height,'CenterInfoBackGround',true);
bitData.fill(0,0,0,0.8);
this.backGround = game.add.sprite(0,0,game.cache.getBitmapData('CenterInfoBackGround'));
this.add(this.backGround);
//提示信息
this.loadingText = this.game.add.text(width/2.0,height/2.0,&注册成功&,{font: &36px Arial&,fill: &#FFFFFF&,fontWeight:'bold'});
this.loadingText.anchor.setTo(0.5,0);
this.loadingText.alpha = 1;
this.backGround.addChild(this.loadingText);
+CenterInfoUI.prototype = Object.create(Phaser.Group.prototype);
+CenterInfoUI.prototype.constructor = CenterInfoUI;
+CenterInfoUI.prototype.showTips = function(text,hideTime,finish)
this.loadingText.text =
this.visible =
this.backGround.alpha = 1;
//添加隐藏动画
var tween = this.game.add.tween(this.backGround);
tween.to({alpha:1},hideTime,Phaser.Easing.Default,true,0,0,false);
tween.onComplete.add(function()
this.visible =
if(finish == 'undefined')
Index: InputCheck.js
===================================================================
--- InputCheck.js (revision 0)
+++ InputCheck.js (revision 2)
@@ -0,0 +1,33 @@
+ * Created by 李腾飞 on .
+ * 输入检测
+String.prototype.trim=function()
return this.replace(/(^\s*)|(\s*$)/g, &&);
+String.prototype.ltrim=function()
return this.replace(/(^\s*)/g,&&);
+String.prototype.rtrim=function()
return this.replace(/(\s*$)/g,&&);
+function InputCheck()
+//判断是否超过了长度
+InputCheck.isOutLength = function(length,str)
var trimStr = str.trim();
if(trimStr.length == 0)
if(str.indexOf(& &) &=0)
if(str.length &length)
\ No newline at end of file
Index: HeadSelectUI.js
===================================================================
--- HeadSelectUI.js (revision 0)
+++ HeadSelectUI.js (revision 2)
@@ -0,0 +1,38 @@
+ * Created by 李腾飞 on .
+function HeadSelectUI(game,x,y,mainKey,headKey,selectKey)
Phaser.Sprite.call(this,game,0,0,mainKey,headKey);
this.headID = headK
var head = this.head =
var headSelect = this.headSelect = game.add.sprite(0,0,mainKey,selectKey);
this.addChild(headSelect);
this.unSelect();
game.add.existing(this);
+HeadSelectUI.prototype = Object.create(Phaser.Sprite.prototype);
+HeadSelectUI.prototype.constructor = HeadSelectUI;
+HeadSelectUI.prototype.select = function()
this.head.visible =
this.headSelect.visible =
+HeadSelectUI.prototype.unSelect = function()
this.head.visible =
this.headSelect.visible =
Index: MobileThing.js
===================================================================
--- MobileThing.js (revision 0)
+++ MobileThing.js (revision 2)
@@ -0,0 +1,96 @@
+ * Created by Administrator on .
+ * 跨平台时候,如果是手机端的特殊部分,比如手机的自动登录,获取上次登录信息等
+function MobileThing()
+MobileThing._isLoginSucess = &0&;
+MobileThing._userName = &&;
+MobileThing._passWord = &&;
+//得到上次是否手动登录成功
+MobileThing.isLastTimeLoginSuccess = function(callBack)
var storage = window.localS
MobileThing._isLoginSucess = storage.getItem(&login&);
alert(MobileThing._isLoginSucess);
if(typeof (MobileThing._isLoginSucess)==&undefined&)MobileThing._isLoginSucess = &0&;
return MobileThing._isLoginS
var prefs = plugins.appP
MobileThing._isLoginSucess = prefs.fetch (function(value)
if(typeof(value) == &undefined&)
if(value == &1&)
prefs.fetch(function(value)
MobileThing._userName =
prefs.fetch(function(value)
MobileThing._passWord =
callBack();
},null,&PassWord&);
},null,&UserName&);
callBack();
}, MobileThing.error, &login&);
if(typeof (MobileThing._isLoginSucess)==&undefined&)MobileThing._isLoginSucess = &0&;
+//设置上次是否登录成功
+MobileThing.setLastLoginSuccess = function(suc)
var storage = window.localS
storage.setItem(&login&,suc);
MobileThing._isLoginSucess =
var prefs = plugins.appP
prefs.store(MobileThing.saveOk, MobileThing.error,&login&, suc);
MobileThing._isLoginSucess =
+//获得上次登录成功的用户名密码
+MobileThing.getLoginInfo = function()
MobileThing.getLoginInfoFromLocal();
return {un:MobileThing._userName,pw:MobileThing._passWord};
+//使用PhoneGap获取存放在本地的账号密码
+MobileThing.getLoginInfoFromLocal = function()
var storage = window.localS
MobileThing._userName = storage.getItem('UserName');
MobileThing._passWord = storage.getItem(&PassWord&);
+//将账号密码放在本地(使用Phonegap)
+MobileThing.saveLoginInfoToLocal = function(userName,PassWord)
var storage = window.localS
MobileThing._userName = userN
MobileThing._passWord = PassW
storage.setItem(&UserName&,userName);
storage.setItem(&PassWord&,PassWord);
var prefs = plugins.appP
prefs.store(MobileThing.saveOk, MobileThing.error,&UserName&, userName);
prefs.store(MobileThing.saveOk, MobileThing.error,&PassWord&, PassWord);
MobileThing._userName = userN
MobileThing._passWord = PassW
+MobileThing.saveOk = function(value)
+MobileThing.saveError = function(error)
Index: HorScrollView.js
===================================================================
--- HorScrollView.js (revision 0)
+++ HorScrollView.js (revision 2)
@@ -0,0 +1,137 @@
+ * Created by 李腾飞 on .
+//水平滚动UI
+function HorScrollView(game,x,y,key,frame,width,height)
Phaser.Group.call(this, game);
this.extendData = {};
this.extendData.game =
this.extendData.background = this.create(x,y,key,frame);
this.extendData.background.width =
this.extendData.background.height =
//子元素最小的X
this.extendData._minX = 0;
//子元素最大X
this.extendData._maxX = 0;
//鼠标按下时候的X,Y
this.extendData._currentX = 0;
this.extendData._currentY = 0;
this.extendData._isTouch =
//左右最大拉动距离
this.extendData._holdDistance = 80;
this.extendData.needLeftDrag =
this.extendData.needRightDrig =
//添加背景实际承载子元素的group
this.extendData.parent = game.add.group();
this.extendData.parent.y = 10;
this.add(this.extendData.parent);
this.extendData.background.inputEnabled =
this.extendData.background.events.onInputDown.add(function(sprite)
this.extendData._isTouch =
this.extendData._currentX = game.input.x;
this.extendData._currentY = game.input.y;
this.extendData.background.events.onInputUp.add(function(sprite)
this.extendData._isTouch =
var extendDta = this.extendD
var game = extendDta.
var parent
= this.extendData.
var minX = this.extendData._minX;
var maxX = this.extendData._maxX;
var rightLimitX = this.extendData._maxX - game.world.
if(this.extendData.needLeftDrag)
game.add.tween(parent).to({x:minX},200,Phaser.Easing.Default,true,0,0,false);
this.extendData.needLeftDrag =
else if(this.extendData.needRightDrig)
game.add.tween(parent).to({x:(-rightLimitX)},200,Phaser.Easing.Default,true,0,0,false);
this.extendData.needRightDrig =
+var p = HorScrollView.prototype = Object.create(Phaser.Group.prototype);
+p.constructor = HorScrollV
+//添加一个Sprite
+p.addPhaserElement = function(sprite)
var x = sprite.x;
//this.extendData.parent.addChild(sprite);
this.extendData.parent.add(sprite);
var xx = x + sprite.
//根据X,Y来确定最大最小的X
this.extendData._minX = x &this.extendData._minX ? x : this.extendData._minX;
this.extendData._maxX = xx & this.extendData._maxX ? xx : this.extendData._maxX;
+p.update = function()
var game = this.extendData.
var parent = this.extendData.
var currentX = game.input.x;
var currentY = game.input.y;
var extendData = this.extendD
//右面达到临界值的 X值
var rightLimitX = this.extendData._maxX - (game.world.width - this.extendData._holdDistance);
if(this.extendData._isTouch == true)
//拖拽计算
var dX = currentX - this.extendData._currentX;
var finalX = parent.x + dX;
if (finalX &= -rightLimitX)
parent.x = -rightLimitX;
extendData.needRightDrig =
else if(finalX&=this.extendData._holdDistance)
parent.x = this.extendData._holdD
extendData.needLeftDrag =
parent.x = finalX;
extendData.needLeftDrag =
extendData.needRightDrig =
//parent.x = finalX;
this.extendData._currentX = currentX;
this.extendData._currentY = currentY;
Index: GametipInfo.js
===================================================================
--- GametipInfo.js (revision 0)
+++ GametipInfo.js (revision 2)
@@ -0,0 +1,30 @@
+ * Created by Administrator on .
+ * 游戏中提示出牌或者扣底是否正确
+function GametipInfo(game)
Phaser.Group.call(this,game);
this.game =
//添加黑色背景
this.bg = game.add.sprite(0,0,&others&,&blackinfo.png&);
var bgWidth_h = this.bg.width/2.0;
var bgHeight_h = this.bg.height/2.0;
//添加文字信息
this.infoTip = game.add.text(bgWidth_h,bgHeight_h,&&,{font: &37px Arial&, fill: &#FFFFFF&});
this.infoTip.anchor.setTo(0.5,0.5);
this.add(this.bg);
this.add(this.infoTip);
+GametipInfo.prototype = Object.create(Phaser.Group.prototype);
+GametipInfo.prototype.constructor = GametipI
+//显示提示信息
+GametipInfo.prototype.showTipInfo = function(info,showTime)
this.infoTip.text =
PhaserTools.danRuDanChu(this.game,this,showTime);
\ No newline at end of file
Index: Boot.js
===================================================================
--- Boot.js (revision 0)
+++ Boot.js (revision 2)
@@ -0,0 +1,91 @@
+BasicGame = {
/* Here we've just got some global level vars that persist regardless of State swaps */
/* If the music in your game needs to play through-out a few State swaps, then you could reference it here */
music: null,
/* Your game can check BasicGame.orientated in internal loops to know if it should pause or not */
orientated: false
+BasicGame.Boot = function (game) {
+BasicGame.Boot.prototype = {
init: function () {
this.input.maxPointers = 1;
this.stage.disableVisibilityChange =
if (this.game.device.desktop)
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.setMinMax(480, 260, );
this.scale.pageAlignHorizontally =
this.scale.pageAlignVertically =
this.scale.setScreenSize(true);
this.scale.setResizeCallback(this.gameResized, this);
this.scale.refresh();
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.setMinMax(480, 260, );
this.scale.pageAlignHorizontally =
this.scale.pageAlignVertically =
this.scale.forceOrientation(true, false);
this.scale.setResizeCallback(this.gameResized, this);
this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this);
this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this);
this.scale.setScreenSize(true);
this.scale.refresh();
preload: function () {
//读取进度资源
this.game.load.atlasXML('blackloading','images/blackloading.png','images/blackloading.xml');
//加载加载进度
this.game.load.atlasXML('loading','images/loading.png','images/loading.xml');
//加载航天图标
this.game.load.image(&hangtianlog&,&images/hangtiangamelog.png&);
create: function () {
GameData.GameState = this.
this.state.start('Preloader');
gameResized: function (width, height) {
This could be handy if you need to do any extra processing if the game resizes.
A resize could happen if for example swapping orientation on a device or resizing the browser window.
Note that this callback is only really useful if you use a ScaleMode of RESIZE and place it inside your main game state.
//console.log(this.game.canvas.style.left);
enterIncorrectOrientation: function () {
//BasicGame.orientated =
//document.getElementById('orientation').style.display = 'block';
leaveIncorrectOrientation: function () {
//BasicGame.orientated =
//document.getElementById('orientation').style.display = 'none';
\ No newline at end of file
Index: GameData.js
===================================================================
--- GameData.js (revision 0)
+++ GameData.js (revision 2)
@@ -0,0 +1,111 @@
+ * Created by 李腾飞 on .
+//游戏当中的所有数据
+function GameData()
+//玩家的信息(
+// UserAccont玩家登录账户(目前支持微信账户和QQ账户)
+//LoginType 1代表QQ登录,2代表微信登录
+// NormalScore普通积分,可以兑换一些东西,
+// RankScore排位分数,RankName排位名字)
+GameData.UserData = {UserAccont:'litengfei',username:&李腾飞&,headurl:'',pos:'top',LoginType:&0&,NormalScore:0,RankScore:0,RankName:&正在获取.&};
+GameData.UserName =//玩家的登录账号
+GameData.PassWord =//玩家的登录密码
+GameData.GameState =//游戏状态,用来跳转不同的状态
+GameData.Game =
+GameData.GameType = 0;//0表示大厅游戏,1表示排位游戏
+GameData.TableID = -1;//玩家玩的桌子的ID
+GameData.AlReadyFinishRank = //有的时候玩家还没有进入Game界面,有的玩家就离开了,这个时候,需要标注一下,并直接返回游戏
+//大厅信息(TableNums桌子总数,PlayerNums玩家总数)
+GameData.HallInfoData = {TableNums:0,PlayerNums:0};
+//登录界面
+GameData.LoginUI =
+//大厅界面
+GameData.HallState =
+//桌子界面
+GameData.TableState =
+//玩牌的UI
+GameData.GameUI =
+GameData.GameUI2 = &sdfdsf&;
+//玩家信息提示UI
+GameData.PlayerTipUI =
+//玩家得分面板
+GameData.GameScorePlaneUI =
+//玩家排位赛等待UI
+GameData.RankGameWaitingUI =
+//排位赛玩家离开房间等待UI
+GameData.RankGameLeaveGameWaitingUI =
+//游戏声音管理
+GameData.GameSound =
+//当前位置是不是自己
+GameData.isMyPos = function(pos)
if(pos == GameData.UserData.pos)
+//当前账号是不是自己
+GameData.isMyAccount = function(account)
if(GameData.getUserAccount() == account)
+GameData.test1 =
+//获得玩家账号
+GameData.getUserAccount = function()
return GameData.UserData.UserA
+//获得玩家的名字
+GameData.getUserName = function()
return GameData.UserData.
+//获得玩家当前的位置
+GameData.getPlayerPos = function()
return GameData.UserData.
+//获得玩家积分
+GameData.getUserNormalScore = function()
return GameData.UserData.NormalS
+//获得当前出牌的性别
+GameData.getHitCardSex = function()
\ No newline at end of file
Index: PhaserTools.js
===================================================================
--- PhaserTools.js (revision 0)
+++ PhaserTools.js (revision 2)
@@ -0,0 +1,74 @@
+ * Created by 李腾飞 on .
+function PhaserTools()
+PhaserTools.enbleInputDown = function(element,content,callback)
element.inputEnabled =
element.input.useHandCursor =
element.events.onInputDown.add(function(sprite)
var content1 =
callback(content1,sprite);
},content);
+//淡入淡出显示一个界面,可以设定显示时间
+PhaserTools.danRuDanChu = function(game,element,showTime)
element.visible =
element.alpha = 0;
game.add.tween(element).to({alpha:1},500,Phaser.Easing.Linear.None,true);
game.time.events.add(showTime,function()
= game.add.tween(element).to({alpha:0},500,Phaser.Easing.Linear.None,true);
tween.onComplete.add(function()
element.visible =
+//有一种从上面飞入的效果
+PhaserTools.topFlyIn = function(game,element)
element.visible =
game.add.tween(element).from({y:-50,alpha:0.9},300, Phaser.Easing.Circular.Out, true);
+//从上面消失的效果
+PhaserTools.topFlyOut = function(game,element)
var tween = game.add.tween(element);
tween.to({y:-50,alpha:0.2},300, Phaser.Easing.Circular.In, true);
tween.onComplete.add(function()
element.visible =
element.y = 200;
element.alpha = 1;
+//变大变小效果
+PhaserTools.bigSmall = function(game,element)
var tween = game.add.tween(element);
tween.to({width:element.width+30,height:element.height+20},600,Phaser.Easing.Cubic.InOut,true,0,Number.MAX_VALUE,true);
+//从屏幕上方下来的boundce效果
+PhaserTools.topBoundce = function(game,element)
game.add.tween(element).from({y:-50,alpha:0.9},700, Phaser.Easing.Bounce.Out, true);
+//盖章效果
+PhaserTools.gaiZhang = function(game,element)
game.add.tween(element).from({x:element.x+150,y:element.y-100,width:element.width*2,height:element.height*2,alpha:0.9},900, Phaser.Easing.Back.InOut, true);
\ No newline at end of file
Index: MainMenu.js
===================================================================
--- MainMenu.js (revision 0)
+++ MainMenu.js (revision 2)
@@ -0,0 +1,500 @@
+BasicGame.MainMenu = function (game) {
+BasicGame.MainMenu.prototype = {
+ create: function () {
//this.game.device.desktop =
var self =
GameData.LoginUI =
//创建登录界面(包含QQ登录和微信登录)
this.isQQlogin
=//是否点击了QQ登录
var background = this.game.add.sprite(0,0,'login','background.png');
this.gameWidth = background.width = this.game.world.
this.gameHeight = background.height = this.game.world.
//创建QQ登录
var qqLoginGroup = this.game.add.group();
qqLoginGroup.visible =
var qqhead = qqLoginGroup.create(0,0,'login');
qqhead.frameName = 'qq.png';
qqhead.anchor.setTo(0,0.5);
qqhead.inputEnabled =
qqhead.events.onInputDown.add(this.qqLogin,this);
var qqLoginText = qqLoginGroup.create(80,0,'login');
qqLoginText.frameName = 'qqdenglu2.png';
qqLoginText.anchor.setTo(0,0.5);
qqLoginText.inputEnabled =
qqLoginText.events.onInputDown.add(this.qqLogin,this);
//qqLoginGroup.anchor.setTo(0.5,0.5);
qqLoginGroup.x = this.game.world.width*0.18;
qqLoginGroup.y = this.game.world.height *0.7;
//创建微信登录
var weiLoginGroup = this.game.add.group();
weiLoginGroup.visible =
var weixinHead = weiLoginGroup.create(0,0,'login');
weixinHead.frameName = 'weixin.png';
weixinHead.anchor.setTo(0,0.5);
weixinHead.inputEnabled =
weixinHead.events.onInputDown.add(this.weixinLogin,this);
var weixinText = weiLoginGroup.create(80,0,'login');
weixinText.frameName = 'weixindenglu2.png';
weixinText.anchor.setTo(0,0.5);
weixinText.inputEnabled =
weixinText.events.onInputDown.add(this.weixinLogin,this);
weiLoginGroup.x = this.game.world.width*0.6;
weiLoginGroup.y = this.game.world.height*0.7;
var self =
var dengluGroup = this.loginGroup =//登录UI
var zhuceGroup
= this.zhuceGroup =//注册UI
this.headGroup =
//创建登录Group
dengluGroup = this.loginGroup =
this.game.add.group();
var userName_denglu
= createLoginUserName_C(this.game);
var password_denglu
= createLoginPass_C(this.game);
//账号字体
var zhanghaoText = this.game.add.sprite(-70,30,'login','zhanghaotext.png');
//密码字体
var mimaText = this.game.add.sprite(-70,110,'login','mimatext.png');
var zhuce_bn = this.game.add.sprite(10,175,'login','zhuce.png');
zhuce_bn.inputEnabled =
zhuce_bn.input.useHandCursor =
zhuce_bn.events.onInputDown.add(function(sprite)
//点击注册按钮
dengluGroup.visible =
zhuceGroup.visible =
//播放声音
GameData.GameSound.playTexiao(GameSound.Sounds.menuclick.name);
//登录按钮
var denglu_bn = this.game.add.sprite(190,170,'login','loginBn.png');
denglu_bn.inputEnabled =
denglu_bn.input.useHandCursor =
denglu_bn.events.onInputDown.add(function(sprite)
GameData.GameSound.playTexiao(GameSound.Sounds.menuclick.name);
var userName = userName_denglu.
var passWord = password_denglu.
//点击登录
//检查是否为空
if(userName == '' || passWord == '')
//提示用户名密码不能为空
this.loginGroup.visible =
this.tipUI.showTips(&用户名或者密码不能为空&,2000,function()
self.loginGroup.visible =
//向服务器发送登录请求
this.login(userName,passWord);
dengluGroup.add(password_denglu);
dengluGroup.add(userName_denglu);
dengluGroup.add(zhuce_bn);
dengluGroup.add(denglu_bn);
dengluGroup.add(zhanghaoText);
dengluGroup.add(mimaText);
dengluGroup.x = this.gameWidth/2.0 - 250;
dengluGroup.y = this.gameHeight/2.0 - 20;
//创建注册Group
zhuceGroup = this.zhuceGroup = this.game.add.group();
//账号文字
var zhuceZhanghaoText = this.game.add.sprite(-70,30,'login','zhanghaotext.png');
//密码文字
var zhuceMimaText = this.game.add.sprite(-70,110,'login','mimatext.png');
//昵称文字
var zhuceNichengText = this.game.add.sprite(-70,190,'login','nichengtext.png');
//头像文字
var zhuceHeadSelectText = this.game.add.sprite(-70,270,'login','touxiangtext.png');
var userName_zhuce = createZhuceUserName_C(this.game);
var password_zhuce = createZhucePass_C(this.game);
var nicheng_zhuce = createZhuceNicheng_c(this.game);
this.headGroup = this.game.add.group();
var head1 = new HeadSelectUI(this.game,0,270,'login','head1.png','headSelect.png');
var head2 = new HeadSelectUI(this.game,80,270,'login','head2.png','headSelect.png');
PhaserTools.enbleInputDown(head1,this,this.selectHead)
PhaserTools.enbleInputDown(head2,this,this.selectHead);
head1.select();
this.selectHeadID = head1.headID;
this.headGroup.add(head1);
this.headGroup.add(head2);
//确定注册按钮
var zhuceConfirm = this.game.add.sprite(210,350,'login','tijiao.png');
zhuceConfirm.inputEnabled =
zhuceConfirm.input.useHandCursor =
zhuceConfirm.events.onInputDown.add(function(sprite)
GameData.GameSound.playTexiao(GameSound.Sounds.menuclick.name);
var userName = userName_zhuce.
var passWord = password_zhuce.
var name = nicheng_zhuce.
//userName = 'litengfei';
//passWord = ';;
//name = '李腾飞';
if(userName == '' || passWord == '' || name == '')
//提示用户名密码不能为空
self.zhuceGroup.visible =
this.tipUI.showTips(&用户名密码和昵称不能为空!&,2000,function()
self.zhuceGroup.visible =
//检测登录名是否合法
if(InputCheck.isOutLength(10,userName) == false)
//提示用户名密码不能为空
self.zhuceGroup.visible =
this.tipUI.showTips(&用户名不能超过10个字符!&,2000,function()
self.zhuceGroup.visible =
//检测密码是否合法
if(InputCheck.isOutLength(10,passWord) == false)
//提示用户名密码不能为空
self.zhuceGroup.visible =
this.tipUI.showTips(&密码不能超过10个字符!&,2000,function()
self.zhuceGroup.visible =
//检测昵称是否合法
if(InputCheck.isOutLength(5,name) == false)
//提示用户名密码不能为空
self.zhuceGroup.visible =
this.tipUI.showTips(&昵称不能超过5个字符!&,2000,function()
self.zhuceGroup.visible =
//显示正在注册
GameData.registerUserName = userN
GameData.registerPass = passW
this.zhuceGroup.visible =
this.waitingUI.showWaiting('正在注册...');
this.game.netWork.sendData('register',{pa:userName,ps:passWord,pn:name,phu:this.selectHeadID});
//返回按钮
var zhuceBack = this.game.add.sprite(100,350,'login','back.png');
zhuceBack.inputEnabled =
zhuceBack.input.useHandCursor =
zhuceBack.events.onInputDown.add(function(sprite)
dengluGroup.visible =
zhuceGroup.visible =
GameData.GameSound.playTexiao(GameSound.Sounds.menuclick.name);
zhuceGroup.add(userName_zhuce);
zhuceGroup.add(password_zhuce);
zhuceGroup.add(nicheng_zhuce);
zhuceGroup.add(this.headGroup);
zhuceGroup.add(zhuceConfirm);
zhuceGroup.add(zhuceBack);
zhuceGroup.add(zhuceZhanghaoText);
zhuceGroup.add(zhuceMimaText);
zhuceGroup.add(zhuceNichengText);
zhuceGroup.add(zhuceHeadSelectText);
zhuceGroup.x = this.gameWidth/2.0 - 250;
zhuceGroup.y = this.gameHeight/2.0 - 70;
zhuceGroup.visible =
//添加航天图标
var hangtianIcon = this.game.add.sprite(20,620,&hangtianlog&);
//等待操作UI
this.waitingUI = new BlackWaitUI(this.game);
this.tipUI = new CenterInfoUI(this.game);
this.waitingUI.showWaiting('正在连接服务器...');
this.loginGroup.visible =
this.connectGameServer();
//播放背景音乐
GameData.GameSound.playBackGround();
//添加支付UI测试
//var payUI = new PayUI(this.game,{'1':{mouths:3,money:20}});
//声音测试
//GameData.GameSound.playHitNum(1,[1,1,1]);
//手机版本的输入法测试
//var modText = new MobTextInput(this.game,100,100,300,100,'others','inputbox.png','ok.png',{color:'#000',fontSize:&20px&},'1');
//modText.placeHolder = &输入用户名&;
//modText.password =
//var userName_denglu
= new MobTextInput(this.game,100,200,300,100,'others','inputbox.png','ok.png',{color:'#000',fontSize:&20px&},'2');
//userName_denglu.placeHolder = &请输入密码&;
//自动登录测试
//MobileThing.saveLoginInfoToLocal(&1&,&1&);
//var autoLoginUI = new AutoLoginUI(this.game,function()
//自动登录,发送登录
var userName = MobileThing.getLoginInfo().
var passWord = MobileThing.getLoginInfo().
self.login(userName,passWord);
//autoLoginUI.x = 150;
//autoLoginUI.y = 300;
//-------------------------------------------测试排列组合---------------------------------
//var combinArray = [1,2,3];
= GameHelper.combineArray(combinArray,3);
//console.log(res);
//var combinArray1 = [1,2];
//var combinArray2 = [3,4,5,6];
//console.log(GameHelper.combineArray1(combinArray1,combinArray2,3));
//var sortCardArray = [[1],[2],[3],[4],[5],[7],[8]];
//console.log(GameHelper.sortCardArray(sortCardArray,1,3));
//--------------------------------------------排列组合测试结束-----------------------------
//--------------------------------------全屏取消等待界面测试--------------------------------
//var waitingAndCancle = new WaitingAndCancleUI(this.game,&正在匹配玩家,请稍后..0秒&,&others&,&cancelwait.png&,function()
waitingAndCancle.visible =
//waitingAndCancle.showInfo(&哈哈哈哈&);
//--------------------------------------全屏取消等待界面测试结束
//--------------------------------------测试信息提示界面------------------------------------
//var messageBox = new MessageBox(this.game,function()
//},function()
//messageBox.x = 350;
//messageBox.y = 200;
//--------------------------------------结束信息提示测试界面-----------------------------------
//--------------------------------------游戏中不合法操作提示界面操作------------------------------------------
//var gameInfo = new GametipInfo(this.game);
//var self =
////PhaserTools.danRuDanChu(this.game,gameInfo,2000);
////this.game.time.events.loop(3000,function()
PhaserTools.danRuDanChu(self.game,gameInfo,2000);
////},this);
//gameInfo.showTipInfo(&扣底只能扣6张牌&,3000);
//--------------------------------------游戏得分界面测试------------------------------------
//var defenUI = new NormalScoreUI(this.game);
//defenUI.scale.setTo(1.2,1.2);
//defenUI.x = 500;
//defenUI.y =
////PhaserTools.topBoundce(this.game,defenUI);
//defenUI.showScore([{name:'李腾飞',score:&10&},{name:'李腾飞123',score:&-30&},{name:'李腾飞sdf',score:&30&},{name:'李腾飞sdf1',score:&30&}]);
//-------------------------------------说话面板测试-----------------------------------------
//var talkPlane = new TalkPlane(this.game);
//talkPlane.showTalk(&哈哈哈&);
//--------------------------------------结束游戏中不合法操作界面提示-----------------------------------------
//--------------------------------------APP升级测试--------------------------------------------------
//--------------------------------------结束APP升级测试-----------------------------------------------
//添加声音
//GameData.GameSound.playerGameBackGround();
//GameData.GameSound.playTexiao(GameSound.Sounds.gaizhang.name);
//var a = GameSound.Sounds.stamp.play(&&,0,1,true,true);
//---------------------------------------webview测试-------------------------------------------------
//var webView = new WebView(this.game,100,100,700,400,&http://www.baidu.com&);
//webView.showGameCenter();
//webView.hideWebView();
//webView.showGameCenter();
//if(AdMob) AdMob.createBanner( {
adId:AdmobInfo.admobid.banner,
position: AdMob.AD_POSITION.TOP_CENTER,
autoShow: true } );
//--------------------------------------测试Google广告------------------------------------------------
//var adView =
new AdmobPhaserView(this.game,329,100,800,100,AdmobInfo.admobid.banner);
//添加全屏
if(this.game.device.desktop)
var fullScreenInput = new FullScreenInput(this.game,'others','ok.png');
userName_denglu.connectFullScreenInput(fullScreenInput);
password_denglu.connectFullScreenInput(fullScreenInput);
userName_zhuce.connectFullScreenInput(fullScreenInput);
password_zhuce.connectFullScreenInput(fullScreenInput);
nicheng_zhuce.connectFullScreenInput(fullScreenInput);
var autoLoginUI = new AutoLoginUI(self.game,function()
//自动登录,发送登录
var userName = MobileThing.getLoginInfo().
var passWord = MobileThing.getLoginInfo().
self.login(userName,passWord);
autoLoginUI.x = 150;
autoLoginUI.y = 300;
autoLoginUI.visible =
//判断是否需要自动登录
MobileThing.isLastTimeLoginSuccess(function()
//如果上次成功登陆,则显示自动登录界面
//创建并显示UI
autoLoginUI.visible =
+ update: function () {
+ startGame: function (pointer) {
showLoginUI:function()
this.loginGroup.visible =
this.zhuceGroup.visible =
selectHead:function(content,head)
for(var key in content.headGroup.children)
var child = content.headGroup.children[key];
child.unSelect();
head.select();
content.selectHeadID = head.headID;
//点击微信登录
weixinLogin:function()
//如果登录成功,连接游戏服务器
GameData.UserData.UserAccont = &weixin&;
GameData.UserData.LoginType = &2&;
this.connectGameServer();
//点击QQ登录
qqLogin:function()
GameData.UserData.UserAccont = &QQ&;
GameData.UserData.LoginType = &1&;
//播放点击声音
GameData.GameSound.playHitSound();
if(this.isQQlogin == true)
this.isQQlogin =
this.connectGameServer();
//如果登录成功,连接游戏服务器
//连接游戏服务器
connectGameServer:function()
//连接服务器进行登录
var self =
this.game.netWork = new NetWork();
this.game.netWork.connectServer(function()
GameData.Game =
//连接成功后初始化网络事件
self.game.netWork.initEvents();
//连接成功
self.waitingUI.hideWaiting();
self.loginGroup.visible =
//self.game.netWork.sendData(&entergame&,{});
////进入玩法选择界面
//self.state.start('ChoosePlay');
// self.state.start('MainMenu');
//上面的代码为实际代码,下面为了方便测试,直接进入玩牌的界面
//self.game.netWork.sendData('quickentergame',{});
//self.state.start('Game');
//登录成功后
login:function(userName,userPass)
GameData.UserName = userN
GameData.PassWord = userP
this.loginGroup.visible =
this.waitingUI.showWaiting('正在登录...');
this.game.netWork.sendData('login',{pa:userName,ps:userPass});
Index: GameHelper.js
===================================================================
--- GameHelper.js (revision 0)
+++ GameHelper.js (revision 2)
@@ -0,0 +1,490 @@
+//这个类主要用来帮助计算游戏中的扑克相关的算法
+function GameHelper()
+GameHelper.CardType =
{'1':1,
'2':2,
'3':3,
'4':4,
'5':5};
+GameHelper.TypePower
'1':0,//普通牌
'2':42,//普通主
'3':98,//常主
'4':142,//打的主
'5':198//王
+GameHelper.ColorPower =
'1':0,
'2':14,
'3':28,
'4':42,
'5':43,
'6':60
+GameHelper.CardNumPower =
'1':14,
'2':2,
'3':3,
'4':4,
'5':5,
'6':6,
'7':7,
'8':8,
'9':9,
'10':10,
'11':11,
'12':12,
'13':13
+//初始化Gamehelper
+GameHelper.init = function()
//创建一个162张牌的数组
var cards = GameHelper.cards3 = [];
for(var i = 0;i&162;i++)
cards[i] = (i+1);
+//162张牌的index,获取其真正的大小
+GameHelper.getCard = function(cardIndex)
var card = new Card();
var oneCardIndex = cardIndex % 54;
oneCardIndex = (oneCardIndex == 0 ? 54 : oneCardIndex);
card.cardNum = oneCardIndex % 13;
card.cardNum = (card.cardNum == 0 ? 13 : card.cardNum);
var cardType = parseInt(oneCardIndex / 13);
if (card.cardNum == 13) cardType = cardType - 1;
card.cardType = (cardType + 1);
+//得到牌的权重
+GameHelper.getPower =
function(card,mainType,keyNum)
//计算这张卡片的权重
var typePower = 0;
var colorPower = 0;
var numPower = 0;
//首先计算出卡片的类型权重
if (card.cardType != mainType && card.cardNum != keyNum && card.cardNum != 2 && card.cardType != GameHelper.CardType['5'])
typePower = GameHelper.TypePower['1'];
if (card.cardType == mainType && card.cardNum != keyNum && card.cardNum != 2)
typePower = GameHelper.TypePower['2'];
if (card.cardNum == 2 && card.cardType != GameHelper.CardType['5'])
typePower = GameHelper.TypePower['3'];
if (card.cardNum == keyNum)
typePower = GameHelper.TypePower['4'];
if (card.cardType == GameHelper.CardType['5'])
typePower = GameHelper.TypePower['5'];
//计算出颜色的权重
if (card.cardType == mainType)
colorPower = GameHelper.ColorPower['5'];
colorPower =
GameHelper.ColorPower[card.cardType];
//计算牌大小的权重
numPower = GameHelper.CardNumPower[card.cardNum];
var finalPower = typePower + colorPower + numP
return finalP
+//分配4个人的牌
+GameHelper.getAssignCard = function()
var cards = GameHelper.getRandomCards();
var assignCars = new AssignCards();
//生成四个人的牌和底牌
var currentIndex =1;
var i = 0;
var j = 0;
for (i = 0,currentIndex = 0;i&=155;i+=4,currentIndex++)
for (j = 0;j&4;j++)
var cardIndex =
cards[i+j];
assignCars.assignCars[j][currentIndex] = cardI
for (i = 156,j = 0;i&=161;i++,j++)//底牌
assignCars.remain[j] = cards[i];
return assignC
+//随机生成一副牌
+GameHelper.getRandomCards = function()
var cards = GameHelper.cards3;
for(var i = 0;i&162;i++)
var randomIndex = GameHelper.randomInt(0,161);
var temp = cards[i];
cards[i] = cards[randomIndex];
cards[randomIndex] =
+//随机产生区间的数
+GameHelper.randomInt = function(min,max)
var length = max -
var random = Math.floor(Math.random()*(length+1));
return min +
+//获得牌的类别,如主,或者其他,便于筛选牌
+GameHelper.getCardType = function(cardIndex,keyNum,mainType)
var cctype = 0;
var card = GameHelper.getCard(cardIndex);
var cardPower = GameHelper.getPower(card,mainType,keyNum);
if (cardPower&85)
cctype = 5;
= card.cardT
+//数组数组,第一个数组的数全部要,第二个的补齐
+GameHelper.combineArray1 = function(requireArray,combinArray,totalNum)
var requireLength = requireArray.
var needCombinNum = totalNum - requireL
var temp = GameHelper.combineArray(combinArray,needCombinNum);
var finalArray = [];
for(var key in temp)
var tp = temp[key];
var oneA = [];
for(var key1 in requireArray)
oneA.push(requireArray[key1]);
for(var key in tp)
oneA.push(tp[key]);
finalArray.push(oneA);
return finalA
+//给定一个数组,按照给定的组合数,进行组合,比如给定数组123 按两两组合 12 13 23 按3个组合 123
+GameHelper.combineArray = function(array,combineNum)
var finalArray = [];
var youbiao = [];//初始时候游标的值
var youbiaoValue = [];
for(var i = 0;i&combineNi++)
youbiao.push(i);
youbiaoValue.push(i);
var length = array.
var currentMoveYoubiao = combineNum-1;//比如有3个数,那么就有3个游标,
var oneCreateCombine = [];
while(true)
for(var key in youbiao)
var oneYoubiao = youbiaoValue[key];
oneCreateCombine.push(array[oneYoubiao]);
finalArray.push(oneCreateCombine);
oneCreateCombine = [];
//当前游标是否到位
var moveYoubiaoEndPos = length-1 - (combineNum-1-currentMoveYoubiao);
var nextPos = youbiaoValue[currentMoveYoubiao]+=1;
var youbiaoChanged =
while(nextPos & moveYoubiaoEndPos)
currentMoveYoubiao-=1;
if(currentMoveYoubiao == -1)return finalA
var currentPos = youbiaoValue[currentMoveYoubiao];
nextPos = currentPos+=1;
moveYoubiaoEndPos = length-1 - (combineNum-1-currentMoveYoubiao);
youbiaoChanged =
//判断最后的游标是否到头,到头后,计算前面的游标
if(youbiaoChanged == true)
for(var i = currentMoveYoubiao,j=youbiaoValue[currentMoveYoubiao]+1;i&combineNi++,j++)
youbiaoValue[i] =
currentMoveYoubiao = combineNum -1;
+//判断一个数组中的牌,是不是都相等
+GameHelper.isCardAllSame = function(cardArray)
var first = GameHelper.getCard(cardArray[0]);
for(var i = 1;i&cardArray.i++)
var oneCard = GameHelper.getCard(cardArray[i]);
if(first.cardNum != oneCard.cardNum || first.cardType != oneCard.cardType)
+//排序这两的数组 [[1,2],[2,3]],按照从大到小的顺序排列,返回排序好的数组
+GameHelper.sortCardArray = function(cardArray,mainType,keyNum)
var finalArray = [];
var hitCardNum = cardArray[0].
var goodCards = [];
var otherCards = [];
if(hitCardNum == 1)
//直接排序返回
cardArray = cardArray.sort(function(a,b)
return (GameHelper.getPower(GameHelper.getCard(a[0]),mainType,keyNum) - GameHelper.getPower(GameHelper.getCard(b[0]),mainType,keyNum));
finalArray = cardA
//先得到满足出牌要求,比如,是一个对儿的话,就得两张牌都一样
for(var key in cardArray)
var oneCards = cardArray[key];
if(GameHelper.isCardAllSame(oneCards))
goodCards.push(oneCards);
otherCards.push(oneCards);
goodCards = goodCards.sort(function(a,b)
var aFirst = GameHelper.getCard(a[0]);
var aPower = GameHelper.getPower(aFirst,mainType,keyNum);
var bFirst = GameHelper.getCard(b[0]);
var bPower = GameHelper.getPower(bFirst,mainType,keyNum);
return aPower - bP
//对于满足出牌要求的进行排序
otherCards = otherCards.sort(function(a,b)
var aPowers = 0;
for(var key in a)
aPowers+=GameHelper.getPower(GameHelper.getCard(a[key]),mainType,keyNum);
var bPowers = 0;
for(var key in b)
bPowers+=GameHelper.getPower(GameHelper.getCard(b[key]),mainType,keyNum);
return aPowers - bP
//对于剩下的进行排序
for(var key in goodCards)
finalArray.push(goodCards[key]);
for(var key in otherCards)
finalArray.push(otherCards[key]);
return finalA
+//出牌提示,分为第一次出牌或者是根据第一个出牌的玩家出牌,生成一个index
+GameHelper.tipCards = function(isFirst,currentCards,tempCardIndex,cardNum,mainType,keyNum)
var canHitCards = [];//最终所有可以出牌的数组
var typeIndexMap = {};//其中的key用type和Index合并的数字表示,比如大王,type为5,index为1,则最终的key为51,value是一个数组,存放相同类型的牌
for(var key in currentCards)
var oneCard = currentCards[key];
var oneCardIndex = oneCard.cardI
var realCard = GameHelper.getCard(oneCardIndex);
var typeKey = &&+realCard.cardType+realCard.cardN
if(typeof (typeIndexMap[typeKey]) == &undefined&)
typeIndexMap[typeKey] = [];
typeIndexMap[typeKey].push(oneCardIndex);
//1,2,3分别表示单牌,双牌,三张牌的集合
var numsMap = {1:[],2:[],3:[]};
for(var key in typeIndexMap)
var cards = typeIndexMap[key];
var length = cards.
numsMap[length].push(cards);
if(isFirst)
for(var i = 3;i&=1;i--)
var cards = numsMap[&&+i];
for(var k1 = 0;k1&cards.k1++)
canHitCards.push(cards[k1]);
var otherCards = [];//不是和出牌的牌类型相同的牌
var goodCards = [];//和第一个出的牌类型一样的牌
var tempCardType = GameHelper.getCardType(tempCardIndex,keyNum,mainType);
for(var key in currentCards)
var oneCardIndex = currentCards[key].cardI
var oneCardType = GameHelper.getCardType(oneCardIndex,keyNum,mainType);
if(tempCardType == oneCardType)
goodCards.push(oneCardIndex);
otherCards.push(oneCardIndex);
var goodNum = goodCards.
if(goodNum &= cardNum)//相同类型的牌够
if(cardNum==1)
for(var key in goodCards)
canHitCards.push([goodCards[key]]);
//所有的牌进行组合,并将牌进行排序,一样的牌优先级较高
canHitCards = GameHelper.combineArray(goodCards,cardNum);
//将牌进行排列组合
else if(goodNum&0&&goodNum&cardNum)//相同类型的牌不够
canHitCards = GameHelper.combineArray1(goodCards,otherCards,cardNum);
else//没有相同类型的牌
canHitCards = GameHelper.combineArray(otherCards,cardNum);
//进行提示排序
canHitCards = GameHelper.sortCardArray(canHitCards,mainType,keyNum);
return canHitC
+//游戏中用到的牌
+function Card()
this.cardType = 0;
this.cardNum = 0;
+//游戏中用到的分配的Cars
+function AssignCards()
this.assignCars = [];
for(var i = 0;i&4;i++)
this.assignCars[i] = [];
this.remain = [];
Index: Game.js
===================================================================
--- Game.js (revision 0)
+++ Game.js (revision 2)
@@ -0,0 +1,2014 @@
+ * Created by 李腾飞 on .
+ * Created by 李腾飞 on .
+BasicGame.Game = function (game) {
+ // When a State is added to Phaser it automatically has the following properties set on it, even if they already exist:
// a reference to the currently running game
// used to add sprites, text, groups, etc
this. // a reference to the game camera
// the game cache
// the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it)
// for preloading assets
// lots of useful common math operations
// the sound manager - add a sound, play one, set-up markers, etc
// the game stage
// the clock
this. // the tween manager
// the game world
this. // the particle manager
this. // the physics manager
// the repeatable random number generator
// You can use any of these from any function within this State.
// But do consider them as being 'reserved words', i.e. don't create a property for your own game called &world& or you'll over-write the world reference.
+BasicGame.Game.prototype = {
+ create: function () {
AdmobInfo.hideBanner();
// Honestly, just about anything could go here. It's YOUR game after all. Eat your heart out!
//创建游戏界面
GameData.GameUI =
var self =
//请求桌子内的准备情况
this.netWork = this.game.netW
this.bifen = &比分:3:3&;//记录的比分(默认为3:3)
this.chifen = &本局吃分:0分&;
//分数(本局玩家吃的分数)
this.gameScore = 0;
//当前是否第一个出牌
this.isFirstHitCard =
//第一个人出的牌
this.firstHitCards = [];
this.isPlaying =
//扑克集合(权重作为主键)
this.cards = {};
this.powers = [];//权重数组,主要用来做排序
this.selectCards = [];//玩家选择的牌
this.mainType = 1;//初始化时候默认打黑桃
this.keyNum = 3;//初始化的时候默认打3
this.dadiPos = &bottom&;//当前局打底的位置
//位置的索引
this.posIndex = {top:0,left:1,bottom:2,right:3};
this.numPosIndex = {0:'top',1:'left',2:'bottom',3:'right'};
this.screenWidth = this.game.world.
this.screenHeight = this.game.world.
this.halfScreenWidth = this.screenWidth/2.0;
this.halfScreenHeight = this.screenHeight/2.0;
//是否已经生了了提示的索引
this.haveTipIndexs =
this.tipCards =//提示出的牌
this.tipIndex = 0;//提示的所以,比如已经生成了提示的100种可能,每点一次,就增加1
//设置背景
this.game.add.sprite(0,0,'game','background.png');
this.topHead = this.game.add.sprite(this.halfScreenWidth,20,'hallui');
this.topHead.frameName = 'headd.png';
this.topHead.anchor.setTo(0.5,0);
this.headWidth = this.topHead.
this.headHeight = this.topHead.
this.topHeadName = this.game.add.text(this.halfScreenWidth,this.headHeight+30,'默认',{font: &40px Arial&,fill: &#F6AB42&,fontWeight:'bold'});
this.topHeadName.anchor.setTo(0.5,0);
this.headAndTextHeight = this.headHeight + this.topHeadName.height+5;
this.topPrepare = this.game.add.sprite(this.halfScreenWidth,this.headAndTextHeight+20,'game','ready.png');
this.topPrepare.anchor.setTo(0.5,0);
//上面的皇冠
this.topCrown = this.game.add.sprite(this.halfScreenWidth + this.topHead.width/2.0+10,20,'game','crown.png');
this.topCrown.anchor.setTo(0,0);
//上面的摘星
this.topZhaixingPlane = new ZhaixingPlane(this.game);
this.topZhaixingPlane.x = this.halfScreenWidth + this.topHead.width/2.0+10;
this.topZhaixingPlane.y = this.topHead.height/2.0+20;
this.topZhaixingPlane.visible =
this.leftHeadName = this.game.add.text(20,this.halfScreenHeight+(this.headHeight/2.0)+5,'默认',{font: &40px Arial&,fill:&#F6AB42&,fontWeight:'bold'});
this.leftHeadName.anchor.setTo(0,0);
this.leftHead = this.game.add.sprite(this.leftHeadName.width/2.0+10,this.halfScreenHeight,'hallui');
this.leftHead.frameName = 'headd.png';
this.leftHead.anchor.setTo(0.5,0.5);
this.leftPrePare = this.game.add.sprite(this.headWidth+40,this.halfScreenHeight,'game','ready.png');
this.leftPrePare.anchor.setTo(0,0.5);
this.leftCrown = this.game.add.sprite(this.leftHeadName.width/2.0+10,this.halfScreenHeight-(this.topHead.height/2.0),'game','crown.png');
this.leftCrown.anchor.setTo(0.5,1);
this.leftZhaixingPlane = new ZhaixingPlane(this.game);
this.leftZhaixingPlane.x = this.leftHeadName.width/2.0+10;
this.leftZhaixingPlane.y = this.halfScreenHeight+(this.headHeight/2.0)+5+this.leftHeadName.
this.leftZhaixingPlane.visible =
//this.leftZhaixingPlane.showStar(3);
this.bottomName =
this.game.add.text(this.halfScreenWidth,this.screenHeight,'默认',{font: &40px Arial&,fill: &#F6AB42&,fontWeight:'bold'});
this.bottomName.anchor.setTo(0.5,1);
this.bottomHead = this.game.add.sprite(this.halfScreenWidth,this.screenHeight-this.bottomName.height-5,'hallui');
this.bottomHead.frameName = 'headd.png';
this.bottomHead.anchor.setTo(0.5,1);
this.bottomPrepare = this.game.add.sprite(this.halfScreenWidth,this.screenHeight - this.headAndTextHeight - 20,'game','ready.png');
this.bottomPrepare.anchor.setTo(0.5,1);
this.bottomCrown = this.game.add.sprite(60,this.screenHeight - 185,'game','crown.png');
this.bottomCrown.anchor.setTo(0,1);
this.bottomZhaixingPlane = new ZhaixingPlane(this.game);
this.bottomZhaixingPlane.x = 100;
this.bottomZhaixingPlane.y = this.screenHeight - 210;
this.bottomZhaixingPlane.visible =
this.rightHeadName = this.game.add.text(this.screenWidth-20,this.halfScreenHeight+(this.headHeight/2.0)+10,'默认',{font: &40px Arial&,fill: &#F6AB42&,fontWeight:'bold'});
this.rightHeadName.anchor.setTo(1,0);
this.rightHead = this.game.add.sprite(this.screenWidth - (this.rightHeadName.width/2.0)-15,this.halfScreenHeight,'hallui');
this.rightHead.frameName = 'headd.png';
this.rightHead.anchor.setTo(0.5,0.5);
this.rightPrepare = this.game.add.sprite(this.screenWidth - this.headWidth - 40,this.halfScreenHeight,'game','ready.png');
this.rightPrepare.anchor.setTo(1,0.5);
this.rightCrown = this.game.add.sprite(this.screenWidth - (this.rightHeadName.width/2.0)-10,this.halfScreenHeight-(this.topHead.height/2.0),'game','crown.png');
this.rightCrown.anchor.setTo(0.5,1);
this.rightZhaixingPlane = new ZhaixingPlane(this.game);
this.rightZhaixingPlane.x = this.screenWidth - 180;
this.rightZhaixingPlane.y = this.halfScreenHeight+(this.headHeight/2.0)+5+this.leftHeadName.
this.rightZhaixingPlane.visible =
//中间的准备按钮
//询问是否摘星面板
this.askZhaixingPlane = this.game.add.group();
this.yaoxing = this.game.add.sprite(this.halfScreenWidth+60,this.halfScreenHeight,&game&,&yaoxing.png&);
this.buyaoxing = this.game.add.sprite(this.halfScreenWidth+280,this.halfScreenHeight,&game&,&buyaoxing.png&);
this.askZhaixingPlane.add(this.yaoxing);
this.askZhaixingPlane.add(this.buyaoxing);
this.askZhaixingPlane.visible =
//点击要星
PhaserTools.enbleInputDown(this.yaoxing,this,function(content,sprite)
content.hideYaoxingUI();
content.netWork.sendData(&yaoxing&,{yx:true});
//点击不要星
PhaserTools.enbleInputDown(this.buyaoxing,this,function(content,sprite)
content.hideYaoxingUI();
content.netWork.sendData(&yaoxing&,{yx:false});
this.prepareBn = this.game.add.sprite(this.halfScreenWidth,this.halfScreenHeight+120,'game','text_ready.png');
this.prepareBn.anchor.setTo(0.5,0.5);
this.prepareBn.inputEnabled =
PhaserTools.bigSmall(this.game,this.prepareBn);
this.prepareBn.input.useHandCursor =
this.prepareBn.events.onInputDown.add(function(sprite)
GameData.GameSound.playHitSound();
this.clearUI();
//点击发送准备事件
var netWork = this.game.netW
netWork.sendData('preparestate',{ip:true});
this.uiMap = {
top:{head:this.topHead,headname:this.topHeadName,prepare:this.topPrepare,crown:this.topCrown,zxplane:this.topZhaixingPlane},
left:{head:this.leftHead,headname:this.leftHeadName,prepare:this.leftPrePare,crown:this.leftCrown,zxplane:this.leftZhaixingPlane},
bottom:{head:this.bottomHead,headname:this.bottomName,prepare:this.bottomPrepare,crown:this.bottomCrown,zxplane:this.bottomZhaixingPlane},
right:{head:this.rightHead,headname:this.rightHeadName,prepare:this.rightPrepare,crown:this.rightCrown,zxplane:this.rightZhaixingPlane}
this.uiMap.top.head.visible =
this.uiMap.top.headname.visible =
this.uiMap.top.prepare.visible =
this.uiMap.top.crown.visible =
this.uiMap.top.zxplane.visible =
this.uiMap.left.head.visible =
this.uiMap.left.headname.visible =
this.uiMap.left.prepare.visible =
this.uiMap.left.crown.visible =
this.uiMap.left.zxplane.visible =
this.uiMap.right.head.visible =
this.uiMap.right.headname.visible =
this.uiMap.right.prepare.visible =
this.uiMap.right.crown.visible =
this.uiMap.right.zxplane.visible =
this.uiMap.bottom.prepare.visible =
this.uiMap.bottom.crown.visible =
this.uiMap.bottom.zxplane.visible =
//玩家牌的Group
this.cardGroup = this.game.add.group();
//反主和不反主UI
var uiBottomCenterHeight = this.halfScreenHeight + 85;//底部一系列UI的基准位置
this.fanzhuUI = this.game.add.sprite(this.halfScreenWidth+200,this.halfScreenHeight+120,'game','fanzhu.png');
this.fanzhuUI.anchor.setTo(1,0.5);
this.fanzhuUI.inputEnabled =
this.fanzhuUI.input.useHandCursor =
this.fanzhuUI.events.onInputDown.add(function(sprite)
GameData.GameSound.playHitSound();
this.hideFanzhuUI();
this.hideTimeOut();
this.netWork.sendData('askfanzhu',{fr:true});
this.buFanzhuUI = this.game.add.sprite(this.halfScreenWidth+220,this.halfScreenHeight+120,'game','bufanzhu.png');
this.buFanzhuUI.anchor.setTo(0,0.5);
this.buFanzhuUI.inputEnabled =
this.buFanzhuUI.input.useHandCursor =
this.buFanzhuUI.events.onInputDown.add(function(sprite)
GameData.GameSound.playHitSound();
this.hideFanzhuUI();
this.hideTimeOut();
this.netWork.sendData('askfanzhu',{fr:false});
//提示和出牌
this.tipUI = this.game.add.sprite(this.halfScreenWidth+200,this.halfScreenHeight+120,'game','tishi.png');
this.tipUI.anchor.setTo(1,0.5);
this.tipUI.inputEnabled =
this.tipUI.input.useHandCursor =
this.tipUI.events.onInputDown.add(function(sprite)
if(this.haveTipIndexs == false)
this.tipCards =
GameHelper.tipCards(this.isFirstHitCard,this.cards,this.firstHitCards[0],this.firstHitCards.length,this.mainType,this.keyNum);
this.haveTipIndexs =
this.tipIndex = 0;
this.unSelectAll();
var canHitCards = this.tipCards[this.tipIndex];
this.tipIndex+=1;
for(var key in canHitCards)
var popCardIndex = canHitCards[key];
this.cardPopUp(this.cards[popCardIndex]);
if(this.tipIndex&this.tipCards.length-1)
this.tipIndex = 0;
this.chupaiUI = this.game.add.sprite(this.halfScreenWidth+220,this.halfScreenHeight+120,'game','chupai.png')
this.chupaiUI.anchor.setTo(0,0.5);
this.chupaiUI.inputEnabled =
this.chupaiUI.input.useHandCursor =
this.chupaiUI.events.onInputDown.add(function(sprite)
GameData.GameSound.playHitSound();
if(this.checkCanHitCard() == false)
//提示不满足出牌规则
this.floatTip.showTipInfo(&您出的牌不满足出牌规则!&,2500);
this.netWork.sendData('hitcard',{hcs:this.selectCards});
this.hideTimeOut();
this.hideChupaiUI();
//摘星不摘星
this.buzhaixing = this.game.add.sprite(this.halfScreenWidth+60,this.halfScreenHeight+120,'game','buzhaixin.png');
this.buzhaixing.anchor.setTo(0,0.5);
this.buzhaixing.inputEnabled =
this.buzhaixing.input.useHandCursor =
this.buzhaixing.events.onInputDown.add(function(sprite)
this.showTips('等待其他玩家扣底和栽星操作...');
GameData.GameSound.playHitSound();
this.netWork.sendData('zhaixing',{zx:0});
this.hideZhaixingUI();
this.hideTimeOut();
this.xing1 = this.game.add.sprite(this.halfScreenWidth+100+100,this.halfScreenHeight+120,'game','xing1.png');
this.xing1.anchor.setTo(0,0.5);
this.xing1.inputEnabled =
this.xing1.input.useHandCursor =
this.xing1.events.onInputDown.add(function(sprite)
this.showTips('等待其他玩家扣底和栽星操作...');
GameData.GameSound.playHitSound();
this.netWork.sendData('zhaixing',{zx:1});
this.hideZhaixingUI();
this.hideTimeOut();
this.xing2 = this.game.add.sprite(this.halfScreenWidth+100+240,this.halfScreenHeight+120,'game','xing2.png');
this.xing2.anchor.setTo(0,0.5);
this.xing2.inputEnabled =
this.xing2.input.useHandCursor =
this.xing2.events.onInputDown.add(function(sprite)
this.showTips('等待其他玩家扣底和栽星操作...');
GameData.GameSound.playHitSound();
this.netWork.sendData('zhaixing',{zx:2});
this.hideZhaixingUI();
this.hideTimeOut();
this.xing3 = this.game.add.sprite(this.halfScreenWidth+100+240+140
,this.halfScreenHeight+120,'game','xing3.png');
this.xing3.anchor.setTo(0,0.5);
this.xing3.inputEnabled =
this.xing3.input.useHandCursor =
this.xing3.events.onInputDown.add(function(sprite)
this.showTips('等待其他玩家扣底和栽星操作...');
GameData.GameSound.playHitSound();
this.netWork.sendData('zhaixing',{zx:3});
this.hideZhaixingUI();
this.hideTimeOut();
this.koudiUI = this.game.add.sprite(this.halfScreenWidth+155,this.halfScreenHeight+120,'game','koudi.png');
this.koudiUI.anchor.setTo(0.5,0.5);
this.koudiUI.inputEnabled =
this.koudiUI.input.useHandCursor =
this.koudiUI.events.onInputDown.add(function(sprite)
if(this.selectCards.length !=6)
//提示,底牌需要扣6张
this.floatTip.showTipInfo(&扣的底牌必须为6张&,2500);
GameData.GameSound.playHitSound();
//从界面上移除这几张牌
this.showTips('等待其他玩家完成栽星操作...');//点击扣底后,如果在等在,就提示出等待其他玩家完成摘星
this.netWork.sendData('remaincard',{rc:this.selectCards});
this.selectCards = [];
this.hideKoudiUI();
this.hideTimeOut();
this.hideKoudiUI();
//倒计时位置信息
this.timeOutPos = {
top:{x:this.halfScreenWidth-100,y:100,ax:0.5,ay:0},
left:{x:100,y:this.halfScreenHeight,ax:0,ay:0.5},
bottom:{x:this.halfScreenWidth,y:this.halfScreenHeight+140,ax:0.5,ay:1},
right:{x:this.screenWidth -100,y:this.halfScreenHeight,ax:1,ay:0.5}
//this.timeOutFont = this.game.add.retroFont('timeout',32,32,'ABCDEFGHIJKLMNOPQRSTUVWXYZ ,.:`&&!',9,2,2);
//this.timeOutImage = this.game.add.image(0,0,this.timeOutFont);
//this.timeOutImage.scale.setTo(1.4,1.4);
this.timeOutText = this.game.add.text(0,0,&&,{ font: &50px Arial&, fill: &#F6AB42&});
//设置本玩家的头像
this.setHead('bottom',GameData.UserData.UserAccont,GameData.UserData.headurl,GameData.UserData.username);
//this.playerEnterTalbe('1','bottom','1','','1',true);
//小扑克Group
this.hitCardGroups =
top:this.game.add.group(),
left:this.game.add.group(),
right:this.game.add.group(),
bottom:this.game.add.group()
this.isSelecting =
//添加全局鼠标弹起事件
this.game.input.onUp.add(function()
this.isSelecting =
//this.bifenUI = this.game.add.text(20,30,&我方打3&,{ font: &32px Arial&, fill: &#F6AB42&});
//this.bifenUI.visible =
//我方打几
this.wofangDajiUI =
this.game.add.text(20,20,&我方打3&,{ font: &28px Arial&, fill: &#F6AB42&});
this.wofangDajiUI.visible =
//对方打几
this.duifangDajiUI =
this.game.add.text(20,60,&对方打3&,{ font: &28px Arial&, fill: &#F6AB42&});
this.duifangDajiUI.visible =
//主文字和图标组
this.topZhuIconGroup = this.game.add.group();
var zhuIconResouce = CardResouceHelper.getSmallCardType(this.mainType);
this.topZhuInfoText = this.game.add.text(20,95,&主 &,{ font: &24px Arial&, fill: &#F6AB42&});
this.topZhuIconGroup.add(this.topZhuInfoText);
this.topZhuIcon = this.game.add.sprite(50,100,zhuIconResouce.mainKey,zhuIconResouce.typeKey);
this.topZhuIconGroup.add(this.topZhuIcon);
this.topZhuIconGroup.visible =
this.chifenUI = this.game.add.text(100 +30,30,this.chifen,{ font: &27px Arial&, fill: &#F6AB42&});
this.chifenUI.anchor.setTo(0,0);
this.chifenUI.visible =
//底牌UIGroup
this.dicardsText = this.game.add.text(50,150,&底牌&,{ font: &23px Arial&, fill:&#F6AB42&});
this.dicardsText.visible =
this.dicardsUI = this.game.add.group();
this.dicardsUI.x = this.dicardsText.x+60;
this.dicardsUI.y = 130;
//扣底UIGroup
this.koudiCardsText = this.game.add.text(50,210,&扣底&,{ font: &23px Arial&, fill: &#F6AB42&});
this.koudiCardsText.visible =
this.koudiCardsUI = this.game.add.group();
this.koudiCardsUI.x = this.koudiCardsText.x+60;
this.koudiCardsUI.y = 200;
//右上角退出按钮
this.leaveRoom = this.game.add.sprite(this.screenWidth-10,10,'game','quitroom.png');
this.leaveRoom.anchor.setTo(1,0);
this.leaveRoom.inputEnabled =
this.leaveRoom.input.useHandCursor =
this.leaveRoom.events.onInputDown.add(function(sprite)
AdmobInfo.showBanner();//显示广告
GameData.GameSound.playTexiao(GameSound.Sounds.meneFlyIn.name);
//发送离开消息(弹出界面进行提示)
if(this.isPlaying == true)
this.messageBox.showInfo(&中途退出扣除20分,确定退出?&);
this.messageBox.showInfo(&确定退出?&);
//界面上的提示信息
this.tipText = this.game.add.text(this.halfScreenWidth,this.halfScreenHeight-80,&&,{ font: &38px Arial&, fill: &#F6AB42&});
this.tipText.anchor.setTo(0.5,0);
this.tipText.visible =
//创建浮动提示信息
this.floatTip = new GametipInfo(this.game);
this.floatTip.x = 450;
this.floatTip.y = 300;
this.floatTip.visible =
//普通局得分UI
//测试得分UI
var normalScore = this.normalScore = new NormalScoreUI(this.game);
normalScore.visible =
normalScore.x = this.screenWidth/2.0-300;
normalScore.y = this.screenHeight/2.0-180;
//normalScore.showScore([{name:'李腾飞',score:&30分&},{name:'李腾飞123',score:&-30分&},{name:'李腾飞sdf',score:&30分&},{name:'李腾飞sdf1',score:&30分&}]);
//添加Tip面板
//this.playerTip = new PlayerInfoTip(this.game);
//添加玩家分数面板
this.gameScorePlane = new GameScorePlane(this.game);
this.gameScorePlane.requestInfo();
//添加主副显示
var cardTypeIcon = CardResouceHelper.getSmallCardType(this.mainType);
this.zhuIcon = this.game.add.sprite(330,this.screenHeight - 183,cardTypeIcon.mainKey,cardTypeIcon.typeKey);
this.zhuIcon.anchor.setTo(1,1);
this.zhuIcon.visible =
this.zhufuPlane = this.game.add.text(330,this.screenHeight - 180,&主:20 副:10&,{font: &25px Arial&,fill: &#F6AB42&});
this.zhufuPlane.anchor.setTo(0,1);
this.zhufuPlane.visible =
//创建排位赛有玩家离开时候的等待界面
this.rankPlayerLeaveUI = GameData.RankGameLeaveGameWaitingUI = new WaitingAndCancleUI(this.game,&有玩家退出,5秒后离开房间...&,&others&,&leavenow.png&,function()
self.game.state.start(&ChoosePlay&);
GameData.RankGameLeaveGameWaitingUI.visible =
this.messageBox = new MessageBox(this.game,function()
//点击确认离开房间
self.netWork.sendData('playerleavetable',{});
self.game.state.start(&ChoosePlay&);
},function()
//点击取消离开房间
AdmobInfo.hideBanner();
this.messageBox.x = 350;
this.messageBox.y = 200;
this.messageBox.visible =
this.netWork.sendData('gametableprepareinfo',{});//请求桌子的准备情况
if(GameData.GameType == 1)//如果是排位赛,直接准备
if(GameData.AlReadyFinishRank == true)//玩家的界面还没开始,就有玩家离开了游戏
GameData.AlReadyFinishRank =//判断是不是没进入界面的依据
GameData.GameUI =//判断是不是没进入界面的依据,因为离开了该界面,所以指针就不再指向了
this.game.state.start(&ChoosePlay&);
this.clearUI();
//点击发送准备事件
var netWork = this.game.netW
netWork.sendData('preparestate',{ip:true});
//每局开始的提示面板
this.beginGameInfoUI = new GameBeginInfoPlane(this.game);
this.beginGameInfoUI.visible =
//吐槽按钮面板
this.tucaoBN = this.game.add.sprite(960,17,&others&,&tucaobn.png&);
var isTucaoShow =
this.canTucaoTime = 5000;
this.tucaoTimeOut = new TimeOut();
PhaserTools.enbleInputDown(this.tucaoBN,this,function(content,sprite)
isTucaoShow = !isTucaoS
if(isTucaoShow)
content.showTucaoUI();
content.hideTucaoUI();
//吐槽文字面板
this.tucaoUI = new TuCaoUI(this.game,function(text)
isTucaoShow =
self.hideTucaoUI();
var isTimeOut = self.tucaoTimeOut.isTimeOut();
if(isTimeOut== false)
//显示吐槽时间还不到
self.floatTip.showTipInfo(&您说话太快啦!冷静...&,1200);
//发送吐槽的索引
self.showTalk(GameData.getPlayerPos(),text.text);
//播放吐槽的声音
var screenPos = self.getScreenPos(GameData.getPlayerPos());
var sex = self.getPlayerSex(screenPos);
var tucaoIndex = text.index+3;
GameData.GameSound.playVoice(sex,tucaoIndex);
//开始吐槽超时检测
self.tucaoTimeOut.setTimeOut(self.canTucaoTime);
self.tucaoTimeOut.startTimeOut();
//发送网络吐槽事件
self.netWork.sendData(&tucao&,text.index);
this.tucaoUI.x = this.game.world.width - this.tucaoUI.bg.width-10;
this.tucaoUI.y = 100;
this.tucaoUI.visible =
//声音按钮
//声音开启图标
//点击声音按钮事件
var canPlay = this.canPlay =
GameData.GameSound.canP
var currentItem = canP
var onSoundClick = function(content,sprite)
GameData.GameSound.playTexiao(GameSound.Sounds.menuclick.name);
currentItem = !currentI
if(!currentItem)
content.soundOn.visible =
content.soundOff.visible =
GameData.GameSound.forbidPlaySounds();
content.canPlay =
content.soundOn.visible =
content.soundOff.visible =
GameData.GameSound.allowPlaySounds();
content.canPlay =
if(content.isPlaying)
GameData.GameSound.playerGameBackGround();
GameData.GameSound.playBackGround();
this.soundOn = this.game.add.sprite(855,20,&others&,&soundon.png&);
PhaserTools.enbleInputDown(this.soundOn,this,onSoundClick);
this.soundOn.visible = canP
//声音关闭图标
this.soundOff = this.game.add.sprite(855,20,&others&,&soundoff.png&);
PhaserTools.enbleInputDown(this.soundOff,this,onSoundClick);
this.soundOff.visible = !canP
this.hideChupaiUI();
this.hideZhaixingUI();
this.hideFanzhuUI();
//this.showDiCards([3,4,5,6,7,8]);
//this.showKoudi([3,4,5,6,7,8]);
//-----------------------------测试CardUI----------------------------
//var j = 0;
//for(var i = 56;i&= 162;i++)
var cardUI = new CardUI(i,this.game);
cardUI.x = 28*j;
//-----------------------------结束CardUI测试-------------------------
//-----------------------------测试添加移除,和重新整理UI---------------
//var self =
//var removeCards = function()
var j = 1;
self.game.time.events.loop(10,function()
self.removeOneCard(j);
//var i =53;
//var loop = this.game.time.events.loop(20,function()
//随机生成一个扑克
var index = Math.floor(Math.random()*30)+2;
this.addOneCardWithGamePower(index);
if(i == 92)
this.game.time.events.remove(loop);
//removeCards();
//self.changeMainType(4,'2');
//},this);
////更换主
//var k = 1;
//var num = 3;
//var loop2 = this.game.time.events.loop(5000,function()
this.changeMainType(num,k);
//},this);
//this.addOneCardWithGamePower(54);
//this.addOneCardAndPopUp(53);
//-----------------------------测试添加移除,和重新整理UI结束---------------
//-----------------------------超时UI测试--------------------------------
//this.showTimeOut('bottom',20);
//-----------------------------结束超时UI测试------------------------------
//------------------------------UI控制测试---------------------
//this.showZhaixingUI();
//------------------------------UI控制测试结束
//-----------------------------HitCardUI测试-------------------------------
//var hitCardUI = new HitCardUI(this.game,53);
//this.showHitCards('top',[53,54]);
//this.showHitCards('left',[2,3,4]);
//this.showHitCards('bottom',[5,6,7]);
//this.showHitCards('right',[8,9,10]);
//this.setHead('bottom',GameData.UserData.UserAccont,GameData.UserData.headurl,GameData.UserData.username);
//this.setHead('left',GameData.UserData.UserAccont,GameData.UserData.headurl,GameData.UserData.username);
//this.setHead('right',GameData.UserData.UserAccont,GameData.UserData.headurl,GameData.UserData.username);
//this.setHead('top',GameData.UserData.UserAccont,GameData.UserData.headurl,GameData.UserData.username);
//------------------------------结束HitCardUI测试
//--------------------------------显示主图标主的数量的测试------------------------------------
//this.showZhufuPlane();
//this.showZhaixingPlane(&left&,3);
//--------------------------------结束主图标主的数量的测试-----------------------------------
//-----------------------------提示出牌测试-----------------------------------------
//显示提示UI
//this.isFirstHitCard =
//this.firstHitCards = [1];
//this.showChupaiUI();
//for(var i = 0;i&10;i++)
this.addOneCardWithGamePower(i+1);
//for(var i = 54;i&64;i++)
this.addOneCardWithGamePower(i+1);
//for(var i = 108;i&113;i++)
this.addOneCardWithGamePower(i+1);
//for(var i = 11;i&15;i++)
this.addOneCardWithGamePower(i+1);
//this.isFirstHitCard =
//this.firstHitCards = [14,14,14];
//-----------------------------结束提示出牌测试--------------------------------------
//-----------------------------说话面板测试-----------------------------------------
//this.showTalk(&right&,&对家,真心玩的臭啊- -!&);
//this.showBeginGameInfo(3,1);
//this.showCrown(&top&);
//this.showCrown(&left&);
//this.showCrown(&bottom&);
//this.showCrown(&right&);
//-----------------------------吐槽UI测试------------------------------------------
//var tucaoUI = this.tucaoUI = new TuCaoUI(this.game,function(text)
alert(text.text);
//tucaoUI.x = this.game.world.width - tucaoUI.bg.width-10;
//tucaoUI.y = 100;
//-----------------------------询问摘星UI测试-------------------------------------
//this.showYaoxingUI(&bottom&);
//this.showZhaixingUI (&bottom&,3);
//-----------------------------声音测试-----------------------------------------
+ update: function () {
// Honestly, just about anything could go here. It's YOUR game after all. Eat your heart out!
//这个状态关闭
shutdown:function()
//停止播放音乐
GameData.GameSound.stopAllSound();
GameData.GameSound.playBackGround();
//设置某个位置的头像,和名字
setHead:function(pos,key,url,name)
var self =
var game = this.
var headName =
this.uiMap[pos].
headName.text =
headName.visible =
var head = this.uiMap[pos].
head.visible =
head.headUrl =
if(this.game.cache.checkImageKey(key) == false)
var image = new Image();
image.src =
image.onload = function()
game.cache.addImage(key,url,image);
head.loadTexture(key);
head.loadTexture(key);
head.width = 57;
head.height = 57;
hideHead:function(pos)
//隐藏掉玩家的头像
var screenPos = this.getScreenPos(pos);
this.uiMap[screenPos].head.visible =
this.uiMap[screenPos].headname.visible =
this.uiMap[screenPos].prepare.visible =
//设置准备
setPrepare:function(pos,prepare)
var screenPos = this.getScreenPos(pos);
if(screenPos == 'bottom')
this.prepareBn.visible = !
this.prepareBn.bringToTop();
var ui = this.getScreenUI(pos);
ui.prepare.visible =
playerEnterTalbe:function(account,pos,name,headUrl,lt,isPrepared)
var screenPos = this.getScreenPos(pos);
this.setHead(screenPos,account,headUrl,name);
this.setPrepare(pos,isPrepared);
playerLeaveTable:function(pos,isPlayering)
//隐藏头像
this.hideHead(pos);
if(isPlayering)
//重置界面
this.resetUI();
//根据服务器的位置,获得当前玩家屏幕的位置
getScreenPos:function(pos)
var playerRealPos = GameData.UserData.
var playerIndex = this.posIndex[playerRealPos];
var temp = 2 - playerI
= temp ==-1?3:
var index = this.posIndex[pos];
var screenIndex = parseInt((index+temp)%4);
return this.numPosIndex[screenIndex];
//根据服务器位置,获得屏幕上的控}

我要回帖

更多关于 undefined是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信