update
This commit is contained in:
parent
7d9bf97bd0
commit
56f6cce2b6
@ -47,8 +47,8 @@
|
||||
},
|
||||
"_scale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0.607421875,
|
||||
"y": 0.607421875,
|
||||
"x": 0.58453369140625,
|
||||
"y": 0.58453369140625,
|
||||
"z": 1
|
||||
},
|
||||
"_quat": {
|
||||
|
File diff suppressed because one or more lines are too long
1250
assets/resources/prefabs/tips/pb_servernoopen.prefab
Normal file
1250
assets/resources/prefabs/tips/pb_servernoopen.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "a6a91bd2-50f6-4438-b4c5-d3361cd7911a",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -471,7 +471,7 @@
|
||||
"__id__": 13
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_active": false,
|
||||
"_level": 3,
|
||||
"_components": [
|
||||
{
|
||||
@ -882,7 +882,7 @@
|
||||
"__id__": 25
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_active": false,
|
||||
"_level": 4,
|
||||
"_components": [
|
||||
{
|
||||
|
@ -25,16 +25,12 @@ window.connectOK = (account) => {
|
||||
tmpaccount = `0x${account}`;
|
||||
}
|
||||
window.account = tmpaccount;
|
||||
// localStorage.setItem('walletaccount', tmpaccount);
|
||||
// cc.Notifier.emit('hasConnectWallet', tmpaccount);
|
||||
jclogin.getNonce();
|
||||
};
|
||||
|
||||
window.signApp = (sign) => {
|
||||
jcgamelog.addOperation(OperationType.WALLET, 'signature success');
|
||||
window.hasWallet = true;
|
||||
localStorage.setItem('walletaccount', window.account);
|
||||
cc.Notifier.emit('hasConnectWallet', window.account);
|
||||
|
||||
var tmpsigm = sign;
|
||||
if (cc.sys.os == cc.sys.OS_ANDROID) {
|
||||
tmpsigm = `0x${sign}`;
|
||||
@ -55,6 +51,11 @@ window.signApp = (sign) => {
|
||||
|
||||
showLoading();
|
||||
cc.director.loadScene('MainScene');
|
||||
|
||||
//
|
||||
window.hasWallet = true;
|
||||
localStorage.setItem('walletaccount', window.account);
|
||||
cc.Notifier.emit('hasConnectWallet', window.account);
|
||||
});
|
||||
|
||||
var node = cc.director.getScene().getComponentInChildren('UILogin');
|
||||
@ -266,8 +267,9 @@ cc.Class({
|
||||
|
||||
getSwitch(() => {
|
||||
if (!Config.isTest) {
|
||||
// debug
|
||||
// 非提审状态
|
||||
if (localStorage.getItem('walletaccount')) {
|
||||
// 本地记录了钱包地址
|
||||
this.btn_tourist.active = false;
|
||||
this.btn_wallet.active = false;
|
||||
window.hasWallet = true;
|
||||
@ -287,11 +289,13 @@ cc.Class({
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// 本地没有记录钱包地址
|
||||
this.btn_tourist.active = true;
|
||||
this.btn_wallet.active = true;
|
||||
}
|
||||
} else {
|
||||
// test
|
||||
// 提审
|
||||
this.btn_tourist.active = true;
|
||||
this.btn_wallet.active = false;
|
||||
this.btn_tourist.position = new cc.v2(0, this.btn_tourist.y);
|
||||
|
@ -9,13 +9,14 @@
|
||||
// - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
|
||||
//var httpclient = require("httpclient");
|
||||
//var urlbuilder = require("urlbuilder");
|
||||
var httpclient = require("httpclient");
|
||||
var urlbuilder = require("urlbuilder");
|
||||
const BaseNet = require("../../BaseNet");
|
||||
const Config = require("../../Config");
|
||||
const { isTesting } = require("../../Config");
|
||||
const { WhitelistTip } = require("../../tips/WhitelistTip");
|
||||
const { uimanger } = require("../../UI/UIManger");
|
||||
var httpclient = require('httpclient');
|
||||
var urlbuilder = require('urlbuilder');
|
||||
const BaseNet = require('../../BaseNet');
|
||||
const Config = require('../../Config');
|
||||
const { isTesting } = require('../../Config');
|
||||
const { default: ServerNotOpenTip } = require('../../tips/ServerNotOpenTip');
|
||||
const { WhitelistTip } = require('../../tips/WhitelistTip');
|
||||
const { uimanger } = require('../../UI/UIManger');
|
||||
|
||||
module.exports = {
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
@ -37,69 +38,69 @@ module.exports = {
|
||||
) {
|
||||
if (window.canAutoLogin == true) {
|
||||
this.autoLogin(
|
||||
localStorage.getItem("loginaccount"),
|
||||
localStorage.getItem("loginsession"),
|
||||
localStorage.getItem('loginaccount'),
|
||||
localStorage.getItem('loginsession'),
|
||||
(res) => {
|
||||
console.log("auto login res===" + res);
|
||||
console.log('auto login res===' + res);
|
||||
var obj = httpclient.JSON_parse(res);
|
||||
// console.log("[__login]success!" + JSON.stringify(obj));
|
||||
successcb && successcb(obj);
|
||||
cc.Notifier.emit("autologinsuccess");
|
||||
cc.Notifier.emit('autologinsuccess');
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(BaseNet.getNormalApiUrl("login"));
|
||||
console.log(BaseNet.getNormalApiUrl('login'));
|
||||
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "auth")
|
||||
.addKV("gameid", gameid);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'auth')
|
||||
.addKV('gameid', gameid);
|
||||
if (cc.appPlatformID) {
|
||||
channelid = cc.appPlatformID;
|
||||
console.log("PlatformID==", channelid);
|
||||
console.log('PlatformID==', channelid);
|
||||
}
|
||||
|
||||
this.urlbd.addKV("channel", channelid);
|
||||
this.urlbd.addKV('channel', channelid);
|
||||
|
||||
if (cc.sdkdata) {
|
||||
this.urlbd.addKV("openid", cc.sdkdata.openid);
|
||||
this.urlbd.addKV('openid', cc.sdkdata.openid);
|
||||
// this.urlbd.addKV('token', cc.sdkdata.token);
|
||||
|
||||
this.urlbd.addKV("poly_sdk_channel", 8001);
|
||||
this.urlbd.addKV('poly_sdk_channel', 8001);
|
||||
this.urlbd.addKV(
|
||||
"poly_sdk_subchannel",
|
||||
'poly_sdk_subchannel',
|
||||
cc.sdkdata.poly_sdk_subchannel
|
||||
);
|
||||
} else if (cc.sdkData2) {
|
||||
console.log("SDKData3==", JSON.stringify(cc.sdkData2));
|
||||
this.urlbd.addKV("openid", cc.sdkData2.openid);
|
||||
console.log('SDKData3==', JSON.stringify(cc.sdkData2));
|
||||
this.urlbd.addKV('openid', cc.sdkData2.openid);
|
||||
// this.urlbd.addKV('token', cc.sdkData2.token);
|
||||
} else {
|
||||
if (openid && openid != "") {
|
||||
this.urlbd.addKV("openid", openid);
|
||||
if (openid && openid != '') {
|
||||
this.urlbd.addKV('openid', openid);
|
||||
} else {
|
||||
this.urlbd.addKV("openid", tokencode);
|
||||
this.urlbd.addKV('openid', tokencode);
|
||||
}
|
||||
this.urlbd.addKV("token", tokencode);
|
||||
this.urlbd.addKV('token', tokencode);
|
||||
}
|
||||
|
||||
if (this.env) {
|
||||
this.urlbd.addKV("env", this.env);
|
||||
this.urlbd.addKV('env', this.env);
|
||||
}
|
||||
|
||||
if (channelid == "6516") {
|
||||
this.urlbd.addKV("account", window.account);
|
||||
this.urlbd.addKV("net_id", "321");
|
||||
if (channelid == '6516') {
|
||||
this.urlbd.addKV('account', window.account);
|
||||
this.urlbd.addKV('net_id', '321');
|
||||
// getNounce
|
||||
this.urlbd.addKV("nonce", window.nonce);
|
||||
this.urlbd.addKV("signature", window.appsign);
|
||||
this.urlbd.addKV("tips", "sign request");
|
||||
this.urlbd.addKV('nonce', window.nonce);
|
||||
this.urlbd.addKV('signature', window.appsign);
|
||||
this.urlbd.addKV('tips', 'sign request');
|
||||
|
||||
// reset token
|
||||
var tmpToken = "";
|
||||
var tmpToken = '';
|
||||
if (cc.sdkdata) {
|
||||
tmpToken = cc.sdkdata.token;
|
||||
} else if (cc.sdkData2) {
|
||||
@ -111,12 +112,12 @@ module.exports = {
|
||||
token = {
|
||||
token: tmpToken,
|
||||
account: window.account,
|
||||
tips: "sign request",
|
||||
tips: 'sign request',
|
||||
nonce: window.nonce,
|
||||
signature: window.appsign,
|
||||
net_id: 321,
|
||||
};
|
||||
this.urlbd.addKV("type", 0);
|
||||
this.urlbd.addKV('type', 0);
|
||||
|
||||
// if (cc.sys.os == cc.sys.OS_ANDROID) {
|
||||
// token = {
|
||||
@ -141,12 +142,12 @@ module.exports = {
|
||||
|
||||
console.log(`TOKEN --- ${JSON.stringify(token)}`);
|
||||
|
||||
this.urlbd.addKV("token", JSON.stringify(token));
|
||||
this.urlbd.addKV('token', JSON.stringify(token));
|
||||
} else {
|
||||
if (cc.sdkdata) {
|
||||
this.urlbd.addKV("token", cc.sdkdata.token);
|
||||
this.urlbd.addKV('token', cc.sdkdata.token);
|
||||
} else if (cc.sdkData2) {
|
||||
this.urlbd.addKV("token", cc.sdkData2.token);
|
||||
this.urlbd.addKV('token', cc.sdkData2.token);
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,28 +157,41 @@ module.exports = {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
console.log(`login res --${restext}`);
|
||||
|
||||
console.log("errcode----" + obj.errcode);
|
||||
console.log('errcode----' + obj.errcode);
|
||||
|
||||
if (obj.errcode == 66) {
|
||||
console.log("用户不在白名单中");
|
||||
console.log('用户不在白名单中');
|
||||
uimanger.showUI(WhitelistTip.prefabPath);
|
||||
localStorage.removeItem("walletaccount");
|
||||
if (localStorage.getItem('walletaccount')) {
|
||||
localStorage.removeItem('walletaccount');
|
||||
}
|
||||
window.hasWallet = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj.errcode == 103) {
|
||||
console.log('服务器未开启');
|
||||
uimanger.showUI(ServerNotOpenTip.prefabPath);
|
||||
if (localStorage.getItem('walletaccount')) {
|
||||
localStorage.removeItem('walletaccount');
|
||||
}
|
||||
window.hasWallet = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj.errcode == 0) {
|
||||
console.log("[__login]success!" + JSON.stringify(obj));
|
||||
console.log('[__login]success!' + JSON.stringify(obj));
|
||||
cc.subchannel = obj.channel;
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[__login]failed!" + obj.errcode + ":" + obj.errmsg
|
||||
'[__login]failed!' + obj.errcode + ':' + obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("[__login]failed!" + errcode + ":" + errmsg);
|
||||
console.log('[__login]failed!' + errcode + ':' + errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
);
|
||||
@ -196,36 +210,36 @@ module.exports = {
|
||||
) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "activateWeiXinUser")
|
||||
.addKV("gameid", gameid)
|
||||
.addKV("account_id", accountid)
|
||||
.addKV("session_id", sessionid)
|
||||
.addKV("rawdata", raw)
|
||||
.addKV("signature", sign)
|
||||
.addKV("encrypted_data", encyptdata)
|
||||
.addKV("iv", iv);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'activateWeiXinUser')
|
||||
.addKV('gameid', gameid)
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid)
|
||||
.addKV('rawdata', raw)
|
||||
.addKV('signature', sign)
|
||||
.addKV('encrypted_data', encyptdata)
|
||||
.addKV('iv', iv);
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (restext) {
|
||||
if (restext == "") {
|
||||
failcb && failcb(0, -1, "restext is nullstring!");
|
||||
if (restext == '') {
|
||||
failcb && failcb(0, -1, 'restext is nullstring!');
|
||||
return;
|
||||
}
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj && obj.errcode == 0) {
|
||||
console.log("[__activeWX]success!" + JSON.stringify(obj));
|
||||
console.log('[__activeWX]success!' + JSON.stringify(obj));
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[__activeWX]failed!" + obj.errcode + ":" + obj.errmsg
|
||||
'[__activeWX]failed!' + obj.errcode + ':' + obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("[__activeWX]failed!" + errcode + ":" + errmsg);
|
||||
console.log('[__activeWX]failed!' + errcode + ':' + errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
);
|
||||
@ -234,19 +248,19 @@ module.exports = {
|
||||
__updateInfo(accountid, sessionid, usrinfo, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "updateUserInfo")
|
||||
.addKV("account_id", accountid)
|
||||
.addKV("session_id", sessionid)
|
||||
.addKV("nickname", usrinfo.nickname)
|
||||
.addKV("city", usrinfo.city)
|
||||
.addKV("province", usrinfo.province)
|
||||
.addKV("avatar_url", usrinfo.avatar_url)
|
||||
.addKV("country", usrinfo.country)
|
||||
.addKV("sex", usrinfo.sex)
|
||||
.addKV("birthday", usrinfo.birthday)
|
||||
.addKV("phone", usrinfo.phone)
|
||||
.addKV("location", usrinfo.location);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'updateUserInfo')
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid)
|
||||
.addKV('nickname', usrinfo.nickname)
|
||||
.addKV('city', usrinfo.city)
|
||||
.addKV('province', usrinfo.province)
|
||||
.addKV('avatar_url', usrinfo.avatar_url)
|
||||
.addKV('country', usrinfo.country)
|
||||
.addKV('sex', usrinfo.sex)
|
||||
.addKV('birthday', usrinfo.birthday)
|
||||
.addKV('phone', usrinfo.phone)
|
||||
.addKV('location', usrinfo.location);
|
||||
// if(!this.isoffical){
|
||||
// console.log(this.urlbd.baseurl);
|
||||
// }
|
||||
@ -255,17 +269,17 @@ module.exports = {
|
||||
function (restext) {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log("[__updateInfo]success!" + JSON.stringify(obj));
|
||||
console.log('[__updateInfo]success!' + JSON.stringify(obj));
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[__updateInfo]failed!" + obj.errcode + ":" + obj.errmsg
|
||||
'[__updateInfo]failed!' + obj.errcode + ':' + obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("[__updateInfo]failed!" + errcode + ":" + errmsg);
|
||||
console.log('[__updateInfo]failed!' + errcode + ':' + errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
);
|
||||
@ -274,11 +288,11 @@ module.exports = {
|
||||
__generalSignature(accountid, sessionid, signdata, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "signature")
|
||||
.addKV("account_id", accountid)
|
||||
.addKV("session_id", sessionid)
|
||||
.addKV("params", signdata);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'signature')
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid)
|
||||
.addKV('params', signdata);
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
@ -286,14 +300,14 @@ module.exports = {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log(
|
||||
"[__generalSignature]success!" + JSON.stringify(obj)
|
||||
'[__generalSignature]success!' + JSON.stringify(obj)
|
||||
);
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[__generalSignature]failed!" +
|
||||
'[__generalSignature]failed!' +
|
||||
obj.errcode +
|
||||
":" +
|
||||
':' +
|
||||
obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
@ -301,7 +315,7 @@ module.exports = {
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log(
|
||||
"[__generalSignature]failed!" + errcode + ":" + errmsg
|
||||
'[__generalSignature]failed!' + errcode + ':' + errmsg
|
||||
);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
@ -311,11 +325,11 @@ module.exports = {
|
||||
__generalToken(accountid, sessionid, sceneid, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "getAccessToken")
|
||||
.addKV("account_id", accountid)
|
||||
.addKV("session_id", sessionid)
|
||||
.addKV("scene", sceneid);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'getAccessToken')
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid)
|
||||
.addKV('scene', sceneid);
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
@ -323,21 +337,21 @@ module.exports = {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log(
|
||||
"[__generalToken]success!" + JSON.stringify(obj)
|
||||
'[__generalToken]success!' + JSON.stringify(obj)
|
||||
);
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[__generalToken]failed!" +
|
||||
'[__generalToken]failed!' +
|
||||
obj.errcode +
|
||||
":" +
|
||||
':' +
|
||||
obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("[__generalToken]failed!" + errcode + ":" + errmsg);
|
||||
console.log('[__generalToken]failed!' + errcode + ':' + errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
);
|
||||
@ -346,10 +360,10 @@ module.exports = {
|
||||
__getAnnouncement(channelid, gameid, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Annc")
|
||||
.addKV("a", "getAnnouncement")
|
||||
.addKV("gameid", gameid)
|
||||
.addKV("channel", channelid);
|
||||
.addKV('c', 'Annc')
|
||||
.addKV('a', 'getAnnouncement')
|
||||
.addKV('gameid', gameid)
|
||||
.addKV('channel', channelid);
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
@ -357,14 +371,14 @@ module.exports = {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log(
|
||||
"[__getAnnouncement]success!" + JSON.stringify(obj)
|
||||
'[__getAnnouncement]success!' + JSON.stringify(obj)
|
||||
);
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[__getAnnouncement]failed!" +
|
||||
'[__getAnnouncement]failed!' +
|
||||
obj.errcode +
|
||||
":" +
|
||||
':' +
|
||||
obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
@ -372,7 +386,7 @@ module.exports = {
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log(
|
||||
"[__getAnnouncement]failed!" + errcode + ":" + errmsg
|
||||
'[__getAnnouncement]failed!' + errcode + ':' + errmsg
|
||||
);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
@ -382,13 +396,13 @@ module.exports = {
|
||||
__getServerList(channelid, gameid, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "SrvList")
|
||||
.addKV("a", "getSrvList")
|
||||
.addKV("gameid", gameid)
|
||||
.addKV("channel", channelid);
|
||||
.addKV('c', 'SrvList')
|
||||
.addKV('a', 'getSrvList')
|
||||
.addKV('gameid', gameid)
|
||||
.addKV('channel', channelid);
|
||||
|
||||
if (this.env) {
|
||||
this.urlbd.addKV("env", this.env);
|
||||
this.urlbd.addKV('env', this.env);
|
||||
}
|
||||
|
||||
httpclient.httpGet(
|
||||
@ -397,14 +411,14 @@ module.exports = {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log(
|
||||
"[__getServerList]success!" + JSON.stringify(obj)
|
||||
'[__getServerList]success!' + JSON.stringify(obj)
|
||||
);
|
||||
successcb && successcb(obj.server_list);
|
||||
} else {
|
||||
console.log(
|
||||
"[__getServerList]failed!" +
|
||||
'[__getServerList]failed!' +
|
||||
obj.errcode +
|
||||
":" +
|
||||
':' +
|
||||
obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
@ -412,7 +426,7 @@ module.exports = {
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log(
|
||||
"[__getServerList]failed!" + errcode + ":" + errmsg
|
||||
'[__getServerList]failed!' + errcode + ':' + errmsg
|
||||
);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
@ -422,28 +436,28 @@ module.exports = {
|
||||
__loginYoume(accountid, sessionid, nickname, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "YouMe")
|
||||
.addKV("a", "login")
|
||||
.addKV("account_id", accountid)
|
||||
.addKV("session_id", sessionid)
|
||||
.addKV("nickname", nickname);
|
||||
.addKV('c', 'YouMe')
|
||||
.addKV('a', 'login')
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid)
|
||||
.addKV('nickname', nickname);
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (restext) {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log("[__loginYoume]success!" + JSON.stringify(obj));
|
||||
console.log('[__loginYoume]success!' + JSON.stringify(obj));
|
||||
successcb && successcb(obj.token);
|
||||
} else {
|
||||
console.log(
|
||||
"[__loginYoume]failed!" + obj.errcode + ":" + obj.errmsg
|
||||
'[__loginYoume]failed!' + obj.errcode + ':' + obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("[__loginYoume]failed!" + errcode + ":" + errmsg);
|
||||
console.log('[__loginYoume]failed!' + errcode + ':' + errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
);
|
||||
@ -530,7 +544,7 @@ module.exports = {
|
||||
}
|
||||
break;
|
||||
}
|
||||
console.log("[_loadLocalInfo]finish");
|
||||
console.log('[_loadLocalInfo]finish');
|
||||
this._localinfoloaded = true;
|
||||
},
|
||||
|
||||
@ -560,56 +574,56 @@ module.exports = {
|
||||
this.svuserinfo.birthday = info.birthday;
|
||||
this.svuserinfo.phone = info.phone;
|
||||
this.svuserinfo.location = info.location;
|
||||
console.log("[_loadServerInfo]finish");
|
||||
console.log('[_loadServerInfo]finish');
|
||||
this._svinfoloaded = true;
|
||||
},
|
||||
|
||||
_combineInfo(svinfo, lcinfo) {
|
||||
let bupdated = false;
|
||||
if (lcinfo.nickname && svinfo.nickname != lcinfo.nickname) {
|
||||
console.log("[nickname]" + svinfo.nickName + "|" + lcinfo.nickname);
|
||||
console.log('[nickname]' + svinfo.nickName + '|' + lcinfo.nickname);
|
||||
svinfo.nickname = lcinfo.nickname;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.city && svinfo.city != lcinfo.city) {
|
||||
console.log("[city]" + svinfo.city + "|" + lcinfo.city);
|
||||
console.log('[city]' + svinfo.city + '|' + lcinfo.city);
|
||||
svinfo.city = lcinfo.city;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.province && svinfo.province != lcinfo.province) {
|
||||
console.log("[province]" + svinfo.province + "|" + lcinfo.province);
|
||||
console.log('[province]' + svinfo.province + '|' + lcinfo.province);
|
||||
svinfo.province = lcinfo.province;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.country && svinfo.country != lcinfo.country) {
|
||||
console.log("[country]" + svinfo.country + "|" + lcinfo.country);
|
||||
console.log('[country]' + svinfo.country + '|' + lcinfo.country);
|
||||
svinfo.country = lcinfo.country;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.avatar_url && svinfo.avatar_url != lcinfo.avatar_url) {
|
||||
console.log(
|
||||
"[avatar_url]" + svinfo.avatar_url + "|" + lcinfo.avatar_url
|
||||
'[avatar_url]' + svinfo.avatar_url + '|' + lcinfo.avatar_url
|
||||
);
|
||||
svinfo.avatar_url = lcinfo.avatar_url;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.sex && svinfo.sex != lcinfo.sex) {
|
||||
console.log("[sex]" + svinfo.sex + "|" + lcinfo.sex);
|
||||
console.log('[sex]' + svinfo.sex + '|' + lcinfo.sex);
|
||||
svinfo.sex = lcinfo.sex;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.birthday && svinfo.birthday != lcinfo.birthday) {
|
||||
console.log("[birthday]" + svinfo.birthday + "|" + lcinfo.birthday);
|
||||
console.log('[birthday]' + svinfo.birthday + '|' + lcinfo.birthday);
|
||||
svinfo.birthday = lcinfo.birthday;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.phone && svinfo.phone != lcinfo.phone) {
|
||||
console.log("[phone]" + svinfo.phone + "|" + lcinfo.phone);
|
||||
console.log('[phone]' + svinfo.phone + '|' + lcinfo.phone);
|
||||
svinfo.phone = lcinfo.phone;
|
||||
bupdated = true;
|
||||
}
|
||||
if (lcinfo.location && svinfo.location != lcinfo.location) {
|
||||
console.log("[location]" + svinfo.location + "|" + lcinfo.location);
|
||||
console.log('[location]' + svinfo.location + '|' + lcinfo.location);
|
||||
svinfo.location = lcinfo.location;
|
||||
bupdated = true;
|
||||
}
|
||||
@ -621,15 +635,15 @@ module.exports = {
|
||||
this.owner = owner;
|
||||
this.channelid = channelid;
|
||||
this.gameid = gameid;
|
||||
this.sessionid = this.sessionid ? this.sessionid : "";
|
||||
this.accountid = this.accountid ? this.accountid : "";
|
||||
this.openid = this.openid ? this.openid : "";
|
||||
this.sessionid = this.sessionid ? this.sessionid : '';
|
||||
this.accountid = this.accountid ? this.accountid : '';
|
||||
this.openid = this.openid ? this.openid : '';
|
||||
this.env = env;
|
||||
this.isoffical = isoffical;
|
||||
this.logined = this.logined ? this.logined : false;
|
||||
this.urlbd = new urlbuilder(BaseNet.getNormalApiUrl("login"));
|
||||
this.urlbd = new urlbuilder(BaseNet.getNormalApiUrl('login'));
|
||||
console.log(
|
||||
"[jclogin]init:" + gameid + "|" + channelid + "|" + isoffical
|
||||
'[jclogin]init:' + gameid + '|' + channelid + '|' + isoffical
|
||||
);
|
||||
},
|
||||
|
||||
@ -678,12 +692,12 @@ module.exports = {
|
||||
//
|
||||
let self = this;
|
||||
let openId = BK.getSystemInfoSync().openId;
|
||||
console.log("loginQQ openid:" + openId);
|
||||
console.log('loginQQ openid:' + openId);
|
||||
// BK.Script.loadlib("GameRes://qqPlayCore.js") //预加载bricks js层接口
|
||||
BK.QQ.fetchOpenKey(function (errCode, cmd, data) {
|
||||
if (errCode == 0) {
|
||||
let openKey = data.openKey;
|
||||
console.log("loginQQ openKey:" + openKey);
|
||||
console.log('loginQQ openKey:' + openKey);
|
||||
self.login(openKey, successcb, failcb, openId);
|
||||
}
|
||||
});
|
||||
@ -691,12 +705,12 @@ module.exports = {
|
||||
break;
|
||||
case 6003:
|
||||
{
|
||||
console.log("[qg.login]BEGIN:" + exparam);
|
||||
if (typeof qg != "undefined") {
|
||||
console.log('[qg.login]BEGIN:' + exparam);
|
||||
if (typeof qg != 'undefined') {
|
||||
qg.login({
|
||||
pkgName: exparam,
|
||||
success: (res) => {
|
||||
console.log("[qg.login]success");
|
||||
console.log('[qg.login]success');
|
||||
console.log(JSON.stringify(res));
|
||||
this.login(
|
||||
res.token,
|
||||
@ -707,7 +721,7 @@ module.exports = {
|
||||
this.updateuserinfo(res);
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log("[qg.login]fail");
|
||||
console.log('[qg.login]fail');
|
||||
console.log(JSON.stringify(res));
|
||||
failcb && failcb();
|
||||
},
|
||||
@ -722,7 +736,7 @@ module.exports = {
|
||||
qg.getProfile({
|
||||
token: vivotoken,
|
||||
success: function (data) {
|
||||
console.log("[vivo.login]success");
|
||||
console.log('[vivo.login]success');
|
||||
self.login(
|
||||
vivotoken,
|
||||
successcb,
|
||||
@ -732,20 +746,20 @@ module.exports = {
|
||||
self.updateuserinfo(data);
|
||||
},
|
||||
fail: function (data, code) {
|
||||
console.log("[vivo.login]fail");
|
||||
console.log('[vivo.login]fail');
|
||||
failcb && failcb();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
qg.authorize({
|
||||
type: "token",
|
||||
type: 'token',
|
||||
success: function (data) {
|
||||
console.log("vivoAuthorize success");
|
||||
console.log('vivoAuthorize success');
|
||||
vivoGetUserInfo(data.accessToken);
|
||||
},
|
||||
fail: function (data, code) {
|
||||
console.log("vivoAuthorize fail");
|
||||
console.log('vivoAuthorize fail');
|
||||
failcb && failcb();
|
||||
},
|
||||
});
|
||||
@ -767,16 +781,16 @@ module.exports = {
|
||||
this._loginstarttime = new Date().getTime();
|
||||
wx.login({
|
||||
success: function (res) {
|
||||
console.log("[wx]login success!" + res.code);
|
||||
console.log('[wx]login success!' + res.code);
|
||||
self.login(res.code, successcb, failcb);
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log("[wx]login fail!");
|
||||
console.log('[wx]login fail!');
|
||||
failcb && failcb(0, res.errcode, res.errmsg);
|
||||
},
|
||||
});
|
||||
} else {
|
||||
failcb && failcb(-1, 0, "not weixin platform!");
|
||||
failcb && failcb(-1, 0, 'not weixin platform!');
|
||||
}
|
||||
},
|
||||
|
||||
@ -861,10 +875,10 @@ module.exports = {
|
||||
},
|
||||
|
||||
AccountID(openid) {
|
||||
if (this.accountid && this.accountid != "") {
|
||||
if (this.accountid && this.accountid != '') {
|
||||
return this.accountid;
|
||||
}
|
||||
return this.channelid + "_" + this.gameid + "_" + openid;
|
||||
return this.channelid + '_' + this.gameid + '_' + openid;
|
||||
},
|
||||
|
||||
setAccountID(accountid, sessionid) {
|
||||
@ -890,44 +904,44 @@ module.exports = {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "getNonce")
|
||||
.addKV("gameid", this.gameid)
|
||||
.addKV("account", window.account);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'getNonce')
|
||||
.addKV('gameid', this.gameid)
|
||||
.addKV('account', window.account);
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (res) {
|
||||
window.nonce = httpclient.JSON_parse(res).nonce;
|
||||
if (cc.sys.os == cc.sys.OS_IOS) {
|
||||
jsb.reflection.callStaticMethod(
|
||||
"AppController",
|
||||
"signApp:",
|
||||
'AppController',
|
||||
'signApp:',
|
||||
window.nonce
|
||||
);
|
||||
} else if (cc.sys.os == cc.sys.OS_ANDROID) {
|
||||
var signData = {
|
||||
types: {
|
||||
EIP712Domain: [
|
||||
{ name: "name", type: "string" },
|
||||
{ name: "version", type: "string" },
|
||||
{ name: 'name', type: 'string' },
|
||||
{ name: 'version', type: 'string' },
|
||||
],
|
||||
set: [
|
||||
{ name: "tips", type: "string" },
|
||||
{ name: "nonce", type: "string" },
|
||||
{ name: 'tips', type: 'string' },
|
||||
{ name: 'nonce', type: 'string' },
|
||||
],
|
||||
},
|
||||
primaryType: "set",
|
||||
domain: { name: "Auth", version: "1" },
|
||||
primaryType: 'set',
|
||||
domain: { name: 'Auth', version: '1' },
|
||||
message: {
|
||||
tips: "sign request",
|
||||
tips: 'sign request',
|
||||
nonce: window.nonce,
|
||||
},
|
||||
};
|
||||
|
||||
jsb.reflection.callStaticMethod(
|
||||
"org/cocos2dx/javascript/AppActivity",
|
||||
"signApp",
|
||||
"(Ljava/lang/String;)V",
|
||||
'org/cocos2dx/javascript/AppActivity',
|
||||
'signApp',
|
||||
'(Ljava/lang/String;)V',
|
||||
JSON.stringify(signData)
|
||||
);
|
||||
}
|
||||
@ -944,20 +958,20 @@ module.exports = {
|
||||
autoLogin(accountid, sessionid, successcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "sessionAuth")
|
||||
.addKV("account_id", accountid)
|
||||
.addKV("session_id", sessionid);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'sessionAuth')
|
||||
.addKV('account_id', accountid)
|
||||
.addKV('session_id', sessionid);
|
||||
|
||||
console.log("auto....");
|
||||
console.log('auto....');
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (res) {
|
||||
console.log("login success");
|
||||
console.log('login success');
|
||||
successcb && successcb(res);
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("login err" + errcode + errmsg);
|
||||
console.log('login err' + errcode + errmsg);
|
||||
}
|
||||
);
|
||||
},
|
||||
@ -965,15 +979,15 @@ module.exports = {
|
||||
getSwitch(cb) {
|
||||
const tmpUrlBd = new urlbuilder(BaseNet.getExaminingUrl());
|
||||
tmpUrlBd
|
||||
.addKV("c", "ServerSwitch")
|
||||
.addKV("a", "getSwitch")
|
||||
.addKV("gameid", 2006);
|
||||
.addKV('c', 'ServerSwitch')
|
||||
.addKV('a', 'getSwitch')
|
||||
.addKV('gameid', 2006);
|
||||
|
||||
httpclient.httpGet(
|
||||
tmpUrlBd.baseurl,
|
||||
function (res) {
|
||||
var obj = httpclient.JSON_parse(res);
|
||||
if (obj.examining == "1") {
|
||||
if (obj.examining == '1') {
|
||||
Config.isTest = true;
|
||||
} else {
|
||||
Config.isTest = false;
|
||||
@ -987,29 +1001,29 @@ module.exports = {
|
||||
getVoipSign(group_id, successcb, failcb) {
|
||||
this.urlbd.clear();
|
||||
this.urlbd
|
||||
.addKV("c", "Login")
|
||||
.addKV("a", "getVoipSign")
|
||||
.addKV("gameid", this.gameid)
|
||||
.addKV("account_id", this.accountid)
|
||||
.addKV("session_id", this.sessionid)
|
||||
.addKV("group_id", group_id);
|
||||
.addKV('c', 'Login')
|
||||
.addKV('a', 'getVoipSign')
|
||||
.addKV('gameid', this.gameid)
|
||||
.addKV('account_id', this.accountid)
|
||||
.addKV('session_id', this.sessionid)
|
||||
.addKV('group_id', group_id);
|
||||
|
||||
httpclient.httpGet(
|
||||
this.urlbd.baseurl,
|
||||
function (restext) {
|
||||
var obj = httpclient.JSON_parse(restext);
|
||||
if (obj.errcode == 0) {
|
||||
console.log("[getVoipSign]success!" + JSON.stringify(obj));
|
||||
console.log('[getVoipSign]success!' + JSON.stringify(obj));
|
||||
successcb && successcb(obj);
|
||||
} else {
|
||||
console.log(
|
||||
"[getVoipSign]failed!" + obj.errcode + ":" + obj.errmsg
|
||||
'[getVoipSign]failed!' + obj.errcode + ':' + obj.errmsg
|
||||
);
|
||||
failcb && failcb(0, obj.errcode, obj.errmsg);
|
||||
}
|
||||
},
|
||||
function (errcode, errmsg) {
|
||||
console.log("[getVoipSign]failed!" + errcode + ":" + errmsg);
|
||||
console.log('[getVoipSign]failed!' + errcode + ':' + errmsg);
|
||||
failcb && failcb(errcode, 0, errmsg);
|
||||
}
|
||||
);
|
||||
|
28
assets/scripts/tips/ServerNotOpenTip.ts
Normal file
28
assets/scripts/tips/ServerNotOpenTip.ts
Normal file
@ -0,0 +1,28 @@
|
||||
// Learn TypeScript:
|
||||
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/typescript.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
|
||||
// Learn Attribute:
|
||||
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
|
||||
// Learn life-cycle callbacks:
|
||||
// - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
|
||||
// - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class ServerNotOpenTip extends cc.Component {
|
||||
public static prefabPath = 'prefabs/tips/pb_servernoopen';
|
||||
|
||||
init(data: any) {
|
||||
// throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
onClickOK() {
|
||||
this.node.destroy();
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
9
assets/scripts/tips/ServerNotOpenTip.ts.meta
Normal file
9
assets/scripts/tips/ServerNotOpenTip.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "68652536-bbb9-4ed4-840f-19bb59062a75",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"packageUrl":"https://test.kingsome.cn/game2006/test/slim/","remoteManifestUrl":"https://test.kingsome.cn/game2006/test/slim/project.manifest","remoteVersionUrl":"https://test.kingsome.cn/game2006/test/slim/version.manifest","version":"0.3.0"}
|
||||
{"packageUrl":"https://www.cebg.games/pubgv4/","remoteManifestUrl":"https://www.cebg.games/pubgv4/project.manifest","remoteVersionUrl":"https://www.cebg.games/pubgv4/version.manifest","version":"0.1.0"}
|
@ -3,8 +3,7 @@ var path = require('path');
|
||||
var crypto = require('crypto');
|
||||
|
||||
//远程服务器所在的url
|
||||
|
||||
var url = 'https://test.kingsome.cn/game2006/test/slim/';
|
||||
var url = 'https://www.cebg.games/pubgv4/';
|
||||
|
||||
var manifest = {
|
||||
packageUrl: url,
|
||||
|
Loading…
x
Reference in New Issue
Block a user