diff --git a/game/game.js b/game/game.js index 2b6dd85e1..341c569a0 100755 --- a/game/game.js +++ b/game/game.js @@ -3144,7 +3144,10 @@ } _status.characterLoaded=true; if(_status.waitingForCharacters){ - game.resume(); + game.createEvent('game',false).content=lib.init.start; + delete lib.init.start; + game.loop(); + delete _status.waitingForCharacters; } if(lib.onCharacterLoad){ lib.onCharacterLoad(); @@ -12968,7 +12971,7 @@ }, gameDraw:function(player,num){ var next=game.createEvent('gameDraw'); - next.player=player; + next.player=player||game.me; if(num==undefined) next.num=4; else next.num=num; next.content=function(){ @@ -13387,6 +13390,24 @@ getExtensionConfig:function(extension,key){ return lib.config['extension_'+extension+'_'+key]; }, + clearModeConfig:function(mode){ + if(_status.reloading) return; + var config; + try{ + config=JSON.parse(localStorage.getItem(lib.configprefix+'config')); + if(!config||typeof config!='object') throw 'err' + } + catch(err){ + config={}; + } + for(var i in config){ + if(i.substr(i.indexOf('_mode_config')+13)==mode){ + delete config[i]; + } + } + localStorage.setItem(lib.configprefix+'config',JSON.stringify(config)); + localStorage.removeItem(lib.configprefix+mode); + }, addPlayer:function(position,character,character2){ if(position<0||position>game.players.length+game.dead.length||position==undefined){ position=Math.ceil(Math.random()*(game.players.length+game.dead.length)); @@ -22738,6 +22759,7 @@ for(i in mode[lib.config.mode].get){ get[i]=lib.init.eval(mode[lib.config.mode].get[i]); } + lib.init.start=mode[lib.config.mode].start; if(game.onwash){ lib.onwash.push(game.onwash); delete game.onwash; @@ -22760,6 +22782,7 @@ if(i=='ui') continue; if(i=='get') continue; if(i=='config') continue; + if(i=='start') continue; if(lib[i]==undefined) lib[i]=(get.objtype(mode[lib.config.mode][i])=='array')?[]:{}; for(j in mode[lib.config.mode][i]){ lib[i][j]=lib.init.eval(mode[lib.config.mode][i][j]); @@ -23001,8 +23024,14 @@ } delete lib.packageReady; ui.create.arena(); - game.start(); - game.loop(); + if(lib.db&&!_status.characterLoaded){ + _status.waitingForCharacters=true; + } + else{ + game.createEvent('game',false).content=lib.init.start; + delete lib.init.start; + game.loop(); + } } if(!mode[lib.config.mode]){ diff --git a/manifest.json b/manifest.json index eda1dc1d9..0ffb6a770 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,6 @@ { "name": "noname", + "xwalk_version": "1.7.11", "xwalk_app_version": "1.7.11", "xwalk_package_id": "com.widget.noname", "xwalk_android_keep_screen_on":true, diff --git a/mode/boss.js b/mode/boss.js index 71e152eb0..00eeebf5a 100755 --- a/mode/boss.js +++ b/mode/boss.js @@ -1,5 +1,344 @@ 'use strict'; mode.boss={ + start:function(){ + "step 0" + if(lib.config.hiddenCharacterPack.contains('boss')){ + game.loadPackage('character/boss'); + } + "step 1" + var playback=localStorage.getItem(lib.configprefix+'playback'); + if(playback){ + ui.create.me(); + ui.arena.style.display='none'; + ui.system.style.display='none'; + _status.playback=playback; + localStorage.removeItem(lib.configprefix+'playback'); + var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); + store.get(parseInt(playback)).onsuccess=function(e){ + if(e.target.result){ + game.playVideoContent(e.target.result.video); + } + else{ + alert('播放失败:找不到录像'); + game.reload(); + } + } + event.finish(); + return; + } + for(var i in lib.skill){ + if(lib.skill[i].changeSeat){ + lib.skill[i]={}; + if(lib.translate[i+'_info']){ + lib.translate[i+'_info']='此模式下不可用'; + } + } + } + lib.init.css('layout/mode','boss'); + game.delay(0.1); + "step 2" + var bosslist=ui.create.div('#bosslist.hidden'); + event.bosslist=bosslist; + bosslist.ontouchmove = ui.click.touchScroll; + bosslist.style.WebkitOverflowScrolling='touch'; + if(!lib.config.touchscreen&&lib.config.mousewheel){ + bosslist._scrollspeed=30; + bosslist._scrollnum=10; + bosslist.onmousewheel=ui.click.mousewheel; + } + var bosslistlinks={}; + var toggleBoss=function(bool){ + game.saveConfig(this._link.config._name,bool,true); + var node=bosslistlinks[this._link.config._name]; + if(bool){ + node.style.display=''; + } + else{ + node.style.display='none'; + } + }; + var onpause=function(){ + ui.window.classList.add('bosspaused'); + } + var onresume=function(){ + ui.window.classList.remove('bosspaused'); + } + game.onpause=onpause; + game.onpause2=onpause; + game.onresume=onresume; + game.onresume2=onresume; + ui.create.div(bosslist); + + event.current=null; + var list=[]; + for(var i in lib.character){ + var info=lib.character[i]; + if(info[4].contains('boss')&&!lib.config.banned.contains(i)){ + var cfg=i+'_bossconfig'; + if(get.config(cfg)==undefined){ + game.saveConfig(cfg,true,true); + } + lib.translate[cfg+'_config']=lib.translate[i]; + lib.config.current_mode.push([cfg,get.config(cfg),toggleBoss]); + lib.mode.boss.config[cfg]={ + name:get.translation(i), + onclick:toggleBoss, + init:true, + } + var player=ui.create.player(bosslist).init(i); + list.push(player); + player.node.hp.classList.add('text'); + player.node.hp.dataset.condition=''; + player.node.hp.innerHTML=info[2]; + if(info[2]==Infinity){ + player.node.hp.innerHTML='∞'; + } + player.setIdentity(player.name); + player.node.identity.dataset.color=info[5]; + bosslistlinks[cfg]=player; + player.classList.add('bossplayer'); + + if(lib.storage.current==i){ + event.current=player; + player.classList.add('highlight'); + } + + if(!get.config(cfg)){ + player.style.display='none'; + } + } + } + if(!list.length){ + alert('挑战模式不可隐藏boss武将包,请在选项-其它中选择“重置隐藏扩展包”'); + event.finish(); + _status.over=true; + return; + } + if(!event.current){ + event.current=bosslist.childNodes[1]; + event.current.classList.add('highlight'); + } + ui.create.div(bosslist); + lib.translate.boss_pangtong='涅槃凤雏'; + ui.create.cards(); + game.finishCards(); + ui.arena.dataset.number=8; + ui.control.style.transitionProperty='opacity'; + ui.control.classList.add('bosslist'); + setTimeout(function(){ + ui.control.style.transitionProperty=''; + },1000); + + ui.window.appendChild(bosslist); + + setTimeout(function(){ + if(event.current){ + var left=event.current.offsetLeft-(ui.window.offsetWidth-180)/2; + if(bosslist.scrollLeft0){ + td.innerHTML='剩余'+get.cnNumber(game.bossinfo.chongzheng-game.dead[i].storage.boss_chongzheng)+'回合'; + } + else{ + td.innerHTML='无法重整' + } + } + + if(!added){ + uiintro.add('
(无重整角色)
'); + uiintro.add(ui.create.div('.placeholder.slim')) + } + else{ + uiintro.add(table); + } + + return uiintro; + },180); + ui.single_swap=ui.create.system('换人',function(){ + var players=get.players(game.me); + players.remove(game.boss); + if(players.length>1){ + if(ui.auto.classList.contains('hidden')){ + game.me.popup('请稍后换人'); + return; + } + if(_status.event.isMine()){ + ui.click.auto(); + setTimeout(function(){ + ui.click.auto(); + },500); + } + game.modeSwapPlayer(players[1]); + } + },true); + if(get.config('single_control')||game.me==game.boss){ + ui.single_swap.style.display='none'; + } + + ui.arena.appendChild(boss); + ui.refresh(boss); + boss.classList.remove('highlight'); + boss.classList.remove('bossplayer'); + boss.style.left=''; + boss.style.top=''; + boss.style.position=''; + + event.bosslist.delete(); + + game.arrangePlayers(); + for(var i=0;i0){ - td.innerHTML='剩余'+get.cnNumber(game.bossinfo.chongzheng-game.dead[i].storage.boss_chongzheng)+'回合'; - } - else{ - td.innerHTML='无法重整' - } - } - - if(!added){ - uiintro.add('
(无重整角色)
'); - uiintro.add(ui.create.div('.placeholder.slim')) - } - else{ - uiintro.add(table); - } - - return uiintro; - },180); - ui.single_swap=ui.create.system('换人',function(){ - var players=get.players(game.me); - players.remove(game.boss); - if(players.length>1){ - if(ui.auto.classList.contains('hidden')){ - game.me.popup('请稍后换人'); - return; - } - if(_status.event.isMine()){ - ui.click.auto(); - setTimeout(function(){ - ui.click.auto(); - },500); - } - game.modeSwapPlayer(players[1]); - } - },true); - if(get.config('single_control')||game.me==game.boss){ - ui.single_swap.style.display='none'; - } - - ui.arena.appendChild(boss); - ui.refresh(boss); - boss.classList.remove('highlight'); - boss.classList.remove('bossplayer'); - boss.style.left=''; - boss.style.top=''; - boss.style.position=''; - - event.bosslist.delete(); - - game.arrangePlayers(); - for(var i=0;i0&&_status.mode!='tafang'){ + lib.card.list=lib.card.list.concat(lib.chess_obstaclelist); + delete lib.chess_obstaclelist + } + ui.create.cards(); + game.finishCards(); + ui.chessContainer=ui.create.div('#chess-container',ui.arena); + lib.setScroll(ui.chessContainer); + ui.chessContainer.style.WebkitOverflowScrolling='touch'; + ui.chess=ui.create.div('#chess',ui.chessContainer); + ui.canvas2=document.createElement('canvas'); + ui.canvas2.id='canvas2'; + ui.chess.appendChild(ui.canvas2); + ui.ctx2=ui.canvas2.getContext('2d'); + game.me=ui.create.player(); + if(playback){ + for(var i in lib.characterPack){ + for(var j in lib.characterPack[i]){ + lib.character[j]=lib.character[j]||lib.characterPack[i][j]; + } + } + game.pause(); + ui.system.style.display='none'; + _status.playback=playback; + localStorage.removeItem(lib.configprefix+'playback'); + var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); + store.get(parseInt(playback)).onsuccess=function(e){ + if(e.target.result){ + event.video=e.target.result.video; + game.resume(); + } + else{ + alert('播放失败:找不到录像'); + game.reload(); + } + } + } + else{ + switch(_status.mode){ + case 'leader':{ + game.leaderView(); + break; + } + case 'combat':{ + if(lib.storage.test){ + lib.config.game_speed='vfast'; + _status.auto=true; + setTimeout(function(){ + console.log(get.translation(game.players)); + ui.updatehl(); + },500); + ui.auto.classList.add('glow'); + } + game.chooseCharacter(); + break; + } + case 'tafang':{ + _status.mylist=[]; + _status.enemylist=[]; + break; + } + default:{ + game.chooseCharacter(); + } + } + } + "step 2" + ui.arena.classList.add('chess'); + var mylistmap,enemylistmap; + if(event.video){ + var videocontent; + for(var ii=0;ii.player'+pos+ + '{left:'+(14+i*148)+'px;top:'+(14+j*148)+'px}',0); + ui.chesssheet.sheet.insertRule('#arena.chess #chess>.card'+pos+ + '{left:'+(22+i*148)+'px;top:'+(22+j*148)+'px}',0); + ui.chesssheet.sheet.insertRule('#arena.chess #chess>.popup'+pos+ + '{left:'+(19+i*148)+'px;top:'+(142+j*148)+'px}',0); + } + } + + var grids=[]; + var gridnum=ui.chessheight*ui.chesswidth; + for(var i=0;i=8&&j!=0&&j!=ui.chesswidth-1) continue; + if(tafanglist.contains(j)){ + var cg=i*ui.chesswidth+j; + grids.remove(cg); + game.addObstacle(cg.toString(),false); + event.obs.push(cg.toString()); + } + } + } + for(var i=0;i0){ + var ng=Math.floor(gridnum*nco); + for(var i=0;i_status.enemyDied){ + game.forceOver(false); + } + else{ + game.forceOver(); + } + }); + ui.finishGame.classList.add('finish_game'); + ui.finishGame.parentNode.insertBefore(finishGameBr,ui.finishGame); + } + + ui.create.me(); + ui.create.fakeme(); + + if(!event.video&&_status.mode=='combat'&&get.config('zhu')&&!_status.vsboss&&game.players.length>2){ + game.friendZhu=event.friendZhu; + game.friendZhu.hp++; + game.friendZhu.maxHp++; + game.friendZhu.update(); + game.friendZhu.node.identity.firstChild.innerHTML='将'; + + for(var i=0;i0&&_status.mode!='tafang'){ - lib.card.list=lib.card.list.concat(lib.chess_obstaclelist); - delete lib.chess_obstaclelist - } - ui.create.cards(); - game.finishCards(); - ui.chessContainer=ui.create.div('#chess-container',ui.arena); - lib.setScroll(ui.chessContainer); - ui.chessContainer.style.WebkitOverflowScrolling='touch'; - ui.chess=ui.create.div('#chess',ui.chessContainer); - ui.canvas2=document.createElement('canvas'); - ui.canvas2.id='canvas2'; - ui.chess.appendChild(ui.canvas2); - ui.ctx2=ui.canvas2.getContext('2d'); - game.me=ui.create.player(); - if(playback){ - for(var i in lib.characterPack){ - for(var j in lib.characterPack[i]){ - lib.character[j]=lib.character[j]||lib.characterPack[i][j]; - } - } - game.pause(); - ui.system.style.display='none'; - _status.playback=playback; - localStorage.removeItem(lib.configprefix+'playback'); - var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); - store.get(parseInt(playback)).onsuccess=function(e){ - if(e.target.result){ - event.video=e.target.result.video; - game.resume(); - } - else{ - alert('播放失败:找不到录像'); - game.reload(); - } - } - } - else{ - switch(_status.mode){ - case 'leader':{ - game.leaderView(); - break; - } - case 'combat':{ - if(lib.storage.test){ - lib.config.game_speed='vfast'; - _status.auto=true; - setTimeout(function(){ - console.log(get.translation(game.players)); - ui.updatehl(); - },500); - ui.auto.classList.add('glow'); - } - game.chooseCharacter(); - break; - } - case 'tafang':{ - _status.mylist=[]; - _status.enemylist=[]; - break; - } - default:{ - game.chooseCharacter(); - } - } - } - "step 2" - ui.arena.classList.add('chess'); - var mylistmap,enemylistmap; - if(event.video){ - var videocontent; - for(var ii=0;ii.player'+pos+ - '{left:'+(14+i*148)+'px;top:'+(14+j*148)+'px}',0); - ui.chesssheet.sheet.insertRule('#arena.chess #chess>.card'+pos+ - '{left:'+(22+i*148)+'px;top:'+(22+j*148)+'px}',0); - ui.chesssheet.sheet.insertRule('#arena.chess #chess>.popup'+pos+ - '{left:'+(19+i*148)+'px;top:'+(142+j*148)+'px}',0); - } - } - - var grids=[]; - var gridnum=ui.chessheight*ui.chesswidth; - for(var i=0;i=8&&j!=0&&j!=ui.chesswidth-1) continue; - if(tafanglist.contains(j)){ - var cg=i*ui.chesswidth+j; - grids.remove(cg); - game.addObstacle(cg.toString(),false); - event.obs.push(cg.toString()); - } - } - } - for(var i=0;i0){ - var ng=Math.floor(gridnum*nco); - for(var i=0;i_status.enemyDied){ - game.forceOver(false); - } - else{ - game.forceOver(); - } - }); - ui.finishGame.classList.add('finish_game'); - ui.finishGame.parentNode.insertBefore(finishGameBr,ui.finishGame); - } - - ui.create.me(); - ui.create.fakeme(); - - if(!event.video&&_status.mode=='combat'&&get.config('zhu')&&!_status.vsboss&&game.players.length>2){ - game.friendZhu=event.friendZhu; - game.friendZhu.hp++; - game.friendZhu.maxHp++; - game.friendZhu.update(); - game.friendZhu.node.identity.firstChild.innerHTML='将'; - - for(var i=0;i跳过后,你可以在选项-其它中重置新手向导'); + ui.auto.hide(); + ui.create.control('跳过向导',function(){ + clear(); + clear2(); + game.resume(); + }); + ui.create.control('继续',step2); + } + var step2=function(){ + if(lib.config.layout!='phone'){ + clear(); + ui.create.dialog('如果你在使用手机,可能会觉得按钮有点小'+ + ',将布局改成移动可以使按钮变大'); + ui.dialog.add('
你可以在选项-外观-布局中更改此设置'); + var lcontrol=ui.create.control('使用移动布局',function(){ + if(lib.config.layout=='phone'){ + ui.control.firstChild.firstChild.innerHTML='使用移动布局'; + lib.init.layout('mobile'); + } + else{ + ui.control.firstChild.firstChild.innerHTML='使用默认布局'; + lib.init.layout('phone'); + } + }); + ui.create.control('继续',step3); + } + else{ + step3(); + } + }; + var step3=function(){ + if(lib.config.touchscreen){ + clear(); + ui.create.dialog('触屏模式中,下划可以显示菜单,上划可以切换托管,双指单击可以暂停'); + ui.dialog.add('
你可以在选项-通用-中更改手势设置'); + ui.create.control('继续',step4); + } + else{ + step4(); + } + }; + var step4=function(){ + clear(); + ui.window.classList.add('noclick_important'); + ui.click.configMenu(); + ui.control.classList.add('noclick_click_important'); + ui.control.style.top='calc(100% - 105px)'; + ui.create.control('在菜单中,可以进行各项设置',function(){ + ui.click.menuTab('选项'); + ui.controls[0].replace('如果你感到游戏较卡,可以开启流畅模式',function(){ + ui.controls[0].replace('在技能一栏中,可以设置自动发动或双将禁配的技能',function(){ + ui.click.menuTab('武将'); + ui.controls[0].replace('在武将或卡牌一栏中,单击武将/卡牌可以将其禁用',function(){ + ui.click.menuTab('战局'); + ui.controls[0].replace('在战局中可以输入游戏命令,或者管理录像',function(){ + ui.click.configMenu(); + ui.window.classList.remove('noclick_important'); + ui.control.classList.remove('noclick_click_important'); + ui.control.style.top=''; + step5(); + }); + }); + }); + }); + }) + }; + var step5=function(){ + clear(); + ui.create.dialog('如果还有其它问题,欢迎来到百度无名杀吧进行交流'); + ui.create.control('完成',function(){ + clear(); + clear2(); + game.resume(); + }) + }; + game.pause(); + step1(); + } + else{ + game.showChangeLog(); + } + "step 3" + if(lib.storage.test){ + lib.config.game_speed='vfast'; + _status.auto=true; + ui.auto.classList.add('glow'); + } + game.chooseCharacter(); + "step 4" + if(ui.coin){ + _status.coinCoeff=get.coinCoeff([game.me.name]); + } + if(game.players.length==2){ + game.showIdentity(true); + } + else{ + for(var i=0;i=3){ + var skill; + switch(game.zhu.name){ + case 'liubei':skill='jizhen';break; + case 'dongzhuo':skill='hengzheng';break; + case 'sunquan':skill='batu';break; + case 'sp_zhangjiao':skill='tiangong';break; + case 'liushan':skill='shengxi';break; + case 'sunce':skill='ciqiu';break; + case 'yuanshao':skill='geju';break; + case 're_caocao':skill='dangping';break; + case 'caopi':skill='junxing';break; + case 'liuxie':skill='moukui';break; + default:skill='tianming';break; + } + game.zhu.addSkill(skill); + game.zhu.storage.enhance_zhu=skill; + } + if(lib.storage.test){ + var str=''; + for(var i=0;i跳过后,你可以在选项-其它中重置新手向导'); - ui.auto.hide(); - ui.create.control('跳过向导',function(){ - clear(); - clear2(); - game.resume(); - }); - ui.create.control('继续',step2); - } - var step2=function(){ - if(lib.config.layout!='phone'){ - clear(); - ui.create.dialog('如果你在使用手机,可能会觉得按钮有点小'+ - ',将布局改成移动可以使按钮变大'); - ui.dialog.add('
你可以在选项-外观-布局中更改此设置'); - var lcontrol=ui.create.control('使用移动布局',function(){ - if(lib.config.layout=='phone'){ - ui.control.firstChild.firstChild.innerHTML='使用移动布局'; - lib.init.layout('mobile'); - } - else{ - ui.control.firstChild.firstChild.innerHTML='使用默认布局'; - lib.init.layout('phone'); - } - }); - ui.create.control('继续',step3); - } - else{ - step3(); - } - }; - var step3=function(){ - if(lib.config.touchscreen){ - clear(); - ui.create.dialog('触屏模式中,下划可以显示菜单,上划可以切换托管,双指单击可以暂停'); - ui.dialog.add('
你可以在选项-通用-中更改手势设置'); - ui.create.control('继续',step4); - } - else{ - step4(); - } - }; - var step4=function(){ - clear(); - ui.window.classList.add('noclick_important'); - ui.click.configMenu(); - ui.control.classList.add('noclick_click_important'); - ui.control.style.top='calc(100% - 105px)'; - ui.create.control('在菜单中,可以进行各项设置',function(){ - ui.click.menuTab('选项'); - ui.controls[0].replace('如果你感到游戏较卡,可以开启流畅模式',function(){ - ui.controls[0].replace('在技能一栏中,可以设置自动发动或双将禁配的技能',function(){ - ui.click.menuTab('武将'); - ui.controls[0].replace('在武将或卡牌一栏中,单击武将/卡牌可以将其禁用',function(){ - ui.click.menuTab('战局'); - ui.controls[0].replace('在战局中可以输入游戏命令,或者管理录像',function(){ - ui.click.configMenu(); - ui.window.classList.remove('noclick_important'); - ui.control.classList.remove('noclick_click_important'); - ui.control.style.top=''; - step5(); - }); - }); - }); - }); - }) - }; - var step5=function(){ - clear(); - ui.create.dialog('如果还有其它问题,欢迎来到百度无名杀吧进行交流'); - ui.create.control('完成',function(){ - clear(); - clear2(); - game.resume(); - }) - }; - game.pause(); - step1(); - } - else{ - game.showChangeLog(); - } - "step 3" - if(lib.storage.test){ - lib.config.game_speed='vfast'; - _status.auto=true; - ui.auto.classList.add('glow'); - } - game.chooseCharacter(); - "step 4" - if(ui.coin){ - _status.coinCoeff=get.coinCoeff([game.me.name]); - } - if(game.players.length==2){ - game.showIdentity(true); - } - else{ - for(var i=0;i=3){ - var skill; - switch(game.zhu.name){ - case 'liubei':skill='jizhen';break; - case 'dongzhuo':skill='hengzheng';break; - case 'sunquan':skill='batu';break; - case 'sp_zhangjiao':skill='tiangong';break; - case 'liushan':skill='shengxi';break; - case 'sunce':skill='ciqiu';break; - case 'yuanshao':skill='geju';break; - case 're_caocao':skill='dangping';break; - case 'caopi':skill='junxing';break; - case 'liuxie':skill='moukui';break; - default:skill='tianming';break; - } - game.zhu.addSkill(skill); - game.zhu.storage.enhance_zhu=skill; - } - if(lib.storage.test){ - var str=''; - for(var i=0;i/g,''); + }; + var observer = new MutationObserver(removeLine); + observer.observe(rename,{characterData:true,subtree:true}); + rename.addEventListener('keyup',removeLine); + + var cardDialog=ui.create.cardDialog(true,function(name){ + if(lib.card[name].stonehidden) return true; + var type=lib.card[name].type; + return type!='stonecard'&&type!='stonecharacter'; + },{seperate:function(list){ + var nl=[],ns=[]; + var career={}; + var careerspell={}; + for(var i=0;i=30){ + for(var i=0;i=2){ + list.push(i); + } + } + for(var i=0;ib) return 1; + if(a'+editing.name+'', + listContainer,editDeck); + ui.create.div('.menubutton.round',deckitem).dataset.career=editing.content.career; + deckitem.name=editing.name; + } + lib.storage.deckList[editing.name]=editing.content; + } + game.save('deckList',lib.storage.deckList); + listContainer.style.transform=''; + deckContainer.classList.remove('shown'); + updateCardDialog(); + } + e.stopPropagation(); + }); + var listContainer=ui.create.div('.list-container',deckList); + for(var i in lib.storage.deckList){ + var deckitem=ui.create.div('.deckitem.shadowed',''+i+'', + listContainer,editDeck); + ui.create.div('.menubutton.round',deckitem).dataset.career=lib.storage.deckList[i].career; + deckitem.name=i; + } + var deckContainer=ui.create.div('.list-container.deck',deckList); + }()); + + ui.deckcontrol=ui.create.system('卡组管理',function(){ + // if(lib.config.low_performance){ + // ui.arena.style.transform='translateY('+ui.window.offsetHeight+'px)'; + // } + // else{ + // ui.arena.style.top='100%'; + // } + // ui.arena.style.transform='scale(0.6)'; + ui.arena.style.opacity=0; + ui.system.style.opacity=0; + ui.window.appendChild(ui.deckBuilder); + if(ui.deckBuilder.timeout){ + clearTimeout(ui.deckBuilder.timeout); + delete ui.deckBuilder.timeout; + } + ui.refresh(ui.deckBuilder); + ui.deckBuilder.classList.add('shown'); + ui.auto.hide(); + ui.pause.hide(); + },true); + + } + + if(playback){ + ui.create.me(); + ui.arena.style.display='none'; + ui.system.style.display='none'; + _status.playback=playback; + localStorage.removeItem(lib.configprefix+'playback'); + var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); + store.get(parseInt(playback)).onsuccess=function(e){ + if(e.target.result){ + game.playVideoContent(e.target.result.video); + } + else{ + alert('播放失败:找不到录像'); + game.reload(); + } + } + event.finish(); + } + else{ + game.prepareArena(2); + game.delay(); + } + ui.arena.classList.add('stone'); + "step 1" + for(var i=0;i'+game.me.deckCards.length); + uiintro.addSmall([game.me.deckCards,'card']); + return uiintro; + },220); + if(get.config('skill_bar')){ + _status.rageEnabled=true; + + ui.friendBar=ui.create.div('.skillbar.right.shadowed.playerbg',ui.arena); + ui.enemyBar=ui.create.div('.skillbar.left.shadowed.playerbg',ui.arena); + // ui.friendBar.dataset.nature='metal'; + // ui.enemyBar.dataset.nature='fire'; + ui.create.div('.skillbarshadow',ui.friendBar); + ui.create.div('.skillbarshadow',ui.enemyBar); + ui.create.div('.skillbarfill',ui.friendBar); + ui.create.div('.skillbarfill',ui.enemyBar); + ui.friendBar.fillnode=ui.create.div(ui.friendBar.lastChild); + ui.enemyBar.fillnode=ui.create.div(ui.enemyBar.lastChild); + // ui.friendBar.popnode=ui.create.div('.skillbartext',ui.friendBar); + // ui.enemyBar.popnode=ui.create.div('.skillbartext',ui.enemyBar); + _status.friendRage=0; + _status.enemyRage=0; + + if(lib.config.touchscreen){ + lib.setLongPress(ui.friendBar,ui.click.intro); + lib.setLongPress(ui.enemyBar,ui.click.intro); + } + else{ + if(lib.config.hover_all){ + lib.setHover(ui.friendBar,ui.click.hoverplayer); + lib.setHover(ui.enemyBar,ui.click.hoverplayer); + } + if(lib.config.right_info){ + ui.friendBar.oncontextmenu=ui.click.rightplayer; + ui.enemyBar.oncontextmenu=ui.click.rightplayer; + } + } + } + } + _status.friendCount=ui.create.system('',null,true); + _status.enemyCount=ui.create.system('',null,true); + game.updateStatusCount(); + lib.setPopped(_status.friendCount,function(){ + var uiintro=ui.create.dialog('hidden'); + + if(_status.deadfriend.length){ + uiintro.add('已阵亡'); + uiintro.add([_status.deadfriend,'player']); + } + + uiintro.add('未上场'); + if(_status.mylist.length){ + uiintro.add([_status.mylist,'character']); + } + else{ + uiintro.add('(无)') + } + + return uiintro; + }); + lib.setPopped(_status.enemyCount,function(){ + if(_status.deadenemy.length){ + var uiintro=ui.create.dialog('hidden'); + uiintro.add('已阵亡'); + uiintro.add([_status.deadenemy,'player']); + return uiintro; + } + }); + + game.me.side=Math.random()<0.5; + game.enemy.side=!game.me.side; + + var players=get.players(lib.sort.position); + var info=[]; + for(var i=0;i/g,''); - }; - var observer = new MutationObserver(removeLine); - observer.observe(rename,{characterData:true,subtree:true}); - rename.addEventListener('keyup',removeLine); - - var cardDialog=ui.create.cardDialog(true,function(name){ - if(lib.card[name].stonehidden) return true; - var type=lib.card[name].type; - return type!='stonecard'&&type!='stonecharacter'; - },{seperate:function(list){ - var nl=[],ns=[]; - var career={}; - var careerspell={}; - for(var i=0;i=30){ - for(var i=0;i=2){ - list.push(i); - } - } - for(var i=0;ib) return 1; - if(a'+editing.name+'', - listContainer,editDeck); - ui.create.div('.menubutton.round',deckitem).dataset.career=editing.content.career; - deckitem.name=editing.name; - } - lib.storage.deckList[editing.name]=editing.content; - } - game.save('deckList',lib.storage.deckList); - listContainer.style.transform=''; - deckContainer.classList.remove('shown'); - updateCardDialog(); - } - e.stopPropagation(); - }); - var listContainer=ui.create.div('.list-container',deckList); - for(var i in lib.storage.deckList){ - var deckitem=ui.create.div('.deckitem.shadowed',''+i+'', - listContainer,editDeck); - ui.create.div('.menubutton.round',deckitem).dataset.career=lib.storage.deckList[i].career; - deckitem.name=i; - } - var deckContainer=ui.create.div('.list-container.deck',deckList); - }()); - - ui.deckcontrol=ui.create.system('卡组管理',function(){ - // if(lib.config.low_performance){ - // ui.arena.style.transform='translateY('+ui.window.offsetHeight+'px)'; - // } - // else{ - // ui.arena.style.top='100%'; - // } - // ui.arena.style.transform='scale(0.6)'; - ui.arena.style.opacity=0; - ui.system.style.opacity=0; - ui.window.appendChild(ui.deckBuilder); - if(ui.deckBuilder.timeout){ - clearTimeout(ui.deckBuilder.timeout); - delete ui.deckBuilder.timeout; - } - ui.refresh(ui.deckBuilder); - ui.deckBuilder.classList.add('shown'); - ui.auto.hide(); - ui.pause.hide(); - },true); - - } - - if(playback){ - ui.create.me(); - ui.arena.style.display='none'; - ui.system.style.display='none'; - _status.playback=playback; - localStorage.removeItem(lib.configprefix+'playback'); - var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); - store.get(parseInt(playback)).onsuccess=function(e){ - if(e.target.result){ - game.playVideoContent(e.target.result.video); - } - else{ - alert('播放失败:找不到录像'); - game.reload(); - } - } - event.finish(); - } - else{ - game.prepareArena(2); - game.delay(); - } - ui.arena.classList.add('stone'); - "step 2" - for(var i=0;i'+game.me.deckCards.length); - uiintro.addSmall([game.me.deckCards,'card']); - return uiintro; - },220); - if(get.config('skill_bar')){ - _status.rageEnabled=true; - - ui.friendBar=ui.create.div('.skillbar.right.shadowed.playerbg',ui.arena); - ui.enemyBar=ui.create.div('.skillbar.left.shadowed.playerbg',ui.arena); - // ui.friendBar.dataset.nature='metal'; - // ui.enemyBar.dataset.nature='fire'; - ui.create.div('.skillbarshadow',ui.friendBar); - ui.create.div('.skillbarshadow',ui.enemyBar); - ui.create.div('.skillbarfill',ui.friendBar); - ui.create.div('.skillbarfill',ui.enemyBar); - ui.friendBar.fillnode=ui.create.div(ui.friendBar.lastChild); - ui.enemyBar.fillnode=ui.create.div(ui.enemyBar.lastChild); - // ui.friendBar.popnode=ui.create.div('.skillbartext',ui.friendBar); - // ui.enemyBar.popnode=ui.create.div('.skillbartext',ui.enemyBar); - _status.friendRage=0; - _status.enemyRage=0; - - if(lib.config.touchscreen){ - lib.setLongPress(ui.friendBar,ui.click.intro); - lib.setLongPress(ui.enemyBar,ui.click.intro); - } - else{ - if(lib.config.hover_all){ - lib.setHover(ui.friendBar,ui.click.hoverplayer); - lib.setHover(ui.enemyBar,ui.click.hoverplayer); - } - if(lib.config.right_info){ - ui.friendBar.oncontextmenu=ui.click.rightplayer; - ui.enemyBar.oncontextmenu=ui.click.rightplayer; - } - } - } - } - _status.friendCount=ui.create.system('',null,true); - _status.enemyCount=ui.create.system('',null,true); - game.updateStatusCount(); - lib.setPopped(_status.friendCount,function(){ - var uiintro=ui.create.dialog('hidden'); - - if(_status.deadfriend.length){ - uiintro.add('已阵亡'); - uiintro.add([_status.deadfriend,'player']); - } - - uiintro.add('未上场'); - if(_status.mylist.length){ - uiintro.add([_status.mylist,'character']); - } - else{ - uiintro.add('(无)') - } - - return uiintro; - }); - lib.setPopped(_status.enemyCount,function(){ - if(_status.deadenemy.length){ - var uiintro=ui.create.dialog('hidden'); - uiintro.add('已阵亡'); - uiintro.add([_status.deadenemy,'player']); - return uiintro; - } - }); - - game.me.side=Math.random()<0.5; - game.enemy.side=!game.me.side; - - var players=get.players(lib.sort.position); - var info=[]; - for(var i=0;i=8){ + j-=8; + } + if(list[i][0]=='w'){ + game.players[j].side=true; + game.players[j].setIdentity('wei'); + game.players[j].identity='wei'; + } + else{ + game.players[j].side=false; + game.players[j].setIdentity('shu'); + game.players[j].identity='shu'; + } + if(list[i].indexOf('mech')!=-1){ + game.players[j].type='mech'; + } + else if(list[i].indexOf('boss')!=-1){ + game.players[j].type='boss'; + } + else{ + game.players[j].type='human'; + } + } + game.chooseCharacterJiange(); + } + else{ + game.chooseCharacter(); + } + "step 3" + var players=get.players(lib.sort.position); + var info=[]; + for(var i=0;i=4); + } + game.addVideo('init',null,info); + event.trigger('gameStart'); + if(_status.mode=='four'){ + game.gameDraw(_status.firstAct,function(player){ + if(player==_status.firstAct.previousSeat){ + return 5; + } + return 4; + }); + if(game.me==_status.firstAct.previous||game.me==_status.firstAct.previous.previous){ + game.me.chooseBool('是否置换手牌?'); + event.replaceCard=true; + } + } + else if(_status.mode=='jiange'){ + var firstAct; + for(var i=0;i1){ + for(var i=0;i=lib.storage.number){ + actcount=i-lib.storage.number; + } + else{ + actcount=i+lib.storage.number; + } + } + if(actcount>0){ + actcount--; + } + else{ + actcount=game.players.length-1; + } + firstAct=game.players[actcount]; + break; + } + } + } + else{ + firstAct=game.players[Math.floor(Math.random()*game.players.length)]; + } + } + game.gameDraw(firstAct,4); + _status.first_less=true; + _status.round=0; + if(lib.storage.single_control){ + lib.skill.global.push('versus_swap'); + ui.autoreplace=ui.create.div('.caption.normal'); + ui.autoreplace.innerHTML='
自动换人
'; + ui.autoreplace.style.textAlign='center'; + if(lib.storage.autoreplaceinnerhtml){ + ui.autoreplace.classList.add('on') + } + ui.autoreplace.listen(game.switchAutoreplace); + + // ui.versusreplace=ui.create.system('换人',null,true); + // lib.setPopped(ui.versusreplace,game.versusHoverReplace); + if(game.players.length>2){ + ui.versushs=ui.create.system('手牌',null,true); + lib.setPopped(ui.versushs,game.versusHoverHandcards,220); + } + } + _status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true); + _status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true); + // _status.friendCount=ui.create.system('友方',null,true); + // _status.enemyCount=ui.create.system('敌方',null,true); + + lib.setPopped(_status.friendCount,game.versusHoverFriend); + lib.setPopped(_status.enemyCount,game.versusHoverEnemy); + + if(lib.storage.zhu){ + _status.currentSide=true; + game.versusPhaseLoop(firstAct); + } + else{ + game.versusPhaseLoop(firstAct); + } + } + if(_status.mode!='four'){ + event.finish(); + } + "step 4" + if(event.replaceCard&&result.bool){ + var hs=game.me.get('h'); + for(var i=0;i=8){ - j-=8; - } - if(list[i][0]=='w'){ - game.players[j].side=true; - game.players[j].setIdentity('wei'); - game.players[j].identity='wei'; - } - else{ - game.players[j].side=false; - game.players[j].setIdentity('shu'); - game.players[j].identity='shu'; - } - if(list[i].indexOf('mech')!=-1){ - game.players[j].type='mech'; - } - else if(list[i].indexOf('boss')!=-1){ - game.players[j].type='boss'; - } - else{ - game.players[j].type='human'; - } - } - game.chooseCharacterJiange(); - } - else{ - game.chooseCharacter(); - } - "step 3" - var players=get.players(lib.sort.position); - var info=[]; - for(var i=0;i=4); - } - game.addVideo('init',null,info); - event.trigger('gameStart'); - if(_status.mode=='four'){ - game.gameDraw(_status.firstAct,function(player){ - if(player==_status.firstAct.previousSeat){ - return 5; - } - return 4; - }); - if(game.me==_status.firstAct.previous||game.me==_status.firstAct.previous.previous){ - game.me.chooseBool('是否置换手牌?'); - event.replaceCard=true; - } - } - else if(_status.mode=='jiange'){ - var firstAct; - for(var i=0;i1){ - for(var i=0;i=lib.storage.number){ - actcount=i-lib.storage.number; - } - else{ - actcount=i+lib.storage.number; - } - } - if(actcount>0){ - actcount--; - } - else{ - actcount=game.players.length-1; - } - firstAct=game.players[actcount]; - break; - } - } - } - else{ - firstAct=game.players[Math.floor(Math.random()*game.players.length)]; - } - } - game.gameDraw(firstAct,4); - _status.first_less=true; - _status.round=0; - if(lib.storage.single_control){ - lib.skill.global.push('versus_swap'); - ui.autoreplace=ui.create.div('.caption.normal'); - ui.autoreplace.innerHTML='
自动换人
'; - ui.autoreplace.style.textAlign='center'; - if(lib.storage.autoreplaceinnerhtml){ - ui.autoreplace.classList.add('on') - } - ui.autoreplace.listen(game.switchAutoreplace); - - // ui.versusreplace=ui.create.system('换人',null,true); - // lib.setPopped(ui.versusreplace,game.versusHoverReplace); - if(game.players.length>2){ - ui.versushs=ui.create.system('手牌',null,true); - lib.setPopped(ui.versushs,game.versusHoverHandcards,220); - } - } - _status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true); - _status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true); - // _status.friendCount=ui.create.system('友方',null,true); - // _status.enemyCount=ui.create.system('敌方',null,true); - - lib.setPopped(_status.friendCount,game.versusHoverFriend); - lib.setPopped(_status.enemyCount,game.versusHoverEnemy); - - if(lib.storage.zhu){ - _status.currentSide=true; - game.versusPhaseLoop(firstAct); - } - else{ - game.versusPhaseLoop(firstAct); - } - } - if(_status.mode!='four'){ - event.finish(); - } - "step 4" - if(event.replaceCard&&result.bool){ - var hs=game.me.get('h'); - for(var i=0;i