将parseBigNumber改为类型方法

This commit is contained in:
枫谷剑仙 2020-12-17 12:04:41 +08:00
parent b67e0a1ebc
commit 04726128e5
2 changed files with 21 additions and 5 deletions

View File

@ -50,10 +50,26 @@ function getQueryString(name,url) {
}
//数字补前导0
Number.prototype.PrefixInteger = function(length)
Number.prototype.prefixInteger = function(length, useGrouping = false)
{
return (Array(length).join('0') + this).slice(-length);
return this.toLocaleString(undefined,
{
useGrouping: useGrouping,
minimumIntegerDigits: length
});
}
//数字补前导0
Number.prototype.parseBigNumber = function()
{
return this.toLocaleString();
}
//大数字缩短长度,默认返回本地定义字符串
function parseBigNumber(number)
{
return number.toLocaleString();
}
//数组删除自己尾部的空元素
Array.prototype.DeleteLatter = function(item = null)
{

View File

@ -1725,7 +1725,7 @@ function initialize() {
const card = Cards[editBox.mid];
const decoder = new Adpcm(adpcm_wasm, pcmImportObj);
decoder.resetDecodeState(new Adpcm.State(0, 0));
decodeAudio(`sound/voice/${currentDataSource.code}/padv${card.voiceId.PrefixInteger(3)}.wav`, decoder.decode.bind(decoder));
decodeAudio(`sound/voice/${currentDataSource.code}/padv${card.voiceId.prefixInteger(3)}.wav`, decoder.decode.bind(decoder));
}
}
monEditAwokensLabel.forEach(akDom => akDom.onclick = playVoiceAwoken);
@ -1771,14 +1771,14 @@ function initialize() {
monEditLv110.onclick = setIptToMyValue;
//编辑界面重新计算怪物的经验值
function reCalculateExp() {
const monid = parseInt(monstersID.value || 0, 10);
const monid = editBox.mid;
const level = parseInt(monEditLv.value || 0, 10);
const tempMon = {
id: monid,
level: level
};
const needExp = calculateExp(tempMon);
monLvExp.textContent = needExp ? parseBigNumber(needExp[0]) + (level > 99 ? ` + ${parseBigNumber(needExp[1])}` : "") : "";
monLvExp.textContent = needExp ? needExp[0].parseBigNumber() + (level > 99 ? ` + ${needExp[1].parseBigNumber()}` : "") : "";
}
editBox.reCalculateExp = reCalculateExp;
//三维