修复BUG

This commit is contained in:
YZ\249929363 2024-05-31 16:24:20 +08:00
parent 17010139ce
commit 0563074283
47 changed files with 7757 additions and 7078 deletions

View File

@ -57,7 +57,7 @@
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": false,
"autoReleaseAssets": true,
"_id": "2d2f792f-a40c-49bb-a189-ed176a246e49"
},
{
@ -1166,7 +1166,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "6eyN1+nK5HT7svNqUsa2/+",
"sync": false
@ -1344,7 +1344,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "08Vcf5jRBOhLOtnEzMUku6",
"sync": false
@ -1451,7 +1451,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "f0DfDJ4PNDbb7lvykwzyBm",
"sync": false
@ -1482,7 +1482,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "38W68aamJOhbnBDiSboSCF",
"sync": false
@ -1661,7 +1661,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "07jJ4rjvBM3K8UmWuJPTSW",
"sync": false
@ -1770,7 +1770,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "cf00JqB1FL4J82EdUA2X13",
"sync": false
@ -1879,7 +1879,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "1beDtXl+VD86kzCArCfEPs",
"sync": false
@ -1890,7 +1890,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "d03AAa5MpCZY7eWAmnGlia",
"sync": false
@ -1998,7 +1998,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "de4HHWkIhExrJq1+nHHMA6",
"sync": false
@ -2106,7 +2106,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "05c46heZhJV4sYMqYyxlB5",
"sync": false
@ -2214,7 +2214,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "2an+mxcU5ApJz+ZlYlaw5G",
"sync": false
@ -2322,7 +2322,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "78MlwwIH1CYrPsut4N5MBU",
"sync": false
@ -2343,7 +2343,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "55FH2q1HJAyK0hrjxGH/+q",
"sync": false
@ -4967,7 +4967,7 @@
"__id__": 2
},
"component": "",
"_componentId": "e1b90/rohdEk4SdmmEZANaD",
"_componentId": "e74a999IDFOabyymZgXQIiy",
"handler": "backClick",
"customEventData": ""
},
@ -4988,25 +4988,6 @@
"_fitHeight": true,
"_id": "17HeE62vtFurfhKbLJeXdc"
},
{
"__type__": "e1b90/rohdEk4SdmmEZANaD",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"Player": {
"__id__": 69
},
"selfNode": {
"__id__": 86
},
"phone": {
"__id__": 89
},
"_id": "75enN1g2JHy7NqiKYVoxNQ"
},
{
"__type__": "cc.Widget",
"_name": "",
@ -5033,5 +5014,24 @@
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "45wIx1qRNIfKRBbYhYEP1r"
},
{
"__type__": "e74a999IDFOabyymZgXQIiy",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"Player": {
"__id__": 69
},
"selfNode": {
"__id__": 86
},
"phone": {
"__id__": 89
},
"_id": "81Iy69gIdCtp0UzAUPZ1+M"
}
]

View File

@ -1,588 +0,0 @@
var StorageMessage = require("Storage").StorageMessage;
window.GameTool = {
_startTime: 0,
_endTime: 0,
_totalTime: 0,
getSeedRandom: function (min, max) {//包含min 不包含max
max = max || 1;
min = min || 0;
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
let rnd = GM_INFO.currSeed / 233280.0;
let tmp = min + rnd * (max - min);
return parseInt(tmp);
},
getSetScreenResolutionFlag: function () {
let size = cc.winSize;
let width = size.width;
let height = size.height;
if ((height / width) > (16.2 / 9)) return false;
return true;
},
//判断全面屏适配
setFit: function (canvas) {
let flag = GameTool.getSetScreenResolutionFlag();
if (flag) {
// console.log("不是全面屏");
// canvas.fitWidth = false;
// canvas.fitHeight = true;
} else {
// console.log("是全面屏");
// canvas.fitWidth = true;
// canvas.fitHeight = false;
}
return flag;
},
// submitScoreButtonFunc: function(score1,fen1){
// console.log("上传分数:",score1,fen1)
// // var score = score1;
// // var fen = fen1;
// // if (CC_WECHATGAME) {
// // window.wx.postMessage({
// // messageType: 3,
// // MAIN_MENU_NUM: "guan",
// // score: score,
// // MAIN_MENU_FEN: "score",
// // fen: fen,
// // });
// // } else {
// // cc.log("提交得分: x1 : " + score)
// // }
// // return true;
// },
submitScoreButtonFunc: function(fen2,number){
console.log("number=",number)
if(number == 0){
console.log("上传分数:",fen2)
var fen = fen2;
if (CC_WECHATGAME) {
window.wx.postMessage({
messageType: 3,
MAIN_MENU_FEN: "score",
MAIN_MENU_NUM: "fen",
score: fen,
fen: 0,
});
} else {
cc.log("提交得分: x1 : " + fen)
}
}
else{
console.log("上传特殊分数:",fen2)
var fen = fen2;
if (CC_WECHATGAME) {
window.wx.postMessage({
messageType: 7,
MAIN_MENU_FEN: "score",
MAIN_MENU_NUM: "fen",
score: 0,
fen: fen,
});
} else {
cc.log("提交得分: x1 : " + fen)
}
}
return true;
},
getTip: function () {
let index = Math.floor(Math.random() * 4) + 1;
switch (index) {
case 1: {
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。"
}
case 2: {
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。"
}
case 3: {
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。"
}
case 4: {
return "尝试着顶开掉落的障碍,是个很酷的玩法。"
}
}
},
beginTiming: function () {
this._startTime = new Date().getTime();
},
endTiming: function () {
this._endTime = new Date().getTime();
// this._totalTime = endTime - this._startTime;
},
//如果是判断时常的游戏 调用此方法
updateScoreTime: function () {
let endTime = new Date().getTime();
let tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
this._endTime += tempTime / 1000;
this._totalTime = this._endTime.toFixed(2);
GM_INFO.currScore = this._totalTime;
this._startTime = endTime;
},
//倒计时调用此方法
countDown: function () {
this._endTime = new Date().getTime();
this._totalTime = parseInt((this._endTime - this._startTime) / 1000);
GM_INFO.remainingTime = GM_INFO.totalTime - this._totalTime;
},
httpRequest(url, data, success, fail) {
console.log("进入网络请求:");
wx.getNetworkType({
success(res) {
var networkType = res.networkType;
// console.log(networkType);
//有网络状态下
if(networkType == "wifi" ||networkType == "4g" || networkType == "3g" || networkType =="unknown"){
wx.request({
url: window.globalData.requestAPI + url,
data: data,
header: {
'content-type': 'application/json', // 默认值
'Authorization':window.globalData.BASE64_JWT_TOKEN?'Bearer '+window.globalData.BASE64_JWT_TOKEN:''
},
method: 'POST',
success(res) {
console.log('httpRequest:::::success',res);
success(res);
},
fail(res) {
console.log('httpRequest:::::fail', res,"失败url为",url);
fail(res)
}
})
}
else{
fail(res)
}
},
fail(res){
fail(res)
}
})
// console.log('httpRequest:::::', url, data, success, fail)
},
httpRequest_Notoken(url, data, success, fail) {
// console.log('httpRequest:::::', url, data, success, fail)
wx.getNetworkType({
success(res) {
var networkType = res.networkType;
// console.log(networkType);
//有网络状态下
if(networkType == "wifi" ||networkType == "4g" || networkType == "3g" || networkType =="unknown"){
wx.request({
url: window.globalData.requestAPI + url,
data: data,
header: {
'content-type': 'application/json', // 默认值
},
method: 'POST',
success(res) {
console.log('httpRequest:::::success',res);
success(res);
},
fail(res) {
console.log('httpRequest:::::fail', res,"失败url为",url);
fail(res)
}
})
}
else{
fail(res)
}
},
fail(res){
fail(res)
}
})
},
getGameInfo: function(node){
var jg = false;
var nodes = node;
let data = {
'appid': window.globalData.appid
}
window.GameTool.httpRequest(window.globalData.getUserInfoUrl, data, function (res) {
window.globalData.gameUserInfo = res.data.king_user; //user_id在这里
console.log("拿到服务器的信息",res.data);
if(window.globalData.gameUserInfo){
console.log("获得服务器游戏信息成功:",window.globalData.gameUserInfo);
if(window.globalData.gameUserInfo.unlock_1)
window.GM_INFO.unlock_1 = window.globalData.gameUserInfo.unlock_1;
if(window.globalData.gameUserInfo.unlock_2)
window.GM_INFO.unlock_2 = window.globalData.gameUserInfo.unlock_2;
//如果服务器有金币信息
if(window.globalData.gameUserInfo.coin){
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
if(StorageMessage.getStorage("Coin")){
if(window.globalData.gameUserInfo.coin != StorageMessage.getStorage("Coin")){
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
}
} //如果本地没有金币信息 , 以服务器金币信息为主
else{
window.GM_INFO.coin = window.globalData.gameUserInfo.coin;
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
}
}
else{
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
if(StorageMessage.getStorage("Coin")){
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
} //如果本地没有金币信息 , 以服务器金币信息为主
else{
window.GM_INFO.coin = 200;
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
}
}
cc.director.loadScene('GameBegin');
// console.log("即将进入这里");
// if(StorageMessage.getStorage("level")){
// // console.log("本地有等级信息;");
// // console.log("服务器信息等级为:",window.globalData.gameUserInfo.level);
// window.GM_INFO.level = StorageMessage.getStorage("level");
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// // console.log("本地等级信息为:",window.GM_INFO.level);
// //本地存储等级 小于服务器等级, 等于本地数据丢失,这时以服务器数据为主重新构建游戏
// if(window.GM_INFO.level < window.globalData.gameUserInfo.level){
// // nodes.active = true;
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// window.GameTool.reset();
// }
// //正常进入游戏,以本地数据为主,服务器数据为辅
// else{
// console.log("本地数据大以本地主数据为主");
// // window.GameTool.setGameInfo(true);
// }
// }
// else{
// console.log("笨地没等级数据");
// // nodes.active = true;
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// window.GameTool.reset();
// }
if (CC_WECHATGAME) {
wx.onShow(function(res){
if(res){
if(res.query){
console.log("分享中带的信息",res.query);
if(res.query.key1){
window.GameTool.setFrindHelp(res.query.key1);
}
if(res.query.key2){
window.GameTool.setFrindBlock(res.query.key2);
}
if(res.query.key3){
window.GameTool.setFrindBlockMax(res.query.key3);
}
}
}
});
wx.onHide(function(res){
console.log("检测退出游戏");
// window.arm = [];
// for(var i=0; i<12; i++){
// window.arm[i] = null;
// window.arm[i] = {error:"error"};
// }
// window.arm = StorageMessage.setStorage("arm",window.arm);
var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
window.GameTool.setGameInfo();
});
}
jg = true;
}
else{
console.log("拿到服务器信息失败");
cc.director.loadScene("LoadScene");
}
},function(){
jg = false;
console.log("get用户信息失败",res);
})
return jg;
},
//根据服务器数据重置所需要所有数据
reset: function(){
// if(window.globalData.gameUserInfo.arm)
// StorageMessage.setStorage("arm",window.globalData.gameUserInfo.arm);
// if(window.globalData.gameUserInfo.richest_coin)
// StorageMessage.setStorage("coin",parseInt(window.globalData.gameUserInfo.richest_coin));
// if(window.globalData.gameUserInfo.dimond)
// StorageMessage.setStorage("dimond",window.globalData.gameUserInfo.dimond);
// if(window.globalData.gameUserInfo.buy_time)
// StorageMessage.setStorage("buy_Time",window.globalData.gameUserInfo.buy_time);
// if(window.globalData.gameUserInfo.dimond_time)
// StorageMessage.setStorage("dimond_Time",window.globalData.gameUserInfo.dimond_time);
// if(window.globalData.gameUserInfo.level)
// StorageMessage.setStorage("level",window.globalData.gameUserInfo.level);
// if(window.globalData.gameUserInfo.total_Speed)
// StorageMessage.setStorage("total_Speed",parseInt(window.globalData.gameUserInfo.total_Speed));
// if(window.globalData.gameUserInfo.leave_time)
// StorageMessage.setStorage("leave_time",window.globalData.gameUserInfo.leave_time);
// if(window.globalData.gameUserInfo.reward1)
// StorageMessage.setStorage("share_Array",window.globalData.gameUserInfo.reward1);
// if(window.globalData.gameUserInfo.reward2)
// StorageMessage.setStorage("share_100",window.globalData.gameUserInfo.reward2);
// StorageMessage.setStorage("GM_INFO",window.GM_INFO);
console.log("本地数据丢失,重新启动游戏");
cc.director.loadScene('LoadScene');
},
setGameInfo: function(pd){
let data = {
// "richest_coin":window.coin+"",
// "arm":window.arm,
// "buy_time":window.buy_Time,
// "dimond":parseInt(window.dimond),
// "dimond_time":window.dimond_Time,
// "level":window.GM_INFO.level,
// "total_speed":window.total_Speed+"",
// "reward_1":window.GM_INFO.share_Array, //用于存储6个红包的领取信息
// "reward_2":window.share_100 //用于存储100个红包的领取信息
}
// console.log("存储之前检测:",window.arm,arms);
window.GameTool.httpRequest(window.globalData.richest, data, function (res) {
console.log('存储userInfo成功', res);
if(!pd){
window.GM_INFO.leave_time = res.data.leave_time;
StorageMessage.setStorage("leave_time",window.GM_INFO.leave_time);
}
},function(res){
console.log('存储userInfo失败', res);
if(!pd){
window.GM_INFO.leave_time = parseInt(new Date().valueOf()/1000);
StorageMessage.setStorage("leave_time",data);
}
})
},
//输入秒,返回需要展示时间格式
getTimeMargin:(second) => {
let total = second;
let hour = parseInt(total / (60 * 60));//计算整数小时数
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
let min = parseInt(afterHour / 60);//计算整数分
let afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
return '剩余:' + hour + ':' + min + ':' + afterMin
},
getTimeMargin2:(second) => {
let total = second;
let hour = parseInt(total / (60 * 60));//计算整数小时数
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
let min = parseInt(afterHour / 60);//计算整数分
if(min < 10) min = "0"+min;
let afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
if(afterMin < 10) afterMin = "0" + afterMin;
return '剩余:' + min + ':' + afterMin
},
setFrindBlock: function(userid){
// console.log("添加时候的userid");
let data = {
user_id:userid
}
// if(userid != window.globalData.gameUserInfo.user_id){
// console.log("进分享的不是自己");
// {
window.GameTool.httpRequest(window.globalData.entryBlock, data, function (res) {
console.log('添加红包助力信息成功', res)
}, function (res) {
console.log('添加红包助力信息失败', res)
})
// }
// }
// else{
// console.log("进入分享的是自己");
// }
},
// setFrindBlockMax: function(userid){
// // console.log("添加时候的userid");
// let data = {
// user_id:userid
// }
// // if(userid != window.globalData.gameUserInfo.user_id){
// // console.log("进分享的不是自己");
// // {
// window.GameTool.httpRequest(window.globalData.entryBlockMax, data, function (res) {
// console.log('添加最后的好友信息成功', res)
// }, function (res) {
// console.log('添加最后的好友信息信息失败', res)
// })
// // }
// // }
// // else{
// // console.log("进入分享的是自己");
// // }
// },
getSeedRandom: function (min, max) {//包含min 不包含max
max = max || 1;
min = min || 0;
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
let rnd = GM_INFO.currSeed / 233280.0;
let tmp = min + rnd * (max - min);
return parseInt(tmp);
},
//将时间转换为59:23
getTime: function(time){
var label = "";
var number_1 = parseInt(time/60);
var number_2 = time-number_1*60;
if(number_1 < 10){
number_1 = "0"+number_1;
}
if(number_2 < 10){
number_2 = "0"+number_2;
}
label = number_1 + ":" + number_2;
return label;
},
//number 为传进来的数值,type为最多显示几位数
getNumber: function(number,type){
// console.log(type,"需要转换的数字为:",number);
var count = 1000;
var place = type - 3;
if(number > Math.pow(count,8)*Math.pow(10,place)){
if(number/Math.pow(count,8) < 100)
number = parseInt(number/Math.pow(count,8)*10)/10+"S";
else
number = parseInt(number/Math.pow(count,8))+"S";
}
else if(number > Math.pow(count,7)*Math.pow(10,place)){
if(number/Math.pow(count,7) < 100)
number = parseInt(number/Math.pow(count,7)*10)/10+"s";
else
number = parseInt(number/Math.pow(count,7))+"s";
}
else if(number > Math.pow(count,6)*Math.pow(10,place)){
if(number/Math.pow(count,6) < 100)
number = parseInt(number/Math.pow(count,6)*10)/10+"Q";
else
number = parseInt(number/Math.pow(count,6))+"Q";
}
else if(number > Math.pow(count,5)*Math.pow(10,place)){
if(number/Math.pow(count,5) < 100)
number = parseInt(number/Math.pow(count,5)*10)/10+"q";
else
number = parseInt(number/Math.pow(count,5))+"q";
}
else if(number > Math.pow(count,4)*Math.pow(10,place)){
if(number/Math.pow(count,4) < 100)
number = parseInt(number/Math.pow(count,4)*10)/10+"t";
else
number = parseInt(number/Math.pow(count,4))+"t";
}
else if(number > Math.pow(count,3)*Math.pow(10,place)){
if(number/Math.pow(count,3) < 100)
number = parseInt(number/Math.pow(count,3)*10)/10+"b";
else
number = parseInt(number/Math.pow(count,3))+"b";
}
else if(number > Math.pow(count,2)*Math.pow(10,place)){
if(number/Math.pow(count,2) < 100)
number = parseInt(number/Math.pow(count,2)*10)/10+"m";
else
number = parseInt(number/Math.pow(count,2))+"m";
}
else if(number > Math.pow(count,1)*Math.pow(10,place)){
if(number/Math.pow(count,1) < 100){
number = parseInt(number/Math.pow(count,1)*10)/10+"k";
}
else
number = parseInt(number/Math.pow(count,1))+"k";
}
else{
number = parseInt(number/Math.pow(count,0))+"";
}
// console.log("结果为"+type+"位数",number);
return number;
},
begainTiming: function () {
this._startTime = new Date().getTime();
},
endTiming: function () {
let endTime = new Date().getTime();
this._endTime = endTime;
this._totalTime = endTime - this._startTime;
},
getScoreTime: function () {
let endTime = new Date().getTime();
let tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
GM_INFO.currScore += tempTime;
this._startTime = endTime;
},
getFormatTime: function (time) {
let date = new Date();
date.setTime(time);
let ms = date.getMilliseconds();
// let msString = date.getMilliseconds();
let msString = parseInt(ms / 10) % 100;
let secondString = date.getSeconds();
let minString = date.getMinutes();
if (msString < 10) {
msString = "0" + msString;
}
if (secondString < 10) {
secondString = "0" + secondString;
}
secondString = secondString + ":";
if (minString < 10) {
minString = "0" + minString;
}
minString = minString + ":";
return minString + secondString + msString;
},
pushLister:function () {
},
removeAllLister:function () {
},
};

View File

@ -0,0 +1,254 @@
import GameData from "../GameData";
import { StorageMessage } from "./Storage";
//最大工具类
var GameTool = {
_startTime: 0,
_endTime: 0,
_totalTime: 0,
getSeedRandom: function (min, max) {//包含min 不包含max
max = max || 1;
min = min || 0;
GameData._instance.GM_INFO.currSeed = (GameData._instance.GM_INFO.currSeed * 9301 + 49297) % 233280;
let rnd = GameData._instance.GM_INFO.currSeed / 233280.0;
let tmp = min + rnd * (max - min);
return Math.floor(tmp);
},
getSetScreenResolutionFlag: function () {
let size = cc.winSize;
let width = size.width;
let height = size.height;
if ((height / width) > (16.2 / 9)) return false;
return true;
},
//判断全面屏适配
setFit: function (canvas) {
let flag = GameTool.getSetScreenResolutionFlag();
if (flag) {
// console.log("不是全面屏");
// canvas.fitWidth = false;
// canvas.fitHeight = true;
} else {
// console.log("是全面屏");
// canvas.fitWidth = true;
// canvas.fitHeight = false;
}
return flag;
},
getTip: function () {
let index = Math.floor(Math.random() * 4) + 1;
switch (index) {
case 1: {
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。"
}
case 2: {
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。"
}
case 3: {
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。"
}
case 4: {
return "尝试着顶开掉落的障碍,是个很酷的玩法。"
}
}
},
beginTiming: function () {
this._startTime = new Date().getTime();
},
endTiming: function () {
this._endTime = new Date().getTime();
// this._totalTime = endTime - this._startTime;
},
//如果是判断时常的游戏 调用此方法
updateScoreTime: function () {
let endTime = new Date().getTime();
let tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
this._endTime += tempTime / 1000;
this._totalTime = this._endTime.toFixed(2);
GameData._instance.GM_INFO.currScore = this._totalTime;
this._startTime = endTime;
},
//倒计时调用此方法
countDown: function () {
this._endTime = new Date().getTime();
this._totalTime = Math.floor((this._endTime - this._startTime) / 1000);
GameData._instance.GM_INFO.remainingTime = GameData._instance.GM_INFO.totalTime - this._totalTime;
},
getGameInfo: function(node){
var jg = false;
return jg;
},
//根据服务器数据重置所需要所有数据
reset: function(){
console.log("本地数据丢失,重新启动游戏");
cc.director.loadScene('LoadScene');
},
setGameInfo: function(pd){
},
//输入秒,返回需要展示时间格式
getTimeMargin:(second) => {
let total = second;
let hour = Math.floor(total / (60 * 60));//计算整数小时数
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
let min = Math.floor(afterHour / 60);//计算整数分
let afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
return '剩余:' + hour + ':' + min + ':' + afterMin
},
getTimeMargin2:(second) => {
let total = second;
let min = null;
let afterMin = null;
let hour = Math.floor(total / (60 * 60));//计算整数小时数
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
min = Math.floor(afterHour / 60);//计算整数分
if(min < 10) min = "0"+min;
afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
if(afterMin < 10) afterMin = "0" + afterMin;
return '剩余:' + min + ':' + afterMin
},
setFrindBlock: function(userid){
},
//将时间转换为59:23
getTime: function(time){
var label = "";
var number_1 = null;
var number_2 = null;
number_1 = Math.floor(time/60)
number_2 = time-number_1*60;
if(number_1 < 10){
number_1 = "0"+number_1;
}
if(number_2 < 10){
number_2 = "0"+number_2;
}
label = number_1 + ":" + number_2;
return label;
},
//number 为传进来的数值,type为最多显示几位数
getNumber: function(number,type){
// console.log(type,"需要转换的数字为:",number);
var count = 1000;
var place = type - 3;
if(number > Math.pow(count,8)*Math.pow(10,place)){
if(number/Math.pow(count,8) < 100)
number = Math.floor(number/Math.pow(count,8)*10)/10+"S";
else
number = Math.floor(number/Math.pow(count,8))+"S";
}
else if(number > Math.pow(count,7)*Math.pow(10,place)){
if(number/Math.pow(count,7) < 100)
number = Math.floor(number/Math.pow(count,7)*10)/10+"s";
else
number = Math.floor(number/Math.pow(count,7))+"s";
}
else if(number > Math.pow(count,6)*Math.pow(10,place)){
if(number/Math.pow(count,6) < 100)
number = Math.floor(number/Math.pow(count,6)*10)/10+"Q";
else
number = Math.floor(number/Math.pow(count,6))+"Q";
}
else if(number > Math.pow(count,5)*Math.pow(10,place)){
if(number/Math.pow(count,5) < 100)
number = Math.floor(number/Math.pow(count,5)*10)/10+"q";
else
number = Math.floor(number/Math.pow(count,5))+"q";
}
else if(number > Math.pow(count,4)*Math.pow(10,place)){
if(number/Math.pow(count,4) < 100)
number = Math.floor(number/Math.pow(count,4)*10)/10+"t";
else
number = Math.floor(number/Math.pow(count,4))+"t";
}
else if(number > Math.pow(count,3)*Math.pow(10,place)){
if(number/Math.pow(count,3) < 100)
number = Math.floor(number/Math.pow(count,3)*10)/10+"b";
else
number = Math.floor(number/Math.pow(count,3))+"b";
}
else if(number > Math.pow(count,2)*Math.pow(10,place)){
if(number/Math.pow(count,2) < 100)
number = Math.floor(number/Math.pow(count,2)*10)/10+"m";
else
number = Math.floor(number/Math.pow(count,2))+"m";
}
else if(number > Math.pow(count,1)*Math.pow(10,place)){
if(number/Math.pow(count,1) < 100){
number = Math.floor(number/Math.pow(count,1)*10)/10+"k";
}
else
number = Math.floor(number/Math.pow(count,1))+"k";
}
else{
number = Math.floor(number/Math.pow(count,0))+"";
}
// console.log("结果为"+type+"位数",number);
return number;
},
begainTiming: function () {
this._startTime = new Date().getTime();
},
endTiming2: function () {
let endTime = new Date().getTime();
this._endTime = endTime;
this._totalTime = endTime - this._startTime;
},
getScoreTime: function () {
let endTime = new Date().getTime();
let tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
GameData._instance.GM_INFO.currScore += tempTime;
this._startTime = endTime;
},
getFormatTime: function (time) {
let date = new Date();
date.setTime(time);
let ms = date.getMilliseconds();
// let msString = date.getMilliseconds();
let msString = null;
let secondString = null;
let minString = null;
msString = Math.floor(ms / 10) % 100;
secondString = date.getSeconds();
minString = date.getMinutes();
if (msString < 10) {
msString = "0" + msString;
}
if (secondString < 10) {
secondString = "0" + secondString;
}
secondString = secondString + ":";
if (minString < 10) {
minString = "0" + minString;
}
minString = minString + ":";
return minString + secondString + msString;
},
pushLister:function () {
},
removeAllLister:function () {
},
};
export { GameTool };

View File

@ -1,7 +1,7 @@
{
"ver": "1.1.0",
"uuid": "a1dd7a8c-882a-4e2c-bdc5-0d725df431b2",
"importer": "javascript",
"uuid": "ddac3642-fbda-4742-bd05-b3d208870e1a",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,

View File

@ -0,0 +1,27 @@
//缓存浏览器数据
var StorageMessage = {
getStorage : function(key){
var result = null;
if(cc.sys.localStorage.getItem(key)){
var result = cc.sys.localStorage.getItem(key);
}
if(result){
result = JSON.parse(result);
}
return result;
},
setStorage : function(key,value){
//主动拉起分享接口
var temp = JSON.stringify(value);
cc.sys.localStorage.setItem(key, temp)
},
removeStorage : function(key){
//主动删除消息接口
if(cc.sys.localStorage.getItem(key)){
cc.sys.localStorage.removeItem(key)
}
},
};
export { StorageMessage };

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "f124c672-2895-4f3e-86ec-14a468f946a6",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"ver": "1.3.2",
"uuid": "32254f37-ac95-4912-a787-b8e0429ba0f1",
"uuid": "2a951e22-b1e0-4155-972d-251ef3fa8f5a",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,

File diff suppressed because it is too large Load Diff

View File

@ -1167,7 +1167,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "6eyN1+nK5HT7svNqUsa2/+",
"sync": false
@ -1345,7 +1345,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "08Vcf5jRBOhLOtnEzMUku6",
"sync": false
@ -1452,7 +1452,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "f0DfDJ4PNDbb7lvykwzyBm",
"sync": false
@ -1483,7 +1483,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "38W68aamJOhbnBDiSboSCF",
"sync": false
@ -1662,7 +1662,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "07jJ4rjvBM3K8UmWuJPTSW",
"sync": false
@ -1771,7 +1771,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "cf00JqB1FL4J82EdUA2X13",
"sync": false
@ -1880,7 +1880,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "1beDtXl+VD86kzCArCfEPs",
"sync": false
@ -1891,7 +1891,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "d03AAa5MpCZY7eWAmnGlia",
"sync": false
@ -1999,7 +1999,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "de4HHWkIhExrJq1+nHHMA6",
"sync": false
@ -2107,7 +2107,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "05c46heZhJV4sYMqYyxlB5",
"sync": false
@ -2215,7 +2215,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "2an+mxcU5ApJz+ZlYlaw5G",
"sync": false
@ -2323,7 +2323,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "78MlwwIH1CYrPsut4N5MBU",
"sync": false
@ -2344,7 +2344,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "55FH2q1HJAyK0hrjxGH/+q",
"sync": false
@ -4968,7 +4968,7 @@
"__id__": 2
},
"component": "",
"_componentId": "e1b90/rohdEk4SdmmEZANaD",
"_componentId": "e74a999IDFOabyymZgXQIiy",
"handler": "backClick",
"customEventData": ""
},
@ -4989,25 +4989,6 @@
"_fitHeight": true,
"_id": "17HeE62vtFurfhKbLJeXdc"
},
{
"__type__": "e1b90/rohdEk4SdmmEZANaD",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"Player": {
"__id__": 69
},
"selfNode": {
"__id__": 86
},
"phone": {
"__id__": 89
},
"_id": "75enN1g2JHy7NqiKYVoxNQ"
},
{
"__type__": "cc.Widget",
"_name": "",
@ -5034,5 +5015,24 @@
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "45wIx1qRNIfKRBbYhYEP1r"
},
{
"__type__": "e74a999IDFOabyymZgXQIiy",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"Player": {
"__id__": 69
},
"selfNode": {
"__id__": 86
},
"phone": {
"__id__": 89
},
"_id": "81Iy69gIdCtp0UzAUPZ1+M"
}
]

View File

@ -1,430 +0,0 @@
[
{
"__type__": "cc.Prefab",
"_name": "RankListItem",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "RankListItem",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 5
},
{
"__id__": 8
}
],
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_prefab": {
"__id__": 12
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 164,
"g": 118,
"b": 239,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "6eyN1+nK5HT7svNqUsa2/+",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "rankLab",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 16,
"g": 1,
"b": 1,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 97.87,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-46.832,
22.301,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "Label",
"_N$string": "Label",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "de4HHWkIhExrJq1+nHHMA6",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "nameLab",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": {
"__id__": 10
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 13,
"g": 1,
"b": 1,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100.06,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-45.717,
-24.531,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "name",
"_N$string": "name",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "05c46heZhJV4sYMqYyxlB5",
"sync": false
},
{
"__type__": "ca0f9k0oBVDbpQC+OMNTF3m",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]

View File

@ -1,529 +0,0 @@
"use strict";
cc._RF.push(module, 'a1dd7qMiCpOLL3FDXJd9DGy', 'GameTool');
// Script/tool/GameTool.js
"use strict";
var _window$GameTool;
var StorageMessage = require("Storage").StorageMessage;
window.GameTool = (_window$GameTool = {
_startTime: 0,
_endTime: 0,
_totalTime: 0,
getSeedRandom: function getSeedRandom(min, max) {
//包含min 不包含max
max = max || 1;
min = min || 0;
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return parseInt(tmp);
},
getSetScreenResolutionFlag: function getSetScreenResolutionFlag() {
var size = cc.winSize;
var width = size.width;
var height = size.height;
if (height / width > 16.2 / 9) return false;
return true;
},
//判断全面屏适配
setFit: function setFit(canvas) {
var flag = GameTool.getSetScreenResolutionFlag();
if (flag) {// console.log("不是全面屏");
// canvas.fitWidth = false;
// canvas.fitHeight = true;
} else {// console.log("是全面屏");
// canvas.fitWidth = true;
// canvas.fitHeight = false;
}
return flag;
},
// submitScoreButtonFunc: function(score1,fen1){
// console.log("上传分数:",score1,fen1)
// // var score = score1;
// // var fen = fen1;
// // if (CC_WECHATGAME) {
// // window.wx.postMessage({
// // messageType: 3,
// // MAIN_MENU_NUM: "guan",
// // score: score,
// // MAIN_MENU_FEN: "score",
// // fen: fen,
// // });
// // } else {
// // cc.log("提交得分: x1 : " + score)
// // }
// // return true;
// },
submitScoreButtonFunc: function submitScoreButtonFunc(fen2, number) {
console.log("number=", number);
if (number == 0) {
console.log("上传分数:", fen2);
var fen = fen2;
if (CC_WECHATGAME) {
window.wx.postMessage({
messageType: 3,
MAIN_MENU_FEN: "score",
MAIN_MENU_NUM: "fen",
score: fen,
fen: 0
});
} else {
cc.log("提交得分: x1 : " + fen);
}
} else {
console.log("上传特殊分数:", fen2);
var fen = fen2;
if (CC_WECHATGAME) {
window.wx.postMessage({
messageType: 7,
MAIN_MENU_FEN: "score",
MAIN_MENU_NUM: "fen",
score: 0,
fen: fen
});
} else {
cc.log("提交得分: x1 : " + fen);
}
}
return true;
},
getTip: function getTip() {
var index = Math.floor(Math.random() * 4) + 1;
switch (index) {
case 1:
{
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。";
}
case 2:
{
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。";
}
case 3:
{
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。";
}
case 4:
{
return "尝试着顶开掉落的障碍,是个很酷的玩法。";
}
}
},
beginTiming: function beginTiming() {
this._startTime = new Date().getTime();
},
endTiming: function endTiming() {
this._endTime = new Date().getTime(); // this._totalTime = endTime - this._startTime;
},
//如果是判断时常的游戏 调用此方法
updateScoreTime: function updateScoreTime() {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
this._endTime += tempTime / 1000;
this._totalTime = this._endTime.toFixed(2);
GM_INFO.currScore = this._totalTime;
this._startTime = endTime;
},
//倒计时调用此方法
countDown: function countDown() {
this._endTime = new Date().getTime();
this._totalTime = parseInt((this._endTime - this._startTime) / 1000);
GM_INFO.remainingTime = GM_INFO.totalTime - this._totalTime;
},
httpRequest: function httpRequest(url, data, _success, _fail) {
console.log("进入网络请求:");
wx.getNetworkType({
success: function success(res) {
var networkType = res.networkType; // console.log(networkType);
//有网络状态下
if (networkType == "wifi" || networkType == "4g" || networkType == "3g" || networkType == "unknown") {
wx.request({
url: window.globalData.requestAPI + url,
data: data,
header: {
'content-type': 'application/json',
// 默认值
'Authorization': window.globalData.BASE64_JWT_TOKEN ? 'Bearer ' + window.globalData.BASE64_JWT_TOKEN : ''
},
method: 'POST',
success: function success(res) {
console.log('httpRequest:::::success', res);
_success(res);
},
fail: function fail(res) {
console.log('httpRequest:::::fail', res, "失败url为", url);
_fail(res);
}
});
} else {
_fail(res);
}
},
fail: function fail(res) {
_fail(res);
}
}); // console.log('httpRequest:::::', url, data, success, fail)
},
httpRequest_Notoken: function httpRequest_Notoken(url, data, _success2, _fail2) {
// console.log('httpRequest:::::', url, data, success, fail)
wx.getNetworkType({
success: function success(res) {
var networkType = res.networkType; // console.log(networkType);
//有网络状态下
if (networkType == "wifi" || networkType == "4g" || networkType == "3g" || networkType == "unknown") {
wx.request({
url: window.globalData.requestAPI + url,
data: data,
header: {
'content-type': 'application/json' // 默认值
},
method: 'POST',
success: function success(res) {
console.log('httpRequest:::::success', res);
_success2(res);
},
fail: function fail(res) {
console.log('httpRequest:::::fail', res, "失败url为", url);
_fail2(res);
}
});
} else {
_fail2(res);
}
},
fail: function fail(res) {
_fail2(res);
}
});
},
getGameInfo: function getGameInfo(node) {
var jg = false;
var nodes = node;
var data = {
'appid': window.globalData.appid
};
window.GameTool.httpRequest(window.globalData.getUserInfoUrl, data, function (res) {
window.globalData.gameUserInfo = res.data.king_user; //user_id在这里
console.log("拿到服务器的信息", res.data);
if (window.globalData.gameUserInfo) {
console.log("获得服务器游戏信息成功:", window.globalData.gameUserInfo);
if (window.globalData.gameUserInfo.unlock_1) window.GM_INFO.unlock_1 = window.globalData.gameUserInfo.unlock_1;
if (window.globalData.gameUserInfo.unlock_2) window.GM_INFO.unlock_2 = window.globalData.gameUserInfo.unlock_2; //如果服务器有金币信息
if (window.globalData.gameUserInfo.coin) {
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
if (StorageMessage.getStorage("Coin")) {
if (window.globalData.gameUserInfo.coin != StorageMessage.getStorage("Coin")) {
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
}
} //如果本地没有金币信息 , 以服务器金币信息为主
else {
window.GM_INFO.coin = window.globalData.gameUserInfo.coin;
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
}
} else {
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
if (StorageMessage.getStorage("Coin")) {
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
} //如果本地没有金币信息 , 以服务器金币信息为主
else {
window.GM_INFO.coin = 200;
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
}
}
cc.director.loadScene('GameBegin'); // console.log("即将进入这里");
// if(StorageMessage.getStorage("level")){
// // console.log("本地有等级信息;");
// // console.log("服务器信息等级为:",window.globalData.gameUserInfo.level);
// window.GM_INFO.level = StorageMessage.getStorage("level");
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// // console.log("本地等级信息为:",window.GM_INFO.level);
// //本地存储等级 小于服务器等级, 等于本地数据丢失,这时以服务器数据为主重新构建游戏
// if(window.GM_INFO.level < window.globalData.gameUserInfo.level){
// // nodes.active = true;
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// window.GameTool.reset();
// }
// //正常进入游戏,以本地数据为主,服务器数据为辅
// else{
// console.log("本地数据大以本地主数据为主");
// // window.GameTool.setGameInfo(true);
// }
// }
// else{
// console.log("笨地没等级数据");
// // nodes.active = true;
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// window.GameTool.reset();
// }
if (CC_WECHATGAME) {
wx.onShow(function (res) {
if (res) {
if (res.query) {
console.log("分享中带的信息", res.query);
if (res.query.key1) {
window.GameTool.setFrindHelp(res.query.key1);
}
if (res.query.key2) {
window.GameTool.setFrindBlock(res.query.key2);
}
if (res.query.key3) {
window.GameTool.setFrindBlockMax(res.query.key3);
}
}
}
});
wx.onHide(function (res) {
console.log("检测退出游戏"); // window.arm = [];
// for(var i=0; i<12; i++){
// window.arm[i] = null;
// window.arm[i] = {error:"error"};
// }
// window.arm = StorageMessage.setStorage("arm",window.arm);
var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level, window.GM_INFO.coin);
window.GameTool.setGameInfo();
});
}
jg = true;
} else {
console.log("拿到服务器信息失败");
cc.director.loadScene("LoadScene");
}
}, function () {
jg = false;
console.log("get用户信息失败", res);
});
return jg;
},
//根据服务器数据重置所需要所有数据
reset: function reset() {
// if(window.globalData.gameUserInfo.arm)
// StorageMessage.setStorage("arm",window.globalData.gameUserInfo.arm);
// if(window.globalData.gameUserInfo.richest_coin)
// StorageMessage.setStorage("coin",parseInt(window.globalData.gameUserInfo.richest_coin));
// if(window.globalData.gameUserInfo.dimond)
// StorageMessage.setStorage("dimond",window.globalData.gameUserInfo.dimond);
// if(window.globalData.gameUserInfo.buy_time)
// StorageMessage.setStorage("buy_Time",window.globalData.gameUserInfo.buy_time);
// if(window.globalData.gameUserInfo.dimond_time)
// StorageMessage.setStorage("dimond_Time",window.globalData.gameUserInfo.dimond_time);
// if(window.globalData.gameUserInfo.level)
// StorageMessage.setStorage("level",window.globalData.gameUserInfo.level);
// if(window.globalData.gameUserInfo.total_Speed)
// StorageMessage.setStorage("total_Speed",parseInt(window.globalData.gameUserInfo.total_Speed));
// if(window.globalData.gameUserInfo.leave_time)
// StorageMessage.setStorage("leave_time",window.globalData.gameUserInfo.leave_time);
// if(window.globalData.gameUserInfo.reward1)
// StorageMessage.setStorage("share_Array",window.globalData.gameUserInfo.reward1);
// if(window.globalData.gameUserInfo.reward2)
// StorageMessage.setStorage("share_100",window.globalData.gameUserInfo.reward2);
// StorageMessage.setStorage("GM_INFO",window.GM_INFO);
console.log("本地数据丢失,重新启动游戏");
cc.director.loadScene('LoadScene');
},
setGameInfo: function setGameInfo(pd) {
var data = {// "richest_coin":window.coin+"",
// "arm":window.arm,
// "buy_time":window.buy_Time,
// "dimond":parseInt(window.dimond),
// "dimond_time":window.dimond_Time,
// "level":window.GM_INFO.level,
// "total_speed":window.total_Speed+"",
// "reward_1":window.GM_INFO.share_Array, //用于存储6个红包的领取信息
// "reward_2":window.share_100 //用于存储100个红包的领取信息
}; // console.log("存储之前检测:",window.arm,arms);
window.GameTool.httpRequest(window.globalData.richest, data, function (res) {
console.log('存储userInfo成功', res);
if (!pd) {
window.GM_INFO.leave_time = res.data.leave_time;
StorageMessage.setStorage("leave_time", window.GM_INFO.leave_time);
}
}, function (res) {
console.log('存储userInfo失败', res);
if (!pd) {
window.GM_INFO.leave_time = parseInt(new Date().valueOf() / 1000);
StorageMessage.setStorage("leave_time", data);
}
});
},
//输入秒,返回需要展示时间格式
getTimeMargin: function getTimeMargin(second) {
var total = second;
var hour = parseInt(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
var min = parseInt(afterHour / 60); //计算整数分
var afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
return '剩余:' + hour + ':' + min + ':' + afterMin;
},
getTimeMargin2: function getTimeMargin2(second) {
var total = second;
var hour = parseInt(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
var min = parseInt(afterHour / 60); //计算整数分
if (min < 10) min = "0" + min;
var afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
if (afterMin < 10) afterMin = "0" + afterMin;
return '剩余:' + min + ':' + afterMin;
},
setFrindBlock: function setFrindBlock(userid) {
// console.log("添加时候的userid");
var data = {
user_id: userid
}; // if(userid != window.globalData.gameUserInfo.user_id){
// console.log("进分享的不是自己");
// {
window.GameTool.httpRequest(window.globalData.entryBlock, data, function (res) {
console.log('添加红包助力信息成功', res);
}, function (res) {
console.log('添加红包助力信息失败', res);
}); // }
// }
// else{
// console.log("进入分享的是自己");
// }
}
}, _window$GameTool["getSeedRandom"] = function getSeedRandom(min, max) {
//包含min 不包含max
max = max || 1;
min = min || 0;
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return parseInt(tmp);
}, _window$GameTool.getTime = function getTime(time) {
var label = "";
var number_1 = parseInt(time / 60);
var number_2 = time - number_1 * 60;
if (number_1 < 10) {
number_1 = "0" + number_1;
}
if (number_2 < 10) {
number_2 = "0" + number_2;
}
label = number_1 + ":" + number_2;
return label;
}, _window$GameTool.getNumber = function getNumber(number, type) {
// console.log(type,"需要转换的数字为:",number);
var count = 1000;
var place = type - 3;
if (number > Math.pow(count, 8) * Math.pow(10, place)) {
if (number / Math.pow(count, 8) < 100) number = parseInt(number / Math.pow(count, 8) * 10) / 10 + "S";else number = parseInt(number / Math.pow(count, 8)) + "S";
} else if (number > Math.pow(count, 7) * Math.pow(10, place)) {
if (number / Math.pow(count, 7) < 100) number = parseInt(number / Math.pow(count, 7) * 10) / 10 + "s";else number = parseInt(number / Math.pow(count, 7)) + "s";
} else if (number > Math.pow(count, 6) * Math.pow(10, place)) {
if (number / Math.pow(count, 6) < 100) number = parseInt(number / Math.pow(count, 6) * 10) / 10 + "Q";else number = parseInt(number / Math.pow(count, 6)) + "Q";
} else if (number > Math.pow(count, 5) * Math.pow(10, place)) {
if (number / Math.pow(count, 5) < 100) number = parseInt(number / Math.pow(count, 5) * 10) / 10 + "q";else number = parseInt(number / Math.pow(count, 5)) + "q";
} else if (number > Math.pow(count, 4) * Math.pow(10, place)) {
if (number / Math.pow(count, 4) < 100) number = parseInt(number / Math.pow(count, 4) * 10) / 10 + "t";else number = parseInt(number / Math.pow(count, 4)) + "t";
} else if (number > Math.pow(count, 3) * Math.pow(10, place)) {
if (number / Math.pow(count, 3) < 100) number = parseInt(number / Math.pow(count, 3) * 10) / 10 + "b";else number = parseInt(number / Math.pow(count, 3)) + "b";
} else if (number > Math.pow(count, 2) * Math.pow(10, place)) {
if (number / Math.pow(count, 2) < 100) number = parseInt(number / Math.pow(count, 2) * 10) / 10 + "m";else number = parseInt(number / Math.pow(count, 2)) + "m";
} else if (number > Math.pow(count, 1) * Math.pow(10, place)) {
if (number / Math.pow(count, 1) < 100) {
number = parseInt(number / Math.pow(count, 1) * 10) / 10 + "k";
} else number = parseInt(number / Math.pow(count, 1)) + "k";
} else {
number = parseInt(number / Math.pow(count, 0)) + "";
} // console.log("结果为"+type+"位数",number);
return number;
}, _window$GameTool.begainTiming = function begainTiming() {
this._startTime = new Date().getTime();
}, _window$GameTool["endTiming"] = function endTiming() {
var endTime = new Date().getTime();
this._endTime = endTime;
this._totalTime = endTime - this._startTime;
}, _window$GameTool.getScoreTime = function getScoreTime() {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
GM_INFO.currScore += tempTime;
this._startTime = endTime;
}, _window$GameTool.getFormatTime = function getFormatTime(time) {
var date = new Date();
date.setTime(time);
var ms = date.getMilliseconds(); // let msString = date.getMilliseconds();
var msString = parseInt(ms / 10) % 100;
var secondString = date.getSeconds();
var minString = date.getMinutes();
if (msString < 10) {
msString = "0" + msString;
}
if (secondString < 10) {
secondString = "0" + secondString;
}
secondString = secondString + ":";
if (minString < 10) {
minString = "0" + minString;
}
minString = minString + ":";
return minString + secondString + msString;
}, _window$GameTool.pushLister = function pushLister() {}, _window$GameTool.removeAllLister = function removeAllLister() {}, _window$GameTool);
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,247 @@
"use strict";
cc._RF.push(module, 'ddac3ZC+9pHQr0Fs9IIhw4a', 'GameTool');
// Script/tool/GameTool.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GameTool = void 0;
var GameData_1 = require("../GameData");
//最大工具类
var GameTool = {
_startTime: 0,
_endTime: 0,
_totalTime: 0,
getSeedRandom: function (min, max) {
max = max || 1;
min = min || 0;
GameData_1.default._instance.GM_INFO.currSeed = (GameData_1.default._instance.GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = GameData_1.default._instance.GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return Math.floor(tmp);
},
getSetScreenResolutionFlag: function () {
var size = cc.winSize;
var width = size.width;
var height = size.height;
if ((height / width) > (16.2 / 9))
return false;
return true;
},
//判断全面屏适配
setFit: function (canvas) {
var flag = GameTool.getSetScreenResolutionFlag();
if (flag) {
// console.log("不是全面屏");
// canvas.fitWidth = false;
// canvas.fitHeight = true;
}
else {
// console.log("是全面屏");
// canvas.fitWidth = true;
// canvas.fitHeight = false;
}
return flag;
},
getTip: function () {
var index = Math.floor(Math.random() * 4) + 1;
switch (index) {
case 1: {
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。";
}
case 2: {
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。";
}
case 3: {
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。";
}
case 4: {
return "尝试着顶开掉落的障碍,是个很酷的玩法。";
}
}
},
beginTiming: function () {
this._startTime = new Date().getTime();
},
endTiming: function () {
this._endTime = new Date().getTime();
// this._totalTime = endTime - this._startTime;
},
//如果是判断时常的游戏 调用此方法
updateScoreTime: function () {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
this._endTime += tempTime / 1000;
this._totalTime = this._endTime.toFixed(2);
GameData_1.default._instance.GM_INFO.currScore = this._totalTime;
this._startTime = endTime;
},
//倒计时调用此方法
countDown: function () {
this._endTime = new Date().getTime();
this._totalTime = Math.floor((this._endTime - this._startTime) / 1000);
GameData_1.default._instance.GM_INFO.remainingTime = GameData_1.default._instance.GM_INFO.totalTime - this._totalTime;
},
getGameInfo: function (node) {
var jg = false;
return jg;
},
//根据服务器数据重置所需要所有数据
reset: function () {
console.log("本地数据丢失,重新启动游戏");
cc.director.loadScene('LoadScene');
},
setGameInfo: function (pd) {
},
//输入秒,返回需要展示时间格式
getTimeMargin: function (second) {
var total = second;
var hour = Math.floor(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
var min = Math.floor(afterHour / 60); //计算整数分
var afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
return '剩余:' + hour + ':' + min + ':' + afterMin;
},
getTimeMargin2: function (second) {
var total = second;
var min = null;
var afterMin = null;
var hour = Math.floor(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
min = Math.floor(afterHour / 60); //计算整数分
if (min < 10)
min = "0" + min;
afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
if (afterMin < 10)
afterMin = "0" + afterMin;
return '剩余:' + min + ':' + afterMin;
},
setFrindBlock: function (userid) {
},
//将时间转换为59:23
getTime: function (time) {
var label = "";
var number_1 = null;
var number_2 = null;
number_1 = Math.floor(time / 60);
number_2 = time - number_1 * 60;
if (number_1 < 10) {
number_1 = "0" + number_1;
}
if (number_2 < 10) {
number_2 = "0" + number_2;
}
label = number_1 + ":" + number_2;
return label;
},
//number 为传进来的数值,type为最多显示几位数
getNumber: function (number, type) {
// console.log(type,"需要转换的数字为:",number);
var count = 1000;
var place = type - 3;
if (number > Math.pow(count, 8) * Math.pow(10, place)) {
if (number / Math.pow(count, 8) < 100)
number = Math.floor(number / Math.pow(count, 8) * 10) / 10 + "S";
else
number = Math.floor(number / Math.pow(count, 8)) + "S";
}
else if (number > Math.pow(count, 7) * Math.pow(10, place)) {
if (number / Math.pow(count, 7) < 100)
number = Math.floor(number / Math.pow(count, 7) * 10) / 10 + "s";
else
number = Math.floor(number / Math.pow(count, 7)) + "s";
}
else if (number > Math.pow(count, 6) * Math.pow(10, place)) {
if (number / Math.pow(count, 6) < 100)
number = Math.floor(number / Math.pow(count, 6) * 10) / 10 + "Q";
else
number = Math.floor(number / Math.pow(count, 6)) + "Q";
}
else if (number > Math.pow(count, 5) * Math.pow(10, place)) {
if (number / Math.pow(count, 5) < 100)
number = Math.floor(number / Math.pow(count, 5) * 10) / 10 + "q";
else
number = Math.floor(number / Math.pow(count, 5)) + "q";
}
else if (number > Math.pow(count, 4) * Math.pow(10, place)) {
if (number / Math.pow(count, 4) < 100)
number = Math.floor(number / Math.pow(count, 4) * 10) / 10 + "t";
else
number = Math.floor(number / Math.pow(count, 4)) + "t";
}
else if (number > Math.pow(count, 3) * Math.pow(10, place)) {
if (number / Math.pow(count, 3) < 100)
number = Math.floor(number / Math.pow(count, 3) * 10) / 10 + "b";
else
number = Math.floor(number / Math.pow(count, 3)) + "b";
}
else if (number > Math.pow(count, 2) * Math.pow(10, place)) {
if (number / Math.pow(count, 2) < 100)
number = Math.floor(number / Math.pow(count, 2) * 10) / 10 + "m";
else
number = Math.floor(number / Math.pow(count, 2)) + "m";
}
else if (number > Math.pow(count, 1) * Math.pow(10, place)) {
if (number / Math.pow(count, 1) < 100) {
number = Math.floor(number / Math.pow(count, 1) * 10) / 10 + "k";
}
else
number = Math.floor(number / Math.pow(count, 1)) + "k";
}
else {
number = Math.floor(number / Math.pow(count, 0)) + "";
}
// console.log("结果为"+type+"位数",number);
return number;
},
begainTiming: function () {
this._startTime = new Date().getTime();
},
endTiming2: function () {
var endTime = new Date().getTime();
this._endTime = endTime;
this._totalTime = endTime - this._startTime;
},
getScoreTime: function () {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
GameData_1.default._instance.GM_INFO.currScore += tempTime;
this._startTime = endTime;
},
getFormatTime: function (time) {
var date = new Date();
date.setTime(time);
var ms = date.getMilliseconds();
// let msString = date.getMilliseconds();
var msString = null;
var secondString = null;
var minString = null;
msString = Math.floor(ms / 10) % 100;
secondString = date.getSeconds();
minString = date.getMinutes();
if (msString < 10) {
msString = "0" + msString;
}
if (secondString < 10) {
secondString = "0" + secondString;
}
secondString = secondString + ":";
if (minString < 10) {
minString = "0" + minString;
}
minString = minString + ":";
return minString + secondString + msString;
},
pushLister: function () {
},
removeAllLister: function () {
},
};
exports.GameTool = GameTool;
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
"use strict";
cc._RF.push(module, 'f124cZyKJVPPobsFKRo+Uam', 'Storage');
// Script/tool/Storage.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StorageMessage = void 0;
//缓存浏览器数据
var StorageMessage = {
getStorage: function (key) {
var result = null;
if (cc.sys.localStorage.getItem(key)) {
var result = cc.sys.localStorage.getItem(key);
}
if (result) {
result = JSON.parse(result);
}
return result;
},
setStorage: function (key, value) {
//主动拉起分享接口
var temp = JSON.stringify(value);
cc.sys.localStorage.setItem(key, temp);
},
removeStorage: function (key) {
//主动删除消息接口
if (cc.sys.localStorage.getItem(key)) {
cc.sys.localStorage.removeItem(key);
}
},
};
exports.StorageMessage = StorageMessage;
cc._RF.pop();

View File

@ -0,0 +1 @@
{"version":3,"sources":["assets\\Script\\tool\\Storage.ts"],"names":[],"mappings":";;;;;;;AAAA,SAAS;AACT,IAAI,cAAc,GAAG;IACjB,UAAU,EAAG,UAAS,GAAG;QACrB,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC/C;QAED,IAAG,MAAM,EAAC;YACR,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,UAAU,EAAG,UAAS,GAAG,EAAC,KAAK;QAC3B,UAAU;QACV,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;IACD,aAAa,EAAG,UAAS,GAAG;QAC1B,UAAU;QACV,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;SACpC;IACH,CAAC;CACJ,CAAC;AAEO,wCAAc","file":"","sourceRoot":"/","sourcesContent":["//缓存浏览器数据\nvar StorageMessage = {\n getStorage : function(key){\n var result = null;\n if(cc.sys.localStorage.getItem(key)){\n var result = cc.sys.localStorage.getItem(key);\n }\n \n if(result){\n result = JSON.parse(result);\n }\n return result;\n },\n setStorage : function(key,value){\n //主动拉起分享接口\n var temp = JSON.stringify(value);\n cc.sys.localStorage.setItem(key, temp)\n },\n removeStorage : function(key){\n //主动删除消息接口\n if(cc.sys.localStorage.getItem(key)){\n cc.sys.localStorage.removeItem(key)\n }\n },\n};\n\nexport { StorageMessage };"]}

File diff suppressed because it is too large Load Diff

View File

@ -13,13 +13,13 @@
"type": "dock-h",
"children": [
{
"width": 207.1666717529297,
"width": 207.28125,
"height": 571,
"type": "dock-v",
"children": [
{
"width": 207.1666717529297,
"height": 307.9895935058594,
"width": 207.28125,
"height": 308.13543701171875,
"type": "panel",
"active": 0,
"children": [
@ -27,8 +27,8 @@
]
},
{
"width": 207.1666717529297,
"height": 260,
"width": 207.28125,
"height": 259.8645935058594,
"type": "panel",
"active": 0,
"children": [
@ -38,7 +38,7 @@
]
},
{
"width": 759.59375,
"width": 759.3333740234375,
"height": 571,
"type": "panel",
"active": 0,
@ -47,7 +47,7 @@
]
},
{
"width": 307.2395935058594,
"width": 307.375,
"height": 571,
"type": "panel",
"active": 0,

View File

@ -1,9 +1,8 @@
{
"last-edit": "4eaf518b-35ec-4262-928d-4d497c3f2830",
"last-edit": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"recent-items": [
"40ba7e70-1826-4aa1-92f3-aa63ae39294b",
"32254f37-ac95-4912-a787-b8e0429ba0f1",
"2d2f792f-a40c-49bb-a189-ed176a246e49",
"774829bb-123e-48b6-930e-6b3e02491506",
"9c08062d-4cf1-4b6e-a8ba-4a3881cc7e7d",
"3a232388-d8dc-4f79-a1ea-82f6385b7ce2",
@ -11,6 +10,7 @@
"13110e4f-3587-4e6b-8811-0ca16cac8149",
"d1323772-4ab2-4527-bd20-501fe4fb9723",
"4b9c5a7e-c645-48a4-9aca-5df381ce4ef5",
"4eaf518b-35ec-4262-928d-4d497c3f2830"
"4eaf518b-35ec-4262-928d-4d497c3f2830",
"2d2f792f-a40c-49bb-a189-ed176a246e49"
]
}

View File

@ -185,10 +185,7 @@
"a9Y/TP/QhAdq9i2KGsTC0d",
"a1BRwywGFMT6iJxK+nijOf",
"7aHA1K+7hE8YNbYjVirEih",
"8ak5WlHVBELqSzRzcpZa3P",
"a2Zfykcl1GPqJhA7ixiKd3",
"10unPSfi1NUb30N1EjhieB",
"791LpnRkFNkqdfpCoJ3Pqk",
"fe7qLOC0RM9qPt+IfQpa5W",
"8fIUbpCjhI5r01JqiMBRub",
"78pYT7vxBK7YbD2aVkC4Kw",
@ -201,6 +198,17 @@
"a5O+jG/8JF/bXXMh61VbrP",
"ecZU+ZNaxJvovWhjTwolW3",
"1eUcABlmZJH62rOyXieYFR",
"9ah+lyxSVO6Jf1EY5aebLK"
"9ah+lyxSVO6Jf1EY5aebLK",
"78Sk802p9L/Ip+ZPEFbJnp",
"cfD+6eekJE44Ilk2xG5ORu",
"6bCpWS8ktAfIpBUoWywuvF",
"97jJpx7PFP3KaIhLHDBrwq",
"beOm6xY9JGcpUIgHepr4za",
"05VwVz2ohMvbMUbFxpVLs6",
"a0jBYkupRJ1qUCnIBv+/lY",
"5dxBdyCr9Dd7WMwsS/0Owj",
"791LpnRkFNkqdfpCoJ3Pqk",
"8ak5WlHVBELqSzRzcpZa3P",
"10unPSfi1NUb30N1EjhieB"
]
}

View File

@ -57,7 +57,7 @@
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": false,
"autoReleaseAssets": true,
"_id": "2d2f792f-a40c-49bb-a189-ed176a246e49"
},
{
@ -1166,7 +1166,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "6eyN1+nK5HT7svNqUsa2/+",
"sync": false
@ -1344,7 +1344,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "08Vcf5jRBOhLOtnEzMUku6",
"sync": false
@ -1451,7 +1451,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "f0DfDJ4PNDbb7lvykwzyBm",
"sync": false
@ -1482,7 +1482,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "38W68aamJOhbnBDiSboSCF",
"sync": false
@ -1661,7 +1661,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "07jJ4rjvBM3K8UmWuJPTSW",
"sync": false
@ -1770,7 +1770,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "cf00JqB1FL4J82EdUA2X13",
"sync": false
@ -1879,7 +1879,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "1beDtXl+VD86kzCArCfEPs",
"sync": false
@ -1890,7 +1890,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "d03AAa5MpCZY7eWAmnGlia",
"sync": false
@ -1998,7 +1998,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "de4HHWkIhExrJq1+nHHMA6",
"sync": false
@ -2106,7 +2106,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "05c46heZhJV4sYMqYyxlB5",
"sync": false
@ -2214,7 +2214,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "2an+mxcU5ApJz+ZlYlaw5G",
"sync": false
@ -2322,7 +2322,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "78MlwwIH1CYrPsut4N5MBU",
"sync": false
@ -2343,7 +2343,7 @@
"__id__": 20
},
"asset": {
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
"__uuid__": "2a951e22-b1e0-4155-972d-251ef3fa8f5a"
},
"fileId": "55FH2q1HJAyK0hrjxGH/+q",
"sync": false
@ -4967,7 +4967,7 @@
"__id__": 2
},
"component": "",
"_componentId": "e1b90/rohdEk4SdmmEZANaD",
"_componentId": "e74a999IDFOabyymZgXQIiy",
"handler": "backClick",
"customEventData": ""
},
@ -4988,25 +4988,6 @@
"_fitHeight": true,
"_id": "17HeE62vtFurfhKbLJeXdc"
},
{
"__type__": "e1b90/rohdEk4SdmmEZANaD",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"Player": {
"__id__": 69
},
"selfNode": {
"__id__": 86
},
"phone": {
"__id__": 89
},
"_id": "75enN1g2JHy7NqiKYVoxNQ"
},
{
"__type__": "cc.Widget",
"_name": "",
@ -5033,5 +5014,24 @@
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "45wIx1qRNIfKRBbYhYEP1r"
},
{
"__type__": "e74a999IDFOabyymZgXQIiy",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"Player": {
"__id__": 69
},
"selfNode": {
"__id__": 86
},
"phone": {
"__id__": 89
},
"_id": "81Iy69gIdCtp0UzAUPZ1+M"
}
]

View File

@ -1 +1 @@
{"version":"1.0.8","stats":{"C:/Work/Project/Sun_moves/temp/quick-scripts/src/__qc_index__.js":"2024-05-31T04:01:01.151Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/ListView/ItemRender.js":"2024-05-31T03:05:31.347Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GameOver.js":"2024-05-31T03:05:31.338Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/crypto/serverAPI.js":"2024-05-31T03:05:31.340Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js":"2024-05-31T03:05:31.336Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GuideManager.js":"2024-05-31T03:59:10.293Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/DynamicAtlasManager.js":"2024-05-31T03:05:31.327Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Helloworld.js":"2024-05-31T03:05:31.350Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GameData.js":"2024-05-31T03:25:56.295Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Load.js":"2024-05-31T03:06:54.359Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Notification.js":"2024-05-31T03:05:31.353Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/BallAudioManager.js":"2024-05-31T03:05:31.346Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GameManager.js":"2024-05-31T03:25:56.329Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/CtrlFluxayTexture.js":"2024-05-31T03:05:31.344Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/Shake.js":"2024-05-31T03:05:31.334Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/test.js":"2024-05-31T03:05:31.356Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Sun.js":"2024-05-31T03:05:31.333Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Storage.js":"2024-05-31T03:05:31.337Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/GameTool.js":"2024-05-31T03:05:31.341Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/ListView/List.js":"2024-05-31T03:05:31.348Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/crypto/crypto-js.min.js":"2024-05-31T03:05:31.351Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/RankManager.js":"2024-05-31T03:59:10.309Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/AudioManager.js":"2024-05-31T03:25:56.512Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/AudioManager.js":"2024-05-31T03:29:13.491Z"}}
{"version":"1.0.8","stats":{"C:/Work/Project/Sun_moves/temp/quick-scripts/src/__qc_index__.js":"2024-05-31T06:57:33.895Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/DynamicAtlasManager.js":"2024-05-31T06:57:33.840Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GameOver.js":"2024-05-31T06:57:33.849Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/ListView/List.js":"2024-05-31T06:57:33.856Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/crypto/serverAPI.js":"2024-05-31T06:57:33.851Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/RankManager.js":"2024-05-31T06:57:33.860Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GuideManager.js":"2024-05-31T06:57:33.837Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js":"2024-05-31T06:57:33.847Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Notification.js":"2024-05-31T06:57:33.863Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Sun.js":"2024-05-31T06:57:33.844Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GameData.js":"2024-05-31T06:57:33.864Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Load.js":"2024-05-31T06:57:33.842Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/Storage.js":"2024-05-31T06:57:33.848Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/GameTool.js":"2024-05-31T06:57:33.857Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/ListView/ItemRender.js":"2024-05-31T06:57:33.854Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/AudioManager.js":"2024-05-31T06:57:33.850Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/Shake.js":"2024-05-31T06:57:33.845Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/crypto/crypto-js.min.js":"2024-05-31T06:57:33.859Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/GameManager.js":"2024-05-31T06:57:33.852Z","C:/Work/Project/Sun_moves/temp/quick-scripts/src/assets/Script/tool/Storage.js":"2024-05-31T06:57:33.862Z"}}

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@ require('./assets/Script/tool/AudioManager');
require('./assets/Script/tool/DynamicAtlasManager');
require('./assets/Script/tool/GameTool');
require('./assets/Script/tool/Shake');
require('./assets/Script/tool/Storage');
require('./assets/migration/use_v2.1-2.2.1_cc.Toggle_event');
}

View File

@ -1,6 +1,6 @@
(function () {
var scripts = [{"deps":{"./assets/Script/GameOver":2,"./assets/Script/GuideManager":5,"./assets/Script/Load":8,"./assets/Script/Notification":9,"./assets/Script/RankManager":17,"./assets/Script/Storage":13,"./assets/Script/Sun":12,"./assets/Script/GameData":7,"./assets/Script/ListView/List":15,"./assets/Script/ListView/ItemRender":1,"./assets/Script/crypto/serverAPI":3,"./assets/Script/crypto/crypto-js.min":16,"./assets/Script/tool/DynamicAtlasManager":6,"./assets/Script/tool/GameTool":14,"./assets/Script/tool/Shake":11,"./assets/Script/tool/AudioManager":18,"./assets/migration/use_v2.1-2.2.1_cc.Toggle_event":4,"./assets/Script/GameManager":10},"path":"preview-scripts/__qc_index__.js"},{"deps":{},"path":"preview-scripts/assets/Script/ListView/ItemRender.js"},{"deps":{"./GameData":7,"./crypto/serverAPI":3},"path":"preview-scripts/assets/Script/GameOver.js"},{"deps":{"../GameData":7,"./crypto-js.min.js":16},"path":"preview-scripts/assets/Script/crypto/serverAPI.js"},{"deps":{},"path":"preview-scripts/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js"},{"deps":{"./GameData":7,"./Notification":9},"path":"preview-scripts/assets/Script/GuideManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/DynamicAtlasManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameData.js"},{"deps":{"./GameData":7,"./Storage":13},"path":"preview-scripts/assets/Script/Load.js"},{"deps":{},"path":"preview-scripts/assets/Script/Notification.js"},{"deps":{"./GameData":7,"./Notification":9,"./crypto/serverAPI":3},"path":"preview-scripts/assets/Script/GameManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/Shake.js"},{"deps":{"./Notification":9},"path":"preview-scripts/assets/Script/Sun.js"},{"deps":{},"path":"preview-scripts/assets/Script/Storage.js"},{"deps":{"Storage":13},"path":"preview-scripts/assets/Script/tool/GameTool.js"},{"deps":{"./ItemRender":1},"path":"preview-scripts/assets/Script/ListView/List.js"},{"deps":{},"path":"preview-scripts/assets/Script/crypto/crypto-js.min.js"},{"deps":{"./GameData":7,"./ListView/List":15,"./crypto/serverAPI":3},"path":"preview-scripts/assets/Script/RankManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/AudioManager.js"}];
var scripts = [{"deps":{"./assets/Script/GameOver":2,"./assets/Script/GuideManager":6,"./assets/Script/Load":11,"./assets/Script/Notification":8,"./assets/Script/RankManager":5,"./assets/Script/Storage":12,"./assets/Script/Sun":9,"./assets/Script/GameData":10,"./assets/Script/ListView/List":3,"./assets/Script/ListView/ItemRender":14,"./assets/Script/crypto/serverAPI":4,"./assets/Script/crypto/crypto-js.min":17,"./assets/Script/tool/DynamicAtlasManager":1,"./assets/Script/tool/GameTool":13,"./assets/Script/tool/Shake":16,"./assets/Script/tool/Storage":19,"./assets/Script/tool/AudioManager":15,"./assets/migration/use_v2.1-2.2.1_cc.Toggle_event":7,"./assets/Script/GameManager":18},"path":"preview-scripts/__qc_index__.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/DynamicAtlasManager.js"},{"deps":{"./GameData":10,"./crypto/serverAPI":4},"path":"preview-scripts/assets/Script/GameOver.js"},{"deps":{"./ItemRender":14},"path":"preview-scripts/assets/Script/ListView/List.js"},{"deps":{"../GameData":10,"./crypto-js.min.js":17},"path":"preview-scripts/assets/Script/crypto/serverAPI.js"},{"deps":{"./GameData":10,"./ListView/List":3,"./crypto/serverAPI":4},"path":"preview-scripts/assets/Script/RankManager.js"},{"deps":{"./GameData":10,"./Notification":8},"path":"preview-scripts/assets/Script/GuideManager.js"},{"deps":{},"path":"preview-scripts/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js"},{"deps":{},"path":"preview-scripts/assets/Script/Notification.js"},{"deps":{"./Notification":8},"path":"preview-scripts/assets/Script/Sun.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameData.js"},{"deps":{"./GameData":10,"./Storage":12},"path":"preview-scripts/assets/Script/Load.js"},{"deps":{},"path":"preview-scripts/assets/Script/Storage.js"},{"deps":{"../GameData":10},"path":"preview-scripts/assets/Script/tool/GameTool.js"},{"deps":{},"path":"preview-scripts/assets/Script/ListView/ItemRender.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/AudioManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/Shake.js"},{"deps":{},"path":"preview-scripts/assets/Script/crypto/crypto-js.min.js"},{"deps":{"./GameData":10,"./Notification":8,"./crypto/serverAPI":4},"path":"preview-scripts/assets/Script/GameManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/tool/Storage.js"}];
var entries = ["preview-scripts/__qc_index__.js"];
var bundleScript = 'preview-scripts/__qc_bundle__.js';

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,56 @@
(function() {
var nodeEnv = typeof require !== 'undefined' && typeof process !== 'undefined';
var __module = nodeEnv ? module : {exports:{}};
var __filename = 'preview-scripts/assets/Script/tool/Storage.js';
var __require = nodeEnv ? function (request) {
return cc.require(request);
} : function (request) {
return __quick_compile_project__.require(request, __filename);
};
function __define (exports, require, module) {
if (!nodeEnv) {__quick_compile_project__.registerModule(__filename, module);}"use strict";
cc._RF.push(module, 'f124cZyKJVPPobsFKRo+Uam', 'Storage');
// Script/tool/Storage.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StorageMessage = void 0;
//缓存浏览器数据
var StorageMessage = {
getStorage: function (key) {
var result = null;
if (cc.sys.localStorage.getItem(key)) {
var result = cc.sys.localStorage.getItem(key);
}
if (result) {
result = JSON.parse(result);
}
return result;
},
setStorage: function (key, value) {
//主动拉起分享接口
var temp = JSON.stringify(value);
cc.sys.localStorage.setItem(key, temp);
},
removeStorage: function (key) {
//主动删除消息接口
if (cc.sys.localStorage.getItem(key)) {
cc.sys.localStorage.removeItem(key);
}
},
};
exports.StorageMessage = StorageMessage;
cc._RF.pop();
}
if (nodeEnv) {
__define(__module.exports, __require, __module);
}
else {
__quick_compile_project__.registerModuleFunc(__filename, function () {
__define(__module.exports, __require, __module);
});
}
})();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFzc2V0c1xcU2NyaXB0XFx0b29sXFxTdG9yYWdlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLFNBQVM7QUFDVCxJQUFJLGNBQWMsR0FBRztJQUNqQixVQUFVLEVBQUcsVUFBUyxHQUFHO1FBQ3JCLElBQUksTUFBTSxHQUFHLElBQUksQ0FBQztRQUNsQixJQUFHLEVBQUUsQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFBQztZQUNsQyxJQUFJLE1BQU0sR0FBRyxFQUFFLENBQUMsR0FBRyxDQUFDLFlBQVksQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7U0FDL0M7UUFFRCxJQUFHLE1BQU0sRUFBQztZQUNSLE1BQU0sR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDO1NBQzdCO1FBQ0QsT0FBTyxNQUFNLENBQUM7SUFDbEIsQ0FBQztJQUNELFVBQVUsRUFBRyxVQUFTLEdBQUcsRUFBQyxLQUFLO1FBQzNCLFVBQVU7UUFDVixJQUFJLElBQUksR0FBRyxJQUFJLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBQ2pDLEVBQUUsQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLE9BQU8sQ0FBQyxHQUFHLEVBQUUsSUFBSSxDQUFDLENBQUE7SUFDMUMsQ0FBQztJQUNELGFBQWEsRUFBRyxVQUFTLEdBQUc7UUFDMUIsVUFBVTtRQUNWLElBQUcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxZQUFZLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFDO1lBQ2xDLEVBQUUsQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLFVBQVUsQ0FBQyxHQUFHLENBQUMsQ0FBQTtTQUNwQztJQUNILENBQUM7Q0FDSixDQUFDO0FBRU8sd0NBQWMiLCJmaWxlIjoiIiwic291cmNlUm9vdCI6Ii8iLCJzb3VyY2VzQ29udGVudCI6WyIvL+e8k+WtmOa1j+iniOWZqOaVsOaNrlxudmFyIFN0b3JhZ2VNZXNzYWdlID0ge1xuICAgIGdldFN0b3JhZ2UgOiBmdW5jdGlvbihrZXkpe1xuICAgICAgICB2YXIgcmVzdWx0ID0gbnVsbDtcbiAgICAgICAgaWYoY2Muc3lzLmxvY2FsU3RvcmFnZS5nZXRJdGVtKGtleSkpe1xuICAgICAgICAgIHZhciByZXN1bHQgPSBjYy5zeXMubG9jYWxTdG9yYWdlLmdldEl0ZW0oa2V5KTtcbiAgICAgICAgfVxuICAgICAgICBcbiAgICAgICAgaWYocmVzdWx0KXtcbiAgICAgICAgICByZXN1bHQgPSBKU09OLnBhcnNlKHJlc3VsdCk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICB9LFxuICAgIHNldFN0b3JhZ2UgOiBmdW5jdGlvbihrZXksdmFsdWUpe1xuICAgICAgICAvL+S4u+WKqOaLiei1t+WIhuS6q+aOpeWPo1xuICAgICAgICB2YXIgdGVtcCA9IEpTT04uc3RyaW5naWZ5KHZhbHVlKTtcbiAgICAgICAgY2Muc3lzLmxvY2FsU3RvcmFnZS5zZXRJdGVtKGtleSwgdGVtcClcbiAgICB9LFxuICAgIHJlbW92ZVN0b3JhZ2UgOiBmdW5jdGlvbihrZXkpe1xuICAgICAgLy/kuLvliqjliKDpmaTmtojmga/mjqXlj6NcbiAgICAgIGlmKGNjLnN5cy5sb2NhbFN0b3JhZ2UuZ2V0SXRlbShrZXkpKXtcbiAgICAgICAgY2Muc3lzLmxvY2FsU3RvcmFnZS5yZW1vdmVJdGVtKGtleSlcbiAgICAgIH1cbiAgICB9LFxufTtcblxuZXhwb3J0IHsgU3RvcmFnZU1lc3NhZ2UgfTsiXX0=

View File

@ -16,4 +16,5 @@ require('./assets/Script/tool/AudioManager');
require('./assets/Script/tool/DynamicAtlasManager');
require('./assets/Script/tool/GameTool');
require('./assets/Script/tool/Shake');
require('./assets/Script/tool/Storage');
require('./assets/migration/use_v2.1-2.2.1_cc.Toggle_event');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"sources":["assets\\Script\\Storage.ts"],"names":[],"mappings":";;;;;;;AACA,IAAI,cAAc,GAAG;IACjB,UAAU,EAAG,UAAS,GAAG;QACrB,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC/C;QAED,IAAG,MAAM,EAAC;YACR,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,UAAU,EAAG,UAAS,GAAG,EAAC,KAAK;QAC3B,UAAU;QACV,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACtC,YAAY;QACZ,+CAA+C;QAC/C,YAAY;IAChB,CAAC;IACD,aAAa,EAAG,UAAS,GAAG;QAC1B,UAAU;QACV,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;SACpC;IACH,CAAC;CACJ,CAAC;AAEO,wCAAc","file":"","sourceRoot":"/","sourcesContent":["\nvar StorageMessage = {\n getStorage : function(key){\n var result = null;\n if(cc.sys.localStorage.getItem(key)){\n var result = cc.sys.localStorage.getItem(key);\n }\n \n if(result){\n result = JSON.parse(result);\n }\n return result;\n },\n setStorage : function(key,value){\n //主动拉起分享接口\n var temp = JSON.stringify(value);\n cc.sys.localStorage.setItem(key, temp)\n // debugger;\n // var temp = cc.sys.localStorage.getItem(key);\n // debugger;\n },\n removeStorage : function(key){\n //主动删除消息接口\n if(cc.sys.localStorage.getItem(key)){\n cc.sys.localStorage.removeItem(key)\n }\n },\n};\n\nexport { StorageMessage };"]}
{"version":3,"sources":["assets\\Script\\Storage.ts"],"names":[],"mappings":";;;;;;;AAAA,SAAS;AACT,IAAI,cAAc,GAAG;IACjB,UAAU,EAAG,UAAS,GAAG;QACrB,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC/C;QAED,IAAG,MAAM,EAAC;YACR,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,UAAU,EAAG,UAAS,GAAG,EAAC,KAAK;QAC3B,UAAU;QACV,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;IACD,aAAa,EAAG,UAAS,GAAG;QAC1B,UAAU;QACV,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;SACpC;IACH,CAAC;CACJ,CAAC;AAEO,wCAAc","file":"","sourceRoot":"/","sourcesContent":["//缓存浏览器数据\nvar StorageMessage = {\n getStorage : function(key){\n var result = null;\n if(cc.sys.localStorage.getItem(key)){\n var result = cc.sys.localStorage.getItem(key);\n }\n \n if(result){\n result = JSON.parse(result);\n }\n return result;\n },\n setStorage : function(key,value){\n //主动拉起分享接口\n var temp = JSON.stringify(value);\n cc.sys.localStorage.setItem(key, temp)\n },\n removeStorage : function(key){\n //主动删除消息接口\n if(cc.sys.localStorage.getItem(key)){\n cc.sys.localStorage.removeItem(key)\n }\n },\n};\n\nexport { StorageMessage };"]}

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":["assets\\Script\\test.ts"],"names":[],"mappings":"","file":"","sourceRoot":"/","sourcesContent":[""]}

File diff suppressed because one or more lines are too long

View File

@ -1,529 +1,247 @@
"use strict";
cc._RF.push(module, 'a1dd7qMiCpOLL3FDXJd9DGy', 'GameTool');
// Script/tool/GameTool.js
cc._RF.push(module, 'ddac3ZC+9pHQr0Fs9IIhw4a', 'GameTool');
// Script/tool/GameTool.ts
"use strict";
var _window$GameTool;
var StorageMessage = require("Storage").StorageMessage;
window.GameTool = (_window$GameTool = {
_startTime: 0,
_endTime: 0,
_totalTime: 0,
getSeedRandom: function getSeedRandom(min, max) {
//包含min 不包含max
max = max || 1;
min = min || 0;
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return parseInt(tmp);
},
getSetScreenResolutionFlag: function getSetScreenResolutionFlag() {
var size = cc.winSize;
var width = size.width;
var height = size.height;
if (height / width > 16.2 / 9) return false;
return true;
},
//判断全面屏适配
setFit: function setFit(canvas) {
var flag = GameTool.getSetScreenResolutionFlag();
if (flag) {// console.log("不是全面屏");
// canvas.fitWidth = false;
// canvas.fitHeight = true;
} else {// console.log("是全面屏");
// canvas.fitWidth = true;
// canvas.fitHeight = false;
}
return flag;
},
// submitScoreButtonFunc: function(score1,fen1){
// console.log("上传分数:",score1,fen1)
// // var score = score1;
// // var fen = fen1;
// // if (CC_WECHATGAME) {
// // window.wx.postMessage({
// // messageType: 3,
// // MAIN_MENU_NUM: "guan",
// // score: score,
// // MAIN_MENU_FEN: "score",
// // fen: fen,
// // });
// // } else {
// // cc.log("提交得分: x1 : " + score)
// // }
// // return true;
// },
submitScoreButtonFunc: function submitScoreButtonFunc(fen2, number) {
console.log("number=", number);
if (number == 0) {
console.log("上传分数:", fen2);
var fen = fen2;
if (CC_WECHATGAME) {
window.wx.postMessage({
messageType: 3,
MAIN_MENU_FEN: "score",
MAIN_MENU_NUM: "fen",
score: fen,
fen: 0
});
} else {
cc.log("提交得分: x1 : " + fen);
}
} else {
console.log("上传特殊分数:", fen2);
var fen = fen2;
if (CC_WECHATGAME) {
window.wx.postMessage({
messageType: 7,
MAIN_MENU_FEN: "score",
MAIN_MENU_NUM: "fen",
score: 0,
fen: fen
});
} else {
cc.log("提交得分: x1 : " + fen);
}
}
return true;
},
getTip: function getTip() {
var index = Math.floor(Math.random() * 4) + 1;
switch (index) {
case 1:
{
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GameTool = void 0;
var GameData_1 = require("../GameData");
//最大工具类
var GameTool = {
_startTime: 0,
_endTime: 0,
_totalTime: 0,
getSeedRandom: function (min, max) {
max = max || 1;
min = min || 0;
GameData_1.default._instance.GM_INFO.currSeed = (GameData_1.default._instance.GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = GameData_1.default._instance.GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return Math.floor(tmp);
},
getSetScreenResolutionFlag: function () {
var size = cc.winSize;
var width = size.width;
var height = size.height;
if ((height / width) > (16.2 / 9))
return false;
return true;
},
//判断全面屏适配
setFit: function (canvas) {
var flag = GameTool.getSetScreenResolutionFlag();
if (flag) {
// console.log("不是全面屏");
// canvas.fitWidth = false;
// canvas.fitHeight = true;
}
case 2:
{
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。";
else {
// console.log("是全面屏");
// canvas.fitWidth = true;
// canvas.fitHeight = false;
}
case 3:
{
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。";
}
case 4:
{
return "尝试着顶开掉落的障碍,是个很酷的玩法。";
}
}
},
beginTiming: function beginTiming() {
this._startTime = new Date().getTime();
},
endTiming: function endTiming() {
this._endTime = new Date().getTime(); // this._totalTime = endTime - this._startTime;
},
//如果是判断时常的游戏 调用此方法
updateScoreTime: function updateScoreTime() {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
this._endTime += tempTime / 1000;
this._totalTime = this._endTime.toFixed(2);
GM_INFO.currScore = this._totalTime;
this._startTime = endTime;
},
//倒计时调用此方法
countDown: function countDown() {
this._endTime = new Date().getTime();
this._totalTime = parseInt((this._endTime - this._startTime) / 1000);
GM_INFO.remainingTime = GM_INFO.totalTime - this._totalTime;
},
httpRequest: function httpRequest(url, data, _success, _fail) {
console.log("进入网络请求:");
wx.getNetworkType({
success: function success(res) {
var networkType = res.networkType; // console.log(networkType);
//有网络状态下
if (networkType == "wifi" || networkType == "4g" || networkType == "3g" || networkType == "unknown") {
wx.request({
url: window.globalData.requestAPI + url,
data: data,
header: {
'content-type': 'application/json',
// 默认值
'Authorization': window.globalData.BASE64_JWT_TOKEN ? 'Bearer ' + window.globalData.BASE64_JWT_TOKEN : ''
},
method: 'POST',
success: function success(res) {
console.log('httpRequest:::::success', res);
_success(res);
},
fail: function fail(res) {
console.log('httpRequest:::::fail', res, "失败url为", url);
_fail(res);
return flag;
},
getTip: function () {
var index = Math.floor(Math.random() * 4) + 1;
switch (index) {
case 1: {
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。";
}
});
} else {
_fail(res);
}
},
fail: function fail(res) {
_fail(res);
}
}); // console.log('httpRequest:::::', url, data, success, fail)
},
httpRequest_Notoken: function httpRequest_Notoken(url, data, _success2, _fail2) {
// console.log('httpRequest:::::', url, data, success, fail)
wx.getNetworkType({
success: function success(res) {
var networkType = res.networkType; // console.log(networkType);
//有网络状态下
if (networkType == "wifi" || networkType == "4g" || networkType == "3g" || networkType == "unknown") {
wx.request({
url: window.globalData.requestAPI + url,
data: data,
header: {
'content-type': 'application/json' // 默认值
},
method: 'POST',
success: function success(res) {
console.log('httpRequest:::::success', res);
_success2(res);
},
fail: function fail(res) {
console.log('httpRequest:::::fail', res, "失败url为", url);
_fail2(res);
case 2: {
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。";
}
});
} else {
_fail2(res);
}
},
fail: function fail(res) {
_fail2(res);
}
});
},
getGameInfo: function getGameInfo(node) {
var jg = false;
var nodes = node;
var data = {
'appid': window.globalData.appid
};
window.GameTool.httpRequest(window.globalData.getUserInfoUrl, data, function (res) {
window.globalData.gameUserInfo = res.data.king_user; //user_id在这里
console.log("拿到服务器的信息", res.data);
if (window.globalData.gameUserInfo) {
console.log("获得服务器游戏信息成功:", window.globalData.gameUserInfo);
if (window.globalData.gameUserInfo.unlock_1) window.GM_INFO.unlock_1 = window.globalData.gameUserInfo.unlock_1;
if (window.globalData.gameUserInfo.unlock_2) window.GM_INFO.unlock_2 = window.globalData.gameUserInfo.unlock_2; //如果服务器有金币信息
if (window.globalData.gameUserInfo.coin) {
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
if (StorageMessage.getStorage("Coin")) {
if (window.globalData.gameUserInfo.coin != StorageMessage.getStorage("Coin")) {
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
case 3: {
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。";
}
} //如果本地没有金币信息 , 以服务器金币信息为主
else {
window.GM_INFO.coin = window.globalData.gameUserInfo.coin;
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
}
} else {
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
if (StorageMessage.getStorage("Coin")) {
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
} //如果本地没有金币信息 , 以服务器金币信息为主
else {
window.GM_INFO.coin = 200;
StorageMessage.setStorage("Coin", window.GM_INFO.coin);
}
}
cc.director.loadScene('GameBegin'); // console.log("即将进入这里");
// if(StorageMessage.getStorage("level")){
// // console.log("本地有等级信息;");
// // console.log("服务器信息等级为:",window.globalData.gameUserInfo.level);
// window.GM_INFO.level = StorageMessage.getStorage("level");
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// // console.log("本地等级信息为:",window.GM_INFO.level);
// //本地存储等级 小于服务器等级, 等于本地数据丢失,这时以服务器数据为主重新构建游戏
// if(window.GM_INFO.level < window.globalData.gameUserInfo.level){
// // nodes.active = true;
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// window.GameTool.reset();
// }
// //正常进入游戏,以本地数据为主,服务器数据为辅
// else{
// console.log("本地数据大以本地主数据为主");
// // window.GameTool.setGameInfo(true);
// }
// }
// else{
// console.log("笨地没等级数据");
// // nodes.active = true;
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
// window.GameTool.reset();
// }
if (CC_WECHATGAME) {
wx.onShow(function (res) {
if (res) {
if (res.query) {
console.log("分享中带的信息", res.query);
if (res.query.key1) {
window.GameTool.setFrindHelp(res.query.key1);
}
if (res.query.key2) {
window.GameTool.setFrindBlock(res.query.key2);
}
if (res.query.key3) {
window.GameTool.setFrindBlockMax(res.query.key3);
}
}
case 4: {
return "尝试着顶开掉落的障碍,是个很酷的玩法。";
}
});
wx.onHide(function (res) {
console.log("检测退出游戏"); // window.arm = [];
// for(var i=0; i<12; i++){
// window.arm[i] = null;
// window.arm[i] = {error:"error"};
// }
// window.arm = StorageMessage.setStorage("arm",window.arm);
var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level, window.GM_INFO.coin);
window.GameTool.setGameInfo();
});
}
jg = true;
} else {
console.log("拿到服务器信息失败");
cc.director.loadScene("LoadScene");
}
}, function () {
jg = false;
console.log("get用户信息失败", res);
});
return jg;
},
//根据服务器数据重置所需要所有数据
reset: function reset() {
// if(window.globalData.gameUserInfo.arm)
// StorageMessage.setStorage("arm",window.globalData.gameUserInfo.arm);
// if(window.globalData.gameUserInfo.richest_coin)
// StorageMessage.setStorage("coin",parseInt(window.globalData.gameUserInfo.richest_coin));
// if(window.globalData.gameUserInfo.dimond)
// StorageMessage.setStorage("dimond",window.globalData.gameUserInfo.dimond);
// if(window.globalData.gameUserInfo.buy_time)
// StorageMessage.setStorage("buy_Time",window.globalData.gameUserInfo.buy_time);
// if(window.globalData.gameUserInfo.dimond_time)
// StorageMessage.setStorage("dimond_Time",window.globalData.gameUserInfo.dimond_time);
// if(window.globalData.gameUserInfo.level)
// StorageMessage.setStorage("level",window.globalData.gameUserInfo.level);
// if(window.globalData.gameUserInfo.total_Speed)
// StorageMessage.setStorage("total_Speed",parseInt(window.globalData.gameUserInfo.total_Speed));
// if(window.globalData.gameUserInfo.leave_time)
// StorageMessage.setStorage("leave_time",window.globalData.gameUserInfo.leave_time);
// if(window.globalData.gameUserInfo.reward1)
// StorageMessage.setStorage("share_Array",window.globalData.gameUserInfo.reward1);
// if(window.globalData.gameUserInfo.reward2)
// StorageMessage.setStorage("share_100",window.globalData.gameUserInfo.reward2);
// StorageMessage.setStorage("GM_INFO",window.GM_INFO);
console.log("本地数据丢失,重新启动游戏");
cc.director.loadScene('LoadScene');
},
setGameInfo: function setGameInfo(pd) {
var data = {// "richest_coin":window.coin+"",
// "arm":window.arm,
// "buy_time":window.buy_Time,
// "dimond":parseInt(window.dimond),
// "dimond_time":window.dimond_Time,
// "level":window.GM_INFO.level,
// "total_speed":window.total_Speed+"",
// "reward_1":window.GM_INFO.share_Array, //用于存储6个红包的领取信息
// "reward_2":window.share_100 //用于存储100个红包的领取信息
}; // console.log("存储之前检测:",window.arm,arms);
window.GameTool.httpRequest(window.globalData.richest, data, function (res) {
console.log('存储userInfo成功', res);
if (!pd) {
window.GM_INFO.leave_time = res.data.leave_time;
StorageMessage.setStorage("leave_time", window.GM_INFO.leave_time);
}
}, function (res) {
console.log('存储userInfo失败', res);
if (!pd) {
window.GM_INFO.leave_time = parseInt(new Date().valueOf() / 1000);
StorageMessage.setStorage("leave_time", data);
}
});
},
//输入秒,返回需要展示时间格式
getTimeMargin: function getTimeMargin(second) {
var total = second;
var hour = parseInt(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
var min = parseInt(afterHour / 60); //计算整数分
var afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
return '剩余:' + hour + ':' + min + ':' + afterMin;
},
getTimeMargin2: function getTimeMargin2(second) {
var total = second;
var hour = parseInt(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
var min = parseInt(afterHour / 60); //计算整数分
if (min < 10) min = "0" + min;
var afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
if (afterMin < 10) afterMin = "0" + afterMin;
return '剩余:' + min + ':' + afterMin;
},
setFrindBlock: function setFrindBlock(userid) {
// console.log("添加时候的userid");
var data = {
user_id: userid
}; // if(userid != window.globalData.gameUserInfo.user_id){
// console.log("进分享的不是自己");
// {
window.GameTool.httpRequest(window.globalData.entryBlock, data, function (res) {
console.log('添加红包助力信息成功', res);
}, function (res) {
console.log('添加红包助力信息失败', res);
}); // }
// }
// else{
// console.log("进入分享的是自己");
// }
}
}, _window$GameTool["getSeedRandom"] = function getSeedRandom(min, max) {
//包含min 不包含max
max = max || 1;
min = min || 0;
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return parseInt(tmp);
}, _window$GameTool.getTime = function getTime(time) {
var label = "";
var number_1 = parseInt(time / 60);
var number_2 = time - number_1 * 60;
if (number_1 < 10) {
number_1 = "0" + number_1;
}
if (number_2 < 10) {
number_2 = "0" + number_2;
}
label = number_1 + ":" + number_2;
return label;
}, _window$GameTool.getNumber = function getNumber(number, type) {
// console.log(type,"需要转换的数字为:",number);
var count = 1000;
var place = type - 3;
if (number > Math.pow(count, 8) * Math.pow(10, place)) {
if (number / Math.pow(count, 8) < 100) number = parseInt(number / Math.pow(count, 8) * 10) / 10 + "S";else number = parseInt(number / Math.pow(count, 8)) + "S";
} else if (number > Math.pow(count, 7) * Math.pow(10, place)) {
if (number / Math.pow(count, 7) < 100) number = parseInt(number / Math.pow(count, 7) * 10) / 10 + "s";else number = parseInt(number / Math.pow(count, 7)) + "s";
} else if (number > Math.pow(count, 6) * Math.pow(10, place)) {
if (number / Math.pow(count, 6) < 100) number = parseInt(number / Math.pow(count, 6) * 10) / 10 + "Q";else number = parseInt(number / Math.pow(count, 6)) + "Q";
} else if (number > Math.pow(count, 5) * Math.pow(10, place)) {
if (number / Math.pow(count, 5) < 100) number = parseInt(number / Math.pow(count, 5) * 10) / 10 + "q";else number = parseInt(number / Math.pow(count, 5)) + "q";
} else if (number > Math.pow(count, 4) * Math.pow(10, place)) {
if (number / Math.pow(count, 4) < 100) number = parseInt(number / Math.pow(count, 4) * 10) / 10 + "t";else number = parseInt(number / Math.pow(count, 4)) + "t";
} else if (number > Math.pow(count, 3) * Math.pow(10, place)) {
if (number / Math.pow(count, 3) < 100) number = parseInt(number / Math.pow(count, 3) * 10) / 10 + "b";else number = parseInt(number / Math.pow(count, 3)) + "b";
} else if (number > Math.pow(count, 2) * Math.pow(10, place)) {
if (number / Math.pow(count, 2) < 100) number = parseInt(number / Math.pow(count, 2) * 10) / 10 + "m";else number = parseInt(number / Math.pow(count, 2)) + "m";
} else if (number > Math.pow(count, 1) * Math.pow(10, place)) {
if (number / Math.pow(count, 1) < 100) {
number = parseInt(number / Math.pow(count, 1) * 10) / 10 + "k";
} else number = parseInt(number / Math.pow(count, 1)) + "k";
} else {
number = parseInt(number / Math.pow(count, 0)) + "";
} // console.log("结果为"+type+"位数",number);
return number;
}, _window$GameTool.begainTiming = function begainTiming() {
this._startTime = new Date().getTime();
}, _window$GameTool["endTiming"] = function endTiming() {
var endTime = new Date().getTime();
this._endTime = endTime;
this._totalTime = endTime - this._startTime;
}, _window$GameTool.getScoreTime = function getScoreTime() {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
GM_INFO.currScore += tempTime;
this._startTime = endTime;
}, _window$GameTool.getFormatTime = function getFormatTime(time) {
var date = new Date();
date.setTime(time);
var ms = date.getMilliseconds(); // let msString = date.getMilliseconds();
var msString = parseInt(ms / 10) % 100;
var secondString = date.getSeconds();
var minString = date.getMinutes();
if (msString < 10) {
msString = "0" + msString;
}
if (secondString < 10) {
secondString = "0" + secondString;
}
secondString = secondString + ":";
if (minString < 10) {
minString = "0" + minString;
}
minString = minString + ":";
return minString + secondString + msString;
}, _window$GameTool.pushLister = function pushLister() {}, _window$GameTool.removeAllLister = function removeAllLister() {}, _window$GameTool);
},
beginTiming: function () {
this._startTime = new Date().getTime();
},
endTiming: function () {
this._endTime = new Date().getTime();
// this._totalTime = endTime - this._startTime;
},
//如果是判断时常的游戏 调用此方法
updateScoreTime: function () {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
this._endTime += tempTime / 1000;
this._totalTime = this._endTime.toFixed(2);
GameData_1.default._instance.GM_INFO.currScore = this._totalTime;
this._startTime = endTime;
},
//倒计时调用此方法
countDown: function () {
this._endTime = new Date().getTime();
this._totalTime = Math.floor((this._endTime - this._startTime) / 1000);
GameData_1.default._instance.GM_INFO.remainingTime = GameData_1.default._instance.GM_INFO.totalTime - this._totalTime;
},
getGameInfo: function (node) {
var jg = false;
return jg;
},
//根据服务器数据重置所需要所有数据
reset: function () {
console.log("本地数据丢失,重新启动游戏");
cc.director.loadScene('LoadScene');
},
setGameInfo: function (pd) {
},
//输入秒,返回需要展示时间格式
getTimeMargin: function (second) {
var total = second;
var hour = Math.floor(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
var min = Math.floor(afterHour / 60); //计算整数分
var afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
return '剩余:' + hour + ':' + min + ':' + afterMin;
},
getTimeMargin2: function (second) {
var total = second;
var min = null;
var afterMin = null;
var hour = Math.floor(total / (60 * 60)); //计算整数小时数
var afterHour = total - hour * 60 * 60; //取得算出小时数后剩余的秒数
min = Math.floor(afterHour / 60); //计算整数分
if (min < 10)
min = "0" + min;
afterMin = total - hour * 60 * 60 - min * 60; //取得算出分后剩余的秒数
if (afterMin < 10)
afterMin = "0" + afterMin;
return '剩余:' + min + ':' + afterMin;
},
setFrindBlock: function (userid) {
},
//将时间转换为59:23
getTime: function (time) {
var label = "";
var number_1 = null;
var number_2 = null;
number_1 = Math.floor(time / 60);
number_2 = time - number_1 * 60;
if (number_1 < 10) {
number_1 = "0" + number_1;
}
if (number_2 < 10) {
number_2 = "0" + number_2;
}
label = number_1 + ":" + number_2;
return label;
},
//number 为传进来的数值,type为最多显示几位数
getNumber: function (number, type) {
// console.log(type,"需要转换的数字为:",number);
var count = 1000;
var place = type - 3;
if (number > Math.pow(count, 8) * Math.pow(10, place)) {
if (number / Math.pow(count, 8) < 100)
number = Math.floor(number / Math.pow(count, 8) * 10) / 10 + "S";
else
number = Math.floor(number / Math.pow(count, 8)) + "S";
}
else if (number > Math.pow(count, 7) * Math.pow(10, place)) {
if (number / Math.pow(count, 7) < 100)
number = Math.floor(number / Math.pow(count, 7) * 10) / 10 + "s";
else
number = Math.floor(number / Math.pow(count, 7)) + "s";
}
else if (number > Math.pow(count, 6) * Math.pow(10, place)) {
if (number / Math.pow(count, 6) < 100)
number = Math.floor(number / Math.pow(count, 6) * 10) / 10 + "Q";
else
number = Math.floor(number / Math.pow(count, 6)) + "Q";
}
else if (number > Math.pow(count, 5) * Math.pow(10, place)) {
if (number / Math.pow(count, 5) < 100)
number = Math.floor(number / Math.pow(count, 5) * 10) / 10 + "q";
else
number = Math.floor(number / Math.pow(count, 5)) + "q";
}
else if (number > Math.pow(count, 4) * Math.pow(10, place)) {
if (number / Math.pow(count, 4) < 100)
number = Math.floor(number / Math.pow(count, 4) * 10) / 10 + "t";
else
number = Math.floor(number / Math.pow(count, 4)) + "t";
}
else if (number > Math.pow(count, 3) * Math.pow(10, place)) {
if (number / Math.pow(count, 3) < 100)
number = Math.floor(number / Math.pow(count, 3) * 10) / 10 + "b";
else
number = Math.floor(number / Math.pow(count, 3)) + "b";
}
else if (number > Math.pow(count, 2) * Math.pow(10, place)) {
if (number / Math.pow(count, 2) < 100)
number = Math.floor(number / Math.pow(count, 2) * 10) / 10 + "m";
else
number = Math.floor(number / Math.pow(count, 2)) + "m";
}
else if (number > Math.pow(count, 1) * Math.pow(10, place)) {
if (number / Math.pow(count, 1) < 100) {
number = Math.floor(number / Math.pow(count, 1) * 10) / 10 + "k";
}
else
number = Math.floor(number / Math.pow(count, 1)) + "k";
}
else {
number = Math.floor(number / Math.pow(count, 0)) + "";
}
// console.log("结果为"+type+"位数",number);
return number;
},
begainTiming: function () {
this._startTime = new Date().getTime();
},
endTiming2: function () {
var endTime = new Date().getTime();
this._endTime = endTime;
this._totalTime = endTime - this._startTime;
},
getScoreTime: function () {
var endTime = new Date().getTime();
var tempTime = endTime - this._startTime;
if (tempTime < 0 || tempTime > 500) {
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
}
GameData_1.default._instance.GM_INFO.currScore += tempTime;
this._startTime = endTime;
},
getFormatTime: function (time) {
var date = new Date();
date.setTime(time);
var ms = date.getMilliseconds();
// let msString = date.getMilliseconds();
var msString = null;
var secondString = null;
var minString = null;
msString = Math.floor(ms / 10) % 100;
secondString = date.getSeconds();
minString = date.getMinutes();
if (msString < 10) {
msString = "0" + msString;
}
if (secondString < 10) {
secondString = "0" + secondString;
}
secondString = secondString + ":";
if (minString < 10) {
minString = "0" + minString;
}
minString = minString + ":";
return minString + secondString + msString;
},
pushLister: function () {
},
removeAllLister: function () {
},
};
exports.GameTool = GameTool;
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
"use strict";
cc._RF.push(module, 'f124cZyKJVPPobsFKRo+Uam', 'Storage');
// Script/tool/Storage.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StorageMessage = void 0;
//缓存浏览器数据
var StorageMessage = {
getStorage: function (key) {
var result = null;
if (cc.sys.localStorage.getItem(key)) {
var result = cc.sys.localStorage.getItem(key);
}
if (result) {
result = JSON.parse(result);
}
return result;
},
setStorage: function (key, value) {
//主动拉起分享接口
var temp = JSON.stringify(value);
cc.sys.localStorage.setItem(key, temp);
},
removeStorage: function (key) {
//主动删除消息接口
if (cc.sys.localStorage.getItem(key)) {
cc.sys.localStorage.removeItem(key);
}
},
};
exports.StorageMessage = StorageMessage;
cc._RF.pop();

View File

@ -0,0 +1 @@
{"version":3,"sources":["assets\\Script\\tool\\Storage.ts"],"names":[],"mappings":";;;;;;;AAAA,SAAS;AACT,IAAI,cAAc,GAAG;IACjB,UAAU,EAAG,UAAS,GAAG;QACrB,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,IAAI,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC/C;QAED,IAAG,MAAM,EAAC;YACR,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC7B;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IACD,UAAU,EAAG,UAAS,GAAG,EAAC,KAAK;QAC3B,UAAU;QACV,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;IACD,aAAa,EAAG,UAAS,GAAG;QAC1B,UAAU;QACV,IAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;YAClC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;SACpC;IACH,CAAC;CACJ,CAAC;AAEO,wCAAc","file":"","sourceRoot":"/","sourcesContent":["//缓存浏览器数据\nvar StorageMessage = {\n getStorage : function(key){\n var result = null;\n if(cc.sys.localStorage.getItem(key)){\n var result = cc.sys.localStorage.getItem(key);\n }\n \n if(result){\n result = JSON.parse(result);\n }\n return result;\n },\n setStorage : function(key,value){\n //主动拉起分享接口\n var temp = JSON.stringify(value);\n cc.sys.localStorage.setItem(key, temp)\n },\n removeStorage : function(key){\n //主动删除消息接口\n if(cc.sys.localStorage.getItem(key)){\n cc.sys.localStorage.removeItem(key)\n }\n },\n};\n\nexport { StorageMessage };"]}

View File

@ -1 +0,0 @@
{"pid":14292}