This commit is contained in:
libccy 2017-02-01 15:33:32 +08:00
parent 57203ada4e
commit ca467c1113
3 changed files with 188 additions and 34 deletions

View File

@ -27,6 +27,9 @@ window.config={
forbidboss:['caiwenji','gjqt_aruan','pal_xuanxiao','swd_hupo'], forbidboss:['caiwenji','gjqt_aruan','pal_xuanxiao','swd_hupo'],
forbiddouble:['zhugedan','swd_kangnalishi','dongzhuo','wutugu','jg_simayi','hs_siwangzhiyi','hs_ronghejuren','hs_shanlingjuren'], forbiddouble:['zhugedan','swd_kangnalishi','dongzhuo','wutugu','jg_simayi','hs_siwangzhiyi','hs_ronghejuren','hs_shanlingjuren'],
all:{ all:{
diymode:['stone','chess','boss','tafang'],
diycharacter:['diy','yxs','hearth','swd','gujian','xianjian','boss','ow'],
diycard:['zhenfa','yunchou','swd','shenqi','hearth','gujian'],
stockmode:['identity','guozhan','versus','boss','chess','stone','connect','brawl','tafang','hearthstone'], stockmode:['identity','guozhan','versus','boss','chess','stone','connect','brawl','tafang','hearthstone'],
stockextension:['boss','cardpile','character','coin','soldier','weather','wuxing','hs_mod'], stockextension:['boss','cardpile','character','coin','soldier','weather','wuxing','hs_mod'],
layout:['default','newlayout'], layout:['default','newlayout'],
@ -235,6 +238,9 @@ window.config={
image_character:'default', image_character:'default',
image_background:'default', image_background:'default',
asset_image:true,
asset_font:true,
card_font:'xiaozhuan', card_font:'xiaozhuan',
show_name:true, show_name:true,
show_replay:false, show_replay:false,

View File

@ -1676,9 +1676,9 @@
onclick:function(){ onclick:function(){
if(this.innerHTML!='已隐藏'){ if(this.innerHTML!='已隐藏'){
this.innerHTML='已隐藏'; this.innerHTML='已隐藏';
game.saveConfig('hiddenModePack',['stone','chess','boss','tafang']); game.saveConfig('hiddenModePack',lib.config.all.diymode);
game.saveConfig('hiddenCardPack',['zhenfa','yunchou','swd','shenqi','hearth','gujian']); game.saveConfig('hiddenCardPack',lib.config.all.diycard);
game.saveConfig('hiddenCharacterPack',['diy','yxs','hearth','swd','gujian','xianjian','boss','ow']); game.saveConfig('hiddenCharacterPack',lib.config.all.diycharacter);
var that=this; var that=this;
setTimeout(function(){ setTimeout(function(){
that.innerHTML='隐藏非官方扩展包'; that.innerHTML='隐藏非官方扩展包';
@ -3793,11 +3793,13 @@
lib.config.all.plays=[]; lib.config.all.plays=[];
lib.config.all.mode=[]; lib.config.all.mode=[];
if(lib.config.dev){
lib.init.js(lib.assetURL+'game','asset',function(){ lib.init.js(lib.assetURL+'game','asset',function(){
lib.skin=window.noname_skin_list; lib.skin=window.noname_skin_list;
delete window.noname_skin_list; delete window.noname_skin_list;
delete window.noname_asset_list; delete window.noname_asset_list;
}); });
}
if(window.isNonameServer){ if(window.isNonameServer){
lib.config.mode='connect'; lib.config.mode='connect';
@ -4091,7 +4093,7 @@
else{ else{
url=get.url()+url; url=get.url()+url;
} }
if(lib.config.debug) game.print(url); if(lib.config.dev) game.print(url);
var dir=folder.split('/'); var dir=folder.split('/');
var str=''; var str='';
var download=function(){ var download=function(){
@ -4217,7 +4219,7 @@
else{ else{
url=get.url()+url; url=get.url()+url;
} }
if(lib.config.debug) game.print(url); if(lib.config.dev) game.print(url);
var fileTransfer = new FileTransfer(); var fileTransfer = new FileTransfer();
folder=lib.assetURL+folder; folder=lib.assetURL+folder;
fileTransfer.download(encodeURI(url),encodeURI(folder),onsuccess,onerror); fileTransfer.download(encodeURI(url),encodeURI(folder),onsuccess,onerror);
@ -4261,9 +4263,6 @@
game.documentZoom=1; game.documentZoom=1;
game.deviceZoom=1; game.deviceZoom=1;
} }
// if(lib.config.debug&&window.require){
// window.require('remote').getCurrentWindow().openDevTools();
// }
ui.background=ui.create.div('.background'); ui.background=ui.create.div('.background');
ui.background.style.backgroundSize="cover"; ui.background.style.backgroundSize="cover";
if(lib.config.image_background&&lib.config.image_background!='default'&&lib.config.image_background!='custom'){ if(lib.config.image_background&&lib.config.image_background!='default'&&lib.config.image_background!='custom'){
@ -25484,7 +25483,6 @@
ui.updatep2.style.display='none'; ui.updatep2.style.display='none';
} }
var button1,button2,button3; var button1,button2,button3;
var span1,includeskin;
game.checkForUpdate=function(forcecheck,dev){ game.checkForUpdate=function(forcecheck,dev){
if(!dev&&button1.disabled){ if(!dev&&button1.disabled){
@ -25705,13 +25703,59 @@
var skins=window.noname_skin_list; var skins=window.noname_skin_list;
delete window.noname_skin_list; delete window.noname_skin_list;
var asset_version=updates.shift(); var asset_version=updates.shift();
if(asset_version==lib.config.asset_version&&lib.config.exclude_skin){
alert('素材已是最新'); var skipcharacter=[],skipcard=[];
button2.disabled=false; if(!lib.config.asset_full){
button2.innerHTML='检查素材更新'; for(var i=0;i<lib.config.all.diycharacter.length;i++){
return; var pack=lib.characterPack[lib.config.all.diycharacter[i]];
for(var j in pack){
skipcharacter.add(j);
} }
if(!lib.config.exclude_skin){ }
for(var i=0;i<lib.config.all.diycard.length;i++){
var pack=lib.cardPack[lib.config.all.diycard[i]];
if(pack){
skipcard=skipcard.concat(pack);
}
}
}
for(var i=0;i<updates.length;i++){
switch(updates[i].slice(0,5)){
case 'image':{
if(!lib.config.asset_image){
updates.splice(i--,1);
}
else if(!lib.config.asset_full){
if(updates[i].indexOf('image/character')==0){
if(skipcharacter.contains(updates[i].slice(16,updates[i].lastIndexOf('.')))){
updates.splice(i--,1);
}
}
else if(updates[i].indexOf('image/card')==0){
if(skipcard.contains(updates[i].slice(11,updates[i].lastIndexOf('.')))){
updates.splice(i--,1);
}
}
else if(updates[i].indexOf('image/mode/stone')==0){
updates.splice(i--,1);
}
}
break;
}
case 'audio':{
if(!lib.config.asset_audio){
updates.splice(i--,1);
}
break;
}
case 'font/':{
if(!lib.config.asset_font){
updates.splice(i--,1);
}
}
}
}
if(lib.config.asset_skin){
for(var i in skins){ for(var i in skins){
for(var j=1;j<=skins[i];j++){ for(var j=1;j<=skins[i];j++){
updates.push('image/skin/'+i+'/'+j+'.jpg'); updates.push('image/skin/'+i+'/'+j+'.jpg');
@ -25738,7 +25782,8 @@
var n2=updates.length; var n2=updates.length;
span.innerHTML='正在下载素材('+n1+'/'+n2+''; span.innerHTML='正在下载素材('+n1+'/'+n2+'';
span1.remove(); span1.remove();
includeskin.remove(); span2.remove();
span2_check.remove();
p.appendChild(span); p.appendChild(span);
var finish=function(){ var finish=function(){
if(n1==n2){ if(n1==n2){
@ -25784,7 +25829,7 @@
button3.onclick=function(){ button3.onclick=function(){
game.checkForUpdate(null,true); game.checkForUpdate(null,true);
}; };
if(lib.config.debug){ if(lib.config.dev){
li1.lastChild.appendChild(button3); li1.lastChild.appendChild(button3);
} }
@ -25793,22 +25838,124 @@
button2.onclick=game.checkForAssetUpdate; button2.onclick=game.checkForAssetUpdate;
li2.lastChild.appendChild(button2); li2.lastChild.appendChild(button2);
var span1=document.createElement('span'); var span1=ui.create.div('.config.more','选项 <div>&gt;</div>');
span1.innerHTML='包含皮肤';
span1.style.fontSize='small'; span1.style.fontSize='small';
span1.style.marginLeft='10px'; span1.style.display='inline';
span1.listen(function(){
this.classList.toggle('on');
if(!this.classList.contains('on')){
span2.style.display='none';
span2_check.style.display='none';
span3.style.display='none';
span3_check.style.display='none';
span4.style.display='none';
span4_check.style.display='none';
span5.style.display='none';
span5_check.style.display='none';
span6.style.display='none';
span6_check.style.display='none';
}
else{
span2.style.display='';
span2_check.style.display='';
span3.style.display='';
span3_check.style.display='';
span4.style.display='';
span4_check.style.display='';
span5.style.display='';
span5_check.style.display='';
span6.style.display='';
span6_check.style.display='';
}
})
li2.lastChild.appendChild(span1); li2.lastChild.appendChild(span1);
var includeskin=document.createElement('input'); li2.lastChild.appendChild(ui.create.node('br'));
includeskin.type='checkbox';
includeskin.name='包含皮肤'; var span5=ui.create.div('','图片素材');
if(!lib.config.exclude_skin){ span5.style.fontSize='small';
includeskin.checked=true; li2.lastChild.appendChild(span5);
var span5_check=document.createElement('input');
span5_check.type='checkbox';
span5_check.style.marginLeft='5px';
if(lib.config.asset_image){
span5_check.checked=true;
} }
includeskin.onchange=function(){ span5_check.onchange=function(){
game.saveConfig('exclude_skin',!this.checked); game.saveConfig('asset_image',this.checked);
} }
li2.lastChild.appendChild(includeskin); li2.lastChild.appendChild(span5_check);
li2.lastChild.appendChild(ui.create.node('br'));
var span4=ui.create.div('','字体素材');
span4.style.fontSize='small';
li2.lastChild.appendChild(span4);
var span4_check=document.createElement('input');
span4_check.type='checkbox';
span4_check.style.marginLeft='5px';
if(lib.config.asset_font){
span4_check.checked=true;
}
span4_check.onchange=function(){
game.saveConfig('asset_font',this.checked);
}
li2.lastChild.appendChild(span4_check);
li2.lastChild.appendChild(ui.create.node('br'));
var span3=ui.create.div('','音效素材');
span3.style.fontSize='small';
li2.lastChild.appendChild(span3);
var span3_check=document.createElement('input');
span3_check.type='checkbox';
span3_check.style.marginLeft='5px';
if(lib.config.asset_audio){
span3_check.checked=true;
}
span3_check.onchange=function(){
game.saveConfig('asset_audio',this.checked);
}
li2.lastChild.appendChild(span3_check);
li2.lastChild.appendChild(ui.create.node('br'));
var span2=ui.create.div('','皮肤素材');
span2.style.fontSize='small';
li2.lastChild.appendChild(span2);
var span2_check=document.createElement('input');
span2_check.type='checkbox';
span2_check.style.marginLeft='5px';
if(lib.config.asset_skin){
span2_check.checked=true;
}
span2_check.onchange=function(){
game.saveConfig('asset_skin',this.checked);
}
li2.lastChild.appendChild(span2_check);
li2.lastChild.appendChild(ui.create.node('br'));
var span6=ui.create.div('','图片素材(完整)');
span6.style.fontSize='small';
li2.lastChild.appendChild(span6);
var span6_check=document.createElement('input');
span6_check.type='checkbox';
span6_check.style.marginLeft='5px';
if(lib.config.asset_full){
span6_check.checked=true;
}
span6_check.onchange=function(){
game.saveConfig('asset_full',this.checked);
}
li2.lastChild.appendChild(span6_check);
span2.style.display='none';
span2_check.style.display='none';
span3.style.display='none';
span3_check.style.display='none';
span4.style.display='none';
span4_check.style.display='none';
span5.style.display='none';
span5_check.style.display='none';
span6.style.display='none';
span6_check.style.display='none';
ul.appendChild(li1); ul.appendChild(li1);
ul.appendChild(li2); ul.appendChild(li2);

View File

@ -4,6 +4,7 @@ window.noname_update={
changeLog:[ changeLog:[
'bug修复', 'bug修复',
'联机可禁卡', '联机可禁卡',
'素材下载改进',
], ],
files:[ files:[
'game/game.js', 'game/game.js',