update
This commit is contained in:
parent
a4e889301e
commit
babca2ed7c
@ -22,11 +22,10 @@ var notification = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建一个信号与监听函数的绑定
|
||||
* @param {Number} [eEvent] 事件id(也可使用字符串)。
|
||||
* @param {Function} [fnListener] 信号处理函数.
|
||||
* @param {Object} [oTarget] 信号处理函数的对象。
|
||||
* @return {Object} 返回一个描述信号与处理函数的绑定对象,作为移除绑定的句柄使用。
|
||||
* @param {Number} [eEvent]
|
||||
* @param {Function} [fnListener]
|
||||
* @param {Object} [oTarget]
|
||||
* @return {Object}
|
||||
*/
|
||||
createBinding: function(eEvent, fnListener, oTarget) {
|
||||
// find signal
|
||||
@ -51,8 +50,7 @@ var notification = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 移除信号的绑定函数
|
||||
* @param {Object|Array} [oBinding] createSignalBinding返回的对象。
|
||||
* @param {Object|Array} [oBinding] createSignalBinding
|
||||
*/
|
||||
removeBinding: function(oBinding) {
|
||||
var bindings = oBinding instanceof Array ? oBinding : [oBinding];
|
||||
@ -70,8 +68,6 @@ var notification = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听事件
|
||||
* 与createBinding功能一致(增加了缓存,方便删除)
|
||||
*/
|
||||
on(eEvent, fnListener, oTarget){
|
||||
let obj = this._cachebinds[eEvent];
|
||||
@ -96,7 +92,6 @@ var notification = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消监听事件(参数必须与监听事件保持一致)
|
||||
*/
|
||||
off(eEvent, fnListener, oTarget){
|
||||
let obj = this._cachebinds[eEvent];
|
||||
@ -115,8 +110,7 @@ var notification = {
|
||||
},
|
||||
|
||||
/**
|
||||
* 发送信号
|
||||
* @param {Number} [eEvent] 事件id。
|
||||
* @param {Number} [eEvent]
|
||||
*/
|
||||
emit: function(eEvent) {
|
||||
var signal = this._findSignal(eEvent);
|
||||
|
@ -31,13 +31,13 @@ module.exports = {
|
||||
lauchInfo: null,
|
||||
shareInfo: {},
|
||||
_handlers: [],
|
||||
// 初始化
|
||||
//
|
||||
/**
|
||||
*
|
||||
* @param {number} channelid : 频道ID
|
||||
* @param {number} gameid :游戏ID
|
||||
* @param {boolean} isoffical :上线版本还是测试版本
|
||||
* @param {object} response :回调对象(可不填),如果填的话,可实现以下一个或多个函数:
|
||||
* @param {number} channelid :
|
||||
* @param {number} gameid :
|
||||
* @param {boolean} isoffical :
|
||||
* @param {object} response :
|
||||
* .onLogin(logininfo)
|
||||
* .onLoginFail(net_err, logic_err, errmsg)
|
||||
* .onUpdateUser(userinfo)
|
||||
@ -76,9 +76,9 @@ module.exports = {
|
||||
|
||||
/**
|
||||
* 登陆函数
|
||||
* @param {object} successcb :成功回调(初始化时设置了回调对象的话,此处可不填)
|
||||
* @param {object} failcb :失败回调(初始化时设置了回调对象的话,此处可不填)
|
||||
* @param {string} ex_param :额外参数(预留字段,某些平台可能会使用此字段)
|
||||
* @param {object} successcb :
|
||||
* @param {object} failcb :
|
||||
* @param {string} ex_param :
|
||||
*/
|
||||
loginUser(successcb, failcb, ex_param) {
|
||||
if (this._logining) {
|
||||
@ -135,12 +135,12 @@ module.exports = {
|
||||
return 0;
|
||||
},
|
||||
|
||||
// 激活
|
||||
//
|
||||
/**
|
||||
*
|
||||
* @param {object} allinfo :包含用户信息的对象: 注意:allinfo.userInfo为用户实际信息
|
||||
* @param {object} successcb :成功回调(初始化时设置了回调对象的话,此处可不填)
|
||||
* @param {object} failcb :失败回调(初始化时设置了回调对象的话,此处可不填)
|
||||
* @param {object} allinfo :
|
||||
* @param {object} successcb :
|
||||
* @param {object} failcb :
|
||||
*/
|
||||
updateUser(allinfo, successcb, failcb) {
|
||||
if (!this.logined) {
|
||||
@ -203,7 +203,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 普通分享
|
||||
|
||||
shareNormal(content, imgurl, sharetype, shareparam, extrainfo) {
|
||||
this.share.shareNormal(
|
||||
content,
|
||||
@ -236,7 +236,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 截图分享
|
||||
|
||||
shareCapture(content, capture_rect, sharetype, shareparam, extrainfo) {
|
||||
this.share.shareCapture(
|
||||
content,
|
||||
@ -269,24 +269,16 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 生成唯一ID【无需关注此函数】
|
||||
|
||||
makeUUID() {
|
||||
return this.gamelog.generateUUID();
|
||||
},
|
||||
// 根据OpenID生成账号ID【通常情况不使用此函数】
|
||||
|
||||
makeAccountID(openid) {
|
||||
return this.login.AccountID(openid);
|
||||
},
|
||||
|
||||
// 添加监听处理器
|
||||
// handler是回调对象,按实际需要可实现以下一个或多个回调:
|
||||
// .onJCInit(channelid, gameid, isoffical){}
|
||||
// .onJCAccountID(accountid, sessionid){}
|
||||
// .onJCLocalUUID(localuuid){}
|
||||
// .onJCUserInfo(userinfo){}
|
||||
// .onJCLaunchInfo(lauchscene, lauchfromid, launchparam){}
|
||||
// .onJCGameStart(startmode, extparam){}
|
||||
// .onJCGameOver(score, bsuccess, extparam){}
|
||||
|
||||
addHandler(handler) {
|
||||
this._checkListener();
|
||||
if (!handler) {
|
||||
@ -302,7 +294,7 @@ module.exports = {
|
||||
return true;
|
||||
},
|
||||
|
||||
// 删除监听处理器
|
||||
|
||||
delHandler(handler) {
|
||||
if (!handler || !this._handlers) {
|
||||
return false;
|
||||
@ -317,20 +309,18 @@ module.exports = {
|
||||
return true;
|
||||
},
|
||||
|
||||
// 重置本地ID【通常情况不使用此函数】
|
||||
|
||||
resetLocalID() {
|
||||
this._cleanLocalID();
|
||||
this._loadLocalID();
|
||||
},
|
||||
|
||||
// 设置sdk回调
|
||||
|
||||
setResponse(rsp) {
|
||||
this.rsp = rsp;
|
||||
},
|
||||
|
||||
//游戏相关-------------------------------------------------------
|
||||
// 游戏开始
|
||||
// startmode: 0:正常开始游戏 1:重新开始 2:再来一次
|
||||
|
||||
gameStart(startmode, extparam) {
|
||||
switch (startmode) {
|
||||
case 0:
|
||||
@ -346,36 +336,36 @@ module.exports = {
|
||||
this._handleGameStart(startmode, extparam);
|
||||
},
|
||||
|
||||
// 游戏结束
|
||||
|
||||
gameOver(score, bsuccess, extparam) {
|
||||
this.gamelog.logGameover(extparam, score, bsuccess ? 1 : 0);
|
||||
this._handleGameOver(score, bsuccess, extparam);
|
||||
},
|
||||
|
||||
// 游戏显示
|
||||
|
||||
gameShow(showinfo) {
|
||||
this.gamelog.logShow();
|
||||
this._handleGameShow(showinfo);
|
||||
},
|
||||
|
||||
// 游戏隐藏
|
||||
|
||||
gameHide() {
|
||||
this.gamelog.logHide();
|
||||
this._handGameHide();
|
||||
},
|
||||
|
||||
// 使用道具
|
||||
|
||||
gameUseItem(itemid, itemcount, reson, extparam) {
|
||||
this.gamelog.logUseItem(itemid, itemcount, reson, extparam);
|
||||
},
|
||||
|
||||
// 获得道具
|
||||
|
||||
gameGetItem(itemid, itemcount, reson, extparam) {
|
||||
this.gamelog.logProductItem(itemid, itemcount, reson, extparam);
|
||||
},
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
// 以下函数无需手动调用
|
||||
|
||||
|
||||
setAccountID(accountid, sessionid, exobj) {
|
||||
this.accountID = accountid;
|
||||
|
@ -147,7 +147,7 @@ module.exports = {
|
||||
this.winH = info.windowHeight;
|
||||
},
|
||||
|
||||
// 添加banner广告
|
||||
|
||||
addBannerAD(advid, identifier, bannerY, canvasH, rspCb){
|
||||
var adobj = this.__createAD(0, advid, bannerY, canvasH);
|
||||
if(adobj){
|
||||
@ -159,7 +159,7 @@ module.exports = {
|
||||
return ad;
|
||||
},
|
||||
|
||||
// 添加激励广告(视频广告)
|
||||
|
||||
addVideoAD(advid, identifier, rspCb){
|
||||
var adobj = this.__createAD(1, advid);
|
||||
if(adobj){
|
||||
@ -221,7 +221,7 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
// 显示/隐藏banner广告
|
||||
|
||||
switchBannerAD (identifier, bShow){
|
||||
this.hideAllAD();
|
||||
|
||||
@ -232,7 +232,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// 显示激励广告(视频广告)
|
||||
|
||||
showRewardAD (identifier){
|
||||
let obj = this.findVideoAD(identifier);
|
||||
if(!obj || !obj.ad){
|
||||
@ -283,7 +283,7 @@ module.exports = {
|
||||
ad.hide && ad.hide();
|
||||
},
|
||||
|
||||
// 激励广告调用
|
||||
|
||||
loadAD(obj){
|
||||
let ad = obj.ad;
|
||||
if(!ad){
|
||||
@ -319,16 +319,15 @@ module.exports = {
|
||||
case 6001:{
|
||||
let closeCb = function(res){
|
||||
console.log("[ad]onClose:"+JSON.stringify(res));
|
||||
// 用户点击了【关闭广告】按钮
|
||||
// 小于 2.1.0 的基础库版本,res 是一个 undefined
|
||||
|
||||
if (res && res.isEnded || res === undefined) {
|
||||
// 正常播放结束,可以下发游戏奖励
|
||||
|
||||
obj.rspCb && obj.rspCb(10, obj, res, res.isEnded);
|
||||
} else {
|
||||
// 播放中途退出,不下发游戏奖励
|
||||
|
||||
obj.rspCb && obj.rspCb(11, obj, res, false);
|
||||
}
|
||||
// ad.offClose && ad.offClose(closeCb);
|
||||
|
||||
};
|
||||
ad.onClose && ad.onClose(closeCb);
|
||||
}break;
|
||||
@ -338,11 +337,9 @@ module.exports = {
|
||||
obj.rspCb && obj.rspCb(11, obj, null, false);
|
||||
// ad.offClose && ad.offClose(closeCb);
|
||||
};
|
||||
// ad.onPlayStart && ad.onPlayStart(function () {
|
||||
// //开始播放
|
||||
// });
|
||||
|
||||
ad.onPlayFinish && ad.onPlayFinish(function () {
|
||||
//播放结束
|
||||
|
||||
obj.rspCb && obj.rspCb(10, obj, null, true);
|
||||
});
|
||||
ad.onClose && ad.onClose(closeCb);
|
||||
|
@ -25,7 +25,7 @@ module.exports = {
|
||||
// update (dt) {},
|
||||
|
||||
__getConfig(channelid, gameid, openid, successcb, failcb) {
|
||||
channelid = cc.channelid; //为了测试
|
||||
channelid = cc.channelid; //
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV('c', 'Config')
|
||||
@ -33,7 +33,7 @@ module.exports = {
|
||||
.addKV('gameid', gameid)
|
||||
.addKV('channel', channelid)
|
||||
.addKV('openid', openid);
|
||||
//.addKV('publish_env', 'dev');//开发后台
|
||||
//.addKV('publish_env', 'dev');//
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (restext) {
|
||||
@ -366,7 +366,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 获取服务器配置
|
||||
//
|
||||
getServerConfig(successcb, failcb, bForce) {
|
||||
if (bForce) {
|
||||
this.cfginited = false;
|
||||
|
@ -165,7 +165,7 @@ const _HIDE_FLAG = 1;
|
||||
|
||||
const _ONLINE_KEY = 'jc_online_flags';
|
||||
|
||||
// 说明:带下划线的函数是内部函数,无需关心
|
||||
//
|
||||
|
||||
module.exports = {
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
@ -509,12 +509,12 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
//【通用函数】生成本地匿名ID
|
||||
//
|
||||
generateUUID() {
|
||||
return this.__uuid(32, 62);
|
||||
},
|
||||
|
||||
// 初始化(上报前必须调用此函数)【使用jcfw.init的话此函数无需手动调用】
|
||||
//
|
||||
init(channelid, gameid, isoffical) {
|
||||
this.gameid = gameid;
|
||||
this.channelid = channelid;
|
||||
@ -544,12 +544,12 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 【暂未使用】
|
||||
//
|
||||
setSubmitFlag(bsubmit) {
|
||||
this.needsubmit = bsubmit;
|
||||
},
|
||||
|
||||
// 登陆成功后调用,传入accountid和sessionid【使用jcfw.login的话此函数无需手动调用】
|
||||
//
|
||||
setAccountID(accountid, sessionid, exobj) {
|
||||
if (!this.accountid || this.accountid != accountid) {
|
||||
this.accountid = accountid;
|
||||
@ -564,21 +564,21 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// 设置昵称【无需手动调用】
|
||||
//
|
||||
setNickName(nickname) {
|
||||
if (!this.nickname || this.nickname != nickname) {
|
||||
this.nickname = nickname;
|
||||
}
|
||||
},
|
||||
|
||||
// 设置本app从哪个appid跳转过来的【使用jcfw.init的话此函数无需手动调用】
|
||||
//
|
||||
setFromAppID(appid) {
|
||||
if (!this.fromid || this.fromid != appid) {
|
||||
this.fromid = appid;
|
||||
}
|
||||
},
|
||||
|
||||
// 设置本地匿名ID(本地生成匿名id后调用)【使用jcfw.init的话此函数无需手动调用】
|
||||
//
|
||||
setLocalUUID(uuid) {
|
||||
if (!this.localid || this.localid != uuid) {
|
||||
this.localid = uuid;
|
||||
@ -587,7 +587,7 @@ module.exports = {
|
||||
|
||||
setSystemInfo(info) {},
|
||||
|
||||
// 【暂未使用】
|
||||
//
|
||||
setToken(token) {
|
||||
this.token = token;
|
||||
},
|
||||
@ -617,15 +617,14 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
//////////////////统计函数////////////////////
|
||||
// 启动游戏--------游戏启动后上报【使用jcfw.init的话此函数无需手动调用】
|
||||
|
||||
logLaunch(launch_option) {
|
||||
this._launchtime = new Date().getTime();
|
||||
this._handlelaunch(launch_option);
|
||||
this.logLauchDefault(launch_option);
|
||||
},
|
||||
|
||||
//启动游戏(内部调用)
|
||||
|
||||
logLauchDefault(launch_option) {
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
@ -643,7 +642,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.lauch, data);
|
||||
},
|
||||
|
||||
// 登陆成功--------游戏登陆成功后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
|
||||
logLoginSuccess(res, costtime) {
|
||||
let nowtime = new Date().getTime();
|
||||
this._handleLoginInfo(res);
|
||||
@ -661,7 +660,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.logined, data);
|
||||
},
|
||||
|
||||
// 登陆失败---------游戏登陆失败后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
|
||||
logLoginFailed(neterr, logicerr, errmsg) {
|
||||
let data = {
|
||||
error_code_net: neterr,
|
||||
@ -671,7 +670,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.loginFailed, data);
|
||||
},
|
||||
|
||||
// 授权成功--------微信获取userinfo后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
|
||||
logAuthSuccess(res) {
|
||||
this._handleAuthInfo(res);
|
||||
let data = {
|
||||
@ -687,7 +686,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.authed, data);
|
||||
},
|
||||
|
||||
// 授权失败--------微信获取userinfo时,用户拒绝授权后上报【使用jcfw.login的话此函数无需手动调用】
|
||||
|
||||
logAuthFail() {
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
@ -696,7 +695,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.authfail, data);
|
||||
},
|
||||
|
||||
// 分享---------------用户分享时上报【使用jcfw.shareNormal/shareCapture的话此函数无需手动调用】
|
||||
|
||||
logShare(businessid, sharetokenid, param) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -707,7 +706,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.share, data);
|
||||
},
|
||||
|
||||
// 分享点击-------------当用户点击别人分享的卡片进入游戏时上报【使用jcfw.login的话此函数无需手动调用】
|
||||
|
||||
logShareInvite(inviterid, businessid, sharetokenid, param) {
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
@ -719,7 +718,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.inviter, data);
|
||||
},
|
||||
|
||||
// 系统信息-------------获取用户系统信息后上报【使用jcfw.init的话此函数无需手动调用】
|
||||
|
||||
logSysInfo(res, typeobj) {
|
||||
let data = {
|
||||
str1: res.brand,
|
||||
@ -754,7 +753,7 @@ module.exports = {
|
||||
this.logSysInfo(res, JC_LOG_T.launchsysteminfo);
|
||||
},
|
||||
|
||||
// 开始游戏---------开始一局游戏时上报【使用jcfw.gameStart的话此函数无需手动调用】
|
||||
|
||||
logStartGame(param, startmode) {
|
||||
this._tempuuid = this.generateUUID();
|
||||
this._starttime = new Date().getTime();
|
||||
@ -769,7 +768,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.startgame, data);
|
||||
},
|
||||
|
||||
// 重新开始游戏---------重新开始一局游戏时上报【使用jcfw.gameStart的话此函数无需手动调用】
|
||||
|
||||
logRestartGame(param) {
|
||||
this._tempuuid = this.generateUUID();
|
||||
this._starttime = new Date().getTime();
|
||||
@ -784,7 +783,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.restartgame, data);
|
||||
},
|
||||
|
||||
// 游戏结束---------本局游戏结束时上报【使用jcfw.gameOver的话此函数无需手动调用】
|
||||
|
||||
logGameover(param, score, endflag) {
|
||||
let nowtime = new Date().getTime();
|
||||
let data = {
|
||||
@ -800,7 +799,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.gameover, data);
|
||||
},
|
||||
|
||||
// 再来一次----------再来一次时上报【使用jcfw.gameStart的话此函数无需手动调用】
|
||||
|
||||
logTryAgain(param) {
|
||||
this._tempuuid = this.generateUUID();
|
||||
let data = {
|
||||
@ -814,7 +813,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.againgame, data);
|
||||
},
|
||||
|
||||
// 显示-----------------------app显示时上报(eg:wx.onShow)【使用jcfw.gameShow的话此函数无需手动调用】
|
||||
|
||||
logShow(bIgnoreFlag) {
|
||||
if (!bIgnoreFlag) {
|
||||
let bok = !this.showflag || this.showflag == _HIDE_FLAG;
|
||||
@ -845,7 +844,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 隐藏-----------------------app隐藏时上报(eg:wx.onHide)【使用jcfw.gameHide的话此函数无需手动调用】
|
||||
|
||||
logHide(bIgnoreFlag) {
|
||||
if (!bIgnoreFlag) {
|
||||
let bok = this.showflag && this.showflag == _SHOW_FLAG;
|
||||
@ -875,7 +874,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 产出道具----------道具产出时上报【使用jcfw.gameGetItem的话此函数无需手动调用】
|
||||
|
||||
logProductItem(itemid, itemcount, reson, resonparam) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -887,7 +886,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.productitem, data);
|
||||
},
|
||||
|
||||
// 使用道具----------使用道具时上报【使用jcfw.gameUseItem的话此函数无需手动调用】
|
||||
|
||||
logUseItem(itemid, itemcount, reson, resonparam) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -899,7 +898,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.useitem, data);
|
||||
},
|
||||
|
||||
// 运营活动上报---------------开始运营活动时上报
|
||||
|
||||
logBusiness(businessid, actionid) {
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
@ -910,7 +909,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.business, data);
|
||||
},
|
||||
|
||||
// 进入游戏主界面-------------主界面显示时上报
|
||||
|
||||
logEnterMainScene(dt) {
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
@ -920,7 +919,6 @@ module.exports = {
|
||||
this._report(JC_LOG_T.entermain, data);
|
||||
},
|
||||
|
||||
// 跳转到其他app--------------跳转到其他app时上报(eg: wx.navigateMiniProgram)
|
||||
logJumpApp(appid, appparam, jumpres) {
|
||||
let data = {
|
||||
str1: this.localid,
|
||||
@ -934,7 +932,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.jumpapp, data);
|
||||
},
|
||||
|
||||
// 广告相关-----------------处理广告时上报(eg: 激励广告出现时)
|
||||
|
||||
logAdvInfo(advid, actiontype, actionparam) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -945,7 +943,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.advinfo, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】登陆【无需主动调用】
|
||||
|
||||
logVS_login() {
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
@ -953,7 +951,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vslogin, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】重连【无需主动调用】
|
||||
|
||||
logVS_reconnect(roomid) {
|
||||
let data = {
|
||||
str1: this.nickName,
|
||||
@ -962,7 +960,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vsreconnect, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】创建房间【无需主动调用】
|
||||
|
||||
logVS_createRoom(roomname, maxplayer) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -972,7 +970,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vsroomcreate, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】加入房间【无需主动调用】
|
||||
|
||||
logVS_joinRoom(roomid, customdata, israndom) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -983,7 +981,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vsroomjoin, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】离开房间【无需主动调用】
|
||||
|
||||
logVS_leaveRoom(roomid, customdata) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -993,7 +991,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vsroomleave, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】游戏准备【无需主动调用】
|
||||
|
||||
logVS_gameReady(roomid, customdata, isready) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -1004,7 +1002,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vsroomsetstate, data);
|
||||
},
|
||||
|
||||
// 【对战开房间】游戏开始【无需主动调用】
|
||||
|
||||
logVS_gameStart(roomid, customdata) {
|
||||
let data = {
|
||||
str1: this.nickname,
|
||||
@ -1015,7 +1013,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.vsroomsetstate, data);
|
||||
},
|
||||
|
||||
// 按钮事件----------------点击按钮时上报
|
||||
|
||||
logButtonClick(buttonname, param) {
|
||||
let data = {
|
||||
nickname: this.nickname,
|
||||
@ -1026,17 +1024,7 @@ module.exports = {
|
||||
this._report(JC_LOG_T.buttonclick, data);
|
||||
},
|
||||
|
||||
// 设置角色属性
|
||||
/* 调用示例:角色初始化时
|
||||
run(){
|
||||
let obj = {
|
||||
level: 1,
|
||||
money: 10000,
|
||||
...
|
||||
};
|
||||
jcfw.gamelog.userSet(obj);
|
||||
}
|
||||
*/
|
||||
|
||||
userSet(kvobj) {
|
||||
let data = {
|
||||
set: kvobj,
|
||||
@ -1044,15 +1032,7 @@ module.exports = {
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
// 设置角色属性(仅允许设置一次)
|
||||
/* 调用示例:改名时(如果有此功能)
|
||||
run(){
|
||||
let obj = {
|
||||
nickname: "abc"
|
||||
};
|
||||
jcfw.gamelog.userSet(obj);
|
||||
}
|
||||
*/
|
||||
|
||||
userSetOnce(kvobj) {
|
||||
let data = {
|
||||
set_once: kvobj,
|
||||
@ -1060,15 +1040,7 @@ module.exports = {
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
// 增加/减少角色数值属性
|
||||
/* 调用示例:角色升级时
|
||||
run(){
|
||||
let obj = {
|
||||
level: 1
|
||||
};
|
||||
jcfw.gamelog.userAdd(obj);
|
||||
}
|
||||
*/
|
||||
|
||||
userAdd(kvobj) {
|
||||
let data = {
|
||||
add: kvobj,
|
||||
@ -1076,7 +1048,7 @@ module.exports = {
|
||||
this._reportUser(data);
|
||||
},
|
||||
|
||||
/*可以一次调用set/setonce/add */
|
||||
|
||||
userReport(setobj, setonceobj, addobj) {
|
||||
let data = {
|
||||
set: setobj,
|
||||
|
@ -160,7 +160,7 @@ module.exports = {
|
||||
console.log('errcode----' + obj.errcode);
|
||||
|
||||
if (obj.errcode == 66) {
|
||||
console.log('用户不在白名单中');
|
||||
|
||||
uimanger.showUI(WhitelistTip.prefabPath);
|
||||
if (localStorage.getItem('walletaccount')) {
|
||||
localStorage.removeItem('walletaccount');
|
||||
@ -170,7 +170,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
if (obj.errcode == 103) {
|
||||
console.log('服务器未开启');
|
||||
|
||||
uimanger.showUI(ServerNotOpenTip.prefabPath);
|
||||
if (localStorage.getItem('walletaccount')) {
|
||||
localStorage.removeItem('walletaccount');
|
||||
@ -671,7 +671,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 登陆平台
|
||||
|
||||
loginPT(successcb, failcb, exparam) {
|
||||
switch (this.channelid) {
|
||||
case 6511:
|
||||
@ -693,7 +693,7 @@ module.exports = {
|
||||
let self = this;
|
||||
let openId = BK.getSystemInfoSync().openId;
|
||||
console.log('loginQQ openid:' + openId);
|
||||
// BK.Script.loadlib("GameRes://qqPlayCore.js") //预加载bricks js层接口
|
||||
// BK.Script.loadlib("GameRes://qqPlayCore.js") //
|
||||
BK.QQ.fetchOpenKey(function (errCode, cmd, data) {
|
||||
if (errCode == 0) {
|
||||
let openKey = data.openKey;
|
||||
@ -768,14 +768,14 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
// 更新用户信息
|
||||
|
||||
updatePTInfo(userinfo, tokeninfo, successcb, failcb) {
|
||||
this.updateuserinfo(userinfo, tokeninfo, successcb, failcb);
|
||||
},
|
||||
|
||||
// 登陆微信
|
||||
|
||||
loginwx(successcb, failcb) {
|
||||
// let wx = wx || {};
|
||||
|
||||
if (wx.login) {
|
||||
var self = this;
|
||||
this._loginstarttime = new Date().getTime();
|
||||
@ -804,7 +804,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
// 获取用户信息后调用此方法激活账号(info为空说明授权失败)
|
||||
|
||||
updateuserinfo(userinfo, tokeninfo, successcb, failcb) {
|
||||
this._loadLocalInfo(userinfo);
|
||||
this._loadTokenInfo(tokeninfo);
|
||||
@ -963,7 +963,7 @@ module.exports = {
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid);
|
||||
|
||||
console.log('auto....');
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (res) {
|
||||
|
@ -92,7 +92,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
//获取服务器时间
|
||||
|
||||
getTime(cb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
@ -107,7 +107,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
//创建队伍
|
||||
|
||||
createTeam(cb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
@ -119,7 +119,7 @@ module.exports = {
|
||||
this.getResponce(cb, this.urlbd);
|
||||
},
|
||||
|
||||
//获取队伍信息
|
||||
|
||||
getTeamInfo(team_uuid, cb) {
|
||||
var teamid = '';
|
||||
if (typeof team_uuid == 'string') {
|
||||
@ -137,7 +137,7 @@ module.exports = {
|
||||
this.getResponce(cb, this.urlbd);
|
||||
},
|
||||
|
||||
//加入队伍
|
||||
|
||||
joinTeam(team_uuid, cb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
@ -149,7 +149,7 @@ module.exports = {
|
||||
this.getResponce(cb, this.urlbd);
|
||||
},
|
||||
|
||||
//退出队伍
|
||||
|
||||
leaveTeam(team_uuid, cb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
@ -161,7 +161,7 @@ module.exports = {
|
||||
this.getResponce(cb, this.urlbd);
|
||||
},
|
||||
|
||||
//开始游戏
|
||||
|
||||
teamStartGame(team_uuid) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
@ -173,7 +173,7 @@ module.exports = {
|
||||
this.getResponce(null, this.urlbd);
|
||||
},
|
||||
|
||||
//保存新手引导流程
|
||||
|
||||
saveNewbie(newbieid) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
@ -188,7 +188,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
//获取城市ID
|
||||
|
||||
getNodeID(cb) {
|
||||
var urlbd = new urlbuilder(BaseNet.getNodeUrl());
|
||||
urlbd.clear();
|
||||
@ -200,7 +200,7 @@ module.exports = {
|
||||
);
|
||||
},
|
||||
|
||||
//查询屏蔽字
|
||||
|
||||
dirtyWordCheck(text) {
|
||||
var urlbd;
|
||||
urlbd = new urlbuilder(BaseNet.getNormalApiUrl('service'));
|
||||
|
@ -17,7 +17,7 @@ var toCodePoint = function (unicodeSurrogates) {
|
||||
i = 0;
|
||||
while (i < unicodeSurrogates.length) {
|
||||
var pos = i;
|
||||
c = unicodeSurrogates.charCodeAt(i++); //返回位置的字符的 Unicode 编码
|
||||
c = unicodeSurrogates.charCodeAt(i++);
|
||||
if (c == 0xfe0f) {
|
||||
continue;
|
||||
}
|
||||
@ -26,15 +26,15 @@ var toCodePoint = function (unicodeSurrogates) {
|
||||
r.push({
|
||||
v: value,
|
||||
pos: pos,
|
||||
}); //计算4字节的unicode
|
||||
});
|
||||
p = 0;
|
||||
} else if (0xd800 <= c && c <= 0xdbff) {
|
||||
p = c; //如果unicode编码在oxD800-0xDBff之间,则需要与后一个字符放在一起
|
||||
p = c;
|
||||
} else {
|
||||
r.push({
|
||||
v: c,
|
||||
pos: pos,
|
||||
}); //如果是2字节,直接将码点转为对应的十六进制形式
|
||||
});
|
||||
}
|
||||
}
|
||||
return r;
|
||||
@ -49,7 +49,7 @@ var SDKManage = function () {
|
||||
this.session_id = '';
|
||||
|
||||
this.m_hiID = 18001;
|
||||
this.account_id = 0; //玩家账号ID
|
||||
this.account_id = 0; //
|
||||
|
||||
// playerData.SDKManage = this
|
||||
this.getplayerdata = function () {
|
||||
@ -76,14 +76,14 @@ var SDKManage = function () {
|
||||
add = 2;
|
||||
}
|
||||
|
||||
//如果超过了限制,则按上一个为准
|
||||
|
||||
if (numChar + add > maxChars) {
|
||||
break;
|
||||
}
|
||||
|
||||
index = i;
|
||||
|
||||
//累加
|
||||
|
||||
numChar += add;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ var SDKManage = function () {
|
||||
return str.substring(0, codeArr[index - more].pos + 1) + suffix;
|
||||
};
|
||||
|
||||
// 6513 游客 6516 钱包
|
||||
|
||||
this.init = function (channelid = 6513) {
|
||||
// this.nickName = this.sixstr(this.nickName)
|
||||
if (cc.sys.platform == cc.sys.WECHAT_GAME) {
|
||||
@ -144,7 +144,7 @@ var SDKManage = function () {
|
||||
this.logincbarr[this.loginStep](res);
|
||||
this.loginStep++;
|
||||
} else {
|
||||
this.logEvent('loginend', '登录完成');
|
||||
this.logEvent('loginend', 'loginginish');
|
||||
var lgtime = Number(new Date().getTime() - this.gameloginstartime);
|
||||
|
||||
jcgamelog.logEnterMainScene(lgtime);
|
||||
@ -169,7 +169,7 @@ var SDKManage = function () {
|
||||
(res) => {
|
||||
cc.channelid = res.channel;
|
||||
self.hasLogin = true;
|
||||
self.logEvent('gamelogin', '游戏登录成功');
|
||||
self.logEvent('gamelogin', 'loginsuccess');
|
||||
|
||||
self.account_id = res.account_id;
|
||||
self.session_id = res.session_id;
|
||||
@ -227,8 +227,8 @@ var SDKManage = function () {
|
||||
sex: 0,
|
||||
// "proto_version":this.friend_pversion,
|
||||
server_id: 1,
|
||||
vip_lv: 0, //性别
|
||||
head: Number(cc.playerData.head_frame), //头像框
|
||||
vip_lv: 0, //
|
||||
head: Number(cc.playerData.head_frame), //
|
||||
};
|
||||
cc.chatMgr.initengine(cc.SDKManage.isoffical, opt);
|
||||
};
|
||||
@ -237,10 +237,9 @@ var SDKManage = function () {
|
||||
var self = this;
|
||||
var cb = function (obj) {
|
||||
cc.playerData.refreshInfo(obj.info);
|
||||
self.logEvent('getUserInfo', '获取用户信息成功');
|
||||
self.logEvent('getUserInfo', 'getuserinfo');
|
||||
self.initFriendInfo();
|
||||
self.doLogin();
|
||||
console.log('改名次数:' + obj.info.rename_count);
|
||||
if (obj.info.rename_count == 0) {
|
||||
window.canrename = true;
|
||||
} else {
|
||||
@ -262,7 +261,7 @@ var SDKManage = function () {
|
||||
// NetManage.getTime(() => {})
|
||||
|
||||
console.log('start init 6516');
|
||||
self.logEvent('initNetManage', '初始化人物信息');
|
||||
self.logEvent('initNetManage', 'initplayer');
|
||||
setTimeout(() => {
|
||||
self.doLogin();
|
||||
}, 10);
|
||||
@ -271,7 +270,7 @@ var SDKManage = function () {
|
||||
this.getGameConfig = function () {
|
||||
var self = this;
|
||||
var cb = function (res2) {
|
||||
self.logEvent('getGameConfig', '获取配置信息成功');
|
||||
self.logEvent('getGameConfig', 'getconfig');
|
||||
var res = {};
|
||||
for (var i = 0; i < res2.length; i++) {
|
||||
res[res2[i].key] = res2[i].value;
|
||||
@ -291,7 +290,7 @@ var SDKManage = function () {
|
||||
};
|
||||
|
||||
this.checkRate = function (nubmer) {
|
||||
//判断正整数/[1−9]+[0−9]∗]∗/
|
||||
|
||||
var re = /^[0-9]+.?[0-9]*/; //
|
||||
if (!re.test(nubmer)) {
|
||||
return false;
|
||||
@ -306,7 +305,7 @@ var SDKManage = function () {
|
||||
v = '';
|
||||
}
|
||||
if (cc.sys.os == cc.sys.OS_ANDROID) {
|
||||
//反射调用原生的隐藏方法
|
||||
|
||||
jsb.reflection.callStaticMethod(
|
||||
'org/cocos2dx/javascript/AppActivity',
|
||||
'logEvent',
|
||||
@ -347,17 +346,17 @@ var SDKManage = function () {
|
||||
};
|
||||
|
||||
this.dirtyWordCheck = function (
|
||||
_str //检查敏感词汇
|
||||
_str
|
||||
) {
|
||||
NetManage.dirtyWordCheck(_str);
|
||||
};
|
||||
|
||||
this.initGameRes = function () //初始化进入游戏前数据
|
||||
this.initGameRes = function ()
|
||||
{
|
||||
wxVoice.playbgm('bgm');
|
||||
cc.battleCache.loadwave();
|
||||
cc.highmode = true;
|
||||
//SDKManage.nickName = "战斗测试"
|
||||
|
||||
cc.game.setFrameRate(60);
|
||||
cc.macro.CLEANUP_IMAGE_CACHE = false;
|
||||
cc.dynamicAtlasManager.enabled = true;
|
||||
|
@ -43,7 +43,7 @@ cc.Class({
|
||||
if (this.nd_loading) {
|
||||
this.nd_loading.active = true
|
||||
}
|
||||
//关闭Loading
|
||||
|
||||
// if (this.nd_loading) {
|
||||
// this.nd_loading.active = true
|
||||
// this.loadingani.play("loading_ani")
|
||||
@ -101,7 +101,7 @@ cc.Class({
|
||||
cc.sdkdata = null
|
||||
cc.tableView._cellPoolCache={}
|
||||
|
||||
console.log("4399重新登录");
|
||||
|
||||
//cc.sdkdata = v
|
||||
cc.inlogin = true
|
||||
var ree = cc.director.loadScene("LoginScene");
|
||||
|
@ -134,7 +134,7 @@ cc.Class({
|
||||
cc.Notifier.emit('guildinvite', msgbox)
|
||||
}
|
||||
}
|
||||
console.log("自定义数据======02FromChatManager==",tmpState,noti);
|
||||
|
||||
if(tmpState == 0)
|
||||
{
|
||||
cc.Notifier.emit('SMCustomMsgNotify', msg)
|
||||
@ -188,7 +188,7 @@ cc.Class({
|
||||
this.haslongin = true
|
||||
this.account_info = msg.account_info
|
||||
playerData.guild_id = this.account_info.user_info.base_data['guild_id']
|
||||
console.log("公会ID=0222========",playerData.guild_id);
|
||||
|
||||
if (playerData.guild_id == '0') {
|
||||
playerData.isguild = false
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user