添加主线关卡和每日关卡

This commit is contained in:
luying
2020-09-29 17:03:01 +08:00
parent e448704dc7
commit 160f32bf9e
18 changed files with 743 additions and 2199 deletions

View File

@@ -1,4 +1,5 @@
export function genCode(len) {
const chars = '123456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijklmnopqrstuvwxyz';
const charArr = chars.split('');
@@ -7,4 +8,29 @@
code += charArr[Math.floor(Math.random() * charArr.length)];
}
return code;
}
export function decodeStr(type, str) {
if(str == '&') str = '';
return str.split('|').map(cur => {
let arr = cur.split('&');
let result = {};
switch (type) {
case 'fixReward': {
let [gid, count] = arr;
result = { gid: parseInt(gid), count: parseInt(count)};
break;
}
case 'conditionReward': {
let [gid, count, condition] = arr;
result = { gid: parseInt(gid), count: parseInt(count), condition: parseInt(condition) };
break;
}
case 'randomReward': {
let [gid, count, frequency] = arr;
result = { gid: parseInt(gid), count: parseInt(count), frequency: parseInt(frequency) };
}
}
return result;
});
}