function Player(seat){ this.openid = "";//id this.playerid = -1;//playerid this.nickname = "";//昵称 this.avatar = "";//头像地址 this.sex = 0;//性别 this.ip = "";//ip地址 this.province = "";//微信信息省份 this.city = "";//微信信息城市 this.roomcard = -1;//房卡数量 this.taskstate = 0;//任务状态 this.unionid = 0;//平台唯一表示 this.seat = seat; //座位号 this.score = 0; this.state = -1;//玩家状态0->默认值 -1->申请解散 1->同意解散 2->拒绝解散 this.status = 0;//0->默认值 1->房主 2->非房主 //this.offline = 0;//玩家是否离线0->否 1->离线 this.canexit=1;//是否可以直接离开 this.onstate=0;//0:在线1:离线2:通话中 this.addr = null; this.invitecode = "";//邀请码 this.isStart = false;//能否点击按钮开始游戏 this.bean = 0;//玩家豆子数量 this.initialBean = 0;//玩家豆子初始值 this.isprepare = 0;//玩家是否准备 this.advanced = 0;//玩家是否有高级选项 this.paycode = "";//吱口令 } //玩家信息初始化 if(typeof(Player.prototype.Init) == "undefined"){ Player.prototype.Init = function(bTemp){ this.openid = "";//id this.playerid = -1;//playerid this.nickname = "";//昵称 this.score = 0; this.avatar = "";//头像地址 this.sex = 0;//性别 this.ip = "";//ip地址 this.province = "";//省份 this.city = "";//城市 this.roomcard = 0;//房卡数量 this.taskstate = 0;//任务状态 this.unionid = 0;//平台唯一表示 if(bTemp)this.seat = -1; //座位号 this.state = -1;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散 this.status = 0;//0->默认值 1->房主 2->非房主 this.offline = 0;//玩家是否离线0->否 1->离线 this.canexit=1;//是否可以直接离开 this.onstate=0;//0:在线1:离线2:通话中 this.addr = null; this.invitecode = "";//邀请码 this.isStart = false;//能否点击按钮开始游戏 this.bean = 0;//玩家豆子数量 this.initialBean = 0;//玩家豆子初始值 this.isprepare = 0;//玩家是否准备 this.advanced = 0;//玩家是否有高级选项 this.paycode = "";//吱口令 }; } //玩家微信信息初始化 if(typeof(Player.prototype.SetWxInfo) == "undefined"){ Player.prototype.SetWxInfo = function(openid,headimgurl,nickname,sex,city,Province,unionid){ this.openid = openid;//id this.nickname = nickname;//昵称 this.avatar = headimgurl;//头像地址 this.sex = sex;//性别 this.city = city;//城市 this.province = Province;//省 this.unionid=unionid;//开放平台id //alert("设置玩家信息"); }; } //玩家游戏信息初始化 if(typeof(Player.prototype.SetMyInfo) == "undefined"){ Player.prototype.SetMyInfo = function(_playerid,_roomcard,_taskstate,_ip,_score,_bean,_paycode){ this.playerid = _playerid; this.roomcard = _roomcard; this.taskstate = _taskstate; this.ip=_ip; this.score = _score; this.bean = _bean; this.initialBean = _bean; //this.paycode = _paycode; }; } //设置玩家位置 if(typeof(Player.prototype.SetLocationInfo) == "undefined"){ Player.prototype.SetLocationInfo = function(_locationinfo){ this.addr = _locationinfo; set_self(200,7,C_Player.addr.province+"-"+C_Player.addr.city,0,0); }; } //设置玩家座位 if(typeof(Player.prototype.SetSeat) == "undefined"){ Player.prototype.SetSeat = function(seat){ this.seat = seat; }; } //设置玩家邀请码 if(typeof(Player.prototype.setInvitecod) == "undefined"){ Player.prototype.setInvitecod = function(_invitecode){ this.invitecode = _invitecode; }; } //修改房卡 if(typeof(Player.prototype.UpdateRoomcard) == "undefined"){ Player.prototype.UpdateRoomcard = function(_msg){ this.roomcard = _msg.data.roomcard; set_self(157,7,C_Player.roomcard,0,0); set_self(157,18,get_self(287,18,0,0,0)+get_self(287,20,0,0,0)/2-String(C_Player.roomcard).length*7,0,0); GameUI.Openupdataroomcard(_msg); }; } //修改豆豆 if(typeof(Player.prototype.update_bean) == "undefined"){ Player.prototype.update_bean = function(_msg){ this.bean = _msg.data.bean; set_self(497,7,C_Player.bean,0,0); set_self(497,18,get_self(496,18,0,0,0)+get_self(496,20,0,0,0)/2-String(C_Player.bean).length*7,0,0); set_self(510,7,GameData.starName+":"+C_Player.bean,0,0); GameUI.openUpdateBean(_msg); if(C_Player.seat>-1){//在房间内 var pobj = Desk.GetPlayerBySeat(C_Player.seat); pobj.bean = C_Player.bean; pobj = null; if(C_Player.seat == GameData.infoSeat){ set_self(511,7,GameData.starName+":"+C_Player.bean,0,0); } } }; } //修改豆豆 if(typeof(Player.prototype.changeBean) == "undefined"){ Player.prototype.changeBean = function(_bean){ this.bean = this.initialBean + _bean; set_self(497,7,C_Player.bean,0,0); set_self(497,18,get_self(496,18,0,0,0)+get_self(496,20,0,0,0)/2-String(C_Player.bean).length*7,0,0); set_self(510,7,GameData.starName+":"+C_Player.bean,0,0); if(C_Player.seat>-1){//在房间内 var pobj = Desk.GetPlayerBySeat(C_Player.seat); pobj.bean = C_Player.bean; pobj = null; if(C_Player.seat == GameData.infoSeat){ set_self(511,7,GameData.starName+":"+C_Player.bean,0,0); } } }; } //设置房卡 if(typeof(Player.prototype.setRoomcard) == "undefined"){ Player.prototype.setRoomcard = function(_roomcard){ this.roomcard = _roomcard; //set_rec(203,this.roomcard); set_self(157,7,this.roomcard,0,0); set_self(157,18,get_self(287,18,0,0,0)+get_self(287,20,0,0,0)/2-String(C_Player.roomcard).length*7,0,0); }; } //设置吱口令 if(typeof(Player.prototype.setPayCode) == "undefined"){ Player.prototype.setPayCode = function(_paycode){ if(_paycode){ this.paycode = _paycode;//吱口令 }else{ this.paycode = "";//吱口令 } }; } //绑定邀请码 if(typeof(Player.prototype.binding_invitecode) == "undefined"){ Player.prototype.binding_invitecode = function(_msg){ if(_msg.data.state == 0){ this.invitecode = _msg.data.invitecode; } GameUI.OpenTips(_msg.data.error,ConstVal.Tips.time); }; } //设置牌桌内玩家数据 if(typeof(Player.prototype.SetDeskInfo) == "undefined"){ Player.prototype.SetDeskInfo = function(_data){ this.playerid=_data.playerid; this.nickname=_data.nickname; this.avatar=_data.avatar; this.sex=_data.sex; this.ip=_data.ip; this.onstate=_data.onstate; this.bean = _data.bean; this.initialBean = _data.bean;//玩家豆子初始值 this.isprepare = _data.isprepare;//玩家是否准备 if(_data.paycode){ this.paycode = _data.paycode; }else{ this.paycode = ""; } }; } //房间解散 if(typeof(Player.prototype.BreakRoom) == "undefined"){ Player.prototype.BreakRoom = function(){ this.seat = -1; //座位号 this.state = -1;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散 this.status = 0;//0->默认值 1->房主 2->非房主 this.isStart = false;//能否点击按钮开始游戏 //this.paycode = ""; }; } //申请解散房间 if(typeof(Player.prototype.ApplyBreakRoom) == "undefined"){ Player.prototype.ApplyBreakRoom = function(){ this.state = 0;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散 }; } //同意解散房间 if(typeof(Player.prototype.AgreeBreakRoom) == "undefined"){ Player.prototype.AgreeBreakRoom = function(){ this.state = 1;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散 }; } //拒绝解散房间 if(typeof(Player.prototype.RefuseBreakRoom) == "undefined"){ Player.prototype.RefuseBreakRoom = function(){ this.state = 2;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散 }; } //更改玩家是否可以直接退出 if(typeof(Player.prototype.ChangeExit) == "undefined"){ Player.prototype.ChangeExit = function(v){ this.canexit = v; switch(v){ case 1: if(this.status == 1){ set_self(181,43,4,0,0); }else{ set_self(181,43,3,0,0); } break; case 0: set_self(181,43,1,0,0); break; } }; } //更改玩家通话状态 if(typeof(Player.prototype.phonestate) == "undefined"){ Player.prototype.phonestate = function(state){ state=Number(state); C_Player.onstate=state; var pobj=Desk.GetPlayerBySeat(C_Player.seat); if(!pobj){return;} pobj.onstate=state; GameUI.SetOnState(C_Player.seat.seat,state); switch(state){ case 0://挂断 var data={}; data.agentid=GameData.AgentId; data.gameid=GameData.GameId; data.playerid=C_Player.playerid; data.roomcode=Desk.roomcode; Net.Send_hangup_phone(data); break; case 1://接起电话 var data={}; data.agentid=GameData.AgentId; data.gameid=GameData.GameId; data.playerid=C_Player.playerid; data.roomcode=Desk.roomcode; Net.Send_call_phone(data); break; case 2://电话进来 var data={}; data.agentid=GameData.AgentId; data.gameid=GameData.GameId; data.playerid=C_Player.playerid; data.roomcode=Desk.roomcode; Net.Send_call_phone(data); break; case 3://去电 var data={}; data.agentid=GameData.AgentId; data.gameid=GameData.GameId; data.playerid=C_Player.playerid; data.roomcode=Desk.roomcode; Net.Send_call_phone(data); break; } }; } //更改玩家任务提醒状态 if(typeof(Player.prototype.ChangeTaskstate) == "undefined"){ Player.prototype.ChangeTaskstate = function(v){ this.taskstate = v; }; } //分享回调 if(typeof(Player.prototype.sharesuccess) == "undefined"){ Player.prototype.sharesuccess = function(success,type){ if(success==2 && type == 2){//分享成功 var data={}; data.agentid=GameData.AgentId; data.playerid=this.playerid; data.taskid=ConstVal.ShareTaskId; Net.Send_player_finish_task(data); }else{ //GameUI.OpenTips("分享失败!",ConstVal.Tips.time); } if(success == 2 && GameData.shareFrom == 1){//截图分享成功 try{ if(!isArray(GameData.hallConfig.activity)){ return; } GameData.shareTimes++; //logmessage("大赢家截图分享成功!"+GameData.shareTimes+"、"+GameData.activityType,1); switch(GameData.activityType){// case 1://大赢家 if(GameData.shareTimes == 1){ var sendUrl = "http://discount.0791ts.cn/api/add_game_times"; var actId = 1; if(GameData.hallConfig.activity.length>4){ sendUrl = GameData.hallConfig.activity[5]; actId = GameData.hallConfig.activity[6]; } Logic.sendToWeb(sendUrl,actId); } break; } }catch(e){ } } GameData.activityType = 0; GameData.activityData = null; }; } //有 if(typeof(Player.prototype.player_finish_task) == "undefined"){ Player.prototype.player_finish_task = function(_msg){ if(_msg.data.state==1 && C_Player.taskstate==0){ C_Player.taskstate=1; } }; } //领取任务奖励 if(typeof(Player.prototype.get_task_award) == "undefined"){ Player.prototype.get_task_award = function(_msg){ for(var i=0;i