buttonPresets, 神典韦 update

This commit is contained in:
Spmario233 2023-09-27 13:37:20 +08:00
parent 39a126b64d
commit 0ad723d2db
2 changed files with 244 additions and 168 deletions

View File

@ -109,15 +109,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!_status.characterlist){
lib.skill.pingjian.initList();
}
var list=_status.characterlist.randomGets(5);
if(!list.length) event.finish();
else{
var num=player.countEquipableSlot(1);
player.chooseButton([
'挈挟:选择至多'+get.cnNumber(num)+'张武将置入武器栏',
[list,'character'],
],[1,num],true).set('filterButton',function(button){
var name=button.link;
_status.characterlist.randomSort();
var list=[];
for(var name of _status.characterlist){
var info=lib.character[name];
if(info[3].some(function(skill){
var info=get.skillInfoTranslation(skill);
@ -126,10 +120,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){
list.remove('锁定技');
return list.length==0;
})){
button.classList.add('glow2');
list.push(name);
if(list.length>=5) break;
}
return true;
}).set('ai',function(button){
}
if(!list.length) event.finish();
else{
var num=player.countEquipableSlot(1);
player.chooseButton([
'挈挟:选择至多'+get.cnNumber(num)+'张武将置入武器栏',
[list,function(item,type,position,noclick,node){
return lib.skill.qiexie.$createButton(item,type,position,noclick,node);
}],
],[1,num],true).set('ai',function(button){
var name=button.link;
var info=lib.character[name];
var skills=info[3].filter(function(skill){
@ -164,6 +167,58 @@ game.import('character',function(lib,game,ui,get,ai,_status){
for(var card of cards) player.equip(card);
}
},
$createButton:function(item,type,position,noclick,node){
node=ui.create.buttonPresets.character(item,'character',position,noclick);
const info=lib.character[item];
const skills=info[3].filter(function(skill){
var info=get.skillInfoTranslation(skill);
if(!info.includes('【杀】')) return false;
var list=get.skillCategoriesOf(skill);
list.remove('锁定技');
return list.length==0;
});
if(skills.length){
const skillstr=skills.map(i=>`[${get.translation(i)}]`).join('<br>');
const skillnode=ui.create.caption(`<div class="text" data-nature=${get.groupnature(info[1])}>${skillstr}</div>`,node);
skillnode.style.left='2px';
skillnode.style.bottom='2px';
}
node._customintro=function(uiintro,evt){
const character=node.link,characterInfo=get.character(node.link);
let capt=get.translation(character);
if(characterInfo){
const infoSex=characterInfo[0];
if(infoSex) capt+=`&nbsp;&nbsp;${infoSex=='none'?'无':lib.translate[infoSex]}`;
const infoGroup=characterInfo[1];
if(infoGroup){
const group=get.is.double(character,true);
if(group) capt+=`&nbsp;&nbsp;${group.map(value=>get.translation(value)).join('/')}`;
else capt+=`&nbsp;&nbsp;${lib.translate[infoGroup]}`;
}
}
uiintro.add(capt);
if(lib.characterTitle[node.link]){
uiintro.addText(get.colorspan(lib.characterTitle[node.link]));
}
for(let i=0;i<skills.length;i++){
if(lib.translate[skills[i]+'_info']){
let translation=lib.translate[skills[i]+'_ab']||get.translation(skills[i]).slice(0,2);
if(lib.skill[skills[i]]&&lib.skill[skills[i]].nobracket){
uiintro.add('<div><div class="skilln">'+get.translation(skills[i])+'</div><div>'+get.skillInfoTranslation(skills[i])+'</div></div>');
}
else{
uiintro.add('<div><div class="skill">【'+translation+'】</div><div>'+get.skillInfoTranslation(skills[i])+'</div></div>');
}
if(lib.translate[skills[i]+'_append']){
uiintro._place_text=uiintro.add('<div class="text">'+lib.translate[skills[i]+'_append']+'</div>')
}
}
}
}
return node;
},
video:function(player,info){
for(var name of info[0]){
lib.skill.qiexie.createCard(name);

View File

@ -50267,9 +50267,8 @@
_status.prebutton.push(node);
return node;
},
button:function(item,type,position,noclick,node){
switch(type){
case 'tdnodes':
buttonPresets:{
tdnodes:(item,type,position,noclick,node)=>{
node=ui.create.div('.shadowed.reduce_radius.pointerdiv.tdnode.tdnodes',position);
if(Array.isArray(item)){
node.innerHTML='<span>'+(item[1])+'</span>';
@ -50279,14 +50278,14 @@
node.innerHTML='<span>'+(item)+'</span>';
node.link=item;
}
break;
case 'blank':
return node;
},
blank:(item,type,position,noclick,node)=>{
node=ui.create.div('.button.card',position);
node.link=item;
break;
case 'card':
return node;
},
card:(item,type,position,noclick,node)=>{
if(typeof item.copy=='function'){
node=item.copy(false);
}
@ -50313,9 +50312,9 @@
if(get.position(item)=='j'&&item.viewAs&&item.viewAs!=item.name&&lib.config.cardtempname!='off'){
ui.create.cardTempName(item,node);
}
break;
case 'vcard':
return node;
},
vcard:(item,type,position,noclick,node)=>{
if(typeof item=='string'){
item=[get.type(item),'',item];
}
@ -50323,9 +50322,9 @@
node.classList.add('button');
node.init(item);
node.link=item;
break;
case 'character':case 'player':case 'characterx':
return node;
},
character:(item,type,position,noclick,node)=>{
if(node){
node.classList.add('button');
node.classList.add('character');
@ -50340,7 +50339,7 @@
if(lib.characterReplace[item]&&lib.characterReplace[item].length) item=lib.characterReplace[item].randomGet();
}
node.link=item;
if(type=='character'||type=='characterx'){
var double=get.is.double(node._link,true);
if(double) node._changeGroup=true;
if(type=='characterx'&&lib.characterReplace[node._link]&&lib.characterReplace[node._link].length>1) node._replaceButton=true;
@ -50466,8 +50465,23 @@
};
node.refresh=func;
node.refresh(node,item);
return node;
},
characterx:(item,type,position,noclick,node)=>{
return ui.create.buttonPresets.character(item,type,position,noclick,node);
},
player:(item,type,position,noclick,node)=>{
if(node){
node.classList.add('button');
node.classList.add('character');
node.style.display='';
}
else{
node=ui.create.div('.button.character',position);
}
node._link=item;
node.link=item;
node.node={
name:ui.create.div('.name',node),
intro:ui.create.div('.intro',node)
@ -50484,8 +50498,15 @@
else{
node.setBackground(item.name,'character');
}
return node;
}
break;
},
button:function(item,type,position,noclick,node){
if(ui.create.buttonPresets[type]){
node=ui.create.buttonPresets[type](item,type,position,noclick,node);
}
else if(typeof type=='function'){
node=type(item,type,position,noclick,node);
}
if(!noclick){
node.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.button);
@ -50503,7 +50524,7 @@
},
buttons:function(list,type,position,noclick,zoom){
var buttons=[];
var pre=(type.slice(0,3)=='pre');
var pre=(typeof type=='string'&&type.slice(0,3)=='pre');
if(pre){
if(!_status.prebutton){
_status.prebutton=[];