Merge pull request #412 from Tipx-L/PR-Branch

The Delta Update.
This commit is contained in:
Spmario233 2023-09-28 03:25:29 +08:00 committed by GitHub
commit a540c04dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 204 additions and 222 deletions

View File

@ -6681,9 +6681,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
const RAD = Math.PI / 180; const RAD = Math.PI / 180;
const maxScore = Math.max(2,1+game.me.countMark('yufeng')); const maxScore = Math.max(2,1+game.me.countMark('yufeng'));
const ctx=canvas.getContext('2d'); const ctx=canvas.getContext('2d');
let ticks = 0;
let frames = 0; let frames = 0;
let dx = 1; let dx = 0.1;
let previousDOMHighResTimeStamp = performance.now();
let deltaTime = 0;
const state = { const state = {
curr: 0, curr: 0,
getReady: 0, getReady: 0,
@ -6710,8 +6711,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
update: function () { update: function () {
if(state.curr == state.gameOver || state.curr == state.gameSuccess) return; if(state.curr == state.gameOver || state.curr == state.gameSuccess) return;
this.x -= dx; this.x -= dx * deltaTime;
this.x = this.x % (this.sprite.width / 2); const halfWidth = this.sprite.width / 2;
if(this.x <= -halfWidth) this.x += halfWidth;
}, },
}; };
const bg = { const bg = {
@ -6729,6 +6731,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
gap: 127, gap: 127,
moved: true, moved: true,
pipes: [], pipes: [],
numberOfPipes: 1,
timeElapsed: 0,
draw: function () { draw: function () {
for (let i = 0; i < this.pipes.length; i++) { for (let i = 0; i < this.pipes.length; i++) {
let p = this.pipes[i]; let p = this.pipes[i];
@ -6742,14 +6746,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
update: function () { update: function () {
if (state.curr != state.Play) return; if (state.curr != state.Play) return;
if (ticks % 160 == 0) { this.timeElapsed += deltaTime;
if (this.timeElapsed >= 1600) {
this.timeElapsed -= 1600;
this.pipes.push({ this.pipes.push({
x: parseFloat(canvas.width), x: parseFloat(canvas.width),
y: -210 * Math.min(Math.random()*0.8 + 1.2, 1.8), y: -210 * Math.min(Math.random()*0.8 + 1.2, 1.8),
}); });
} }
this.pipes.forEach((pipe) => { this.pipes.forEach((pipe) => {
pipe.x -= dx; pipe.x -= dx * deltaTime;
}); });
if (this.pipes.length && this.pipes[0].x < -this.top.sprite.width) { if (this.pipes.length && this.pipes[0].x < -this.top.sprite.width) {
@ -6769,9 +6775,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
x: 50, x: 50,
y: 100, y: 100,
speed: 0, speed: 0,
gravity: 0.04, gravity: 0.0004,
thrust: 1.8, thrust: 0.18,
frame: 0, frame: 0,
timeElapsed: 0,
totalTimeElapsed: 0,
draw: function () { draw: function () {
let h = this.animations[this.frame].sprite.height; let h = this.animations[this.frame].sprite.height;
let w = this.animations[this.frame].sprite.width; let w = this.animations[this.frame].sprite.width;
@ -6782,25 +6790,36 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ctx.restore(); ctx.restore();
}, },
update: function () { update: function () {
this.totalTimeElapsed += deltaTime;
let r = parseFloat(this.animations[0].sprite.width) / 2; let r = parseFloat(this.animations[0].sprite.width) / 2;
switch (state.curr) { switch (state.curr) {
case state.getReady: case state.gameSuccess: case state.getReady: case state.gameSuccess:
this.rotatation = 0; this.rotatation = 0;
this.y += ticks % 20 == 0 ? Math.sin(ticks * RAD) : 0; this.timeElapsed += deltaTime;
this.frame += ticks % 20 == 0 ? 1 : 0; if (this.timeElapsed >= 200) {
this.timeElapsed -= 200;
this.y += Math.sin(this.totalTimeElapsed / 10 * RAD);
this.frame++;
}
break; break;
case state.Play: case state.Play:
this.frame += ticks % 10 == 0 ? 1 : 0; this.timeElapsed += deltaTime;
this.y += this.speed; if (this.timeElapsed >= 100) {
this.timeElapsed -= 100;
this.frame++;
}
this.y += this.speed * deltaTime;
this.setRotation(); this.setRotation();
this.speed += this.gravity; this.speed += this.gravity * deltaTime;
if(UI.score.curr >= maxScore){ if(UI.score.curr >= maxScore){
state.curr = state.gameSuccess; state.curr = state.gameSuccess;
this.timeElapsed = 0;
updateText('御风飞行表演成功!') updateText('御风飞行表演成功!')
setTimeout(switchToAuto,2000); setTimeout(switchToAuto,2000);
} }
else if (this.y + r >= gnd.y || this.collisioned()) { else if (this.y + r >= gnd.y || this.collisioned()) {
state.curr = state.gameOver; state.curr = state.gameOver;
this.timeElapsed = 0;
updateText('御风飞行表演失败……') updateText('御风飞行表演失败……')
setTimeout(switchToAuto,2000); setTimeout(switchToAuto,2000);
} }
@ -6809,28 +6828,30 @@ game.import('character',function(lib,game,ui,get,ai,_status){
case state.gameOver: case state.gameOver:
this.frame = 1; this.frame = 1;
if (this.y + r < gnd.y) { if (this.y + r < gnd.y) {
this.y += this.speed; this.y += this.speed * deltaTime;
this.setRotation(); this.setRotation();
this.speed += this.gravity; this.speed += this.gravity * deltaTime;
} else { } else {
this.speed = 0; this.speed = 0;
this.y = gnd.y - r; this.y = gnd.y - r;
this.rotatation = 90; this.rotatation = 90;
if (!SFX.played) { if (!SFX.played) {
SFX.die.play(); Promise.resolve(SFX.die.play()).catch(() => void 0);
SFX.played = true; SFX.played = true;
} }
} }
break; break;
} }
this.frame = this.frame % this.animations.length; const animationsLength = this.animations.length;
if (this.frame >= animationsLength) this.frame -= animationsLength;
}, },
flap: function () { flap: function () {
if (this.y > 0) { if (this.y <= 0) return;
SFX.flap.play(); const flap = SFX.flap;
this.speed = -this.thrust; flap.currentTime = 0;
} if (flap.paused) Promise.resolve(flap.play()).catch(() => void 0);
this.speed = -this.thrust;
}, },
setRotation: function () { setRotation: function () {
if (this.speed <= 0) { if (this.speed <= 0) {
@ -6851,13 +6872,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if (this.x + r >= x) { if (this.x + r >= x) {
if (this.x + r < x + w) { if (this.x + r < x + w) {
if (this.y - r <= roof || this.y + r >= floor) { if (this.y - r <= roof || this.y + r >= floor) {
SFX.hit.play(); Promise.resolve(SFX.hit.play()).catch(() => void 0);
return true; return true;
} }
} }
else if (pipe.moved) { else if (pipe.moved) {
UI.score.curr++; updateText(`当前分数:${++UI.score.curr}`);
SFX.score.play(); const score = SFX.score;
score.currentTime = 0;
if (score.paused) Promise.resolve(score.play()).catch(() => void 0);
pipe.moved = false; pipe.moved = false;
} }
} }
@ -6876,6 +6899,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
tx: 0, tx: 0,
ty: 0, ty: 0,
frame: 0, frame: 0,
timeElapsed: 0,
draw: function () { draw: function () {
switch (state.curr) { switch (state.curr) {
case state.getReady: case state.getReady:
@ -6894,18 +6918,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
this.ty = this.ty =
this.y + this.gameOver.sprite.height - this.tap[0].sprite.height; this.y + this.gameOver.sprite.height - this.tap[0].sprite.height;
ctx.drawImage(this.gameOver.sprite, this.x, this.y); ctx.drawImage(this.gameOver.sprite, this.x, this.y);
break;
default:
this.drawScore();
} }
}, },
drawScore: function () {
updateText('当前分数:'+UI.score.curr);
},
update: function () { update: function () {
if (state.curr == state.Play) return; if (state.curr == state.Play) return;
this.frame += ticks % 20 == 0 ? 1 : 0; this.timeElapsed += deltaTime;
this.frame = this.frame % this.tap.length; if (this.timeElapsed >= 200) {
this.timeElapsed -= 200;
this.frame++;
}
const tapLength = this.tap.length;
if (this.frame >= tapLength) this.frame -= tapLength;
}, },
}; };
gnd.sprite.src = lib.assetURL+"image/flappybird/ground.png"; gnd.sprite.src = lib.assetURL+"image/flappybird/ground.png";
@ -6927,16 +6950,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
SFX.hit.src = lib.assetURL+"audio/effect/flappybird_hit.wav"; SFX.hit.src = lib.assetURL+"audio/effect/flappybird_hit.wav";
SFX.die.src = lib.assetURL+"audio/effect/flappybird_die.wav"; SFX.die.src = lib.assetURL+"audio/effect/flappybird_die.wav";
const gameLoop = function(){ const gameLoop = domHighResTimeStamp => {
if(frames<0) return;
deltaTime = domHighResTimeStamp - previousDOMHighResTimeStamp;
previousDOMHighResTimeStamp = domHighResTimeStamp;
update(); update();
ticks++; draw();
} frames++;
const gameRender = function(){ window.requestAnimationFrame(gameLoop);
if(frames>=0){
draw();
frames++;
window.requestAnimationFrame(gameRender);
}
} }
const update = function(){ const update = function(){
@ -6961,11 +6982,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
switch (state.curr) { switch (state.curr) {
case state.getReady: case state.getReady:
state.curr = state.Play; state.curr = state.Play;
SFX.start.play(); bird.timeElapsed = 0;
break; Promise.resolve(SFX.start.play()).catch(() => void 0);
case state.Play: updateText(`当前分数:${UI.score.curr}`);
bird.flap();
break; break;
case state.Play: bird.flap();
} }
}; };
const switchToAuto = function(){ const switchToAuto = function(){
@ -6978,7 +6999,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
game.resume(); game.resume();
_status.imchoosing=false; _status.imchoosing=false;
frames=-1; frames=-1;
clearInterval(gameLoop);
document.removeEventListener(lib.config.touchscreen?'touchstart':'mousedown',click); document.removeEventListener(lib.config.touchscreen?'touchstart':'mousedown',click);
} }
@ -6987,8 +7007,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
game.countChoose(); game.countChoose();
document.addEventListener(lib.config.touchscreen?'touchstart':'mousedown',click); document.addEventListener(lib.config.touchscreen?'touchstart':'mousedown',click);
setInterval(gameLoop, 10); window.requestAnimationFrame(gameLoop);
window.requestAnimationFrame(gameRender);
}, },
}, },
yufeng_old:{ yufeng_old:{

View File

@ -4022,11 +4022,11 @@
show_characternamepinyin:{ show_characternamepinyin:{
name:'显示武将名注解', name:'显示武将名注解',
intro:'在武将资料卡显示武将名及其注解、性别、势力、体力等信息', intro:'在武将资料卡显示武将名及其注解、性别、势力、体力等信息',
init:true, init:'showPinyin',
unfrequent:true, unfrequent:true,
item:{ item:{
false:'不显示', doNotShow:'不显示',
true:'显示拼音', showPinyin:'显示拼音',
showCodeIdentifier:'显示代码ID' showCodeIdentifier:'显示代码ID'
}, },
visualMenu:(node,link,name)=>{ visualMenu:(node,link,name)=>{
@ -4062,41 +4062,17 @@
show_skillnamepinyin:{ show_skillnamepinyin:{
name:'显示技能名注解', name:'显示技能名注解',
intro:'在武将资料卡显示技能名注解', intro:'在武将资料卡显示技能名注解',
init:true, get init(){
unfrequent:true, return lib.configMenu.view.config.show_characternamepinyin.init;
item:{
false:'不显示',
true:'显示拼音',
showCodeIdentifier:'显示代码ID'
}, },
visualMenu:(node,link,name)=>{ get unfrequent(){
node.classList.add('button','character'); return lib.configMenu.view.config.show_characternamepinyin.unfrequent;
const style=node.style; },
style.alignItems='center'; get item(){
style.animation='background-position-left-center-right-center-left-center 15s ease infinite'; return lib.configMenu.view.config.show_characternamepinyin.item;
style.background='linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB)'; },
style.backgroundSize='400% 400%'; get visualMenu(){
style.display='flex'; return lib.configMenu.view.config.show_characternamepinyin.visualMenu;
style.height='60px';
style.justifyContent='center';
style.width='150px';
const firstChild=node.firstChild;
firstChild.removeAttribute('class');
firstChild.style.position='initial';
if(link=='false') return;
const ruby=document.createElement('ruby');
ruby.textContent=name;
const leftParenthesisRP=document.createElement('rp');
leftParenthesisRP.textContent='';
ruby.appendChild(leftParenthesisRP);
const rt=document.createElement('rt');
rt.style.fontSize='smaller';
rt.textContent=link=='showCodeIdentifier'?link:get.pinyin(name).join(' ');
ruby.appendChild(rt);
const rightParenthesisRP=document.createElement('rp');
rightParenthesisRP.textContent='';
ruby.appendChild(rightParenthesisRP);
firstChild.innerHTML=ruby.outerHTML;
} }
} }
} }
@ -8256,7 +8232,7 @@
var natures=get.natureList(this,player); var natures=get.natureList(this,player);
if(!nature) return natures.length>0; if(!nature) return natures.length>0;
if(nature=='linked') return natures.some(n=>lib.linked.includes(n)); if(nature=='linked') return natures.some(n=>lib.linked.includes(n));
return get.is.sameNature(natures,nature,true); return get.is.sameNature(natures,nature);
} }
}); });
if (!('includes' in Array.prototype)) { if (!('includes' in Array.prototype)) {
@ -20020,7 +19996,7 @@
} }
return this; return this;
}, },
assgin(obj) { assign(obj) {
if(lib.skill[skillName]!=skill) throw `This skill has been destroyed`; if(lib.skill[skillName]!=skill) throw `This skill has been destroyed`;
if(typeof obj=='object'&&obj!==null) Object.assign(skill,obj); if(typeof obj=='object'&&obj!==null) Object.assign(skill,obj);
return this; return this;
@ -24465,7 +24441,7 @@
if(!nature) return Boolean(this.nature&&this.nature.length>0); if(!nature) return Boolean(this.nature&&this.nature.length>0);
let natures=get.natureList(nature),naturesx=get.natureList(this.nature); let natures=get.natureList(nature),naturesx=get.natureList(this.nature);
if(nature=='linked') return naturesx.some(n=>lib.linked.includes(n)); if(nature=='linked') return naturesx.some(n=>lib.linked.includes(n));
return get.is.sameNature(natures,naturesx,true); return get.is.sameNature(natures,naturesx);
}; };
if(next.hasNature('poison')) delete next._triggered; if(next.hasNature('poison')) delete next._triggered;
next.setContent('damage'); next.setContent('damage');
@ -28821,7 +28797,7 @@
var natures=get.natureList(this,player); var natures=get.natureList(this,player);
if(!nature) return natures.length>0; if(!nature) return natures.length>0;
if(nature=='linked') return natures.some(n=>lib.linked.includes(n)); if(nature=='linked') return natures.some(n=>lib.linked.includes(n));
return get.is.sameNature(natures,nature,true); return get.is.sameNature(natures,nature);
}, },
//只针对【杀】起效果 //只针对【杀】起效果
addNature:function(nature){ addNature:function(nature){
@ -34005,67 +33981,51 @@
} }
return node; return node;
}, },
changeLand:function(url,player){ changeLand:(url,player)=>{
game.addVideo('changeLand',player,url); game.addVideo('changeLand',player,url);
if(url.indexOf('/')===-1){ const parsedPath=lib.path.parse(url);
url='image/card/'+url; delete parsedPath.base;
} if(!parsedPath.dir) parsedPath.dir='image/card';
if(url.indexOf('.png')==-1&&url.indexOf('.jpg')==-1){ if(!parsedPath.ext) parsedPath.ext='.jpg';
url+='.jpg'; game.broadcastAll((formattedPath,name,skill,player)=>{
} const node=ui.create.div('.background.upper.land');
var name=url.slice(url.lastIndexOf('/')+1,url.lastIndexOf('.')); node.setBackgroundImage(formattedPath);
var skill=name+'_skill'; node.destroy=()=>{
var node=ui.create.div('.background.upper.land'); if (node.skill) {
node.setBackgroundImage(url); game.removeGlobalSkill(node.skill);
node.destroy=function(){ if(node.system) node.system.remove();
if (this.skill) {
game.removeGlobalSkill(this.skill);
if(this.system){
this.system.remove();
} }
node.classList.add('hidden');
setTimeout(()=>node.remove(),3000);
if(ui.land==node) ui.land=null;
} }
this.classList.add('hidden'); if(ui.land){
var node=this; document.body.insertBefore(node,ui.land);
setTimeout(function(){ ui.land.destroy();
node.remove();
},3000);
if(ui.land==this){
ui.land=null;
} }
} else{
if(ui.land){ node.classList.add('hidden');
document.body.insertBefore(node,ui.land); document.body.insertBefore(node,ui.window);
ui.land.destroy(); ui.refresh(node);
} node.classList.remove('hidden');
else{ }
node.classList.add('hidden'); ui.land=node;
document.body.insertBefore(node,ui.window); if(!name) return;
ui.refresh(node);
node.classList.remove('hidden');
}
ui.land=node;
if(name){
node.name=name; node.name=name;
node.skill=skill; node.skill=skill;
if(player){ if(player){
node.player=player; node.player=player;
player.addTempSkill('land_used'); player.addTempSkill('land_used');
} }
node.system=ui.create.system(lib.translate[skill],null,true,true); lib.setPopped(node.system=ui.create.system(lib.translate[skill],null,true,true),()=>{
lib.setPopped(node.system,function(){ const uiIntro=ui.create.dialog('hidden');
var uiintro=ui.create.dialog('hidden'); uiIntro.addText(player?`来源:${get.translation(player)}`:'地图').style.margin='0';
var str='地图'; uiIntro._place_text=uiIntro.add(ui.create.div('.text',lib.translate[`${skill}_info`]));
if(player){ uiIntro.add(ui.create.div('.placeholder.slim'));
str='来源:'+get.translation(player); return uiIntro;
}
var caption=uiintro.addText(str);
caption.style.margin='0';
uiintro._place_text=uiintro.add('<div class="text">'+lib.translate[skill+'_info']+'</div>');
uiintro.add(ui.create.div('.placeholder.slim'));
return uiintro;
},200); },200);
game.addGlobalSkill(skill); game.addGlobalSkill(skill);
} },lib.path.format(parsedPath),parsedPath.name,`${name}_skill`,player);
}, },
checkFileList:function(updates,proceed){ checkFileList:function(updates,proceed){
var n=updates.length; var n=updates.length;
@ -34540,7 +34500,7 @@
audio.oncanplay=()=>Promise.resolve(audio.play()).catch(()=>void 0); audio.oncanplay=()=>Promise.resolve(audio.play()).catch(()=>void 0);
new Promise((resolve,reject)=>{ new Promise((resolve,reject)=>{
if(path.indexOf('db:')==0) game.getDB('file',path.slice(3)).then(octetStream=>resolve(get.objectURL(octetStream)),reject); if(path.indexOf('db:')==0) game.getDB('file',path.slice(3)).then(octetStream=>resolve(get.objectURL(octetStream)),reject);
else if(path.split('/').pop().split('.').length>1) resolve(`${lib.assetURL}audio/${path}`); else if(lib.path.extname(path)) resolve(`${lib.assetURL}audio/${path}`);
else resolve(`${lib.assetURL}audio/${path}.mp3`); else resolve(`${lib.assetURL}audio/${path}.mp3`);
}).then(resolvedPath=>{ }).then(resolvedPath=>{
audio.src=resolvedPath; audio.src=resolvedPath;
@ -37166,28 +37126,24 @@
(triggerevent||_status.event).next.push(next); (triggerevent||_status.event).next.push(next);
return next; return next;
}, },
addCharacter:function(name,info){ addCharacter:(name,information)=>{
var extname=(_status.extension||info.extension); const extensionName=_status.extension||information.extension,character=[
var imgsrc; information.sex,
if(_status.evaluatingExtension){ information.group,
imgsrc='db:extension-'+extname+':'+name+'.jpg'; information.hp,
} information.skills||[],
else{ [
imgsrc='ext:'+extname+'/'+name+'.jpg'; _status.evaluatingExtension?`db:extension-${extensionName}:${name}.jpg`:`ext:${extensionName}/${name}.jpg`,
} `die:ext:${extensionName}/${name}.mp3`
const audiosrc='die:ext:'+extname+'/'+name+'.mp3'; ]
var character=[info.sex,info.group,info.hp,info.skills||[],[imgsrc,audiosrc]]; ];
if(info.tags){ if(information.tags) character[4]=character[4].concat(information.tags);
character[4]=character[4].concat(info.tags);
}
lib.character[name]=character; lib.character[name]=character;
var packname='mode_extension_'+extname; const packName=`mode_extension_${extensionName}`;
if(!lib.characterPack[packname]){ if(!lib.characterPack[packName]) lib.characterPack[packName]={};
lib.characterPack[packname]={}; lib.translate[name]=information.translate;
} lib.characterPack[packName][name]=character;
lib.translate[name]=info.translate; lib.translate[`${packName}_character_config`]=extensionName;
lib.characterPack[packname][name]=character;
lib.translate[packname+'_character_config']=extname;
}, },
addCharacterPack:(pack,packagename)=>{ addCharacterPack:(pack,packagename)=>{
var extname=_status.extension||'扩展'; var extname=_status.extension||'扩展';
@ -38475,7 +38431,7 @@
for(i=0;i<cards.length;i++){ for(i=0;i<cards.length;i++){
if(lib.config.cardtempname!='off'){ if(lib.config.cardtempname!='off'){
var cardname=get.name(cards[i]); var cardname=get.name(cards[i]);
if(cards[i].name!=cardname||!get.is.sameNature(get.nature(cards[i]),cards[i].nature)){ if(cards[i].name!=cardname||!get.is.sameNature(get.nature(cards[i]),cards[i].nature,true)){
var node=ui.create.cardTempName(cards[i]); var node=ui.create.cardTempName(cards[i]);
var cardtempnameConfig=lib.config.cardtempname; var cardtempnameConfig=lib.config.cardtempname;
if(cardtempnameConfig!=='default') node.classList.remove('vertical'); if(cardtempnameConfig!=='default') node.classList.remove('vertical');
@ -42828,29 +42784,19 @@
var loadData=function(){ var loadData=function(){
var zip=new JSZip(); var zip=new JSZip();
zip.load(data); zip.load(data);
var images=[],audios=[],fonts=[],directories={},directorylist=[]; var images=[],audios=[],fonts=[],directories={},directoryList=[];
for(var i in zip.files){ Object.keys(zip.files).forEach(file=>{
var ext=i.slice(i.lastIndexOf('.')+1).toLowerCase(); const parsedPath=lib.path.parse(file),directory=parsedPath.dir,fileExtension=parsedPath.ext.toLowerCase();
if(i.indexOf('audio/')==0&&(ext=='mp3'||ext=='ogg')){ if(directory.indexOf('audio')==0&&(fileExtension=='.mp3'||fileExtension=='.ogg')) audios.push(file);
audios.push(i); else if(directory.indexOf('font')==0&&fileExtension=='.woff2') fonts.push(file);
else if(directory.indexOf('image')==0&&(fileExtension=='.jpg'||fileExtension=='.png')) images.push(file);
else return;
if(!directories[directory]){
directories[directory]=[];
directoryList.push(directory);
} }
else if(i.indexOf('font/')==0&&ext=='woff2'){ directories[directory].push(parsedPath.base);
fonts.push(i); });
}
else if(i.indexOf('image/')==0&&(ext=='jpg'||ext=='png')){
images.push(i);
}
else{
continue;
}
var index=i.lastIndexOf('/');
var str=i.slice(0,index);
if(!directories[str]){
directories[str]=[];
directorylist.push(str);
}
directories[str].push(i.slice(index+1));
}
if(audios.length||fonts.length||images.length){ if(audios.length||fonts.length||images.length){
var str=''; var str='';
if(audios.length){ if(audios.length){
@ -42889,13 +42835,13 @@
assetLoaded(); assetLoaded();
} }
}; };
game.ensureDirectory(directorylist,writeFile); game.ensureDirectory(directoryList,writeFile);
} }
else{ else{
var getDirectory=function(){ var getDirectory=function(){
if(directorylist.length){ if(directoryList.length){
var dir=directorylist.shift(); var dir=directoryList.shift();
var filelist=directories[dir]; var filelist=directories[dir];
window.resolveLocalFileSystemURL(lib.assetURL+dir,function(entry){ window.resolveLocalFileSystemURL(lib.assetURL+dir,function(entry){
var writeFile=function(){ var writeFile=function(){
@ -42923,7 +42869,7 @@
assetLoaded(); assetLoaded();
} }
}; };
game.ensureDirectory(directorylist,getDirectory); game.ensureDirectory(directoryList,getDirectory);
} }
} }
else{ else{
@ -45661,7 +45607,7 @@
fakeme.appendChild(input); fakeme.appendChild(input);
fakeme.imagenode=ui.create.div('.image',fakeme); fakeme.imagenode=ui.create.div('.image',fakeme);
ui.create.div('.name','选<br><br><br>景',fakeme); ui.create.div('.name','选择背景',fakeme);
ui.create.div('.indent','名称:<input class="new_name" type="text">',newCard).style.paddingTop='8px'; ui.create.div('.indent','名称:<input class="new_name" type="text">',newCard).style.paddingTop='8px';
ui.create.div('.indent','描述:<input class="new_description" type="text">',newCard).style.paddingTop='6px'; ui.create.div('.indent','描述:<input class="new_description" type="text">',newCard).style.paddingTop='6px';
@ -54075,7 +54021,7 @@
fav.classList.add('active'); fav.classList.add('active');
} }
const introduction=ui.create.div('.characterintro',uiintro),showCharacterNamePinyin=lib.config.show_characternamepinyin; const introduction=ui.create.div('.characterintro',uiintro),showCharacterNamePinyin=lib.config.show_characternamepinyin;
if(showCharacterNamePinyin){ if(showCharacterNamePinyin!='doNotShow'){
const characterIntroTable=ui.create.div('.character-intro-table',introduction),span=document.createElement('span'); const characterIntroTable=ui.create.div('.character-intro-table',introduction),span=document.createElement('span');
span.style.fontWeight='bold'; span.style.fontWeight='bold';
const nameInfo=get.character(name),exInfo=nameInfo[4],characterName=exInfo&&exInfo.includes('ruby')?lib.translate[name]:get.rawName(name); const nameInfo=get.character(name),exInfo=nameInfo[4],characterName=exInfo&&exInfo.includes('ruby')?lib.translate[name]:get.rawName(name);
@ -54185,7 +54131,7 @@
const link=this.link,skillName=get.translation(link); const link=this.link,skillName=get.translation(link);
skillNameSpan.innerHTML=skillName; skillNameSpan.innerHTML=skillName;
const showSkillNamePinyin=lib.config.show_skillnamepinyin; const showSkillNamePinyin=lib.config.show_skillnamepinyin;
if(showSkillNamePinyin&&skillName!='阵亡'){ if(showSkillNamePinyin!='doNotShow'&&skillName!='阵亡'){
const ruby=document.createElement('ruby'); const ruby=document.createElement('ruby');
ruby.appendChild(skillNameSpan); ruby.appendChild(skillNameSpan);
const leftParenthesisRP=document.createElement('rp'); const leftParenthesisRP=document.createElement('rp');
@ -54221,7 +54167,7 @@
derivationNameSpanStyle.fontWeight='bold'; derivationNameSpanStyle.fontWeight='bold';
const derivationName=get.translation(derivation); const derivationName=get.translation(derivation);
derivationNameSpan.innerHTML=derivationName; derivationNameSpan.innerHTML=derivationName;
if(showSkillNamePinyin&&derivationName.length<=5&&derivation.indexOf('_faq')==-1){ if(showSkillNamePinyin!='doNotShow'&&derivationName.length<=5&&derivation.indexOf('_faq')==-1){
const ruby=document.createElement('ruby'); const ruby=document.createElement('ruby');
ruby.appendChild(derivationNameSpan); ruby.appendChild(derivationNameSpan);
const leftParenthesisRP=document.createElement('rp'); const leftParenthesisRP=document.createElement('rp');
@ -55454,41 +55400,58 @@
/** /**
* 判断传入的参数的属性是否相同参数可以为卡牌卡牌信息属性等 * 判断传入的参数的属性是否相同参数可以为卡牌卡牌信息属性等
* @param ...infos 要判断的属性列表 * @param ...infos 要判断的属性列表
* @param partly {boolean} 是否判断每一个传入的属性是否存在部分相同而不是完全相同 * @param every {boolean} 是否判断每一个传入的属性是否完全相同而不是存在部分相同
*/ */
sameNature:function(){ sameNature:function(){
var _args=Array.from(arguments); let processedArguments=[],every=false;
var args=[],partly=false; Array.from(arguments).forEach(argument=>{
for(const arg of _args){ if(typeof argument=='boolean') every=argument;
if(typeof arg=='boolean') partly=arg; else if(argument) processedArguments.push(argument);
else{ });
if(arg) args.push(arg); if(!processedArguments.length) return true;
} if(processedArguments.length==1){
const argument=processedArguments[0];
if(!Array.isArray(argument)) return false;
if(!argument.length) return true;
if(argument.length==1) return false;
processedArguments=argument;
} }
if(!args.length) return true; const naturesList=processedArguments.map(card=>{
if(args.length==1){ if(typeof card=='string') return card.split(lib.natureSeparator);
if(Array.isArray(args[0])) args=args[0]; else if(Array.isArray(card)) return card;
else return false; return get.natureList(card||{});
});
const testingNaturesList=naturesList.slice(0,naturesList.length-1);
if(every) return testingNaturesList.every((natures,index)=>naturesList.slice(index+1).every(testingNatures=>testingNatures.length==natures.length&&testingNatures.every(nature=>natures.includes(nature))));
return testingNaturesList.every((natures,index)=>naturesList.slice(index+1).some(testingNatures=>testingNatures.some(nature=>natures.includes(nature))));
},
/**
* 判断传入的参数的属性是否不同参数可以为卡牌卡牌信息属性等
* @param ...infos 要判断的属性列表
* @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同
*/
differentNature:function(){
let processedArguments=[],every=false;
Array.from(arguments).forEach(argument=>{
if(typeof argument=='boolean') every=argument;
else if(argument) processedArguments.push(argument);
});
if(!processedArguments.length) return false;
if(processedArguments.length==1){
const argument=processedArguments[0];
if(!Array.isArray(argument)) return true;
if(!argument.length) return false;
if(argument.length==1) return true;
processedArguments=argument;
} }
var naturesList=[]; const naturesList=processedArguments.map(card=>{
const getN=(cardx)=>{ if(typeof card=='string') return card.split(lib.natureSeparator);
if(typeof cardx=='string') return cardx.split(lib.natureSeparator); else if(Array.isArray(card)) return card;
else if(Array.isArray(cardx)) return cardx; return get.natureList(card||{});
return get.natureList(cardx||{}); });
} const testingNaturesList=naturesList.slice(0,naturesList.length-1);
naturesList=args.map(getN); if(every) return testingNaturesList.every((natures,index)=>naturesList.slice(index+1).every(testingNatures=>testingNatures.every(nature=>!natures.includes(nature))));
if(naturesList.length==1) return false; return testingNaturesList.every((natures,index)=>naturesList.slice(index+1).some(testingNatures=>testingNatures.length!=natures.length||testingNatures.some(nature=>!natures.includes(nature))));
if(naturesList.some(natures=>Array.isArray(natures)&&natures.length)){
var uniqueNatures=new Set(naturesList.flat());
for(var nature of uniqueNatures){
if(!nature) continue;
var lens=naturesList.map(natures=>natures.filter(n=>n===nature).length);
var lensx=Array.from(new Set(lens));
if(partly&&lensx.length==1) return true;
if(!partly&&lensx.length!=1) return false;
}
}
return !Boolean(partly);
}, },
//判断一张牌是否为明置手牌 //判断一张牌是否为明置手牌
shownCard:function(card){ shownCard:function(card){

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 634 B

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB