choiceFour
This commit is contained in:
parent
eb90c60325
commit
f0cc3f421e
|
@ -2165,7 +2165,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
if(!event.cards.someInD()) return false;
|
if(!event.cards.someInD()) return false;
|
||||||
let evt=event,type=get.type2(evt.card,false);
|
let evt=event,type=get.type2(evt.card,false);
|
||||||
if(event.name=='useCardToPlayered'){
|
if(event.name=='useCardToTargeted'){
|
||||||
if(type!='equip'||player!=event.target) return false;
|
if(type!='equip'||player!=event.target) return false;
|
||||||
evt=evt.getParent();
|
evt=evt.getParent();
|
||||||
}
|
}
|
||||||
|
@ -7697,7 +7697,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
zhangzhang:['ol_zhangzhang','re_zhangzhang','zhangzhang'],
|
zhangzhang:['ol_zhangzhang','re_zhangzhang','zhangzhang'],
|
||||||
zuoci:['re_zuoci','zuoci'],
|
zuoci:['re_zuoci','zuoci'],
|
||||||
caiwenji:['ol_caiwenji','re_caiwenji','caiwenji'],
|
caiwenji:['ol_caiwenji','re_caiwenji','caiwenji'],
|
||||||
xuyou:['sp_xuyou','xuyou','jsrg_xuyou','yj_xuyou'],
|
xuyou:['sp_xuyou','xuyou','jsrg_xuyou','yj_xuyou','junk_xuyou'],
|
||||||
guanqiujian:['guanqiujian','tw_guanqiujian','re_guanqiujian','old_guanqiujian'],
|
guanqiujian:['guanqiujian','tw_guanqiujian','re_guanqiujian','old_guanqiujian'],
|
||||||
chendao:['chendao','old_chendao','ns_chendao'],
|
chendao:['chendao','old_chendao','ns_chendao'],
|
||||||
zhugezhan:['zhugezhan','old_zhugezhan'],
|
zhugezhan:['zhugezhan','old_zhugezhan'],
|
||||||
|
|
118
game/game.js
118
game/game.js
|
@ -5700,6 +5700,8 @@
|
||||||
map.four_phaseswap.show();
|
map.four_phaseswap.show();
|
||||||
map.expand_dialog.show();
|
map.expand_dialog.show();
|
||||||
map.fouralign.show();
|
map.fouralign.show();
|
||||||
|
map.edit_character_four.show();
|
||||||
|
map.reset_character_four.show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
map.change_choice.show();
|
map.change_choice.show();
|
||||||
|
@ -5712,12 +5714,16 @@
|
||||||
map.four_phaseswap.hide();
|
map.four_phaseswap.hide();
|
||||||
map.expand_dialog.hide();
|
map.expand_dialog.hide();
|
||||||
map.fouralign.hide();
|
map.fouralign.hide();
|
||||||
|
map.edit_character_four.hide();
|
||||||
|
map.reset_character_four.hide();
|
||||||
}
|
}
|
||||||
if(config.versus_mode=='three'){
|
if(config.versus_mode=='three'){
|
||||||
map.edit_character_three.show();
|
map.edit_character_three.show();
|
||||||
|
map.reset_character_three.show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
map.edit_character_three.hide();
|
map.edit_character_three.hide();
|
||||||
|
map.reset_character_three.hide();
|
||||||
}
|
}
|
||||||
if(config.versus_mode=='three'||config.versus_mode=='one'){
|
if(config.versus_mode=='three'||config.versus_mode=='one'){
|
||||||
map.enable_all_three.show();
|
map.enable_all_three.show();
|
||||||
|
@ -6063,7 +6069,7 @@
|
||||||
lineNumbers:true,
|
lineNumbers:true,
|
||||||
indentUnit:4,
|
indentUnit:4,
|
||||||
autoCloseBrackets:true,
|
autoCloseBrackets:true,
|
||||||
theme:'mdn-like'
|
theme:'mdn-like',
|
||||||
});
|
});
|
||||||
lib.setScroll(editor.querySelector('.CodeMirror-scroll'));
|
lib.setScroll(editor.querySelector('.CodeMirror-scroll'));
|
||||||
node.aced=true;
|
node.aced=true;
|
||||||
|
@ -6080,7 +6086,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
reset_character_three:{
|
reset_character_three:{
|
||||||
name:'重置将池',
|
name:'重置统率将池',
|
||||||
intro:'将统率三军模式下的将池重置为默认将池',
|
intro:'将统率三军模式下的将池重置为默认将池',
|
||||||
clear:true,
|
clear:true,
|
||||||
onclick:function(){
|
onclick:function(){
|
||||||
|
@ -6090,6 +6096,114 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
edit_character_four:{
|
||||||
|
name:'编辑4v4将池',
|
||||||
|
clear:true,
|
||||||
|
onclick:function(){
|
||||||
|
if(get.mode()!='versus'){
|
||||||
|
alert('请进入对决模式,然后再编辑将池');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var container=ui.create.div('.popup-container.editor');
|
||||||
|
var editorpage=ui.create.div(container);
|
||||||
|
var discardConfig=ui.create.div('.editbutton','取消',editorpage,function(){
|
||||||
|
ui.window.classList.remove('shortcutpaused');
|
||||||
|
ui.window.classList.remove('systempaused');
|
||||||
|
container.delete(null);
|
||||||
|
delete window.saveNonameInput;
|
||||||
|
});
|
||||||
|
var node=container;
|
||||||
|
var map=get.config('character_four')||lib.choiceFour;
|
||||||
|
var str='character=[\n ';
|
||||||
|
for(var i=0;i<map.length;i++){
|
||||||
|
str+='"'+map[i]+'",';
|
||||||
|
if(i+1<map.length&&(i+1)%5==0) str+='\n ';
|
||||||
|
}
|
||||||
|
str+='\n];';
|
||||||
|
node.code=str;
|
||||||
|
ui.window.classList.add('shortcutpaused');
|
||||||
|
ui.window.classList.add('systempaused');
|
||||||
|
var saveInput=function(){
|
||||||
|
var code;
|
||||||
|
if(container.editor){
|
||||||
|
code=container.editor.getValue();
|
||||||
|
}
|
||||||
|
else if(container.textarea){
|
||||||
|
code=container.textarea.value;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
var character=null;
|
||||||
|
eval(code);
|
||||||
|
if(!Array.isArray(character)){
|
||||||
|
throw('err');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e){
|
||||||
|
alert('代码语法有错误,请仔细检查('+e+')');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
game.saveConfig('character_four',character,'versus');
|
||||||
|
ui.window.classList.remove('shortcutpaused');
|
||||||
|
ui.window.classList.remove('systempaused');
|
||||||
|
container.delete();
|
||||||
|
container.code=code;
|
||||||
|
delete window.saveNonameInput;
|
||||||
|
};
|
||||||
|
window.saveNonameInput=saveInput;
|
||||||
|
var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput);
|
||||||
|
var editor=ui.create.div(editorpage);
|
||||||
|
if(node.aced){
|
||||||
|
ui.window.appendChild(node);
|
||||||
|
node.editor.setValue(node.code,1);
|
||||||
|
}
|
||||||
|
else if(lib.device=='ios'){
|
||||||
|
ui.window.appendChild(node);
|
||||||
|
if(!node.textarea){
|
||||||
|
var textarea=document.createElement('textarea');
|
||||||
|
editor.appendChild(textarea);
|
||||||
|
node.textarea=textarea;
|
||||||
|
lib.setScroll(textarea);
|
||||||
|
}
|
||||||
|
node.textarea.value=node.code;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var aceReady=function(){
|
||||||
|
ui.window.appendChild(node);
|
||||||
|
var mirror = window.CodeMirror(editor, {
|
||||||
|
value:node.code,
|
||||||
|
mode:"javascript",
|
||||||
|
lineWrapping:!lib.config.touchscreen&&lib.config.mousewheel,
|
||||||
|
lineNumbers:true,
|
||||||
|
indentUnit:4,
|
||||||
|
autoCloseBrackets:true,
|
||||||
|
theme:'mdn-like',
|
||||||
|
gameZoom:game.documentZoom,
|
||||||
|
});
|
||||||
|
lib.setScroll(editor.querySelector('.CodeMirror-scroll'));
|
||||||
|
node.aced=true;
|
||||||
|
node.editor=mirror;
|
||||||
|
}
|
||||||
|
if(!window.ace){
|
||||||
|
lib.init.js(lib.assetURL+'game','codemirror',aceReady);
|
||||||
|
lib.init.css(lib.assetURL+'layout/default','codemirror');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
aceReady();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
reset_character_four:{
|
||||||
|
name:'重置4v4将池',
|
||||||
|
intro:'将4v4模式下的将池重置为默认将池',
|
||||||
|
clear:true,
|
||||||
|
onclick:function(){
|
||||||
|
if(confirm('该操作不可撤销!是否清除4v4模式的自定义将池,并将其重置为默认将池?')){
|
||||||
|
game.saveConfig('character_four',null,'versus');
|
||||||
|
alert('将池已重置');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
connect:{
|
connect:{
|
||||||
|
|
|
@ -1626,9 +1626,10 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
|
||||||
var list2=[];
|
var list2=[];
|
||||||
|
|
||||||
event.list=[];
|
event.list=[];
|
||||||
|
event.choiceFour=(get.config('character_four')||lib.choiceFour);
|
||||||
event.filterChoice=function(name){
|
event.filterChoice=function(name){
|
||||||
if(get.config('enable_all')) return false;
|
if(get.config('enable_all')) return false;
|
||||||
return !lib.choiceFour.contains(name);
|
return !event.choiceFour.contains(name);
|
||||||
}
|
}
|
||||||
for(i in lib.character){
|
for(i in lib.character){
|
||||||
if(event.filterChoice(i)) continue;
|
if(event.filterChoice(i)) continue;
|
||||||
|
|
Loading…
Reference in New Issue