平台框架代码更新

This commit is contained in:
2026-08-16 18:46:21 +08:00
parent ca7352b76c
commit 26a52e1a11
3 changed files with 2956 additions and 2971 deletions
+3 -1
View File
@@ -151,7 +151,8 @@ GameData.hallConfigName = ["enablePay",
'channelKey',//支付key 'channelKey',//支付key
'payCSS',//支付css 'payCSS',//支付css
'payJS',//支付js 'payJS',//支付js
'openVideo' 'openVideo',
'showVisitor'//是否显示游客登陆
];//是否开启视频]; ];//是否开启视频];
GameData.hallConfig = { GameData.hallConfig = {
enablePay:0, enablePay:0,
@@ -185,6 +186,7 @@ GameData.hallConfig = {
payCSS:"",//支付css payCSS:"",//支付css
payJS:"",//支付js payJS:"",//支付js
openVideo:0,//是否开启视频 openVideo:0,//是否开启视频
showVisitor:0//是否显示游客登陆
}; };
GameData.starName = "星星"; GameData.starName = "星星";
GameData.roomCardName = "房卡"; GameData.roomCardName = "房卡";
+78 -98
View File
@@ -32,16 +32,14 @@ function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
/* /*
* Perform a simple self-test to see if the VM is working * Perform a simple self-test to see if the VM is working
*/ */
function md5_vm_test() function md5_vm_test() {
{
return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
} }
/* /*
* Calculate the MD5 of an array of little-endian words, and a bit length * Calculate the MD5 of an array of little-endian words, and a bit length
*/ */
function core_md5(x, len) function core_md5(x, len) {
{
/* append padding */ /* append padding */
x[len >> 5] |= 0x80 << ((len) % 32); x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len; x[(((len + 64) >>> 9) << 4) + 14] = len;
@@ -51,8 +49,7 @@ function core_md5(x, len)
var c = -1732584194; var c = -1732584194;
var d = 271733878; var d = 271733878;
for(var i = 0; i < x.length; i += 16) for (var i = 0; i < x.length; i += 16) {
{
var olda = a; var olda = a;
var oldb = b; var oldb = b;
var oldc = c; var oldc = c;
@@ -138,38 +135,31 @@ function core_md5(x, len)
/* /*
* These functions implement the four basic operations the algorithm uses. * These functions implement the four basic operations the algorithm uses.
*/ */
function md5_cmn(q, a, b, x, s, t) function md5_cmn(q, a, b, x, s, t) {
{
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
} }
function md5_ff(a, b, c, d, x, s, t) function md5_ff(a, b, c, d, x, s, t) {
{
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
} }
function md5_gg(a, b, c, d, x, s, t) function md5_gg(a, b, c, d, x, s, t) {
{
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
} }
function md5_hh(a, b, c, d, x, s, t) function md5_hh(a, b, c, d, x, s, t) {
{
return md5_cmn(b ^ c ^ d, a, b, x, s, t); return md5_cmn(b ^ c ^ d, a, b, x, s, t);
} }
function md5_ii(a, b, c, d, x, s, t) function md5_ii(a, b, c, d, x, s, t) {
{
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
} }
/* /*
* Calculate the HMAC-MD5, of a key and some data * Calculate the HMAC-MD5, of a key and some data
*/ */
function core_hmac_md5(key, data) function core_hmac_md5(key, data) {
{
var bkey = str2binl(key); var bkey = str2binl(key);
if (bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); if (bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16); var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++) for (var i = 0; i < 16; i++) {
{
ipad[i] = bkey[i] ^ 0x36363636; ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C; opad[i] = bkey[i] ^ 0x5C5C5C5C;
} }
@@ -182,8 +172,7 @@ function core_hmac_md5(key, data)
* Add integers, wrapping at 2^32. This uses 16-bit operations internally * Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters. * to work around bugs in some JS interpreters.
*/ */
function safe_add(x, y) function safe_add(x, y) {
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF); var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16); var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF); return (msw << 16) | (lsw & 0xFFFF);
@@ -192,8 +181,7 @@ function safe_add(x, y)
/* /*
* Bitwise rotate a 32-bit number to the left. * Bitwise rotate a 32-bit number to the left.
*/ */
function bit_rol(num, cnt) function bit_rol(num, cnt) {
{
return (num << cnt) | (num >>> (32 - cnt)); return (num << cnt) | (num >>> (32 - cnt));
} }
@@ -201,8 +189,7 @@ function bit_rol(num, cnt)
* Convert a string to an array of little-endian words * Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored. * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
*/ */
function str2binl(str) function str2binl(str) {
{
var bin = Array(); var bin = Array();
var mask = (1 << chrsz) - 1; var mask = (1 << chrsz) - 1;
for (var i = 0; i < str.length * chrsz; i += chrsz) for (var i = 0; i < str.length * chrsz; i += chrsz)
@@ -213,8 +200,7 @@ function str2binl(str)
/* /*
* Convert an array of little-endian words to a string * Convert an array of little-endian words to a string
*/ */
function binl2str(bin) function binl2str(bin) {
{
var str = ""; var str = "";
var mask = (1 << chrsz) - 1; var mask = (1 << chrsz) - 1;
for (var i = 0; i < bin.length * 32; i += chrsz) for (var i = 0; i < bin.length * 32; i += chrsz)
@@ -225,12 +211,10 @@ function binl2str(bin)
/* /*
* Convert an array of little-endian words to a hex string. * Convert an array of little-endian words to a hex string.
*/ */
function binl2hex(binarray) function binl2hex(binarray) {
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = ""; var str = "";
for(var i = 0; i < binarray.length * 4; i++) for (var i = 0; i < binarray.length * 4; i++) {
{
str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +
hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF); hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);
} }
@@ -240,17 +224,14 @@ function binl2hex(binarray)
/* /*
* Convert an array of little-endian words to a base-64 string * Convert an array of little-endian words to a base-64 string
*/ */
function binl2b64(binarray) function binl2b64(binarray) {
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = ""; var str = "";
for(var i = 0; i < binarray.length * 4; i += 3) for (var i = 0; i < binarray.length * 4; i += 3) {
{
var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16)
| (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) | (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF); | ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
for(var j = 0; j < 4; j++) for (var j = 0; j < 4; j++) {
{
if (i * 8 + j * 6 > binarray.length * 32) str += b64pad; if (i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F); else str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);
} }
@@ -739,8 +720,7 @@ Func.SetText=function(_msg,len){
} }
return text_copy; return text_copy;
} }
Func.AjaxHttp = function(_data, func_callbackSucc, func_callbackFail, obj_inputmsg) Func.AjaxHttp = function (_data, func_callbackSucc, func_callbackFail, obj_inputmsg) {
{
// //
var obj_config = {}; var obj_config = {};
obj_config.url = GameData.AjaxUrl; obj_config.url = GameData.AjaxUrl;
@@ -751,8 +731,7 @@ Func.AjaxHttp = function(_data, func_callbackSucc, func_callbackFail, obj_inputm
obj_config.error = func_callbackFail; obj_config.error = func_callbackFail;
min_http(obj_config); min_http(obj_config);
} }
Func.AjaxHttp2 = function(_url,_data, func_callbackSucc, func_callbackFail, obj_inputmsg) Func.AjaxHttp2 = function (_url, _data, func_callbackSucc, func_callbackFail, obj_inputmsg) {
{
var obj_config = {}; var obj_config = {};
obj_config.url = _url; obj_config.url = _url;
@@ -763,8 +742,7 @@ Func.AjaxHttp2 = function(_url,_data, func_callbackSucc, func_callbackFail, obj_
obj_config.error = func_callbackFail; obj_config.error = func_callbackFail;
min_http(obj_config); min_http(obj_config);
} }
Func.AjaxHttp3 = function(_url,_data, func_callbackSucc, func_callbackFail, obj_inputmsg) Func.AjaxHttp3 = function (_url, _data, func_callbackSucc, func_callbackFail, obj_inputmsg) {
{
//var sData = "?"; //var sData = "?";
//for(var key in _data){ //for(var key in _data){
//sData += "&"+key+"="+_data[key]; //sData += "&"+key+"="+_data[key];
@@ -1119,64 +1097,52 @@ var IDValidator = function() {
GB2260 = GB2260 == null ? "" : GB2260; GB2260 = GB2260 == null ? "" : GB2260;
return new _IDValidator(GB2260); return new _IDValidator(GB2260);
} }
Func.subString=function(str, len, hasDot) Func.subString = function (str, len, hasDot) {
{
var newLength = 0; var newLength = 0;
var newStr = ""; var newStr = "";
var chineseRegex = /[^\x00-\xff]/g; var chineseRegex = /[^\x00-\xff]/g;
var singleChar = ""; var singleChar = "";
var strLength = str.replace(chineseRegex, "**").length; var strLength = str.replace(chineseRegex, "**").length;
for(var i = 0;i < strLength;i++) for (var i = 0; i < strLength; i++) {
{
singleChar = str.charAt(i).toString(); singleChar = str.charAt(i).toString();
if(singleChar.match(chineseRegex) != null) if (singleChar.match(chineseRegex) != null) {
{
newLength += 2; newLength += 2;
} }
else else {
{
newLength++; newLength++;
} }
if(newLength > len) if (newLength > len) {
{
break; break;
} }
newStr += singleChar; newStr += singleChar;
} }
if(hasDot && strLength > len) if (hasDot && strLength > len) {
{
newStr += "..."; newStr += "...";
} }
return newStr; return newStr;
} }
Func.subString2=function(str, len, hasDot) Func.subString2 = function (str, len, hasDot) {
{
var newLength = 0; var newLength = 0;
var newStr = ""; var newStr = "";
var chineseRegex = /[^\x00-\xff]/g; var chineseRegex = /[^\x00-\xff]/g;
var singleChar = ""; var singleChar = "";
var strLength = str.replace(chineseRegex, "**").length; var strLength = str.replace(chineseRegex, "**").length;
for(var i = 0;i < strLength;i++) for (var i = 0; i < strLength; i++) {
{
singleChar = str.charAt(i).toString(); singleChar = str.charAt(i).toString();
if(singleChar.match(chineseRegex) != null) if (singleChar.match(chineseRegex) != null) {
{
newLength += 2; newLength += 2;
} }
else else {
{
newLength++; newLength++;
} }
if(newLength > len) if (newLength > len) {
{
break; break;
} }
newStr += singleChar; newStr += singleChar;
} }
if(hasDot && strLength > len) if (hasDot && strLength > len) {
{
newStr += "..."; newStr += "...";
} }
return newStr; return newStr;
@@ -1261,23 +1227,45 @@ Func.sharefinend=function(sharefriend,type,webpageUrl,title,description,spidList
Func.visitorLogin = function () { Func.visitorLogin = function () {
//游客身份登入,随机游客数据 //游客身份登入,随机游客数据
GameData.isVisitor = true; // GameData.isVisitor = true;
GameData.isDeviceLogin = false; // GameData.isDeviceLogin = false;
var WxInfo = Utl.ReadData(Utl.Config.visitorinfo); var WxInfo = Utl.ReadData(Utl.Config.wxinfo);
if (WxInfo != null) { if (WxInfo != null) {
WxInfo = JSON.parse(WxInfo); WxInfo = JSON.parse(WxInfo);
sharelogin(WxInfo.openid, WxInfo.headimgurl, WxInfo.nickname, WxInfo.sex, WxInfo.city, WxInfo.Province, WxInfo.unionid); sharelogin(WxInfo.openid, WxInfo.headimgurl, WxInfo.nickname, WxInfo.sex, WxInfo.city, WxInfo.Province, WxInfo.unionid);
} else { } else {
var ram = 100000+ifast_random(100000); var pInfo = Func.simulatePlayerInfo("游客");
var headLoginList=["http://img5.imgtn.bdimg.com/it/u=110166870,238965605&fm=27&gp=0.jpg",
"http://www.qqzhi.com/uploadpic/2015-01-15/200511535.jpg", sharelogin(pInfo.openid, pInfo.openid.headimgurl, pInfo.nickname, pInfo.sex, pInfo.city, pInfo.province, pInfo.unionid);
"http://img0.imgtn.bdimg.com/it/u=2722294531,1396252661&fm=27&gp=0.jpg",
"http://p2.gexing.com/touxiang/20130201/1735/510b8c7c1e572_200x200_3.jpg?recache=20131108",
"http://www.qqzhi.com/uploadpic/2015-01-15/200512924.jpg"];
sharelogin(""+ram,headLoginList[ifast_random(headLoginList.length)],"游客"+ram,ifast_random(2)+1,"nanchang","jiangxi","ylgame"+ram);
} }
} }
Func.simulatePlayerInfo = function (nameString) {
var headLoginList = [
"https://img2.baidu.com/it/u=1823726962,2692568839&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
"https://img0.baidu.com/it/u=320875415,2231067789&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=3407774307,2859661062&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
"https://img2.baidu.com/it/u=1161398577,3592656327&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=2061657615,4194426181&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501",
"https://img2.baidu.com/it/u=3081347414,2363887197&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=1364384963,3982203144&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=3041194995,2386060237&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img2.baidu.com/it/u=2904976445,2884058010&fm=253&fmt=auto&app=120&f=JPEG?w=529&h=500",
"https://img0.baidu.com/it/u=1801052125,1596537112&fm=253&fmt=auto&app=120&f=JPEG?w=529&h=500",
];
var ram = ifast_random(100000);
var resInfo = {
openid: "testopenid_" + ram,
headimgurl: headLoginList[ifast_random(headLoginList.length)],
nickname: ram + '_' + nameString,
sex: ifast_random(2) + 1,
city: "nanchang",
province: "jiangxi",
unionid: "ylgame" + ram
}
return resInfo;
}
Func.deviceLogin = function (phone, sms) { Func.deviceLogin = function (phone, sms) {
//设备登录 //设备登录
GameData.isVisitor = false; GameData.isVisitor = false;
@@ -1362,22 +1350,9 @@ Func.accreditlogin=function(type){
if (GameData.h5Version == 1) { if (GameData.h5Version == 1) {
} else { } else {
var headLoginList=[ var pInfo = Func.simulatePlayerInfo("测试");
"https://img2.baidu.com/it/u=1823726962,2692568839&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
"https://img0.baidu.com/it/u=320875415,2231067789&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=3407774307,2859661062&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
"https://img2.baidu.com/it/u=1161398577,3592656327&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=2061657615,4194426181&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=501",
"https://img2.baidu.com/it/u=3081347414,2363887197&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=1364384963,3982203144&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img1.baidu.com/it/u=3041194995,2386060237&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500",
"https://img2.baidu.com/it/u=2904976445,2884058010&fm=253&fmt=auto&app=120&f=JPEG?w=529&h=500",
"https://img0.baidu.com/it/u=1801052125,1596537112&fm=253&fmt=auto&app=120&f=JPEG?w=529&h=500",
]; sharelogin(pInfo.openid, pInfo.openid.headimgurl, pInfo.nickname, pInfo.sex, pInfo.city, pInfo.province, pInfo.unionid);
var ram = ifast_random(100000);
sharelogin("fff23"+ram,headLoginList[ifast_random(headLoginList.length)],ram + "测试",ifast_random(2)+1,"nanchang","jiangxi","ylgame"+ram);
// sharelogin("fff23"+ram,headLoginList[ifast_random(headLoginList.length)],"测试"+ram,ifast_random(2)+1,"nanchang","jiangxi","oLVKis6bj3_l8qspMybG60KV2GN4"); // sharelogin("fff23"+ram,headLoginList[ifast_random(headLoginList.length)],"测试"+ram,ifast_random(2)+1,"nanchang","jiangxi","oLVKis6bj3_l8qspMybG60KV2GN4");
} }
@@ -2026,9 +2001,11 @@ Func.startlocation = function(type){
window.settings.startlocation(type); window.settings.startlocation(type);
} catch (e) { } catch (e) {
console.log("Func.startlocation:", type); console.log("Func.startlocation:", type);
getlocationinfo(JSON.stringify({"address":"江西省南昌市青云谱区施尧路靠近上海浦东发展银行(长天支行)","city":"南昌市", getlocationinfo(JSON.stringify({
"address": "江西省南昌市青云谱区施尧路靠近上海浦东发展银行(长天支行)", "city": "南昌市",
"cityCode": "0791", "country": "中国", "district": "青云谱区", "latitude": 28.623546, "longitude": 115.900333, "cityCode": "0791", "country": "中国", "district": "青云谱区", "latitude": 28.623546, "longitude": 115.900333,
"province":"江西省","street":"施尧路","errorCode":0})); "province": "江西省", "street": "施尧路", "errorCode": 0
}));
} }
} }
//获取定位 //获取定位
@@ -2044,9 +2021,11 @@ Func.getlocation = function(){
window.settings.getlocationinfo(); window.settings.getlocationinfo();
} catch (e) { } catch (e) {
console.log("Func.getlocation:"); console.log("Func.getlocation:");
getlocationinfo(JSON.stringify({"address":"江西省南昌市青云谱区施尧路靠近上海浦东发展银行(长天支行)","city":"南昌市", getlocationinfo(JSON.stringify({
"address": "江西省南昌市青云谱区施尧路靠近上海浦东发展银行(长天支行)", "city": "南昌市",
"cityCode": "0791", "country": "中国", "district": "青云谱区", "latitude": 28.623546, "longitude": 115.900333, "cityCode": "0791", "country": "中国", "district": "青云谱区", "latitude": 28.623546, "longitude": 115.900333,
"province":"江西省","street":"施尧路","errorCode":0})); "province": "江西省", "street": "施尧路", "errorCode": 0
}));
} }
} }
/* /*
@@ -2605,7 +2584,8 @@ var getVideoinfo=function(_playerid){
if (st < 0) { if (st < 0) {
//logmessage("_playeridError!"+_playerid,1); //logmessage("_playeridError!"+_playerid,1);
return;} return;
}
var rValue = {}; var rValue = {};
rValue.playerid = _playerid; rValue.playerid = _playerid;
+4 -1
View File
@@ -3332,7 +3332,10 @@ GameUI.JumpWxAuth = function() { //跳转微信授权
//set_self(3,19,382,0,0); //set_self(3,19,382,0,0);
//set_self(3,20,400,0,0); //set_self(3,20,400,0,0);
//set_self(3,21,116,0,0); //set_self(3,21,116,0,0);
if(GameData.hallConfig.showVisitor){
set_self(3,37,0,0,0);
set_self(177, 37, 1, 0, 0);
}
} }
if (GameData.hallConfig.qqLogin) { if (GameData.hallConfig.qqLogin) {
set_self(106, 37, 1, 0, 0); set_self(106, 37, 1, 0, 0);