diff --git a/audio/skill/reyingzi_sunce1.mp3 b/audio/skill/reyingzi_sunce1.mp3 old mode 100644 new mode 100755 index f418deda7..c6f10e3c3 Binary files a/audio/skill/reyingzi_sunce1.mp3 and b/audio/skill/reyingzi_sunce1.mp3 differ diff --git a/character/hearth.js b/character/hearth.js index e8d9c9575..b70eba2d1 100755 --- a/character/hearth.js +++ b/character/hearth.js @@ -144,6 +144,7 @@ character.hearth={ } 'step 1' if(result.control){ + game.stopCountChoose(); var link=result.control; player.addSkill(link); player.skills.remove(link); @@ -2904,6 +2905,7 @@ character.hearth={ event.finish(); } 'step 1' + game.stopCountChoose(); if(result.buttons.length==1){ player.addSkill(result.buttons[0].name); } diff --git a/character/refresh.js b/character/refresh.js index 1f8330dc5..2a8f89f2e 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -1357,7 +1357,7 @@ character.refresh={ reqianxun_info:'每当一张延时类锦囊牌或其他角色使用的非延时类锦囊牌生效时,若你是此牌的唯一目标,你可以将所有手牌置于你的武将牌上,若如此做,此回合结束时,你获得你武将牌上的所有牌。', relianying_info:'当你失去最后的手牌时,你可以令至多X名角色各摸一张牌(X为你此次失去的手牌数)。', reyingzi_info:'锁定技,摸牌阶段摸牌时,你额外摸一张牌;你的手牌上限不会因体力值的减少而减少。', - refanjian_info:'出牌阶段限一次,你可以展示一张手牌并将此牌交给一名其他角色。然后该角色选择一项:展示其手牌并弃置所有与此牌花色相同的牌,或是去一点体力。', + refanjian_info:'出牌阶段限一次,你可以展示一张手牌并将此牌交给一名其他角色。然后该角色选择一项:展示其手牌并弃置所有与此牌花色相同的牌,或失去一点体力。', qingjian_info:'每当你于摸牌阶段外获得牌时,你可以将其中任意牌以任意顺序交给其他角色,每回合最多发动四次', qinxue_info:'觉醒技,准备阶段开始时,若你的手牌数比体力值多3(人数不少于7时改为2)或更多,你须减一点体力上限并获得技能【攻心】', retuxi_info:'摸牌阶段摸牌时,你可以少摸任意张牌,然后选择等量的手牌数大于或等于你的其他角色,获得这些角色的各一张手牌。', diff --git a/character/shenhua.js b/character/shenhua.js index eae5a8a89..551a3c568 100644 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -607,6 +607,7 @@ character.shenhua={ } "step 2" if(result.bool&&result.targets&&result.targets.length){ + game.stopCountChoose(); var card=event.card; player.storage.tuntian.remove(card); game.addVideo('storage',player,['tuntian',get.cardsInfo(player.storage.tuntian),'cards']); diff --git a/character/standard.js b/character/standard.js index d142c4fba..862b1f305 100755 --- a/character/standard.js +++ b/character/standard.js @@ -694,12 +694,54 @@ character.standard={ if(player.isUnderControl()){ game.modeSwapPlayer(player); } + var cards=get.cards(Math.min(5,game.players.length)); + event.switchToAuto=function(){ + _status.imchoosing=false; + if(event.dialog) event.dialog.close(); + if(event.control) event.control.close(); + var top=[]; + var judges=player.node.judges.childNodes; + var stopped=false; + if(!player.num('h','wuxie')){ + for(var i=0;i0; + return event.player!=player; }, prompt:function(event,player){ return '是否对'+get.translation(event.player)+'发动【献图】?' @@ -2893,17 +2893,28 @@ character.yijiang={ }, qiangzhi:{ audio:2, - enable:'phaseUse', - usable:1, + trigger:{player:'phaseUseBegin'}, + direct:true, filterTarget:function(card,player,target){ return target!=player&&target.num('h')>0; }, content:function(){ - var card=target.get('h').randomGet(); - player.showCards(card); - player.storage.qiangzhi=get.type(card,'trick'); - game.addVideo('storage',player,['qiangzhi',player.storage.qiangzhi]); - player.markSkill('qiangzhi'); + 'step 0' + player.chooseTarget('是否发动【强识】?',function(card,player,target){ + return target!=player&&target.num('h')>0; + }).ai=function(){ + return Math.random(); + } + 'step 1' + if(result.bool){ + var target=result.targets[0]; + player.logSkill('qiangzhi',target); + var card=target.get('h').randomGet(); + player.showCards(card); + player.storage.qiangzhi=get.type(card,'trick'); + game.addVideo('storage',player,['qiangzhi',player.storage.qiangzhi]); + player.markSkill('qiangzhi'); + } }, intro:{ content:function(type){ diff --git a/game/config.js b/game/config.js index eafc853a1..fa5a67978 100755 --- a/game/config.js +++ b/game/config.js @@ -228,6 +228,7 @@ window.config={ show_volumn:true, show_cardpile:true, only_fullskin:true, + show_connect:true, show_wuxie:false, show_wuxie_self:true, show_stat:true, diff --git a/game/game.js b/game/game.js index eb7cea84e..0c6dd1f8d 100755 --- a/game/game.js +++ b/game/game.js @@ -47,6 +47,7 @@ }; var lib={ configprefix:'noname_0.9_', + versionOL:1, updateURL:localStorage.getItem('noname_download_source')||'http://isha.applinzi.com/', assetURL:'', changeLog:[], @@ -134,6 +135,8 @@ name:'控制台命令', init:false, onclick:function(bool){ + game.saveConfig('cheat',bool); + if(_status.connectMode) return; if(lib.config.cheat&&bool==false){ lib.cheat=window.cheat; delete window.cheat; @@ -148,7 +151,6 @@ window.cheat=lib.cheat; window.cheat.i(); } - game.saveConfig('cheat',bool); }, unfrequent:true, }, @@ -370,6 +372,17 @@ init:false, unfrequent:true }, + connect_nickname:{ + name:'联机昵称', + clear:true, + unfrequent:true + }, + connect_avatar:{ + name:'联机头像', + init:'caocao', + item:{}, + unfrequent:true + }, update:function(config,map){ if(config.touchscreen){ map.mousewheel.hide(); @@ -549,45 +562,16 @@ ui.background.delete(); ui.background=ui.create.div('.background'); - switch (lib.config.image_background_filter){ - case 'blur': - ui.background.style.filter='blur(8px)'; - ui.background.style.webkitFilter='blur(8px)'; - ui.background.style.transform='scale(1.05)'; - break; - case 'gray': - ui.background.style.filter='grayscale(1)'; - ui.background.style.webkitFilter='grayscale(1)'; - break; - case 'sepia': - ui.background.style.filter='sepia(0.5)'; - ui.background.style.webkitFilter='sepia(0.5)'; - break; - case 'invert': - ui.background.style.filter='invert(1)'; - ui.background.style.webkitFilter='invert(1)'; - break; - case 'saturate': - ui.background.style.filter='saturate(5)'; - ui.background.style.webkitFilter='saturate(5)'; - break; - case 'contrast': - ui.background.style.filter='contrast(1.4)'; - ui.background.style.webkitFilter='contrast(1.4)'; - break; - case 'hue': - ui.background.style.filter='hue-rotate(180deg)'; - ui.background.style.webkitFilter='hue-rotate(180deg)'; - break; - case 'brightness': - ui.background.style.filter='brightness(5)'; - ui.background.style.webkitFilter='brightness(5)'; - break; - default: - ui.background.style.filter=''; - ui.background.style.webkitFilter=''; - ui.background.style.transform=''; - } + if(lib.config.image_background_blur){ + ui.background.style.filter='blur(8px)'; + ui.background.style.webkitFilter='blur(8px)'; + ui.background.style.transform='scale(1.05)'; + } + else{ + ui.background.style.filter=''; + ui.background.style.webkitFilter=''; + ui.background.style.transform=''; + } document.body.insertBefore(ui.background,document.body.firstChild); if(animate) ui.background.animate('start'); @@ -619,23 +603,21 @@ '', clear:true, }, - image_background_filter:{ - name:'背景特效', - init:'default', - item:{ - default:'无', - blur:'模糊', - gray:'黑白', - sepia:'怀旧', - invert:'反色', - saturate:'饱和', - contrast:'对比', - hue:'偏色', - brightness:'高亮', - }, - onclick:function(filter){ - game.saveConfig('image_background_filter',filter); - ui.click.sidebar.image_background(lib.config.image_background); + image_background_blur:{ + name:'背景模糊', + init:false, + onclick:function(bool){ + game.saveConfig('image_background_blur',bool); + if(lib.config.image_background_blur){ + ui.background.style.filter='blur(8px)'; + ui.background.style.webkitFilter='blur(8px)'; + ui.background.style.transform='scale(1.05)'; + } + else{ + ui.background.style.filter=''; + ui.background.style.webkitFilter=''; + ui.background.style.transform=''; + } }, }, card_style:{ @@ -840,6 +822,19 @@ game.saveConfig('dialog_transform',[0,0]); } }, + remember_round_button:{ + name:'记住按钮位置', + init:false, + unfrequent:true, + }, + reset_round_button:{ + name:'重置按钮位置', + clear:true, + unfrequent:true, + onclick:function(){ + ui.click.resetround(); + } + }, character_dialog_tool:{ name:'自由选将显示', init:'最近', @@ -851,6 +846,17 @@ }, unfrequent:true, }, + recent_character_number:{ + name:'最近使用武将', + init:'12', + item:{ + '6':'6', + '12':'12', + '20':'24', + '30':'36', + }, + unfrequent:true + }, show_favourite:{ name:'显示添加收藏', init:true, @@ -950,6 +956,20 @@ } } }, + show_connect:{ + name:'显示联机按钮', + init:true, + unfrequent:true, + onclick:function(bool){ + game.saveConfig('show_connect',bool); + if(lib.config.show_connect){ + ui.connectconfig.style.display=''; + } + else{ + ui.connectconfig.style.display='none'; + } + } + }, show_cardpile:{ name:'显示牌堆按钮', init:true, @@ -1105,10 +1125,10 @@ // }, update:function(config,map){ if(lib.config.image_background=='default'){ - map.image_background_filter.hide(); + map.image_background_blur.hide(); } else{ - map.image_background_filter.show(); + map.image_background_blur.show(); } if(lib.config.image_background=='custom'&&lib.db){ map.import_background.show(); @@ -1124,6 +1144,14 @@ map.hide_card_prompt_basic.hide(); map.hide_card_prompt_equip.hide(); } + if(lib.config.layout=='phone'){ + map.remember_round_button.show(); + map.reset_round_button.show(); + } + else{ + map.remember_round_button.hide(); + map.reset_round_button.hide(); + } // if(config.theme=='woodden'&&config.image_background=='default'){ // map.background_color_wood.show(); // } @@ -1637,8 +1665,26 @@ mode:{ identity:{ name:'身份', + connect:true, config:{ update:function(config,map){ + if(ui.connectButton.classList.contains('glow')){ + for(var i in map){ + if(map[i]._link.config.connect){ + map[i].style.display=''; + } + else{ + map[i].style.display='none'; + } + } + map.choose_timeout.show(); + } + else{ + for(var i in map){ + map[i].style.display=''; + } + map.choose_timeout.hide(); + } if(config.identity_mode=='zhong'){ map.player_number.hide(); map.enhance_zhu.hide(); @@ -1674,7 +1720,21 @@ }, restart:true, frequent:true, + connect:true }, + choose_timeout:{ + name:'出牌时限', + init:'30', + item:{ + '10':'10秒', + '15':'15秒', + '30':'30秒', + '60':'60秒', + '90':'90秒', + }, + connect:true, + frequent:true + }, player_number:{ name:'游戏人数', init:'8', @@ -1689,18 +1749,21 @@ }, frequent:true, restart:true, + connect:true }, double_nei:{ name:'双内奸', init:false, frequent:true, restart:true, + connect:true }, double_character:{ name:'双将模式', init:false, frequent:true, restart:true, + connect:true }, double_hp:{ name:'双将体力上限', @@ -1713,6 +1776,7 @@ zonghe:'相加', }, restart:true, + connect:true }, auto_identity:{ name:'自动显示身份', @@ -1742,23 +1806,25 @@ }, auto_mark_identity:{ name:'自动标记身份', - init:false + init:true, }, ban_weak:{ name:'屏蔽弱将', init:false, restart:true, + connect:true }, ban_strong:{ name:'屏蔽强将', init:false, restart:true, + connect:true }, enhance_zhu:{ name:'加强主公', init:false, restart:true, - frequent:true, + connect:true }, free_choose:{ name:'自由选将', @@ -1812,7 +1878,7 @@ once:'一次', twice:'两次', unlimited:'无限', - } + }, }, continue_game:{ name:'显示再战', @@ -1872,7 +1938,7 @@ ai_strategy_4:'酱油', ai_strategy_5:'天使', ai_strategy_6:'仇主', - } + }, }, difficulty:{ name:'AI对人类态度', @@ -1881,7 +1947,7 @@ easy:'友好', normal:'一般', hard:'仇视', - } + }, }, choice_zhu:{ name:'主公候选武将数', @@ -1894,7 +1960,7 @@ '6':'六', '8':'八', '10':'十', - } + }, }, choice_zhong:{ name:'忠臣候选武将数', @@ -1907,7 +1973,7 @@ '6':'六', '8':'八', '10':'十', - } + }, }, choice_nei:{ name:'内奸候选武将数', @@ -1920,7 +1986,7 @@ '6':'六', '8':'八', '10':'十', - } + }, }, choice_fan:{ name:'反贼候选武将数', @@ -1933,7 +1999,7 @@ '6':'六', '8':'八', '10':'十', - } + }, }, } }, @@ -2569,7 +2635,7 @@ }, battle_number:{ name:'出场人数', - init:'3', + init:'1', frequent:true, item:{ '1':'一人', @@ -2858,6 +2924,7 @@ } lib.config={}; + lib.configOL={}; var config2; var config=window.config; for(var i in config){ @@ -3160,7 +3227,7 @@ debug:function(){ require('remote').getCurrentWindow().toggleDevTools(); } - } + }; game.download=function(url,folder,onsuccess,onerror){ url=lib.updateURL+url; var dir=folder.split('/'); @@ -3298,43 +3365,11 @@ ui.background.style.backgroundSize="cover"; if(lib.config.image_background&&lib.config.image_background!='default'&&lib.config.image_background!='custom'){ ui.background.setBackgroundImage('image/background/'+lib.config.image_background+'.jpg'); - switch (lib.config.image_background_filter){ - case 'blur': - ui.background.style.filter='blur(8px)'; - ui.background.style.webkitFilter='blur(8px)'; - ui.background.style.transform='scale(1.05)'; - break; - case 'gray': - ui.background.style.filter='grayscale(1)'; - ui.background.style.webkitFilter='grayscale(1)'; - break; - case 'sepia': - ui.background.style.filter='sepia(0.5)'; - ui.background.style.webkitFilter='sepia(0.5)'; - break; - case 'invert': - ui.background.style.filter='invert(1)'; - ui.background.style.webkitFilter='invert(1)'; - break; - case 'saturate': - ui.background.style.filter='saturate(5)'; - ui.background.style.webkitFilter='saturate(5)'; - break; - case 'contrast': - ui.background.style.filter='contrast(1.4)'; - ui.background.style.webkitFilter='contrast(1.4)'; - break; - case 'hue': - ui.background.style.filter='hue-rotate(180deg)'; - ui.background.style.webkitFilter='hue-rotate(180deg)'; - break; - case 'brightness': - ui.background.style.filter='brightness(5)'; - ui.background.style.webkitFilter='brightness(5)'; - break; - default: - ui.background.style.webkitFilter=''; - } + if(lib.config.image_background_blur){ + ui.background.style.filter='blur(8px)'; + ui.background.style.webkitFilter='blur(8px)'; + ui.background.style.transform='scale(1.05)'; + } } document.body.insertBefore(ui.background,document.body.firstChild); @@ -3501,6 +3536,9 @@ } } } + for(var i in lib.character){ + lib.configMenu.general.config.connect_avatar.item[i]=lib.translate[i]; + } if(lib.cardPack.mode_derivation){ for(var i=0;i=lib.configOL.number){ + this.send('denied','number'); + } + else{ + if(config){ + this.avatar=config.avatar; + this.nickname=config.nickname; + } + this.send('init',this.id,lib.configOL); + } + } + }, + client:{ + init:function(id,config){ + console.log(id,config); + if(_status.connectCallback){ + _status.connectCallback(true); + delete _status.connectCallback; + } + game.online=true; + game.onlineID=id; + lib.configOL=config; + }, + denied:function(reason){ + console.log(reason); + } + } + }, group:['wei','shu','wu','qun'], nature:['fire','thunder','poison'], linked:['fire','thunder'], }; var game={ + online:false, + onlineID:null, + waitForStart:function(){ + var next=game.createEvent('waitForStart',false); + next.content=function(){ + console.log(1); + game.pause(); + } + }, + countDown:function(time,onEnd){ + time=parseInt(time); + if(!time) return; + if(time<=0) return; + var current=time; + ui.timer.set(current,1); + _status.countDown=setInterval(function(){ + if(current){ + ui.timer.set(--current,current/time); + } + else{ + clearInterval(_status.countDown); + delete _status.countDown; + if(onEnd) onEnd(); + } + },1000); + }, + countChoose:function(clear){ + if(_status.imchoosing){ + return; + } + _status.imchoosing=true; + if(_status.connectMode&&!_status.countDown){ + ui.timer.show(); + game.countDown(parseInt(get.config('choose_timeout')),function(){ + ui.click.auto(); + ui.timer.hide(); + }); + } + }, + stopCountChoose:function(){ + if(_status.countDown){ + clearInterval(_status.countDown); + delete _status.countDown; + ui.timer.hide(); + } + }, + connect:function(ip,port,callback){ + if(game.online) return; + try{ + game.ws=new WebSocket('ws://'+ip+':'+(port||8080)+''); + } + catch(e){ + alert('错误:无效联机地址'); + if(callback){ + callback(false); + } + return; + } + if(typeof game.onlineID==='number'){ + game.ws.onopen=lib.element.ws.onreconnect; + } + else{ + game.ws.onopen=lib.element.ws.onopen; + } + game.ws.onmessage=lib.element.ws.onmessage; + game.ws.onerror=lib.element.ws.onerror; + game.ws.onclose=lib.element.ws.onclose; + _status.connectCallback=callback; + }, + send:function(){ + if(game.ws){ + game.ws.send(JSON.stringify(Array.from(arguments))); + } + }, + createServer:function(){ + lib.node.clients=[]; + lib.configOL={}; + var WebSocketServer=require('ws').Server; + var wss=new WebSocketServer({port:8080}); + wss.on('connection',function(ws){ + var client={ + ws:ws, + id:(new Date()).getTime(), + closed:false + }; + lib.node.clients.push(client); + for(var i in lib.element.client){ + client[i]=lib.element.client[i]; + } + ws.on('message',function(messagestr){ + var message; + try{ + message=JSON.parse(messagestr); + if(!Array.isArray(message)|| + typeof lib.message.server[message[0]]!=='function'){ + throw('err'); + } + } + catch(e){ + console.log('invalid message: '+messagestr); + return; + } + lib.message.server[message.shift()].apply(client,message); + }); + ws.on('close',function(){ + client.close(); + }); + }); + }, playAudio:function(){ if(_status.video&&arguments[1]!='video') return; var str=''; @@ -11397,7 +11676,7 @@ }, phaseJudge:function(player,card){ if(player&&card){ - player.$phaseJudge(get.infoCard(card)); + // player.$phaseJudge(get.infoCard(card)); } else{ console.log(player); @@ -12332,8 +12611,8 @@ lib.config.recentCharacter.unshift(arguments[i]); } } - if(lib.config.recentCharacter.length>20){ - lib.config.recentCharacter.splice(0,20); + if(lib.config.recentCharacter.length>parseInt(lib.config.recent_character_number)){ + lib.config.recentCharacter.splice(0,12); } game.saveConfig('recentCharacter',lib.config.recentCharacter); }, @@ -12889,16 +13168,21 @@ _status.paused=true; }, pause2:function(){ + if(_status.connectMode) return; _status.paused2=true; }, resume:function(){ if(_status.paused){ + if(!_status.noclearcountdown){ + game.stopCountChoose(); + } _status.paused=false; delete _status.waitingForTransition; game.loop(); } }, resume2:function(){ + if(_status.connectMode) return; if(_status.paused2){ _status.paused2=false; game.loop(); @@ -13205,7 +13489,7 @@ } else{ ui.arena.classList.add('selecting'); - _status.imchoosing=true; + game.countChoose(); if(!_status.noconfirm&&!_status.event.noconfirm){ if(!_status.mousedown||_status.mouseleft){ var str=''; @@ -15069,9 +15353,10 @@ ui.roundmenu.style.transition=''; },500); game.saveConfig('roundmenu_transform',[0,0]); - e.stopPropagation(); + if(e) e.stopPropagation(); return false; }; + ui.click.resetround=resetround; if(lib.config.touchscreen){ ui.roundmenu.addEventListener('touchstart',function(e){ _status.draggingroundmenu=true; @@ -15092,6 +15377,9 @@ else{ ui.roundmenu.oncontextmenu=resetround; } + if(!lib.config.remember_round_button){ + game.saveConfig('roundmenu_transform'); + } if(lib.config.roundmenu_transform){ var translate=lib.config.roundmenu_transform; ui.roundmenu._dragtransform=translate; @@ -15170,7 +15458,7 @@ if(lib.skill[i].frequent&&lib.translate[i]){ lib.translate[i+'_forbid_config']=lib.translate[i]; nodex=ui.create.switcher(i+'_forbid', - !lib.config.autoskilllist.contains(i),ui.click.sidebar.autoskill); + !lib.config.autoskilllist.contains(i),ui.click.autoskill); nodex.link=i; autoskill[i]=nodex; } @@ -15179,6 +15467,7 @@ ui.system1=ui.create.div('#system1',ui.system); ui.system2=ui.create.div('#system2',ui.system); + ui.connectconfig=ui.create.system('联机',ui.click.connectButton,true); ui.replay=ui.create.system('重来',game.reload,true); ui.config2=ui.create.system('选项',ui.click.config); ui.pause=ui.create.system('暂停',ui.click.pause); @@ -15188,12 +15477,14 @@ if(!lib.config.show_pause){ ui.pause.style.display='none'; } + if(!lib.config.show_connect){ + ui.connectconfig.style.display='none'; + } ui.cardPileButton=ui.create.system('牌堆',null,true); lib.setPopped(ui.cardPileButton,ui.click.cardPileButton,220); ui.wuxie=ui.create.system('不询问无懈',ui.click.wuxie,true); if(!lib.config.touchscreen){ lib.setPopped(ui.config2,ui.click.pauseconfig,170); - // lib.setPopped(ui.wuxie,ui.click.wuxieconfig,170); } ui.auto=ui.create.system('托管',ui.click.auto); ui.volumn=ui.create.system('♫'); @@ -15244,9 +15535,64 @@ ui.controls=[]; ui.style={}; + + ui.timer=ui.create.div('.skillbar.shadowed.playerbg.hidden'); + ui.timer.id='timer'; + ui.create.div('.skillbarshadow',ui.timer); + ui.create.div('.skillbarfill',ui.timer); + ui.timer.fillnode=ui.create.div(ui.timer.lastChild); + ui.timer.popnode=ui.create.div('.skillbartext',ui.timer); + ui.timer.popnode.style.opacity=1; + ui.timer.position=4; + ui.timer.style.zIndex=5; + ui.timer.set=function(text,percentage){ + if(typeof text=='string'||typeof text=='number'){ + ui.timer.popnode.innerHTML=text; + } + ui.timer.fillnode.style.top=((1-percentage)*100)+'%'; + } + var setTimerPosition=function(e){ + this.position++; + if(this.position>4){ + this.position=1; + } + var left1='180px'; + var left2='calc(100% - 245px)'; + var top1='210px'; + var top2='calc(100% - 245px)'; + if(lib.config.layout=='default'){ + left1='265px'; + top1='160px'; + left2='calc(100% - 330px)'; + top2='calc(100% - 235px)'; + } + if(this.position==1||this.position==2){ + this.style.top=top2; + } + else{ + this.style.top=top1; + } + if(this.position==1||this.position==4){ + this.style.left=left2; + } + else{ + this.style.left=left1; + } + } + ui.timer.listen(setTimerPosition); + + if(_status.connectMode){ + ui.playerids.remove(); + ui.connectconfig.remove(); + ui.pause.innerHTML='历史'; + setTimerPosition.call(ui.timer); + ui.arena.appendChild(ui.timer); + } + (function(){ var menu,menuContainer; var startButton; + var connectButton; var popupContainer; var closeMenu=function(){ popupContainer.classList.add('hidden'); @@ -15282,12 +15628,22 @@ if(this._link.menu){ var pos1=this.lastChild.getBoundingClientRect(); var pos2=ui.window.getBoundingClientRect(); - openMenu(this._link.menu,{ - x:pos1.left+pos1.width+5-pos2.left, - y:pos1.top-pos2.top - },function(){ - node.classList.remove('on'); - }); + if(this._link.menu.childElementCount>10){ + openMenu(this._link.menu,{ + x:pos1.left+pos1.width+5-pos2.left, + y:40 + },function(){ + node.classList.remove('on'); + }); + } + else{ + openMenu(this._link.menu,{ + x:pos1.left+pos1.width+5-pos2.left, + y:pos1.top-pos2.top + },function(){ + node.classList.remove('on'); + }); + } } }; var clickContainer=function(){ @@ -15452,12 +15808,32 @@ var start=menux.pages[0]; var rightPane=start.lastChild; + + connectButton=ui.create.div('.menubutton.round.highlight','联',start,function(){ + this.classList.toggle('glow'); + var active=this.parentNode.querySelector('.active'); + if(active&&active.update){ + active.update(); + } + }); + connectButton.style.left='275px'; + ui.connectButton=connectButton; + if(lib.config.connectMode){ + connectButton.classList.add('glow'); + } + startButton=ui.create.div('.menubutton.round.highlight','启',start,function(){ if(this.animating||this.classList.contains('dim')){ return; } var active=this.parentNode.querySelector('.active'); if(active){ + if(connectButton.classList.contains('glow')&&lib.mode[active.mode].connect){ + game.saveConfig('connectMode',true); + } + else{ + game.saveConfig('connectMode'); + } game.saveConfig('mode',active.mode); localStorage.setItem(lib.configprefix+'directstart',true); game.reload(); @@ -15474,6 +15850,12 @@ active=this; this.classList.add('active'); rightPane.appendChild(this.link); + if(lib.mode[this.mode].connect){ + connectButton.style.display=''; + } + else{ + connectButton.style.display='none'; + } }; var createModeConfig=function(mode,position){ @@ -15571,6 +15953,9 @@ } if(info.config.update){ info.config.update(config,map); + node.update=function(){ + info.config.update(config,map); + } } } return node; @@ -15587,6 +15972,9 @@ active.classList.add('active'); } rightPane.appendChild(active.link); + if(!lib.mode[active.mode].connect){ + connectButton.style.display='none'; + } }()); (function(){ @@ -17490,12 +17878,12 @@ checkCheat(); }; menuUpdates.push(function(){ - if(_status.video){ + if(_status.video||_status.connectMode){ node.classList.add('off'); node.classList.remove('active'); - node.remove(); page.remove(); - cheatButton.style.display='none'; + cheatButton.remove(); + if(_status.video) node.remove(); return; } var list=[]; @@ -17542,7 +17930,7 @@ game.swapPlayer(this.link); }; menuUpdates.push(function(){ - if(lib.config.mode!='identity'&&lib.config.mode!='guozhan'){ + if(_status.connectMode||(lib.config.mode!='identity'&&lib.config.mode!='guozhan')){ node.classList.add('off'); var active=start.firstChild.querySelector('.active'); if(active==node){ @@ -17553,6 +17941,7 @@ rightPane.appendChild(active.link); cheatButton.style.display=''; } + return; } var list=[]; for(var i=0;i确定'; importVideo.lastChild.onclick=function(){ var fileToLoad = importVideo.firstChild.files[0]; - var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent) { @@ -17892,7 +18283,12 @@ var active=start.firstChild.querySelector('.active'); if(!active){ - active=start.firstChild.firstChild; + if(_status.connectMode){ + active=start.firstChild.lastChild; + } + else{ + active=start.firstChild.firstChild; + } active.classList.add('active'); } rightPane.appendChild(active.link); @@ -17933,6 +18329,10 @@ var button1,button2; game.checkForUpdate=function(forcecheck){ + if(lib.config.debug){ + alert('不能在开发模式下更新'); + return; + } if(button1.disabled){ return; } @@ -18050,6 +18450,10 @@ } }; var checkForAssetUpdate=function(){ + if(lib.config.debug){ + alert('不能在开发模式下更新'); + return; + } if(button2.disabled){ return; } @@ -18243,7 +18647,12 @@ } var node2=ui.create.div('#paused2',node); - node2.innerHTML='已暂停'; + if(_status.connectMode){ + node2.innerHTML=''; + } + else{ + node2.innerHTML='已暂停'; + } // node2.listen(function(){ // _status.clicked=true; @@ -18452,6 +18861,7 @@ if(num===0){ return; } + if(num==undefined) num=lib.configOL.number; if(num==undefined) num=lib.config.mode_config[lib.config.mode].player_number; if(typeof num=='string'){ num=parseInt(num); @@ -18560,6 +18970,9 @@ }, }, click:{ + connectButton:function(){ + game.connect('localhost'); + }, favouriteCharacter:function(e){ if(this.innerHTML=='添加收藏'){ this.innerHTML='移除收藏'; @@ -18701,15 +19114,6 @@ uiintro.add(ui.sidebar); return uiintro; }, - wuxieconfig:function(){ - if(!lib.config.auto_popped) return; - // if(!ui.config.childNodes.length) return; - var uiintro=ui.create.dialog('hidden'); - var node=ui.create.switcher('wuxie_self',lib.config.wuxie_self,ui.click.sidebar.global); - uiintro.add(node); - - return uiintro; - }, pauseconfig:function(){ if(!lib.config.auto_popped_config) return; // if(!ui.config.childNodes.length) return; @@ -20521,454 +20925,17 @@ e.stopPropagation(); } }, - sidebar:{ - local:function(item){ - game.saveConfig(this.name,item,true); - }, - local2:function(item){ - game.saveConfig(this.name,item,true); - ui.sidebarrestart.classList.add('thundertext'); - }, - wuxie_self:function(item){ - ui.wuxie_self.lastChild.click(); - }, - global:function(item){ - game.saveConfig(this.name,item); - }, - global2:function(item){ - game.saveConfig(this.name,item); - ui.sidebarrestart.classList.add('thundertext'); - }, - background_music:function(item){ - game.saveConfig(this.name,item); - game.playBackgroundMusic(); - }, - cheat:function(bool){ - if(lib.config.cheat&&bool==false){ - lib.cheat=window.cheat; - delete window.cheat; - delete window.game; - delete window.ui; - delete window.get; - delete window.ai; - delete window.lib; - delete window._status; - } - else if(!lib.config.cheat&&bool){ - window.cheat=lib.cheat; - window.cheat.i(); - } - game.saveConfig('cheat',bool); - }, - free_choose:function(bool){ - game.saveConfig('free_choose',bool,true); - if(!_status.event.parent.showConfig&&!_status.event.showConfig) return; - if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); - else if(ui.cheat2&&!get.config('free_choose')){ - ui.cheat2.close(); - delete ui.cheat2; - if(ui.cheat2x){ - ui.cheat2x.close(); - delete ui.cheat2; - } - } - }, - change_identity:function(bool){ - game.saveConfig('change_identity',bool,true); - if(!_status.event.parent.showConfig&&!_status.event.showConfig) return; - var dialog; - if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; - else dialog=_status.event.dialog; - if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.parent.addSetting(dialog); - else _status.event.parent.removeSetting(dialog); - ui.update(); - }, - battle_number:function(num){ - game.saveConfig('battle_number',num,true); - if(!_status.event.parent.showConfig&&!_status.event.showConfig) return; - if(_status.event.parent.changeDialog){ - _status.event.parent.changeDialog(); - } - }, - change_choice:function(bool){ - game.saveConfig('change_choice',bool,true); - if(!_status.event.parent.showConfig&&!_status.event.showConfig) return; - if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); - else if(ui.cheat&&!get.config('change_choice')){ - ui.cheat.close(); - delete ui.cheat; - } - }, - player_number:function(num){ - game.saveConfig('player_number',num,true); - game.reload(); - }, - auto_identity:function(item){ - game.saveConfig('auto_identity',item,true); - var num; - switch(item){ - case 'one':num=1;break; - case 'two':num=2;break; - case 'three':num=3;break; - case 'always':num=-1;break; - default:num=0;break; - } - if(num&!_status.identityShown&&game.phaseNumber>game.players.length*num&&game.showIdentity){ - _status.identityShown=true; - game.showIdentity(false); - } - }, - swap:function(bool){ - game.saveConfig('swap',bool,true); - if(get.config('swap')){ - if(!ui.swap&&game.me.isDead()){ - ui.swap=ui.create.control('换人',ui.click.dieswap); - } - } - else if(ui.swap){ - ui.swap.close(); - delete ui.swap; - } - }, - revive:function(bool){ - game.saveConfig('revive',bool,true); - if(get.config('revive')){ - if(!ui.revive&&game.me.isDead()){ - ui.revive=ui.create.control('revive',ui.click.dierevive); - } - } - else if(ui.revive){ - ui.revive.close(); - delete ui.revive; - } - }, - hover_all:function(bool){ - game.saveConfig('hover_all',bool); - if(!lib.config.hover_all) ui.hoverhandcardconfig.classList.add('disabled'); - else ui.hoverhandcardconfig.classList.remove('disabled'); - ui.sidebarrestart.classList.add('thundertext'); - }, - theme:function(theme){ - game.saveConfig('theme',theme); - ui.arena.hide(); - setTimeout(function(){ - var theme=ui.css.theme; - ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style'); - theme.remove(); - setTimeout(function(){ui.arena.show();},100); - },500); - }, - layout:function(layout){ - game.saveConfig('layout',layout); - if(lib.config.mode!='chess'){ - ui.arena.hide(); - setTimeout(function(){ - var layout=ui.css.layout; - ui.css.layout=lib.init.css(lib.assetURL+'layout/'+lib.config.layout,'layout',layout); - - setTimeout(function(){layout.remove();ui.arena.show();},100); - },500); - } - }, - image_background:function(background){ - var animate=lib.config.image_background=='default'; - game.saveConfig('image_background',background); - ui.background.delete(); - ui.background=ui.create.div('.background'); - - switch (lib.config.image_background_filter){ - case 'blur': - ui.background.style.filter='blur(8px)'; - ui.background.style.webkitFilter='blur(8px)'; - ui.background.style.transform='scale(1.05)';break; - case 'gray': - ui.background.style.filter='grayscale(1)'; - ui.background.style.webkitFilter='grayscale(1)'; - break; - case 'sepia': - ui.background.style.filter='sepia(0.5)'; - ui.background.style.webkitFilter='sepia(0.5)'; - break; - case 'invert': - ui.background.style.filter='invert(1)'; - ui.background.style.webkitFilter='invert(1)'; - break; - case 'saturate': - ui.background.style.filter='saturate(5)'; - ui.background.style.webkitFilter='saturate(5)'; - break; - case 'contrast': - ui.background.style.filter='contrast(1.4)'; - ui.background.style.webkitFilter='contrast(1.4)'; - break; - case 'hue': - ui.background.style.filter='hue-rotate(180deg)'; - ui.background.style.webkitFilter='hue-rotate(180deg)'; - break; - case 'brightness': - ui.background.style.filter='brightness(5)'; - ui.background.style.webkitFilter='brightness(5)'; - break; - default: - ui.background.style.filter=''; - ui.background.style.webkitFilter=''; - ui.background.style.transform=''; - } - - document.body.insertBefore(ui.background,document.body.firstChild); - if(animate) ui.background.animate('start'); - if(lib.config.image_background=='default'){ - ui.background.style.backgroundImage="none"; - } - else if(lib.config.image_background=='custom'){ - ui.background.style.backgroundImage="none"; - game.getDB('image','background',function(fileToLoad){ - if(!fileToLoad) return; - var fileReader = new FileReader(); - fileReader.onload = function(fileLoadedEvent) - { - var data = fileLoadedEvent.target.result; - ui.background.style.backgroundImage='url('+data+')'; - }; - fileReader.readAsDataURL(fileToLoad, "UTF-8"); - }); - } - else{ - ui.background.setBackgroundImage("image/background/"+lib.config.image_background+".jpg"); - } - ui.background.style.backgroundSize='cover'; - }, - image_background_filter:function(filter){ - game.saveConfig('image_background_filter',filter); - ui.click.sidebar.image_background(lib.config.image_background); - }, - ui_zoom:function(zoom){ - game.saveConfig('ui_zoom',zoom); - switch(zoom){ - case '极小':ui.window.style.zoom=0.8;break; - case '很小':ui.window.style.zoom=0.9;break; - case '较小':ui.window.style.zoom=0.95;break; - case '较大':ui.window.style.zoom=1.05;break; - case '很大':ui.window.style.zoom=1.1;break; - default:ui.window.style.zoom=1; - } - }, - show_name:function(bool){ - game.saveConfig('show_name',bool); - var players=get.players(false,true); - if(lib.config.show_name){ - for(var i=0;i0){ - game.me.node.handcards1.appendChild(cards[i]); - } - else{ - game.me.node.handcards2.appendChild(cards[i]); - } - } - } - }, - reverse_sort:function(bool){ - game.saveConfig('reverse_sort',bool,true); - var cards1=[]; - var cards2=[]; - var i; - for(i=0;idiv:not(.playerfocus):not(#chess-container):not(.removing){ +#arena.playerfocus>div:not(#timer):not(.playerfocus):not(#chess-container):not(.removing){ opacity: 0.3 !important; } #arena.playerfocus #chess>div:not(.playerfocus):not(.removing){ @@ -1316,6 +1316,75 @@ span[data-color="unknownm"]{ left:calc(100% - 11px); } +#arena>.skillbar{ + width: 65px; + height: 65px; + border-radius: 100%; + font-size: 55px; + font-family: 'huangcao'; + top:calc(50% - 110px); + line-height: 65px; + text-align: center; +} +#arena>.skillbar.left{ + left:0; + right: auto; +} +#arena>.skillbar.right{ + right:0; + left:auto; +} +#arena>.skillbar>div{ + border-radius: 100%; + width: 55px; + height: 55px; + position: absolute; + margin: 0; + padding: 0; + left: 5px; + top: 5px; + overflow: hidden; +} +#arena>.skillbar>.skillbarshadow{ + box-shadow: 0px 0px 8px #222 inset; + z-index: 1; +} +#arena>.skillbar>.skillbarfill>div{ + box-shadow: 0px 0px 10px #555 inset,rgba(0, 0, 0, 0.05) 0 0 0 1px; + width: 200%; + height: 200%; + position: absolute; + margin: 0; + padding: 0; + background-color: rgba(63, 119, 173,1); + left: -50%; + top: 100%; +} +#arena>.skillbar.full>.skillbarfill>div{ + box-shadow: none; + background-color: red; +} +#arena>.skillbar.full{ + /*transform: scale(1.1);*/ + /*box-shadow: rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.45) 0 3px 10px; + -webkit-animation:skillbarglow 3s infinite;*/ +} +#arena>.skillbar>.skillbartext{ + font-family: 'xinwei'; + font-size: 35px; + width: 100%; + text-align: center; + height: 35px; + line-height: 40px; + overflow: visible; + margin: 0; + padding: 0; + left: 0; + top: 15px; + z-index: 2; + opacity: 0; +} + .firetext{ color: rgb(255,119,63); } diff --git a/layout/default/menu.css b/layout/default/menu.css index 975dcbb51..8b2495be2 100644 --- a/layout/default/menu.css +++ b/layout/default/menu.css @@ -282,7 +282,8 @@ } .popup-container>.menu{ position:absolute; - overflow:hidden; + overflow:scroll; + max-height: 400px; } .popup-container>.menu>div{ padding-top:5px; diff --git a/layout/mode/stone.css b/layout/mode/stone.css index 9cc819b22..b358dfbab 100755 --- a/layout/mode/stone.css +++ b/layout/mode/stone.css @@ -277,74 +277,7 @@ display: none !important; } -#arena>.skillbar{ - width: 65px; - height: 65px; - border-radius: 100%; - font-size: 55px; - font-family: 'huangcao'; - top:calc(50% - 110px); - line-height: 65px; - text-align: center; -} -#arena>.skillbar.left{ - left:0; - right: auto; -} -#arena>.skillbar.right{ - right:0; - left:auto; -} -#arena>.skillbar>div{ - border-radius: 100%; - width: 55px; - height: 55px; - position: absolute; - margin: 0; - padding: 0; - left: 5px; - top: 5px; - overflow: hidden; -} -#arena>.skillbar>.skillbarshadow{ - box-shadow: 0px 0px 8px #222 inset; - z-index: 1; -} -#arena>.skillbar>.skillbarfill>div{ - box-shadow: 0px 0px 10px #555 inset,rgba(0, 0, 0, 0.05) 0 0 0 1px; - width: 200%; - height: 200%; - position: absolute; - margin: 0; - padding: 0; - background-color: rgba(63, 119, 173,1); - left: -50%; - top: 100%; -} -#arena>.skillbar.full>.skillbarfill>div{ - box-shadow: none; - background-color: red; -} -#arena>.skillbar.full{ - /*transform: scale(1.1);*/ - /*box-shadow: rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.45) 0 3px 10px; - -webkit-animation:skillbarglow 3s infinite;*/ -} -#arena>.skillbar>.skillbartext{ - font-family: 'xinwei'; - font-size: 35px; - width: 100%; - text-align: center; - height: 35px; - line-height: 40px; - overflow: visible; - margin: 0; - padding: 0; - left: 0; - top: 15px; - z-index: 2; - opacity: 0; -} + /*#arena>.skillbar>.skillbartext:hover{ opacity: 1; }*/ diff --git a/mode/identity.js b/mode/identity.js index 2a1513a43..3d94a44a0 100755 --- a/mode/identity.js +++ b/mode/identity.js @@ -6,6 +6,17 @@ mode.identity={ ui.arena.classList.add('only_dialog'); } _status.mode=get.config('identity_mode'); + if(lib.config.connectMode){ + game.createServer(); + for(var i in lib.mode.identity.config){ + if(lib.mode.identity.config[i].connect){ + lib.configOL[i]=get.config(i); + } + } + lib.configOL.number=lib.configOL.player_number; + lib.configOL.characterPack='standard'; + lib.configOL.cardPack='standard'; + } "step 1" var playback=localStorage.getItem(lib.configprefix+'playback'); if(playback){ @@ -139,7 +150,12 @@ mode.identity={ _status.auto=true; ui.auto.classList.add('glow'); } - game.chooseCharacter(); + if(_status.connectMode){ + game.waitForStart(); + } + else{ + game.chooseCharacter(); + } "step 4" if(ui.coin){ _status.coinCoeff=get.coinCoeff([game.me.name]);