This commit is contained in:
libccy 2017-04-14 01:00:21 +08:00
parent e62de78273
commit f58b92aa6b
3 changed files with 41 additions and 11 deletions

View File

@ -955,7 +955,11 @@
}, },
image_background_random:{ image_background_random:{
name:'随机背景', name:'随机背景',
init:false init:false,
onclick:function(bool){
game.saveConfig('image_background_random',bool);
lib.init.background();
}
}, },
image_background_blur:{ image_background_blur:{
name:'背景模糊', name:'背景模糊',
@ -5813,10 +5817,20 @@
} }
ui.css={default:lib.init.css(lib.assetURL+'layout/default','layout')}; ui.css={default:lib.init.css(lib.assetURL+'layout/default','layout')};
if(localStorage.getItem(lib.configprefix+'background')){ var htmlbg=localStorage.getItem(lib.configprefix+'background');
document.documentElement.style.backgroundImage='url("'+lib.assetURL+'image/background/'+localStorage.getItem(lib.configprefix+'background')+'.jpg")'; if(htmlbg){
document.documentElement.style.backgroundSize='cover'; if(htmlbg[0]=='['){
document.documentElement.style.backgroundPosition='50% 50%'; htmlbg=JSON.parse(htmlbg).randomGet();
_status.htmlbg=htmlbg;
if(htmlbg.indexOf('custom_')==0){
htmlbg=null;
}
}
if(htmlbg){
document.documentElement.style.backgroundImage='url("'+lib.assetURL+'image/background/'+htmlbg+'.jpg")';
document.documentElement.style.backgroundSize='cover';
document.documentElement.style.backgroundPosition='50% 50%';
}
} }
if(lib.device){ if(lib.device){
@ -6390,13 +6404,20 @@
} }
game.layout=layout; game.layout=layout;
if(lib.config.image_background_random){ if(lib.config.image_background_random){
var list=[]; if(_status.htmlbg){
for(var i in lib.configMenu.appearence.config.image_background.item){ game.saveConfig('image_background',_status.htmlbg);
if(i=='default') continue;
list.push(i);
} }
game.saveConfig('image_background',list.randomGet(lib.config.image_background)); else{
var list=[];
for(var i in lib.configMenu.appearence.config.image_background.item){
if(i=='default') continue;
list.push(i);
}
game.saveConfig('image_background',list.randomGet(lib.config.image_background));
}
lib.init.background();
} }
delete _status.htmlbg;
var styleToLoad=7; var styleToLoad=7;
var styleLoaded=function(){ var styleLoaded=function(){
styleToLoad--; styleToLoad--;
@ -7608,7 +7629,16 @@
},500); },500);
}, },
background:function(){ background:function(){
if(lib.config.image_background&&lib.config.image_background!='default'&&lib.config.image_background.indexOf('custom_')!=0){ if(lib.config.image_background_random){
var list=[];
for(var i in lib.configMenu.appearence.config.image_background.item){
if(i=='default') continue;
list.push(i);
}
list.remove(lib.config.image_background);
localStorage.setItem(lib.configprefix+'background',JSON.stringify(list));
}
else if(lib.config.image_background&&lib.config.image_background!='default'&&lib.config.image_background.indexOf('custom_')!=0){
localStorage.setItem(lib.configprefix+'background',lib.config.image_background); localStorage.setItem(lib.configprefix+'background',lib.config.image_background);
} }
else if(lib.config.image_background=='default'&&lib.config.theme=='simple'){ else if(lib.config.image_background=='default'&&lib.config.theme=='simple'){

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 KiB

After

Width:  |  Height:  |  Size: 842 KiB