diff --git a/game/config.js b/game/config.js index da570ae03..708f5a631 100644 --- a/game/config.js +++ b/game/config.js @@ -275,7 +275,7 @@ window.config={ guozhan:{ double_hp:'pingjun', difficulty:'normal', - initshow_draw:0, + initshow_draw:2, dierestart:true } }, diff --git a/game/game.js b/game/game.js index 3653668f1..23df6840b 100644 --- a/game/game.js +++ b/game/game.js @@ -151,82 +151,15 @@ window.play={}; lib.config.defaultcards=lib.config.cards.slice(0); } for(var i in config2){ - switch(i){ - case 'cheat':lib.config.cheat=config2[i];break; - case 'confirmtouch':lib.config.confirmtouch=config2[i];break; - case 'auto_skill':lib.config.auto_skill=config2[i];break; - case 'auto_confirm':lib.config.auto_confirm=config2[i];break; - case 'enable_drag':lib.config.enable_drag=config2[i];break; - case 'hover_all':lib.config.hover_all=config2[i];break; - case 'hover_handcard':lib.config.hover_handcard=config2[i];break; - case 'duration':lib.config.duration=config2[i];break; - case 'hoveration':lib.config.hoveration=config2[i];break; - case 'image_background':lib.config.image_background=config2[i];break; - case 'image_background_filter':lib.config.image_background_filter=config2[i];break; - case 'ui_zoom':lib.config.ui_zoom=config2[i];break; - case 'show_name':lib.config.show_name=config2[i];break; - case 'show_replay':lib.config.show_replay=config2[i];break; - case 'show_playerids':lib.config.show_playerids=config2[i];break; - case 'show_pause':lib.config.show_pause=config2[i];break; - case 'show_auto':lib.config.show_auto=config2[i];break; - case 'right_info':lib.config.right_info=config2[i];break; - case 'long_info':lib.config.long_info=config2[i];break; - case 'only_fullskin':lib.config.only_fullskin=config2[i];break; - case 'hide_card_image':lib.config.hide_card_image=config2[i];break; - case 'show_wuxie':lib.config.show_wuxie=config2[i];break; - case 'show_scrollbar':lib.config.show_scrollbar=config2[i];break; - case 'mousewheel':lib.config.mousewheel=config2[i];break; - case 'fold_card':lib.config.fold_card=config2[i];break; - case 'touchscreen':lib.config.touchscreen=config2[i];break; - case 'threed_card':lib.config.threed_card=config2[i];break; - case 'blur_ui':lib.config.blur_ui=config2[i];break; - case 'hide_history':lib.config.hide_history=config2[i];break; - case 'right_sidebar':lib.config.right_sidebar=config2[i];break; - case 'right_click':lib.config.right_click=config2[i];break; - case 'sort':lib.config.sort=config2[i];break; - case 'reverse_sort':lib.config.reverse_sort=config2[i];break; - case 'title':lib.config.title=config2[i];break; - case 'intro':lib.config.intro=config2[i];break; - case 'theme':lib.config.theme=config2[i];break; - case 'layout':lib.config.layout=config2[i];break; - case 'gameconfig':lib.config.gameconfig=config2[i];break; - case 'modeconfig':lib.config.modeconfig=config2[i];break; - case 'appearence':lib.config.appearence=config2[i];break; - case 'forbidlist':lib.config.forbidlist=config2[i];break; - case 'autoskilllist':lib.config.autoskilllist=config2[i];break; - default: - if(i.indexOf('_character')==i.length-10&&i.length>10){ - if(config2[i]){ - lib.config.characters.add(i.slice(0,i.indexOf('_character'))); - } - else{ - lib.config.characters.remove(i.slice(0,i.indexOf('_character'))); - } - } - else if(i.indexOf('_card')==i.length-5&&i.length>5){ - if(config2[i]){ - lib.config.cards.add(i.slice(0,i.indexOf('_card'))); - } - else{ - lib.config.cards.remove(i.slice(0,i.indexOf('_card'))); - } - } - if(i.indexOf('_play')==i.length-5&&i.length>5){ - if(config2[i]){ - lib.config.plays.add(i.slice(0,i.indexOf('_play'))); - } - else{ - lib.config.plays.remove(i.slice(0,i.indexOf('_play'))); - } - } - else if(i.indexOf('_mode_config')!=-1&&i.substr(i.indexOf('_mode_config')+13)==lib.config.mode){ + if(i.indexOf('_mode_config')!=-1&&i.substr(i.indexOf('_mode_config')+13)==lib.config.mode){ lib.config.mode_config[lib.config.mode][i.substr(0,i.indexOf('_mode_config'))]=config2[i]; } else{ - + lib.config[i]=config2[i]; } - } + + } for(var i in lib.config.translate){ lib.translate[i]=lib.config.translate[i]; @@ -1818,7 +1751,7 @@ window.play={}; ui.revive=ui.create.control('revive',ui.click.dierevive); } if(get.config('dierestart')&&lib.config.mode!='versus'){ - ui.restart=ui.create.control('restart',function(){window.location.reload()}); + ui.restart=ui.create.control('restart',game.reload); } } if(player==game.me&&ui.auto){ @@ -4848,6 +4781,12 @@ window.play={}; }; var game={ version:0.912, + reload:function(){ + if(_status){ + _status.reloading=true; + } + window.location.reload(); + }, update:function(func){ lib.updates.push(func); if(lib.updates.length===1){ @@ -5103,12 +5042,10 @@ window.play={}; dialog.add(ui.create.div('.placeholder')); dialog.add(ui.create.div('.placeholder')); if(!ui.restart){ - ui.restart=ui.create.control('restart',function(){window.location.reload()}); + ui.restart=ui.create.control('restart',game.reload); } if(lib.storage.test){ - setTimeout(function(){ - window.location.reload(); - },500); + setTimeout(game.reload,500); } if(ui.auto) ui.auto.hide(); @@ -5803,6 +5740,7 @@ window.play={}; if(lib.config.title) document.title=str; }, save:function(key,value){ + if(_status.reloading) return; var config={}; if(arguments.length>0){ try{ @@ -5825,6 +5763,7 @@ window.play={}; localStorage.setItem(lib.configprefix+lib.config.mode,JSON.stringify(config)); }, updateSave:function(){ + if(_status.reloading) return; localStorage.setItem(lib.configprefix+lib.config.mode,JSON.stringify(lib.storage)); }, import:function(name,replace){ @@ -5896,6 +5835,7 @@ window.play={}; } }, saveConfig:function(key,value,local){ + if(_status.reloading) return; var config; try{ config=JSON.parse(localStorage.getItem(lib.configprefix+'config')); @@ -6481,15 +6421,15 @@ window.play={}; var span2='