From 053a61a3de5afc7537f5ab90c40e45103ea6a3af Mon Sep 17 00:00:00 2001 From: libccy Date: Wed, 19 Apr 2017 12:33:31 +0800 Subject: [PATCH] f --- game/game.js | 146 ++++++++++++++++++++++++++++----------------------- 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/game/game.js b/game/game.js index 9da8c23fa..ea898a6e6 100644 --- a/game/game.js +++ b/game/game.js @@ -19801,6 +19801,9 @@ ui.connectClients.info=clients; ui.connectClientsCount.innerHTML=clients.length; } + if(_status.connectClientsCallback){ + _status.connectClientsCallback(); + } }, updateevents:function(events){ if(events&&ui.connectEvents){ @@ -35612,12 +35615,19 @@ uiintro.style.bottom='75px'; uiintro.refresh=function(){ + if(button.focused) return; uiintro.content.innerHTML=''; uiintro.addText('创建约战'); button.textnode=uiintro.content.lastChild.lastChild; uiintro.add(''); uiintro.content.lastChild.style.paddingTop=0; button.input=uiintro.content.lastChild.lastChild; + button.input.onfocus=function(){ + button.focused=true; + } + button.input.onblur=function(){ + delete button.focused; + } if(button.interval){ button.input.disabled=true; button.input.style.opacity=0.6; @@ -35762,7 +35772,11 @@ } uiintro.refresh(); ui.window.appendChild(uiintro); - _status.connectEventsCallback=uiintro.refresh; + _status.connectEventsCallback=function(){ + if(uiintro.parentNode==ui.window){ + uiintro.refresh(); + } + }; } }, connectClients:function(){ @@ -35795,84 +35809,82 @@ uiintro.style.top='auto'; uiintro.style.bottom='75px'; - uiintro.addText('发状态'); - button.textnode=uiintro.content.lastChild.lastChild; - uiintro.add(''); - uiintro.content.lastChild.style.paddingTop=0; - button.input=uiintro.content.lastChild.lastChild; - if(button.interval){ - button.input.disabled=true; - button.input.style.opacity=0.6; - if(button.intervaltext){ - button.textnode.innerHTML=button.intervaltext; + uiintro.refresh=function(){ + if(button.focused) return; + uiintro.content.innerHTML=''; + uiintro.addText('发状态'); + button.textnode=uiintro.content.lastChild.lastChild; + uiintro.add(''); + uiintro.content.lastChild.style.paddingTop=0; + button.input=uiintro.content.lastChild.lastChild; + button.input.onfocus=function(){ + button.focused=true; } - } - button.input.onkeydown=function(e){ - if(e.keyCode==13&&!this.disabled){ - game.send('server','status',this.value); - this.disabled=true; - this.style.opacity=0.6; - button.textnode.innerHTML='发状态(10)'; - var num=10; - var that=this; + button.input.onblur=function(){ + delete button.focused; + } + if(button.interval){ button.input.disabled=true; button.input.style.opacity=0.6; - for(var i=0;i0){ + button.textnode.innerHTML='发状态('+num+')'; + button.intervaltext=button.textnode.innerHTML; } else{ - if(menode.nextSibling&&menode.nextSibling.classList.contains('videotext')){ - menode.nextSibling.innerHTML=this.value; - } - else{ - var newnode=ui.create.div('.menubutton.videotext',this.value); - uiintro.content.insertBefore(newnode,menode.nextSibling); - } + button.textnode.innerHTML='发状态'; + button.input.disabled=false; + button.input.style.opacity=''; + clearInterval(button.interval); + delete button.interval; + delete button.intervaltext; } - } + },1000); } - this.value=''; - button.interval=setInterval(function(){ - num--; - if(num>0){ - button.textnode.innerHTML='发状态('+num+')'; - button.intervaltext=button.textnode.innerHTML; - } - else{ - button.textnode.innerHTML='发状态'; - button.input.disabled=false; - button.input.style.opacity=''; - clearInterval(button.interval); - delete button.interval; - delete button.intervaltext; - } - },1000); } - } - for(var i=0;i'+(this.info[i][0]||'无名玩家'),node);node.isme=true; + for(var i=0;i'+(button.info[i][0]||'无名玩家'),node);node.isme=true; + } + else if(button.info[i][2]){ + ui.create.div('.name',(button.info[i][0]||'无名玩家'),node); + } + else{ + ui.create.div('.name',''+(button.info[i][0]||'无名玩家'),node); + } + if(button.info[i][3]){ + ui.create.div('.menubutton.videotext',uiintro.content,button.info[i][3]); + } } - else if(this.info[i][2]){ - ui.create.div('.name',(this.info[i][0]||'无名玩家'),node); - } - else{ - ui.create.div('.name',''+(this.info[i][0]||'无名玩家'),node); - } - if(this.info[i][3]){ - ui.create.div('.menubutton.videotext',uiintro.content,this.info[i][3]); - } - } + }; + uiintro.refresh(); ui.window.appendChild(uiintro); + _status.connectClientsCallback=function(){ + if(uiintro.parentNode==ui.window){ + uiintro.refresh(); + } + }; } }, autoskin:function(){