菜单、数据

This commit is contained in:
libccy 2015-10-30 17:13:19 +08:00
parent db0fa18e0f
commit 69147e065a
9 changed files with 856 additions and 638 deletions

View File

@ -1,3 +1,6 @@
1.3.3 1.4.0
弹出菜单改进 弹出菜单改进
新选项菜单 新选项菜单
游戏速度选项
游戏未正常载入时可重置游戏
导入/导出游戏数据

View File

@ -5,7 +5,7 @@
触屏设备建议开启通用选项中的“触屏模式” 触屏设备建议开启通用选项中的“触屏模式”
####添加配音 ####添加配音
添加游戏未自带的配音或音效。需在通用选项中开启“补全配音”<br> 添加游戏未自带的配音或音效。需在选项中开启“补全配音”<br>
卡牌、武将或技能的名称可在card或character文件夹中的文件里找到<br> 卡牌、武将或技能的名称可在card或character文件夹中的文件里找到<br>
支持mp3或ogg格式 支持mp3或ogg格式
######技能配音 ######技能配音

View File

@ -27,4 +27,10 @@
default:bg.style.webkitFilter=''; default:bg.style.webkitFilter='';
} }
} }
window.resetGameTimeout=setTimeout(function(){
if(confirm('游戏似乎未正常载入,是否重置游戏?')){
localStorage.clear();
window.location.reload();
}
},5000);
}()) }())

View File

@ -54,8 +54,95 @@
wuxie_self:{ wuxie_self:{
name:'不无懈自己', name:'不无懈自己',
init:true, init:true,
},
game_speed:{
name:'游戏速度',
init:'mid',
item:{
vslow:'慢',
slow:'较慢',
mid:'中',
fast:'较快',
vfast:'快',
},
},
right_click:{
name:'右键功能',
init:'pause',
unfrequent:true,
item:{
pause:'暂停',
config:'选项',
auto:'托管',
}
},
right_info:{
name:'右键显示信息',
init:true,
unfrequent:true,
restart:true
},
hover_all:{
name:'悬停显示信息',
init:true,
unfrequent:true,
restart:true,
},
hover_handcard:{
name:'悬停手牌显示信息',
init:true,
unfrequent:true,
},
hoveration:{
name:'悬停菜单弹出时间',
unfrequent:true,
init:'1000',
item:{
'500':'0.5秒',
'700':'0.7秒',
'1000':'1秒',
'1500':'1.5秒',
'2500':'2.5秒',
}
},
touchscreen:{
name:'触屏模式',
init:false,
restart:true
},
mousewheel:{
name:'滚轮控制手牌',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('mousewheel',bool);
if(lib.config.touchscreen) return;
if(lib.config.mousewheel){
game.me.node.handcards1.onmousewheel=ui.click.mousewheel;
game.me.node.handcards2.onmousewheel=ui.click.mousewheel;
}
else{
game.me.node.handcards1.onmousewheel=null;
game.me.node.handcards2.onmousewheel=null;
}
}
},
update:function(config,map){
if(!config.hover_all){
map.hover_handcard.hide();
map.hoveration.hide();
}
else{
map.hover_handcard.show();
map.hoveration.show();
}
if(config.touchscreen){
map.mousewheel.hide();
}
else{
map.mousewheel.show();
}
} }
// *****
} }
}, },
appearence:{ appearence:{
@ -79,6 +166,504 @@
setTimeout(function(){ui.arena.show();},100); setTimeout(function(){ui.arena.show();},100);
},500); },500);
} }
},
layout:{
name:'布局',
init:'newlayout',
item:{
default:'默认',
newlayout:'新版',
},
onclick:function(layout){
game.saveConfig('layout',layout);
if(lib.config.mode!='chess'){
ui.arena.hide();
setTimeout(function(){
var layout=ui.css.layout;
ui.css.layout=lib.init.css('layout/'+lib.config.layout,'layout',layout);
setTimeout(function(){layout.remove();ui.arena.show();},100);
},500);
}
}
},
ui_zoom:{
name:'界面缩放',
unfrequent:true,
init:'normal',
item:{
esmall:'极小',
vsmall:'很小',
small:'较小',
normal:'原始',
big:'较大',
vbig:'很大',
},
onclick:function(zoom){
game.saveConfig('ui_zoom',zoom);
switch(zoom){
case 'esmall':ui.window.style.zoom=0.8;break;
case 'vsmall':ui.window.style.zoom=0.9;break;
case 'small':ui.window.style.zoom=0.95;break;
case 'big':ui.window.style.zoom=1.05;break;
case 'vbig':ui.window.style.zoom=1.1;break;
default:ui.window.style.zoom=1;
}
}
},
image_background:{
name:'游戏背景',
init:'default',
item:{
default:'默认',
huangyueying_bg:'逐墨',
zhulian_bg:'璧合',
september_bg:'九月',
xueji_bg:'雪霁',
yinxiang_bg:'印象',
chunhui_bg:'春晖',
grass_bg:'芳草',
huangtian_bg:'黄天',
},
onclick:function(background){
var animate=lib.config.image_background=='default';
game.saveConfig('image_background',background);
ui.background.delete();
ui.background=ui.create.div('.background');
switch (lib.config.image_background_filter){
case 'blur':ui.background.style.webkitFilter='blur(8px)';
ui.background.style.webkitTransform='scale(1.05)';break;
case 'gray':ui.background.style.webkitFilter='grayscale(1)';break;
case 'sepia':ui.background.style.webkitFilter='sepia(0.5)';break;
case 'invert':ui.background.style.webkitFilter='invert(1)';break;
case 'saturate':ui.background.style.webkitFilter='saturate(5)';break;
case 'contrast':ui.background.style.webkitFilter='contrast(1.4)';break;
case 'hue':ui.background.style.webkitFilter='hue-rotate(180deg)';break;
case 'brightness':ui.background.style.webkitFilter='brightness(5)';break;
default:ui.background.style.webkitFilter='';
ui.background.style.webkitTransform='';
}
document.body.insertBefore(ui.background,document.body.firstChild);
if(animate) ui.background.animate('start');
if(lib.config.image_background=='default'){
ui.background.style.backgroundImage="none";
}
else{
ui.background.style.backgroundImage="url('image/background/"+lib.config.image_background+".jpg')";
}
ui.background.style.backgroundSize='cover';
},
},
image_background_filter:{
name:'背景特效',
init:'default',
unfrequent:true,
item:{
default:'无',
blur:'模糊',
gray:'黑色',
sepia:'怀旧',
invert:'反色',
saturate:'饱和',
contrast:'对比',
hue:'偏色',
brightness:'高亮',
},
onclick:function(filter){
game.saveConfig('image_background_filter',filter);
ui.click.sidebar.image_background(lib.config.image_background);
},
},
auto_popped:{
name:'自动弹出菜单',
init:true,
unfrequent:true,
},
only_fullskin:{
name:'隐藏无全身皮肤武将',
init:true,
unfrequent:true,
restart:true,
},
hide_card_image:{
name:'隐藏卡牌背景',
init:false,
unfrequent:true,
restart:true,
},
bottom_line:{
name:'指示线置底',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('bottom_line',bool);
if(lib.config.bottom_line){
ui.canvas.style.zIndex=0;
}
else{
ui.canvas.style.zIndex='';
}
}
},
line_dash:{
name:'虚线指示线',
init:false,
unfrequent:true,
},
show_name:{
name:'显示武将名',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_name',bool);
if(lib.config.show_name){
for(var i=0;i<game.players.length;i++){
game.players[i].node.name.style.display='';
}
}
else{
for(var i=0;i<game.players.length;i++){
game.players[i].node.name.style.display='none';
}
}
}
},
show_replay:{
name:'显示重来按钮',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_replay',bool);
if(lib.config.show_replay){
ui.replay.style.display='';
}
else{
ui.replay.style.display='none';
}
}
},
show_playerids:{
name:'显示身份按钮',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_playerids',bool);
if(lib.config.show_playerids){
ui.playerids.style.display='';
}
else{
ui.playerids.style.display='none';
}
}
},
show_pause:{
name:'显示历史按钮',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_pause',bool);
if(lib.config.show_pause){
ui.pause.style.display='';
}
else{
ui.pause.style.display='none';
}
}
},
show_auto:{
name:'显示托管按钮',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_auto',bool);
if(lib.config.show_auto){
ui.auto.style.display='';
}
else{
ui.auto.style.display='none';
}
}
},
show_volumn:{
name:'显示音量按钮',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_volumn',bool);
if(lib.config.show_volumn){
ui.volumn.style.display='';
}
else{
ui.volumn.style.display='none';
}
}
},
show_wuxie:{
name:'显示不询问无懈',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_wuxie',bool);
if(lib.config.show_wuxie){
ui.wuxie.style.display='';
}
else{
ui.wuxie.style.display='none';
}
}
},
show_discardpile:{
name:'暂停时显示弃牌堆',
init:false,
unfrequent:true,
},
title:{
name:'标题栏显示信息',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('title',bool);
if(!lib.config.title) document.title='无名杀';
}
},
fold_card:{
name:'折叠手牌',
init:true,
onclick:function(bool){
game.saveConfig('fold_card',bool);
if(bool){
ui.css.fold=lib.init.css('layout/default','fold');
}
else if(ui.css.fold){
ui.css.fold.remove();
}
}
},
blur_ui:{
name:'模糊效果',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('blur_ui',bool);
if(bool){
ui.css.blur_ui=lib.init.css('layout/default','blur');
}
else if(ui.css.blur_ui){
ui.css.blur_ui.remove();
}
}
},
animation:{
name:'游戏特效',
init:true,
},
update:function(config,map){
if(lib.config.layoutfixed.contains(lib.config.mode)){
map.layout.hide();
}
if(lib.config.image_background=='default'){
map.image_background_filter.hide();
}
else{
map.image_background_filter.show();
}
},
}
},
audio:{
name:'音效',
config:{
background_music:{
name:'背景音乐',
init:true,
item:{
music_default:'默认',
music_diaochan:'貂蝉',
music_shezhan:'舌战',
music_danji:'单骑',
music_random:'随机',
music_off:'关闭',
},
onclick:function(item){
game.saveConfig('background_music',item);
game.playBackgroundMusic();
}
},
background_audio:{
name:'游戏音效',
init:true,
},
background_speak:{
name:'人物配音',
init:true,
},
background_ogg:{
name:'补全配音',
init:false
}
}
},
playpack:{
name:'玩法',
config:{
character:{
name:'角色卡牌',
init:false,
restart:true,
onclick:function(bool){
if(bool){
lib.config.plays.add('character');
}
else{
lib.config.plays.remove('character');
}
game.saveConfig('plays',lib.config.plays);
}
},
soldier:{
name:'士兵模式',
init:false,
restart:true,
onclick:function(bool){
if(bool){
lib.config.plays.add('soldier');
}
else{
lib.config.plays.remove('soldier');
}
game.saveConfig('plays',lib.config.plays);
}
},
wuxing:{
name:'五行生克',
init:false,
restart:true,
onclick:function(bool){
if(bool){
lib.config.plays.add('wuxing');
}
else{
lib.config.plays.remove('wuxing');
}
game.saveConfig('plays',lib.config.plays);
}
},
update:function(config,map){
for(var i in map){
if(lib.config.plays.contains(i)){
map[i].classList.add('on');
}
else{
map[i].classList.remove('on');
}
}
}
}
},
skill:{
name:'技能',
config:{
update:function(config,map){
for(var i in map){
if(map[i]._link.config.type=='autoskill'){
if(!lib.config.autoskilllist.contains(i)){
map[i].classList.add('on');
ui.autoskill[i].lastChild.classList.add('on');
}
else{
map[i].classList.remove('on');
ui.autoskill[i].lastChild.classList.remove('on');
}
}
else if(map[i]._link.config.type=='banskill'){
if(!lib.config.forbidlist.contains(i)){
map[i].classList.add('on');
}
else{
map[i].classList.remove('on');
}
}
}
}
}
},
others:{
name:'其它',
config:{
reset_game:{
name:'重置游戏',
onclick:function(){
var node=this;
if(node._clearing){
localStorage.clear();
window.location.reload();
return;
}
node._clearing=true;
node.innerHTML='单击以确认 (3)';
setTimeout(function(){
node.innerHTML='单击以确认 (2)';
setTimeout(function(){
node.innerHTML='单击以确认 (1)';
setTimeout(function(){
node.innerHTML='重置游戏';
delete node._clearing;
},1000);
},1000);
},1000);
},
clear:true
},
import_data:{
name:'导入游戏数据',
onclick:function(){
ui.import_data_button.classList.toggle('hidden');
},
clear:true
},
import_data_button:{
name:'<div style="white-space:nowrap;width:calc(100% - 10px)">'+
'<input type="file" id="fileToLoad" style="width:calc(100% - 40px)">'+
'<button style="width:40px">确定</button></div>',
clear:true,
},
export_data:{
name:'导出游戏数据',
onclick:function(){
var data={};
for(var i in localStorage){
data[i]=localStorage[i];
}
var textToWrite = lib.init.encode(JSON.stringify(data));
var textFileAsBlob = new Blob([textToWrite], {type:'text/plain'});
var fileNameToSaveAs = 'noname-data';
var downloadLink = document.createElement("a");
downloadLink.download = fileNameToSaveAs;
downloadLink.innerHTML = "Download File";
if (window.webkitURL != null)
{
// Chrome allows the link to be clicked
// without actually adding it to the DOM.
downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob);
}
else
{
// Firefox requires the link to be added to the DOM
// before it can be clicked.
downloadLink.href = window.URL.createObjectURL(textFileAsBlob);
downloadLink.onclick = function(){
downloadLink.remove();
};
downloadLink.style.display = "none";
document.body.appendChild(downloadLink);
}
downloadLink.click();
},
clear:true
} }
} }
} }
@ -899,6 +1484,8 @@
if(lib.config.threed_card) ui.css.threed=lib.init.css('layout/default','fold2'); if(lib.config.threed_card) ui.css.threed=lib.init.css('layout/default','fold2');
if(lib.config.blur_ui) ui.css.blur_ui=lib.init.css('layout/default','blur'); if(lib.config.blur_ui) ui.css.blur_ui=lib.init.css('layout/default','blur');
ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style'); ui.css.theme=lib.init.css('theme/'+lib.config.theme,'style');
lib.config.duration=500;
}, },
css:function(path,file,before){ css:function(path,file,before){
var style = document.createElement("link"); var style = document.createElement("link");
@ -1060,7 +1647,12 @@
player.phaseJudge(); player.phaseJudge();
"step 1" "step 1"
player.phaseDraw(); player.phaseDraw();
game.delay(); if(player==game.me){
game.delay();
}
else{
game.delayx();
}
"step 2" "step 2"
player.phaseUse(); player.phaseUse();
"step 3" "step 3"
@ -1987,8 +2579,8 @@
} }
} }
if(event.animate!=false||num>0){ if(event.animate!=false||num>0){
if(num==0)game.delay(); if(num==0)game.delayx();
else game.delay(0.5); else game.delayx(0.5);
} }
"step 3" "step 3"
if(!get.info(event.card).multitarget&&num<targets.length-1){ if(!get.info(event.card).multitarget&&num<targets.length-1){
@ -2136,9 +2728,9 @@
} }
if(num==0){ if(num==0){
if(typeof info.delay=='number') game.delay(info.delay); if(typeof info.delay=='number') game.delay(info.delay);
else if(info.delay!==false&&info.delay!==0) game.delay(); else if(info.delay!==false&&info.delay!==0) game.delayx();
} }
else game.delay(0.5); else game.delayx(0.5);
if(!info.multitarget&&num<targets.length-1){ if(!info.multitarget&&num<targets.length-1){
event.num++; event.num++;
event.redo(); event.redo();
@ -2222,7 +2814,7 @@
if(event.card) name+=get.translation(event.card.name); if(event.card) name+=get.translation(event.card.name);
} }
event.trigger('respond'); event.trigger('respond');
game.delay(0.5); game.delayx(0.5);
}, },
gain:function(){ gain:function(){
"step 0" "step 0"
@ -4596,8 +5188,15 @@
if(this.name&&this.name2){ if(this.name&&this.name2){
this.forbiddenSkills.length=0; this.forbiddenSkills.length=0;
var forbid=[]; var forbid=[];
var getName=function(arr){
var str='';
for(var i=0;i<arr.length;i++){
str+=arr[i]+'+';
}
return str.slice(0,str.length-1);
}
for(var i=0;i<lib.config.forbid.length;i++){ for(var i=0;i<lib.config.forbid.length;i++){
if(lib.config.forbidlist[i]){ if(!lib.config.forbidlist.contains(getName(lib.config.forbid[i]))){
for(var j=0;j<lib.config.forbid[i].length;j++){ for(var j=0;j<lib.config.forbid[i].length;j++){
if(this.skills.contains(lib.config.forbid[i][j])==false) break; if(this.skills.contains(lib.config.forbid[i][j])==false) break;
} }
@ -6820,6 +7419,16 @@
time=time*lib.config.duration+time2; time=time*lib.config.duration+time2;
_status.timeout=setTimeout(game.resume,time); _status.timeout=setTimeout(game.resume,time);
}, },
delayx:function(time){
if(typeof time!='number') time=1;
switch(lib.config.game_speed){
case 'vslow':time*=2.5;break;
case 'slow':time*=1.5;break;
case 'fast':time*=0.7;break;
case 'vfast':time*=0.4;break;
}
return game.delay(time);
},
check:function(event){ check:function(event){
var i,j,range; var i,j,range;
if(event==undefined) event=_status.event; if(event==undefined) event=_status.event;
@ -8481,14 +9090,14 @@
// ui.config.appendChild(gameconfig[i]); // ui.config.appendChild(gameconfig[i]);
// } // }
// } // }
// switch(lib.config.ui_zoom){ switch(lib.config.ui_zoom){
// case '极小':ui.window.style.zoom=0.8;break; case 'esmall':ui.window.style.zoom=0.8;break;
// case '很小':ui.window.style.zoom=0.9;break; case 'vsmall':ui.window.style.zoom=0.9;break;
// case '较小':ui.window.style.zoom=0.95;break; case 'small':ui.window.style.zoom=0.95;break;
// case '较大':ui.window.style.zoom=1.05;break; case 'big':ui.window.style.zoom=1.05;break;
// case '很大':ui.window.style.zoom=1.1;break; case 'vbig':ui.window.style.zoom=1.1;break;
// default:ui.window.style.zoom=1; default:ui.window.style.zoom=1;
// } }
// if(true||lib.config.no_ios_zoom){ // if(true||lib.config.no_ios_zoom){
// var meta=document.createElement('meta'); // var meta=document.createElement('meta');
// meta.name='viewport'; // meta.name='viewport';
@ -8836,7 +9445,7 @@
// ui.configbg.appendChild(ui.characterviewdialog); // ui.configbg.appendChild(ui.characterviewdialog);
// })); // }));
// //
var autoskill=[]; var autoskill={};
// folditems.push(autoskill); // folditems.push(autoskill);
ui.autoskill=autoskill; ui.autoskill=autoskill;
// ui.config.appendChild(ui.create.line2('自动发动',function(){ // ui.config.appendChild(ui.create.line2('自动发动',function(){
@ -8878,7 +9487,7 @@
nodex=ui.create.switcher(i+'_forbid', nodex=ui.create.switcher(i+'_forbid',
!lib.config.autoskilllist.contains(i),ui.click.sidebar.autoskill); !lib.config.autoskilllist.contains(i),ui.click.sidebar.autoskill);
nodex.link=i; nodex.link=i;
autoskill.push(nodex); autoskill[i]=nodex;
} }
} }
// //
@ -9250,7 +9859,7 @@
} }
} }
var menux=createMenu(['开始','选项','武将','卡牌','技能','帮助'],{ var menux=createMenu(['开始','选项','武将','卡牌','战局','帮助'],{
position:menuContainer,bar:40 position:menuContainer,bar:40
}); });
menu=menux.menu; menu=menux.menu;
@ -9403,6 +10012,62 @@
rightPane.appendChild(this.link); rightPane.appendChild(this.link);
}; };
var clickAutoSkill=function(bool){
var name=this._link.config._name;
var list=lib.config.autoskilllist;
if(bool){
list.remove(name);
}
else{
list.add(name);
}
game.saveConfig('autoskilllist',list);
};
for(var i in lib.skill){
if(lib.skill[i].frequent&&lib.translate[i]){
lib.configMenu.skill.config[i]={
name:lib.translate[i],
init:true,
type:'autoskill',
onclick:clickAutoSkill
}
}
}
var clickBanSkill=function(bool){
var name=this._link.config._name;
var list=lib.config.forbidlist;
if(bool){
list.remove(name);
}
else{
list.add(name);
}
game.saveConfig('forbidlist',list);
};
var forbid=lib.config.forbid;
lib.config.forbidmap={};
if(!lib.config.forbidlist){
game.saveConfig('forbidlist',[]);
}
for(var i=0;i<forbid.length;i++){
var str='';
var str2='';
for(var j=0;j<forbid[i].length;j++){
str+=get.translation(forbid[i][j])+'+';
str2+=forbid[i][j]+'+';
}
lib.config.forbidmap[str2]=forbid[i];
str=str.slice(0,str.length-1);
str2=str2.slice(0,str2.length-1);
lib.configMenu.skill.config[str2]={
name:str,
init:true,
type:'banskill',
onclick:clickBanSkill
}
}
var createModeConfig=function(mode,position){ var createModeConfig=function(mode,position){
var info=lib.configMenu[mode]; var info=lib.configMenu[mode];
var page=ui.create.div(''); var page=ui.create.div('');
@ -9415,6 +10080,43 @@
var map={}; var map={};
if(info.config){ if(info.config){
var hiddenNodes=[]; var hiddenNodes=[];
var autoskillNodes=[];
var banskillNodes=[];
var banskill;
if(mode=='skill'){
var autoskillexpanded=false;
var banskillexpanded=false;
ui.create.div('.config.more','自动发动 <div>&gt;</div>',page,function(){
if(autoskillexpanded){
this.classList.remove('on');
for(var k=0;k<autoskillNodes.length;k++){
autoskillNodes[k].hide();
}
}
else{
this.classList.add('on');
for(var k=0;k<autoskillNodes.length;k++){
autoskillNodes[k].show();
}
}
autoskillexpanded=!autoskillexpanded;
});
banskill=ui.create.div('.config.more','双将禁配 <div>&gt;</div>',page,function(){
if(banskillexpanded){
this.classList.remove('on');
for(var k=0;k<banskillNodes.length;k++){
banskillNodes[k].hide();
}
}
else{
this.classList.add('on');
for(var k=0;k<banskillNodes.length;k++){
banskillNodes[k].show();
}
}
banskillexpanded=!banskillexpanded;
});
}
for(var j in info.config){ for(var j in info.config){
if(j==='update'){ if(j==='update'){
continue; continue;
@ -9446,9 +10148,54 @@
}; };
} }
var cfgnode=createConfig(cfg); var cfgnode=createConfig(cfg);
if(cfg.type=='autoskill'){
autoskillNodes.push(cfgnode);
cfgnode.style.transition='all 0s';
cfgnode.classList.add('indent');
cfgnode.hide();
}
else if(cfg.type=='banskill'){
banskillNodes.push(cfgnode);
cfgnode.style.transition='all 0s';
cfgnode.classList.add('indent');
cfgnode.hide();
}
if(j=='import_data_button'){
ui.import_data_button=cfgnode;
cfgnode.hide();
cfgnode.querySelector('button').onclick=function(){
var fileToLoad = document.getElementById("fileToLoad").files[0];
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
var data = fileLoadedEvent.target.result;
if(!data) return;
try{
data=JSON.parse(lib.init.decode(data));
localStorage.clear();
for(var i in data){
localStorage.setItem(i,data[i]);
}
}
catch(e){
alert('导入失败');
return;
}
alert('导入成功');
game.reload();
};
fileReader.readAsText(fileToLoad, "UTF-8");
}
}
map[j]=cfgnode; map[j]=cfgnode;
if(!cfg.unfrequent){ if(!cfg.unfrequent){
page.appendChild(cfgnode); if(cfg.type=='autoskill'){
page.insertBefore(cfgnode,banskill);
}
else{
page.appendChild(cfgnode);
}
} }
else{ else{
cfgnode.classList.add('auto-hide'); cfgnode.classList.add('auto-hide');
@ -9490,6 +10237,8 @@
rightPane.appendChild(active.link); rightPane.appendChild(active.link);
}()); }());
}()); }());
clearTimeout(window.resetGameTimeout);
delete window.resetGameTimeout;
}, },
system:function(str,func,right){ system:function(str,func,right){
var node=ui.create.div(right?ui.system2:ui.system1); var node=ui.create.div(right?ui.system2:ui.system1);
@ -9586,9 +10335,9 @@
ui.create.div('',node.node.hp); ui.create.div('',node.node.hp);
} }
} }
if(!lib.config.show_name){ // if(!lib.config.show_name){
node.node.name.style.display='none'; node.node.name.style.display='none';
} // }
var name=get.translation(item); var name=get.translation(item);
node.node.name.innerHTML=''; node.node.name.innerHTML='';
for(var i=0;i<name.length;i++){ for(var i=0;i<name.length;i++){
@ -9835,8 +10584,8 @@
} }
} }
} }
for(var i=0;i<autoskill.length-1;i++){ for(var i=0;i<sks.length;i++){
if(sks.contains(autoskill[i].link)){ if(autoskill[sks[i]]){
if(!auto){ if(!auto){
ng=ui.create.div('.text'); ng=ui.create.div('.text');
ng.style.marginBottom=0; ng.style.marginBottom=0;
@ -9848,8 +10597,8 @@
auto.innerHTML='自动发动'; auto.innerHTML='自动发动';
uiintro.add(auto); uiintro.add(auto);
} }
autoskill[i].style.display=''; autoskill[sks[i]].style.display='';
uiintro.add(autoskill[i]); uiintro.add(autoskill[sks[i]]);
} }
} }
@ -10152,7 +10901,7 @@
hoveration=node._hoveration; hoveration=node._hoveration;
} }
else{ else{
hoveration=lib.config.hoveration; hoveration=parseInt(lib.config.hoveration);
if(node.classList.contains('button')|| if(node.classList.contains('button')||
(node.parentNode&&node.parentNode.parentNode)==ui.me){ (node.parentNode&&node.parentNode.parentNode)==ui.me){
hoveration+=500; hoveration+=500;
@ -13492,7 +14241,7 @@
} }
lib.config.current_mode=mode[lib.config.mode].config||[]; lib.config.current_mode=mode[lib.config.mode].config||[];
lib.config.mode_choice=mode[lib.config.mode].config; lib.config.mode_choice=mode[lib.config.mode].config;
game.rank=window.characterRank; lib.rank=window.characterRank;
delete window.characterRank; delete window.characterRank;
for(i in mode[lib.config.mode]){ for(i in mode[lib.config.mode]){
if(i=='element') continue; if(i=='element') continue;
@ -13506,7 +14255,14 @@
lib[i][j]=lib.init.eval(mode[lib.config.mode][i][j]); lib[i][j]=lib.init.eval(mode[lib.config.mode][i][j]);
} }
} }
lib.characterPack={};
for(i in character){ for(i in character){
lib.characterPack[i]=[];
if(character[i].character){
for(j in character[i].character){
lib.characterPack[i].push(character[i].character[j]);
}
}
if(character[i].forbid&&character[i].forbid.contains(lib.config.mode)) continue; if(character[i].forbid&&character[i].forbid.contains(lib.config.mode)) continue;
if(character[i].mode&&character[i].mode.contains(lib.config.mode)==false) continue; if(character[i].mode&&character[i].mode.contains(lib.config.mode)==false) continue;
for(j in character[i]){ for(j in character[i]){

View File

@ -1,6 +1,7 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="user-scalable=0">
<link rel="apple-touch-icon" href="image/meta/icon.png"> <link rel="apple-touch-icon" href="image/meta/icon.png">
<link rel="apple-touch-startup-image" href="starts/image/meta/icon.png"> <link rel="apple-touch-startup-image" href="starts/image/meta/icon.png">
<title>无名杀</title> <title>无名杀</title>

View File

@ -216,7 +216,7 @@ margin-bottom: 5px;
/*--------角色--------*/ /*--------角色--------*/
.player>.avatar>.action{ .player>.avatar>.action{
margin: 5px; margin: 5px;
font-family: 'huangcao'; font-family: 'xinwei';
font-size: 20px; font-size: 20px;
letter-spacing: -2px; letter-spacing: -2px;
} }
@ -232,7 +232,7 @@ margin-bottom: 5px;
.player.replaceenemy{-webkit-animation:replaceenemy 0.5s} .player.replaceenemy{-webkit-animation:replaceenemy 0.5s}
.player>div{z-index: 2;} .player>div{z-index: 2;}
.player.dead,.player.likedead{z-index: 1;-webkit-filter:grayscale(1);} .player.dead,.player.likedead{z-index: 1;-webkit-filter:grayscale(1);}
.player>.name{left: 18px;top:36px;} .player>.name{left: 18px;top:36px;font-family: 'huangcao';font-size:20px}
.player>.intro{top:87px;left: 18px;} .player>.intro{top:87px;left: 18px;}
.player>.damage{ .player>.damage{
font-family: 'huangcao'; font-family: 'huangcao';

View File

@ -141,6 +141,11 @@
left:2px !important; left:2px !important;
text-align: left !important; text-align: left !important;
} }
.menu.main>.menu-content>div>.right.pane>div>.config.indent,
.menu.main>.menu-content>div>.right.pane>div>.config.toggle.indent{
left:12px !important;
width: calc(100% - 20px) !important;
}
.menu.main>.menu-content>div>.right.pane>div:not(.expanded)>.config.auto-hide, .menu.main>.menu-content>div>.right.pane>div:not(.expanded)>.config.auto-hide,
.menu.main>.menu-content>div>.right.pane>div>.config.hidden{ .menu.main>.menu-content>div>.right.pane>div>.config.hidden{
margin-top:-25px; margin-top:-25px;

View File

@ -1119,21 +1119,21 @@ mode.chess={
ui.money.childNodes[3].style.fontFamily='huangcao'; ui.money.childNodes[3].style.fontFamily='huangcao';
ui.money.style.letterSpacing='4px'; ui.money.style.letterSpacing='4px';
'step 1' 'step 1'
game.rank.all=game.rank.s. lib.rank.all=lib.rank.s.
concat(game.rank.ap). concat(lib.rank.ap).
concat(game.rank.a). concat(lib.rank.a).
concat(game.rank.am). concat(lib.rank.am).
concat(game.rank.bp). concat(lib.rank.bp).
concat(game.rank.b). concat(lib.rank.b).
concat(game.rank.bm). concat(lib.rank.bm).
concat(game.rank.c). concat(lib.rank.c).
concat(game.rank.d); concat(lib.rank.d);
game.rank.common=[]; lib.rank.common=[];
for(var i=0;i<game.rank.all.length;i++){ for(var i=0;i<lib.rank.all.length;i++){
if(!game.rank.legend.contains(game.rank.all[i])&& if(!lib.rank.legend.contains(lib.rank.all[i])&&
!game.rank.epic.contains(game.rank.all[i])&& !lib.rank.epic.contains(lib.rank.all[i])&&
!game.rank.rare.contains(game.rank.all[i])){ !lib.rank.rare.contains(lib.rank.all[i])){
game.rank.common.push(game.rank.all[i]); lib.rank.common.push(lib.rank.all[i]);
} }
} }
delete window.characterRank; delete window.characterRank;
@ -1296,7 +1296,7 @@ mode.chess={
return aa>bb?1:-1; return aa>bb?1:-1;
}); });
if(game.data.character.length==0||!game.data.challenge){ if(game.data.character.length==0||!game.data.challenge){
game.data.character=game.rank.common.randomGets(3); game.data.character=lib.rank.common.randomGets(3);
game.data.challenge=game.getLeaderList(); game.data.challenge=game.getLeaderList();
game.saveData(); game.saveData();
} }
@ -1639,20 +1639,20 @@ mode.chess={
var total=Math.max(2,_status.mylist.length-1); var total=Math.max(2,_status.mylist.length-1);
var list; var list;
switch(rank){ switch(rank){
case 's':list=game.rank.ap;break; case 's':list=lib.rank.ap;break;
case 'ap':list=game.rank.s.concat(game.rank.a);break; case 'ap':list=lib.rank.s.concat(lib.rank.a);break;
case 'a':list=game.rank.ap.concat(game.rank.am);break; case 'a':list=lib.rank.ap.concat(lib.rank.am);break;
case 'am':list=game.rank.a.concat(game.rank.bp);break; case 'am':list=lib.rank.a.concat(lib.rank.bp);break;
case 'bp':list=game.rank.am.concat(game.rank.b);break; case 'bp':list=lib.rank.am.concat(lib.rank.b);break;
case 'b':list=game.rank.bp.concat(game.rank.bm);break; case 'b':list=lib.rank.bp.concat(lib.rank.bm);break;
case 'bm':list=game.rank.b.concat(game.rank.c);break; case 'bm':list=lib.rank.b.concat(lib.rank.c);break;
case 'c':list=game.rank.bm.concat(game.rank.d);break; case 'c':list=lib.rank.bm.concat(lib.rank.d);break;
case 'd':list=game.rank.c;break; case 'd':list=lib.rank.c;break;
} }
for(var i=0;i<total;i++){ for(var i=0;i<total;i++){
if(Math.random()<0.7){ if(Math.random()<0.7){
_status.enemylist.push(Array.prototype.randomGet.apply( _status.enemylist.push(Array.prototype.randomGet.apply(
game.rank[rank],_status.enemylist.concat(_status.mylist))); lib.rank[rank],_status.enemylist.concat(_status.mylist)));
} }
else{ else{
_status.enemylist.push(Array.prototype.randomGet.apply( _status.enemylist.push(Array.prototype.randomGet.apply(
@ -1677,9 +1677,9 @@ mode.chess={
number=3; number=3;
} }
switch(difficulty){ switch(difficulty){
case 'leader_easy':list=game.rank.d.concat(game.rank.c).concat(game.rank.bm);break; case 'leader_easy':list=lib.rank.d.concat(lib.rank.c).concat(lib.rank.bm);break;
case 'leader_medium':list=game.rank.b.concat(game.rank.bp).concat(game.rank.am);break; case 'leader_medium':list=lib.rank.b.concat(lib.rank.bp).concat(lib.rank.am);break;
case 'leader_hard':list=game.rank.a.concat(game.rank.ap).concat(game.rank.s);break; case 'leader_hard':list=lib.rank.a.concat(lib.rank.ap).concat(lib.rank.s);break;
} }
for(var i=0;i<lib.hiddenCharacters.length;i++){ for(var i=0;i<lib.hiddenCharacters.length;i++){
if(list.length<=number){ if(list.length<=number){
@ -1996,15 +1996,15 @@ mode.chess={
} }
else{ else{
switch(event.arenachoice.length){ switch(event.arenachoice.length){
case 0:choice=game.rank.d.randomGets(3);break; case 0:choice=lib.rank.d.randomGets(3);break;
case 1:choice=game.rank.c.randomGets(3);break; case 1:choice=lib.rank.c.randomGets(3);break;
case 2:choice=game.rank.bm.randomGets(3);break; case 2:choice=lib.rank.bm.randomGets(3);break;
case 3:choice=game.rank.b.randomGets(3);break; case 3:choice=lib.rank.b.randomGets(3);break;
case 4:choice=game.rank.bp.randomGets(3);break; case 4:choice=lib.rank.bp.randomGets(3);break;
case 5:choice=game.rank.am.randomGets(3);break; case 5:choice=lib.rank.am.randomGets(3);break;
case 6:choice=game.rank.a.randomGets(3);break; case 6:choice=lib.rank.a.randomGets(3);break;
case 7:choice=game.rank.ap.randomGets(3);break; case 7:choice=lib.rank.ap.randomGets(3);break;
case 8:choice=game.rank.s.randomGets(3);break; case 8:choice=lib.rank.s.randomGets(3);break;
} }
game.data.arena={ game.data.arena={
win:0, win:0,
@ -2356,14 +2356,14 @@ mode.chess={
} }
game.saveData(); game.saveData();
switch(game.data.arena.win){ switch(game.data.arena.win){
case 0:list=game.rank.d.concat(game.rank.c);break; case 0:list=lib.rank.d.concat(lib.rank.c);break;
case 1:list=game.rank.c.concat(game.rank.bm);break; case 1:list=lib.rank.c.concat(lib.rank.bm);break;
case 2:list=game.rank.bm.concat(game.rank.b);break; case 2:list=lib.rank.bm.concat(lib.rank.b);break;
case 3:list=game.rank.b.concat(game.rank.bp);break; case 3:list=lib.rank.b.concat(lib.rank.bp);break;
case 4:list=game.rank.bp.concat(game.rank.am);break; case 4:list=lib.rank.bp.concat(lib.rank.am);break;
case 5:list=game.rank.am.concat(game.rank.a);break; case 5:list=lib.rank.am.concat(lib.rank.a);break;
case 6:list=game.rank.a.concat(game.rank.ap);break; case 6:list=lib.rank.a.concat(lib.rank.ap);break;
default:list=game.rank.ap.concat(game.rank.s); default:list=lib.rank.ap.concat(lib.rank.s);
} }
for(var i=0;i<_status.mylist.length;i++){ for(var i=0;i<_status.mylist.length;i++){
list.remove(_status.mylist[i]); list.remove(_status.mylist[i]);
@ -2442,7 +2442,7 @@ mode.chess={
}, },
getRank:function(name){ getRank:function(name){
if(name==_status.lord) return 'ap'; if(name==_status.lord) return 'ap';
var rank=game.rank; var rank=lib.rank;
if(rank.s.contains(name)) return 's'; if(rank.s.contains(name)) return 's';
if(rank.ap.contains(name)) return 'ap'; if(rank.ap.contains(name)) return 'ap';
if(rank.a.contains(name)) return 'a'; if(rank.a.contains(name)) return 'a';
@ -2455,7 +2455,7 @@ mode.chess={
return 'x'; return 'x';
}, },
getLeaderList:function(){ getLeaderList:function(){
var list=game.rank.all.slice(0); var list=lib.rank.all.slice(0);
for(var i=0;i<game.data.character.length;i++){ for(var i=0;i<game.data.character.length;i++){
list.remove(game.data.character[i]); list.remove(game.data.character[i]);
} }
@ -2475,13 +2475,13 @@ mode.chess={
if(Math.random()<pleg){ if(Math.random()<pleg){
game.data.legend=0; game.data.legend=0;
game.saveData(); game.saveData();
return game.rank.legend.randomGet(); return lib.rank.legend.randomGet();
} }
game.data.legend++; game.data.legend++;
game.saveData(); game.saveData();
if(Math.random()<0.05) return game.rank.epic.randomGet(); if(Math.random()<0.05) return lib.rank.epic.randomGet();
if(Math.random()<0.3) return game.rank.rare.randomGet(); if(Math.random()<0.3) return lib.rank.rare.randomGet();
return game.rank.common.randomGet(); return lib.rank.common.randomGet();
}, },
changeMoney:function(num){ changeMoney:function(num){
game.data.money+=num; game.data.money+=num;
@ -2494,7 +2494,7 @@ mode.chess={
ui.money.childNodes[1].innerHTML=game.data.dust; ui.money.childNodes[1].innerHTML=game.data.dust;
}, },
getRarity:function(name){ getRarity:function(name){
var rank=game.rank; var rank=lib.rank;
if(rank.legend.contains(name)) return 'legend'; if(rank.legend.contains(name)) return 'legend';
if(rank.epic.contains(name)) return 'epic'; if(rank.epic.contains(name)) return 'epic';
if(rank.rare.contains(name)) return 'rare'; if(rank.rare.contains(name)) return 'rare';

553
todo.js
View File

@ -1,553 +0,0 @@
// gameconfig.push(ui.create.switcher('cheat',lib.config.cheat,ui.click.sidebar.cheat));
// gameconfig.push(ui.create.switcher('auto_confirm',lib.config.auto_confirm,ui.click.sidebar.global));
// gameconfig.push(ui.create.switcher('enable_drag',lib.config.enable_drag,ui.click.sidebar.global));
// ui.wuxie_self=ui.create.switcher('wuxie_self',lib.config.wuxie_self,ui.click.sidebar.global);
// gameconfig.push(ui.wuxie_self);
gameconfig.push(ui.create.switcher('duration',[500,700,1000],lib.config.duration,ui.click.sidebar.global));
gameconfig.push(ui.create.switcher('hoveration',[700,1000,1500],lib.config.hoveration,ui.click.sidebar.global));
gameconfig.push(ui.create.div('.placeholder'));
gameconfig.push(ui.create.switcher('right_click',['pause','config','auto'],lib.config.right_click,ui.click.sidebar.global));
gameconfig.push(ui.create.switcher('right_info',lib.config.right_info,ui.click.sidebar.global2));
gameconfig.push(ui.create.switcher('hover_all',lib.config.hover_all,ui.click.sidebar.hover_all));
ui.hoverhandcardconfig=ui.create.switcher('hover_handcard',lib.config.hover_handcard,ui.click.sidebar.global);
gameconfig.push(ui.hoverhandcardconfig);
if(!lib.config.hover_all) ui.hoverhandcardconfig.classList.add('disabled');
gameconfig.push(ui.create.switcher('touchscreen',lib.config.touchscreen,ui.click.sidebar.touchscreen));
// gameconfig.push(ui.create.switcher('no_ios_zoom',lib.config.no_ios_zoom,ui.click.sidebar.global));
ui.handcardmousewheel=ui.create.switcher('mousewheel',lib.config.mousewheel,ui.click.sidebar.mousewheel);
if(lib.config.touchscreen) ui.handcardmousewheel.classList.add('disabled');
gameconfig.push(ui.handcardmousewheel);
gameconfig.push(ui.create.div('.placeholder'));
gameconfig.push(ui.create.switcher('background_music',lib.config.all.background_music,lib.config.background_music,ui.click.sidebar.background_music));
gameconfig.push(ui.create.switcher('background_audio',lib.config.background_audio,ui.click.sidebar.global));
gameconfig.push(ui.create.switcher('background_speak',lib.config.background_speak,ui.click.sidebar.global));
gameconfig.push(ui.create.switcher('background_ogg',lib.config.background_ogg,ui.click.sidebar.global));
gameconfig.push(ui.create.div('.placeholder'));
if(lib.config.gameconfig){
for(i=0;i<gameconfig.length;i++){
ui.config.appendChild(gameconfig[i]);
}
}
switch(lib.config.ui_zoom){
case '极小':ui.window.style.zoom=0.8;break;
case '很小':ui.window.style.zoom=0.9;break;
case '较小':ui.window.style.zoom=0.95;break;
case '较大':ui.window.style.zoom=1.05;break;
case '很大':ui.window.style.zoom=1.1;break;
default:ui.window.style.zoom=1;
}
if(true||lib.config.no_ios_zoom){
var meta=document.createElement('meta');
meta.name='viewport';
meta.content="user-scalable=0";
document.head.appendChild(meta);
}
var appearence=[];
appearence._configstr='appearence';
folditems.push(appearence);
ui.config.appendChild(ui.create.line2('外观选项',function(){
if(this.clicked) return;
if(lib.config.appearence){
game.saveConfig('appearence',false);
fold(appearence);
}
else{
game.saveConfig('appearence',true);
unfold(this,appearence);
}
}));
appearence.push(ui.create.switcher('theme',lib.config.all.theme,lib.config.theme,ui.click.sidebar.theme));
var layoutconfig=ui.create.switcher('layout',lib.config.all.layout,lib.config.layout,ui.click.sidebar.layout);
appearence.push(layoutconfig);
if(lib.config.layoutfixed.contains(lib.config.mode)){
layoutconfig.classList.add('disabled');
}
appearence.push(ui.create.switcher('image_background',lib.config.all.image_background,lib.config.image_background,ui.click.sidebar.image_background));
appearence.push(ui.create.switcher('image_background_filter',lib.config.all.image_background_filter,lib.config.image_background_filter,ui.click.sidebar.image_background_filter));
appearence.push(ui.create.switcher('ui_zoom',['极小','很小','较小','原始','较大','很大'],lib.config.ui_zoom,ui.click.sidebar.ui_zoom));
appearence.push(ui.create.div('.placeholder'));
appearence.push(ui.create.switcher('auto_popped',lib.config.auto_popped,ui.click.sidebar.global));
appearence.push(ui.create.switcher('only_fullskin',lib.config.only_fullskin,ui.click.sidebar.global2));
appearence.push(ui.create.switcher('hide_card_image',lib.config.hide_card_image,ui.click.sidebar.global2));
appearence.push(ui.create.switcher('bottom_line',lib.config.bottom_line,ui.click.sidebar.bottom_line));
appearence.push(ui.create.switcher('line_dash',lib.config.line_dash,ui.click.sidebar.global2));
appearence.push(ui.create.switcher('show_name',lib.config.show_name,ui.click.sidebar.show_name));
appearence.push(ui.create.switcher('show_replay',lib.config.show_replay,ui.click.sidebar.show_replay));
appearence.push(ui.create.switcher('show_playerids',lib.config.show_playerids,ui.click.sidebar.show_playerids));
appearence.push(ui.create.switcher('show_pause',lib.config.show_pause,ui.click.sidebar.show_pause));
appearence.push(ui.create.switcher('show_auto',lib.config.show_auto,ui.click.sidebar.show_auto));
appearence.push(ui.create.switcher('show_volumn',lib.config.show_volumn,ui.click.sidebar.show_volumn));
appearence.push(ui.create.switcher('show_wuxie',lib.config.show_wuxie,ui.click.sidebar.show_wuxie));
appearence.push(ui.create.switcher('show_wuxie_self',lib.config.show_wuxie_self,ui.click.sidebar.global));
appearence.push(ui.create.switcher('show_discardpile',lib.config.show_discardpile,ui.click.sidebar.global));
appearence.push(ui.create.div('.placeholder'));
appearence.push(ui.create.switcher('title',lib.config.title,ui.click.sidebar.title));
appearence.push(ui.create.switcher('fold_card',lib.config.fold_card,ui.click.sidebar.fold_card));
appearence.push(ui.create.switcher('threed_card',lib.config.threed_card,ui.click.sidebar.threed_card));
appearence.push(ui.create.switcher('blur_ui',lib.config.blur_ui,ui.click.sidebar.blur_ui));
appearence.push(ui.create.switcher('right_sidebar',lib.config.right_sidebar,ui.click.sidebar.right_sidebar));
appearence.push(ui.create.switcher('animation',lib.config.animation,ui.click.sidebar.global));
appearence.push(ui.create.switcher('config_menu',lib.config.config_menu,ui.click.sidebar.global));
// appearence.push(ui.create.div('.placeholder'));
// appearence.push(ui.create.switcher('intro',['⦿','☯','●','❖','✻','i'],lib.config.intro,ui.click.sidebar.intro));
// appearence.push(ui.create.switcher('sort',['type_sort','suit_sort','number_sort'],lib.config.sort,ui.click.sidebar.sort));
if(lib.config.appearence){
for(i=0;i<appearence.length;i++){
ui.config.appendChild(appearence[i]);
}
}
ui.config.appendChild(ui.create.div('.placeholder'));
var characterpack=[];
folditems.push(characterpack);
ui.config.appendChild(ui.create.line2('选择武将',function(){
if(this.clicked) return;
if(characterpack.fold){
characterpack.fold=false;
fold(characterpack);
}
else{
characterpack.fold=true;
unfold(this,characterpack);
}
}));
var characters=lib.config.all.characters;
for(i=0;i<characters.length;i++){
var node=ui.create.switcher(characters[i]+'_character',
lib.config.characters.contains(characters[i]),ui.click.sidebar.characters);
node.link=characters[i]+'_character';
characterpack[i]=node;
}
var reset_characterpack=ui.create.div('.config');
reset_characterpack.innerHTML='恢复默认';
reset_characterpack.addEventListener(lib.config.touchscreen?'touchend':'click',function(){
if(_status.dragged) return;
game.saveConfig('characters',lib.config.defaultcharacters);
for(var i=0;i<characterpack.length;i++){
if(characterpack[i].link){
var pnme=characterpack[i].link.slice(0,characterpack[i].link.indexOf('_character'));
if(lib.config.defaultcharacters.contains(pnme)){
if(!characterpack[i].lastChild.classList.contains('on')){
characterpack[i].querySelector('.toggle').link=true;
characterpack[i].lastChild.classList.add('on');
}
}
else{
if(characterpack[i].lastChild.classList.contains('on')){
characterpack[i].querySelector('.toggle').link=false;
characterpack[i].lastChild.classList.remove('on');
}
}
}
}
ui.sidebarrestart.classList.add('thundertext');
});
var all_characterpack=ui.create.div('.config');
all_characterpack.innerHTML='全部开启';
all_characterpack.addEventListener(lib.config.touchscreen?'touchend':'click',function(){
if(_status.dragged) return;
game.saveConfig('characters',lib.config.all.characters);
for(var i=0;i<characterpack.length;i++){
if(characterpack[i].link){
if(!characterpack[i].lastChild.classList.contains('on')){
characterpack[i].querySelector('.toggle').link=true;
characterpack[i].lastChild.classList.add('on');
}
}
}
ui.sidebarrestart.classList.add('thundertext');
});
characterpack.push(reset_characterpack);
characterpack.push(all_characterpack);
var cardpack=[];
folditems.push(cardpack);
ui.config.appendChild(ui.create.line2('选择卡牌',function(){
if(this.clicked) return;
if(cardpack.fold){
cardpack.fold=false;
fold(cardpack);
}
else{
cardpack.fold=true;
unfold(this,cardpack);
}
}));
var cards=lib.config.all.cards;
for(i=0;i<cards.length;i++){
var node=ui.create.switcher(cards[i]+'_card',
lib.config.cards.contains(cards[i]),ui.click.sidebar.cards);
node.link=cards[i]+'_card';
cardpack[i]=node;
}
var reset_cardpack=ui.create.div('.config');
reset_cardpack.innerHTML='恢复默认';
reset_cardpack.addEventListener(lib.config.touchscreen?'touchend':'click',function(){
if(_status.dragged) return;
game.saveConfig('cards',lib.config.defaultcards);
for(var i=0;i<cardpack.length;i++){
if(cardpack[i].link){
var pnme=cardpack[i].link.slice(0,cardpack[i].link.indexOf('_card'));
if(lib.config.defaultcards.contains(pnme)){
if(!cardpack[i].lastChild.classList.contains('on')){
cardpack[i].querySelector('.toggle').link=true;
cardpack[i].lastChild.classList.add('on');
}
}
else{
if(cardpack[i].lastChild.classList.contains('on')){
cardpack[i].querySelector('.toggle').link=false;
cardpack[i].lastChild.classList.remove('on');
}
}
}
}
ui.sidebarrestart.classList.add('thundertext');
});
var all_cardpack=ui.create.div('.config');
all_cardpack.innerHTML='全部开启';
all_cardpack.addEventListener(lib.config.touchscreen?'touchend':'click',function(){
if(_status.dragged) return;
game.saveConfig('cards',lib.config.all.cards);
for(var i=0;i<cardpack.length;i++){
if(cardpack[i].link){
if(!cardpack[i].lastChild.classList.contains('on')){
cardpack[i].querySelector('.toggle').link=true;
cardpack[i].lastChild.classList.add('on');
}
}
}
ui.sidebarrestart.classList.add('thundertext');
});
cardpack.push(reset_cardpack);
cardpack.push(all_cardpack);
var playpack=[];
folditems.push(playpack);
ui.config.appendChild(ui.create.line2('游戏玩法',function(){
if(this.clicked) return;
if(playpack.fold){
playpack.fold=false;
fold(playpack);
}
else{
playpack.fold=true;
unfold(this,playpack);
}
}));
var plays=lib.config.all.plays;
for(i=0;i<plays.length;i++){
var node=ui.create.switcher(plays[i]+'_play',
lib.config.plays.contains(plays[i]),ui.click.sidebar.plays);
node.link=plays[i]+'_play';
playpack[i]=node;
}
ui.config.appendChild(ui.create.div('.placeholder'));
var cardlist=[];
folditems.push(cardlist);
ui.config.appendChild(ui.create.line2('游戏资料',function(){
if(this.clicked) return;
if(cardlist.fold){
cardlist.fold=false;
fold(cardlist);
}
else{
cardlist.fold=true;
unfold(this,cardlist);
}
}));
ui.cardviewdialog=(function(){
var dialog=ui.create.cardDialog(true);
dialog.classList.add('fullheight');
var stopprop=function(e){e.stopPropagation();return false;};
var clickpop=function(){
this.delete();
if(dialog.popped==this) delete dialog.popped;
}
var clickbutt=function(e){
if(dialog.popped){
dialog.popped.delete();
if(dialog.popped.node==this&&dialog.popped.parentNode){
delete dialog.popped;
return;
}
}
var uiintro=get.nodeintro(this);
uiintro.classList.add('popped');
uiintro.classList.add('static');
uiintro.addEventListener(lib.config.touchscreen?'touchend':'click',clickpop);
ui.window.appendChild(uiintro);
lib.placePoppedDialog(uiintro,e);
dialog.popped=uiintro;
dialog.popped.node=this;
};
for(var i=0;i<dialog.buttons.length;i++){
dialog.buttons[i].listen(clickbutt);
}
dialog.listen(stopprop);
dialog.oncontextmenu=stopprop;
dialog.origin='card';
dialog.style.zIndex=6;
dialog.classList.add('scroll1');
dialog.classList.add('scroll2');
return dialog;
}());
cardlist.push(ui.create.line('卡牌一览',function(){
if(ui.gameviewdialog){
if(ui.gameviewdialog.popped){
ui.gameviewdialog.popped.delete();
delete ui.gameviewdialog.popped;
}
ui.gameviewdialog.close();
ui.arena.classList.remove('paused2');
if(ui.gameviewdialog.origin=='card'){
this.classList.remove('thundertext');
delete ui.gameviewdialog;
return;
}
}
this.classList.add('thundertext');
ui.currentgameview=this;
this.parentNode.nextSibling.firstChild.classList.remove('thundertext');
ui.arena.classList.add('paused2');
ui.gameviewdialog=ui.cardviewdialog;
ui.configbg.appendChild(ui.cardviewdialog);
}));
ui.characterviewdialog=(function(){
var dialog=ui.create.characterDialog(true);
dialog.classList.add('fullheight');
var stopprop=function(e){e.stopPropagation();return false;};
var clickpop=function(){
this.delete();
if(dialog.popped==this) delete dialog.popped;
}
var clickbutt=function(e){
if(dialog.popped){
dialog.popped.delete();
if(dialog.popped.node==this&&dialog.popped.parentNode){
delete dialog.popped;
return;
}
}
var uiintro=get.nodeintro(this);
uiintro.classList.add('popped');
uiintro.classList.add('static');
uiintro.addEventListener(lib.config.touchscreen?'touchend':'click',clickpop);
ui.window.appendChild(uiintro);
lib.placePoppedDialog(uiintro,e);
dialog.popped=uiintro;
dialog.popped.node=this;
};
for(var i=0;i<dialog.buttons.length;i++){
dialog.buttons[i].listen(clickbutt);
}
dialog.listen(stopprop);
dialog.oncontextmenu=stopprop;
dialog.origin='character';
dialog.style.zIndex=6;
dialog.classList.add('scroll1');
dialog.classList.add('scroll2');
return dialog;
}());
cardlist.push(ui.create.line('武将一览',function(){
if(ui.gameviewdialog){
if(ui.gameviewdialog.popped){
ui.gameviewdialog.popped.delete();
delete ui.gameviewdialog.popped;
}
ui.gameviewdialog.close();
ui.arena.classList.remove('paused2');
if(ui.gameviewdialog.origin=='character'){
this.classList.remove('thundertext');
delete ui.gameviewdialog;
return;
}
}
this.classList.add('thundertext');
ui.currentgameview=this;
this.parentNode.previousSibling.firstChild.classList.remove('thundertext');
ui.arena.classList.add('paused2');
ui.gameviewdialog=ui.characterviewdialog;
ui.configbg.appendChild(ui.characterviewdialog);
}));
folditems.push(autoskill);
ui.config.appendChild(ui.create.line2('自动发动',function(){
if(this.clicked) return;
var sks=[];
if(game.players){
for(var i=0;i<game.players.length;i++){
if(game.players[i]==game.me||game.players[i].isUnderControl()){
sks=sks.concat(game.expandSkills(game.players[i].get('s')));
}
}
}
for(var i=0;i<autoskill.length-1;i++){
if(!sks.contains(autoskill[i].link)){
autoskill[i].style.display='none';
}
else{
autoskill[i].style.display='';
}
}
autoskillempty.classList.remove('underlined');
if(autoskill.fold){
autoskill.fold=false;
fold(autoskill);
}
else{
autoskill.fold=true;
unfold(this,autoskill);
}
}));
var autoskillempty=ui.create.div('.config');
autoskillempty.listen(function(){
var sks=[];
if(game.players){
for(var i=0;i<game.players.length;i++){
if(game.players[i]==game.me||game.players[i].isUnderControl()){
sks=sks.concat(game.expandSkills(game.players[i].get('s')));
}
}
}
if(this.classList.contains('underlined')){
this.classList.remove('underlined');
for(var i=0;i<autoskill.length-1;i++){
if(!sks.contains(autoskill[i].link)){
autoskill[i].style.display='none';
}
else{
autoskill[i].style.display='';
}
}
}
else{
this.classList.add('underlined');
for(var i=0;i<autoskill.length-1;i++){
autoskill[i].style.display='';
}
}
});
autoskill.push(autoskillempty);
ui.create.div(autoskillempty).innerHTML='显示所有技能';
var forbidskill=[];
folditems.push(forbidskill);
ui.config.appendChild(ui.create.line2('技能禁配',function(){
if(this.clicked) return;
if(forbidskill.fold){
forbidskill.fold=false;
fold(forbidskill);
}
else{
forbidskill.fold=true;
unfold(this,forbidskill);
}
}));
var forbid=lib.config.forbid;
if(!lib.config.forbidlist){
var list=[];
for(i=0;i<forbid.length;i++){
list.push(true);
}
game.saveConfig('forbidlist',list);
}
var str,node,omit;
for(i=0;i<forbid.length;i++){
str='';
omit=false;
for(j=0;j<forbid[i].length;j++){
if(!lib.skill[forbid[i][j]]){
omit=true;break;
}
str+=get.translation(forbid[i][j])+'+';
}
if(omit) continue;
lib.translate['forbid'+i+'_forbid_config']=str.slice(0,str.length-1);
node=ui.create.switcher('forbid'+i+'_forbid',
lib.config.forbidlist[i],ui.click.sidebar.forbid);
node.link=i;
forbidskill[i]=node;
}
// ui.config.appendChild(ui.create.div('.placeholder'));
var skilllist=[];
folditems.push(skilllist);
foldsubitems.push(skilllist);
ui.config.appendChild(ui.create.line2('游戏帮助',function(){
if(this.clicked) return;
if(skilllist.fold){
skilllist.fold=false;
fold(skilllist);
}
else{
skilllist.fold=true;
unfold(this,skilllist);
}
}));
var skillinfo,skillinfo2;
var clickskillinfo=function(){
var node=this.parentNode.link;
if(node.classList.contains('hidden')){
node.show();
setTimeout(function(){
node.parentNode.style.height=(30+node.parentNode.lastChild.offsetHeight)+'px';
})
}
else{
node.hide();
node.parentNode.style.height='20px';
}
};
for(i in lib.help){
skillinfo=ui.create.line(i,clickskillinfo);
skillinfo.style.height='20px';
skillinfo2=ui.create.div('.configinfo');
skillinfo2.innerHTML=lib.help[i];
skillinfo2.hide();
skillinfo.link=skillinfo2;
skillinfo.appendChild(skillinfo2);
skilllist.push(skillinfo);
}
ui.config.appendChild(ui.create.div('.placeholder'));
var node=ui.create.div('.config.line2',ui.config);
ui.create.div(node).innerHTML='重置游戏';
node.addEventListener(lib.config.touchscreen?'touchend':'click',function(){
if(_status.dragged) return;
if(_status.reset){
this.firstChild.innerHTML='重置游戏';
_status.reset=false;
}
else{
this.firstChild.innerHTML+=' ●';
_status.reset=true;
}
});
var node=ui.create.div('.config.line2',ui.config);
ui.sidebarrestart=node;
ui.create.div(node).innerHTML='重新开始';
node.listen(function(){
if(_status.reset) localStorage.clear();
ui.arena.hide();
ui.config.hide();
setTimeout(game.reload,500);
});