From fba970209689612c402a2106893fa2cf9629a147 Mon Sep 17 00:00:00 2001 From: libccy Date: Sat, 11 Feb 2017 15:47:22 +0800 Subject: [PATCH] z --- character/sp.js | 2 +- game/game.js | 431 +++++++++----------------------------- layout/default/layout.css | 23 ++ layout/mode/boss.css | 9 + layout/mode/chess.css | 3 + mode/guozhan.js | 3 +- mode/identity.js | 6 +- mode/versus.js | 3 +- 8 files changed, 148 insertions(+), 332 deletions(-) diff --git a/character/sp.js b/character/sp.js index eba8a25f5..d41b26fa4 100644 --- a/character/sp.js +++ b/character/sp.js @@ -6357,7 +6357,7 @@ character.sp={ } } else{ - targets=result.target; + targets=result.targets; } player.logSkill('hongyuan',targets); game.asyncDraw(targets); diff --git a/game/game.js b/game/game.js index 9ee44ed77..f0b563c9b 100644 --- a/game/game.js +++ b/game/game.js @@ -1194,6 +1194,24 @@ ui.arena.dataset.target_shake=bool; } }, + cursor_style:{ + name:'指针样式', + init:'auto', + unfrequent:true, + item:{ + auto:'自动', + pointer:'指针' + }, + onclick:function(item){ + game.saveConfig('cursor_style',item); + if(item=='pointer'){ + ui.window.classList.add('nopointer'); + } + else{ + ui.window.classList.remove('nopointer'); + } + } + }, link_style:{ name:'横置样式', init:'rotate', @@ -1416,6 +1434,12 @@ map.player_height.hide(); } } + if(config.touchscreen){ + map.cursor_style.hide(); + } + else{ + map.cursor_style.show(); + } // if(config.theme=='woodden'&&config.image_background=='default'){ // map.background_color_wood.show(); // } @@ -5597,7 +5621,8 @@ pt:function(){ var list=Array.from(arguments); while(list.length){ - ui.cardPile.insertBefore(cheat.gn(list.pop()),ui.cardPile.firstChild); + var card=cheat.gn(list.pop()); + if(card) ui.cardPile.insertBefore(card,ui.cardPile.firstChild); } }, q:function(){ @@ -5877,6 +5902,7 @@ gx:function(name,target){ target=target||game.me; var card=cheat.gn(name); + if(!card) return; target.node.handcards1.appendChild(card); delete _status.event._cardChoice; delete _status.event._targetChoice; @@ -5913,6 +5939,9 @@ name='sha'; nature='thunder'; } + if(!lib.card[name]){ + return null; + } return game.createCard(name,suit,null,nature); }, ge:function(target){ @@ -20933,6 +20962,7 @@ for(var i=0;i<_status.dragline.length;i++){ if(_status.dragline[i]) _status.dragline[i].remove(); } + ui.arena.classList.remove('dragging'); _status.dragline.length=0; }, swapSeat:function(player1,player2,prompt,behind){ @@ -28425,7 +28455,7 @@ } var list=[]; var dialog; - var node=ui.create.div('.caption'); + var node=ui.create.div('.caption.pointerspan'); if(get.is.phoneLayout()){ node.style.fontSize='30px'; } @@ -28765,6 +28795,7 @@ newlined2.style.marginTop='5px'; newlined2.style.display='none'; newlined2.style.fontFamily='xinwei'; + newlined2.classList.add('pointernode'); if(get.is.phoneLayout()){ newlined2.style.fontSize='32px'; } @@ -29349,6 +29380,9 @@ ui.backgroundMusic.autoplay=true; ui.backgroundMusic.addEventListener('ended',game.playBackgroundMusic); ui.window.appendChild(ui.backgroundMusic); + if(lib.config.cursor_style=='pointer'){ + ui.window.classList.add('nopointer'); + } ui.arenalog=ui.create.div('#arenalog',ui.arena); if(lib.config.show_log=='off'){ @@ -30448,7 +30482,7 @@ } } for(var k=0;k100){ - if(ui.roundmenu._resetTimeout){ - clearTimeout(ui.roundmenu._resetTimeout); - delete ui.roundmenu._resetTimeout; - } - } - ui.roundmenu._dragtouches=e.touches[0]; - ui.click.checkroundtranslate(translate); - } - _status.clicked=true; - } - else if(_status.draggingtouchdialog){ - delete _status._swipeorigin; - if(_status.draggingtouchdialog._dragorigin&&_status.draggingtouchdialog._dragtransform&&e.touches.length){ - var translate=_status.draggingtouchdialog._dragtransform.slice(0); - var dx=e.touches[0].clientX/game.documentZoom-_status.draggingtouchdialog._dragorigin.clientX/game.documentZoom; - var dy=e.touches[0].clientY/game.documentZoom-_status.draggingtouchdialog._dragorigin.clientY/game.documentZoom; - translate[0]+=dx; - translate[1]+=dy; - _status.draggingtouchdialog._dragtouches=e.touches[0]; - ui.click.checkdialogtranslate(translate,_status.draggingtouchdialog); - } - _status.clicked=true; - } - else if(_status._swipeorigin&&e.touches[0]){ - _status._swipeorigin.touches=e.touches[0]; - } - - if(_status.mousedragging&&e.touches.length){ - e.preventDefault(); - - var items,item,iwhile,item0; - if(document.elementsFromPoint){ - items=document.elementsFromPoint(e.touches[0].clientX,e.touches[0].clientY); - } - else{ - item0=document.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY); - } - - if(items){ - iwhile=0; - item=items[0]; - } - else{ - item=item0; - } - while(item){ - if(lib.config.enable_touchdragline&&_status.mouseleft&&!game.chess){ - var i=0; - var startPoint0=[_status.mousedragging.clientX/game.documentZoom-ui.arena.offsetLeft,_status.mousedragging.clientY/game.documentZoom-ui.arena.offsetTop]; - var startPoint=startPoint0; - var endPoint; - if(_status.multitarget){ - for(;i<_status.lastdragchange.length;i++){ - var exy=_status.lastdragchange[i]._lastdragchange; - endPoint=[exy[0],exy[1]]; - _status.dragline[i]=game.linexy(startPoint.concat(endPoint),'drag',_status.dragline[i]); - startPoint=endPoint; - } - } - if(!_status.selectionfull){ - endPoint=[e.touches[0].clientX/game.documentZoom-ui.arena.offsetLeft,e.touches[0].clientY/game.documentZoom-ui.arena.offsetTop]; - _status.dragline[i]=game.linexy(startPoint.concat(endPoint),'drag',_status.dragline[i]); - startPoint=endPoint; - i++; - } - if(!_status.multitarget){ - for(;i<_status.lastdragchange.length;i++){ - var exy=_status.lastdragchange[i]._lastdragchange; - _status.dragline[i]=game.linexy(startPoint0.concat([exy[0],exy[1]]),'drag',_status.dragline[i]); - } - } - var remained=_status.dragline.splice(i); - while(remained.length){ - remained.shift().remove(); - } - // ui.canvas.width=ui.arena.offsetWidth; - // ui.canvas.height=ui.arena.offsetHeight; - // var ctx=ui.ctx; - // ctx.shadowBlur=5; - // ctx.shadowColor='rgba(0,0,0,0.3)'; - // ctx.strokeStyle='white'; - // ctx.lineWidth=3; - // ctx.setLineDash([8,2]); - // - // ctx.beginPath(); - // - // ctx.moveTo(_status.mousedragging.clientX/game.documentZoom-ui.arena.offsetLeft,_status.mousedragging.clientY/game.documentZoom-ui.arena.offsetTop); - // - // if(_status.multitarget){ - // for(var i=0;i<_status.lastdragchange.length;i++){ - // var exy=_status.lastdragchange[i]._lastdragchange; - // ctx.lineTo(exy[0],exy[1]); - // } - // } - // if(!_status.selectionfull){ - // ctx.lineTo(e.touches[0].clientX/game.documentZoom-ui.arena.offsetLeft,e.touches[0].clientY/game.documentZoom-ui.arena.offsetTop); - // } - // ctx.stroke(); - // if(!_status.multitarget){ - // for(var i=0;i<_status.lastdragchange.length;i++){ - // ctx.moveTo(_status.mousedragging.clientX/game.documentZoom-ui.arena.offsetLeft,_status.mousedragging.clientY/game.documentZoom-ui.arena.offsetTop); - // var exy=_status.lastdragchange[i]._lastdragchange; - // ctx.lineTo(exy[0],exy[1]); - // ctx.stroke(); - // } - // } - } - - if(item==_status.mousedragorigin){ - if(_status.mouseleft){ - _status.mousedragging=null; - _status.mousedragorigin=null; - _status.clicked=false; - game.uncheck(); - game.check(); - _status.clicked=true; - } - return; - } - var itemtype=get.itemtype(item); - if(itemtype=='card'||itemtype=='button'||itemtype=='player'){ - if(items) _status.mouseleft=true; - var ex=e.touches[0].clientX/game.documentZoom-ui.arena.offsetLeft; - var ey=e.touches[0].clientY/game.documentZoom-ui.arena.offsetTop; - var exx=ex,eyy=ey; - if(game.chess){ - ex-=-ui.chessContainer.scrollLeft+ui.chess.offsetLeft; - ey-=-ui.chessContainer.scrollTop+ui.chess.offsetTop; - } - if(itemtype!='player'||(ex>item.offsetLeft&&exitem.offsetTop&&ey=1000)){ + if(_status.mouseleft){ _status.mousedragging=null; _status.mousedragorigin=null; _status.clicked=false; @@ -31489,7 +31314,7 @@ } var itemtype=get.itemtype(item); if(itemtype=='card'||itemtype=='button'||itemtype=='player'){ - if(items) _status.mouseleft=true; + _status.mouseleft=true; var ex=e.clientX/game.documentZoom-ui.arena.offsetLeft; var ey=e.clientY/game.documentZoom-ui.arena.offsetTop; var exx=ex,eyy=ey; @@ -31506,7 +31331,7 @@ } } if(!targetfixed&&item.classList.contains('selectable')&&_status.dragstatuschanged!=item){ - if(items) _status.mouseleft=true; + _status.mouseleft=true; _status.dragstatuschanged=item; _status.clicked=false; var notbefore=itemtype=='player'&&!item.classList.contains('selected'); @@ -31534,25 +31359,12 @@ } return; } - if(items){ - iwhile++; - item=items[iwhile]; - } - else{ - item=item.parentNode; - } + item=item.parentNode; } - if(items) _status.mouseleft=true; + _status.mouseleft=true; _status.dragstatuschanged=null; } else{ - if(items){ - iwhile=0; - item=items[0]; - } - else{ - item=item0; - } while(item){ if(item==node&&!node._mouseentercreated){ ui.click.mouseentercancel(); @@ -31589,13 +31401,7 @@ },hoveration); break; } - if(items){ - iwhile++; - item=items[iwhile]; - } - else{ - item=item.parentNode; - } + item=item.parentNode; } if(_status.draggingdialog){ var ddialog=_status.draggingdialog; @@ -31626,21 +31432,8 @@ for(var i=0;i.card>.info>span, #control>* { pointer-events: auto; } +#window:not(.nopointer) #control{ + cursor:pointer; +} #control.nozoom>div { transition-property: opacity } @@ -2608,6 +2612,25 @@ div:not(.handcards)>.card>.info>span, opacity: 0.6; } +#window:not(.nopointer) .player .judges>.card, +#window:not(.nopointer) .player .marks>.card, +#window:not(.nopointer) #system>div>div:not(.hidden), +#window:not(.nopointer) .choosedouble.character, +#window:not(.nopointer) .pointernode div, +#window:not(.nopointer) .pointerspan span, +#window:not(.nopointer) .pointertable td>span, +#window:not(.nopointer) .dialog.fullheight .buttons .button:not(.selectedx):not(.glow):not(.forbidden), +#window:not(.nopointer) #arena.selecting:not(.video) .player .equips>.card.selectable, +#window:not(.nopointer) #arena.selecting #me .card.selectable, +#window:not(.nopointer) #arena.selecting .button.selectable, +#window:not(.nopointer) #arena.selecting .player.selectable, +#window:not(.nopointer) .menubutton.round{ + cursor: pointer; +} +#arena.dragging{ + cursor: move; +} + #arena.selecting:not(.video) .player[data-position='0'] .marks>.card:not(.selectable)>.image, #arena.selecting:not(.video) .player[data-position='0'] .judges>.card:not(.selectable)>.image, #arena.selecting:not(.video) .player[data-position='0'] .judges>.card:not(.selectable)>.background { diff --git a/layout/mode/boss.css b/layout/mode/boss.css index b08a58a6f..fdd428672 100644 --- a/layout/mode/boss.css +++ b/layout/mode/boss.css @@ -39,6 +39,15 @@ width:20px; position:relative; } +#window:not(.nopointer) #bosslist>.player{ + cursor: pointer; +} +.dialog.bosscharacter .buttons .button.selectable{ + cursor: pointer; +} +.dialog.bosscharacter .buttons .button:not(.selectable){ + opacity: 0.6 +} .player.bossplayer.bossing{ position:absolute; diff --git a/layout/mode/chess.css b/layout/mode/chess.css index 2f982e89c..31d59223d 100644 --- a/layout/mode/chess.css +++ b/layout/mode/chess.css @@ -24,6 +24,9 @@ left: 0; background-size: cover; } +#window:not(.nopointer) .dialog.fullheight .buttons .button.character:not(.squarebutton):not(.selectable){ + cursor: default; +} #chess-container{ width:100%; height :calc(100% - 120px); diff --git a/mode/guozhan.js b/mode/guozhan.js index 137c9cceb..e9b65075b 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -412,6 +412,7 @@ mode.guozhan={ var addSetting=function(dialog){ dialog.add('选择座位'); var seats=document.createElement('table'); + seats.classList.add('pointertable'); seats.style.margin='0 auto'; seats.style.maxWidth=(60*parseInt(get.config('player_number')))+'px'; var tr=document.createElement('tr'); @@ -422,7 +423,7 @@ mode.guozhan={ td.style.width='40px'; td.style.fontSize='25px'; td.style.fontFamily='xinwei'; - td.innerHTML=get.cnNumber(i,true); + td.innerHTML=''+get.cnNumber(i,true)+''; td.link=i-1; td.addEventListener(lib.config.touchscreen?'touchend':'click',function(){ if(_status.dragged) return; diff --git a/mode/identity.js b/mode/identity.js index 51d29e4fc..be3080f6f 100644 --- a/mode/identity.js +++ b/mode/identity.js @@ -609,6 +609,7 @@ mode.identity={ var table=document.createElement('table'); table.style.margin='0 auto'; table.style.maxWidth='400px'; + table.classList.add('pointertable'); var tr=document.createElement('tr'); table.appendChild(tr); var listi; @@ -628,7 +629,7 @@ mode.identity={ if(td.link===game.me.identity){ td.classList.add('thundertext'); } - td.innerHTML=get.translation(listi[i]+'2'); + td.innerHTML=''+get.translation(listi[i]+'2')+''; td.addEventListener(lib.config.touchscreen?'touchend':'click',function(){ if(_status.dragged) return; if(_status.justdragged) return; @@ -702,6 +703,7 @@ mode.identity={ dialog.add('选择座位'); var seats=document.createElement('table'); + seats.classList.add('pointertable'); seats.style.margin='0 auto'; seats.style.maxWidth=(60*get.playerNumber()-1)+'px'; var tr=document.createElement('tr'); @@ -712,7 +714,7 @@ mode.identity={ td.style.width='40px'; td.style.fontSize='25px'; td.style.fontFamily='xinwei'; - td.innerHTML=get.cnNumber(i,true); + td.innerHTML=''+get.cnNumber(i,true)+''; td.link=i-1; if(get.distance(game.zhu,game.me,'absolute')===i-1){ td.classList.add('thundertext'); diff --git a/mode/versus.js b/mode/versus.js index 3413406d9..e84ea14af 100644 --- a/mode/versus.js +++ b/mode/versus.js @@ -695,6 +695,7 @@ mode.versus={ var addSetting=function(dialog){ dialog.add('选择座位'); var seats=document.createElement('table'); + seats.classList.add('pointertable'); seats.style.margin='0 auto'; seats.style.width='200px'; var tr=document.createElement('tr'); @@ -705,7 +706,7 @@ mode.versus={ td.style.width='40px'; td.style.fontSize='25px'; td.style.fontFamily='xinwei'; - td.innerHTML=get.cnNumber(i,true); + td.innerHTML=''+get.cnNumber(i,true)+''; td.link=i-1; if(get.distance(_status.firstAct,game.me,'absolute')===i-1){ td.classList.add('thundertext');