删除 YouleNexus 内嵌 .git,统一由根仓库唯一管理。提交: - projects/ 旧 H5 模板 Game_Surface_3 与各子游戏源码 - cocoscreator_projects/YouleNexus 工程 + cocos-creator-mcp 扩展源码 - CLAUDE.md、.mcp.json 等配置 library/temp/node_modules/dist 等缓存由 .gitignore 排除。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
554 lines
16 KiB
JavaScript
554 lines
16 KiB
JavaScript
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 = "";//吱口令
|
||
this.wareHouseStarCount = 0;//仓库库存星星
|
||
this.bankpower = 0;//是否有仓库权限
|
||
this.bankpwd = 0;//是否设置仓库密码
|
||
this.charm = undefined;
|
||
this.sign = "";//签名
|
||
this.tel = "";//绑定手机号
|
||
}
|
||
//玩家信息初始化
|
||
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 = "";//吱口令
|
||
this.wareHouseStarCount = 0;//仓库库存星星
|
||
this.bankpower = 0;//是否有仓库权限
|
||
this.bankpwd = 0;//是否设置仓库密码
|
||
this.charm = undefined;
|
||
this.sign = "";//签名
|
||
this.tel = "";//绑定手机号
|
||
};
|
||
}
|
||
//玩家微信信息初始化
|
||
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){
|
||
Player.prototype.SetMyInfo = function(object){
|
||
this.playerid = object.playerid;
|
||
this.roomcard = object.roomcard;
|
||
this.taskstate = object.taskstate;
|
||
this.ip=object.ip;
|
||
this.score = object.score;
|
||
this.bean = object.bean;
|
||
this.initialBean = object.bean;
|
||
this.bankpower = object.bankpower;
|
||
if(object.bank){
|
||
this.wareHouseStarCount = Number(object.bank);//仓库库存星星
|
||
}else{
|
||
this.wareHouseStarCount = 0;
|
||
}
|
||
if(object.bankpwd){
|
||
this.bankpwd = Number(object.bankpwd);//仓库库存星星
|
||
}else{
|
||
this.bankpwd = 0;
|
||
}
|
||
this.charm = object.charm;
|
||
this.sign = object.sign;
|
||
this.tel = object.tel;
|
||
//this.setTel();
|
||
//this.bankpwd = object.bank;//是否设置仓库密码 this.bankpwd = 0;//是否设置仓库密码
|
||
//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.setHallRoomCard();
|
||
if(_msg.data.text){
|
||
GameUI.Openupdataroomcard(_msg.data.text);
|
||
}
|
||
};
|
||
}
|
||
//修改豆豆
|
||
if(typeof(Player.prototype.update_bean) == "undefined"){
|
||
Player.prototype.update_bean = function(_msg){
|
||
this.bean = _msg.data.bean;
|
||
GameUI.setHallStar();
|
||
//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.data.text);
|
||
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.update_bean2) == "undefined"){
|
||
Player.prototype.update_bean2 = function(_bean){
|
||
this.bean = _bean;
|
||
GameUI.setHallStar();
|
||
//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.changeBean) == "undefined"){
|
||
Player.prototype.changeBean = function(_bean){
|
||
this.bean = this.initialBean + _bean;
|
||
GameUI.setHallStar();
|
||
//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;
|
||
GameUI.setHallRoomCard();
|
||
};
|
||
}
|
||
//设置房卡
|
||
if(typeof(Player.prototype.addRoomCard) == "undefined"){
|
||
Player.prototype.addRoomCard = function(value,text){
|
||
this.roomcard += value;
|
||
GameUI.setHallRoomCard();
|
||
if(text){
|
||
GameUI.Openupdataroomcard(text);
|
||
}
|
||
};
|
||
}
|
||
if(typeof(Player.prototype.setBean) == "undefined"){
|
||
Player.prototype.setBean = function(value){
|
||
this.bean = value;
|
||
GameUI.setHallStar();
|
||
};
|
||
}
|
||
if(typeof(Player.prototype.addBean) == "undefined"){
|
||
Player.prototype.addBean = function(value,text){
|
||
this.bean += value;
|
||
GameUI.setHallStar();
|
||
if(text){
|
||
GameUI.Openupdataroomcard(text);
|
||
}
|
||
};
|
||
}
|
||
//设置吱口令
|
||
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,bTemp){
|
||
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;
|
||
if(!bTemp){
|
||
this.initialBean = _data.bean;//玩家豆子初始值
|
||
}else{
|
||
this.initialBean = _data.initialBean;//玩家豆子初始值
|
||
}
|
||
this.isprepare = _data.isprepare;//玩家是否准备
|
||
if(_data.paycode){
|
||
this.paycode = _data.paycode;
|
||
}else{
|
||
this.paycode = "";
|
||
}
|
||
this.charm = _data.charm;
|
||
this.sign = _data.sign;
|
||
};
|
||
}
|
||
//获取牌桌内玩家数据
|
||
if(typeof(Player.prototype.getDeskInfo) == "undefined"){
|
||
Player.prototype.getDeskInfo = function(){
|
||
var rValue = {};
|
||
rValue.playerid=this.playerid;
|
||
rValue.nickname=this.nickname;
|
||
rValue.avatar=this.avatar;
|
||
rValue.sex=this.sex;
|
||
rValue.ip=this.ip;
|
||
rValue.onstate=this.onstate;
|
||
rValue.bean = this.bean;
|
||
rValue.initialBean = this.initialBean;//玩家豆子初始值
|
||
rValue.isprepare = this.isprepare;//玩家是否准备
|
||
if(this.paycode){
|
||
rValue.paycode = _data.paycode;
|
||
}else{
|
||
rValue.paycode = "";
|
||
}
|
||
rValue.charm = this.charm;
|
||
return rValue;
|
||
};
|
||
}
|
||
//房间解散
|
||
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:
|
||
GameUI.hideExitBtn();
|
||
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{
|
||
GameData.shareTimes++;
|
||
if(isArray(GameData.hallConfig.actData)){
|
||
if(GameData.hallConfig.actData[1] == 0){//活动关闭
|
||
return;
|
||
}
|
||
switch(GameData.activityType){//
|
||
case 1://大赢家
|
||
if(GameData.shareTimes == 1){
|
||
var sendUrl = GameData.hallConfig.actData[3];
|
||
var event = 3;
|
||
Logic.sendToWeb2(sendUrl,event);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
//if(!isArray(GameData.hallConfig.activity)){//
|
||
|
||
//return;
|
||
//}else{
|
||
//if(GameData.hallConfig.activity.length>=5){
|
||
//if(GameData.hallConfig.activity[4] == 0){
|
||
//return;
|
||
//}
|
||
//}
|
||
//}
|
||
|
||
//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 > 5){
|
||
//sendUrl = GameData.hallConfig.activity[6];
|
||
//actId = GameData.hallConfig.activity[7];
|
||
//}
|
||
//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<TaskInfo.length;i++){
|
||
if(TaskInfo[i].taskid == _msg.data.taskid){
|
||
TaskInfo[i].state = 2;
|
||
}
|
||
}
|
||
this.taskstate=_msg.data.taskstate;
|
||
GameUI.CloseTask();
|
||
GameUI.OpenTask();
|
||
|
||
};
|
||
}
|
||
//设置是否已初始化密码
|
||
if(typeof(Player.prototype.setBankPwd) == "undefined"){
|
||
Player.prototype.setBankPwd = function(value){
|
||
this.bankpwd = value;
|
||
};
|
||
}
|
||
//设置库存星星数量
|
||
if(typeof(Player.prototype.setWareHouseStarCOunt) == "undefined"){
|
||
Player.prototype.setWareHouseStarCOunt = function(count){
|
||
if(count){
|
||
this.wareHouseStarCount = Number(count);
|
||
}else{
|
||
this.wareHouseStarCount = 0;
|
||
}
|
||
GameUI.setNumberImage(3033,C_Player.wareHouseStarCount,27);//仓库库存数量
|
||
};
|
||
}
|
||
|
||
//设置魅力值
|
||
if(typeof(Player.prototype.setCharm) == "undefined"){
|
||
Player.prototype.setCharm = function(count){
|
||
this.charm = count;
|
||
if(this.seat>-1){//在房间内
|
||
if(this.seat == GameData.infoSeat){
|
||
set_self(3125,7,GameData.sysConfig.charmName+":"+count,0,0);
|
||
}
|
||
}
|
||
};
|
||
}
|
||
//设置魅力值
|
||
if(typeof(Player.prototype.setSign) == "undefined"){
|
||
Player.prototype.setSign = function(sign){
|
||
this.sign = sign;
|
||
GameUI.setSign(sign);
|
||
GameUI.closeTextInput();
|
||
};
|
||
}
|
||
if(typeof(Player.prototype.updateHallData) == "undefined"){
|
||
Player.prototype.updateHallData = function(data){
|
||
this.setSign(data.sign);
|
||
this.setRoomcard(data.roomcard);
|
||
this.update_bean2(data.bean);
|
||
};
|
||
}
|
||
if(typeof(Player.prototype.returnHallData) == "undefined"){
|
||
Player.prototype.returnHallData = function(data){
|
||
var obj={};
|
||
obj.sign = this.sign;
|
||
obj.roomcard = this.roomcard;
|
||
obj.bean = this.bean;
|
||
return obj;
|
||
};
|
||
}
|
||
|
||
//设置手机号
|
||
if(typeof(Player.prototype.setTel) == "undefined"){
|
||
Player.prototype.setTel = function(val){
|
||
this.tel = val;
|
||
// set_self(3256,43,2,0,0);
|
||
// play_ani(0,3256,35,255,100,0,1000,0,0,0,0,0,1);
|
||
};
|
||
}
|
||
|
||
|