feat: provide announce time for theme change.

This commit is contained in:
Rintim 2023-11-27 19:16:35 +08:00
parent 98f180b330
commit e050c8b166
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
1 changed files with 16 additions and 11 deletions

View File

@ -1563,25 +1563,30 @@ new Promise(resolve=>{
node.menu=ui.create.div(node,'','<div></div><div></div><div></div><div></div>'); node.menu=ui.create.div(node,'','<div></div><div></div><div></div><div></div>');
} }
}, },
onclick:function(theme){ onclick:gnc.of(function*(theme){
game.saveConfig('theme',theme); game.saveConfig('theme',theme);
ui.arena.hide(); ui.arena.hide();
lib.init.background(); lib.init.background();
if(lib.config.autostyle){ if(lib.config.autostyle){
if(theme=='simple'){ if(theme === "simple"){
lib.configMenu.appearence.config.player_border.onclick('slim'); lib.configMenu.appearence.config.player_border.onclick("slim");
} }
else{ else{
lib.configMenu.appearence.config.player_border.onclick('normal'); lib.configMenu.appearence.config.player_border.onclick("normal");
} }
} }
setTimeout(function(){ lib.announce.publish("Noname.Apperaence.Theme.onChanging", theme);
var theme=ui.css.theme; yield new Promise(resolve => setTimeout(resolve, 500));
ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style');
theme.remove(); const deletingTheme = ui.css.theme;
setTimeout(function(){ui.arena.show();},100); ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style');
},500); deletingTheme.remove();
} lib.announce.publish("Noname.Apperaence.Theme.onChanged", theme);
yield new Promise(resolve => setTimeout(resolve, 100));
ui.arena.show();
lib.announce.publish("Noname.Apperaence.Theme.onChangeFinished", theme);
})
}, },
layout:{ layout:{
name:'布局', name:'布局',