修复updatePlayerPositions的注释

This commit is contained in:
lieren2023 2023-10-30 22:33:39 +08:00 committed by GitHub
parent d6fa809ef6
commit 5d2d3877be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -58146,13 +58146,13 @@
*/ */
updatePlayerPositions:numberOfPlayers=>{ updatePlayerPositions:numberOfPlayers=>{
if(typeof numberOfPlayers!='number') numberOfPlayers=ui.arena.dataset.number; if(typeof numberOfPlayers!='number') numberOfPlayers=ui.arena.dataset.number;
//当人数小于8时还是用以前的布局。 //当人数不超过8人时还是用以前的布局
if(!numberOfPlayers||numberOfPlayers<9) return; if(!numberOfPlayers||numberOfPlayers<=8) return;
const playerPositions=ui.playerPositions; const playerPositions=ui.playerPositions;
while(playerPositions.length){ while(playerPositions.length){
playerPositions.pop().remove(); playerPositions.pop().remove();
} }
//单个人物的宽度这里要设置玩家的实际的宽度 //单个人物的宽度这里要设置玩家的实际的宽度
const temporaryPlayer=ui.create.div('.player',ui.arena).hide(); const temporaryPlayer=ui.create.div('.player',ui.arena).hide();
const computedStyle=getComputedStyle(temporaryPlayer); const computedStyle=getComputedStyle(temporaryPlayer);
const scale=6/numberOfPlayers; const scale=6/numberOfPlayers;
@ -58163,10 +58163,10 @@
//列数即假如8人场除去自己后上面7个人占7列 //列数即假如8人场除去自己后上面7个人占7列
const columnCount=numberOfPlayers-1; const columnCount=numberOfPlayers-1;
const percentage=90/(columnCount-1); const percentage=90/(columnCount-1);
//仅当游戏人数大于8人且玩家的座位号大于0时设置玩家的位置因为0号位是game.me在最下方无需设置 //仅当游戏人数大于8人且玩家的座位号大于0时设置玩家的位置因为0号位是game.me在最下方无需设置
for(let ordinal=1;ordinal<numberOfPlayers;ordinal++){ for(let ordinal=1;ordinal<numberOfPlayers;ordinal++){
const reversedOrdinal=columnCount-ordinal; const reversedOrdinal=columnCount-ordinal;
//动态计算玩家的top属性实现拱桥的效果只让两边的各两个人向下偏移一些 //动态计算玩家的top属性实现拱桥的效果只让两边的各两个人向下偏移一些
const top=Math.max(0,Math.round(numberOfPlayers/5)-Math.min(Math.abs(ordinal-1),Math.abs(reversedOrdinal)))*quarterHeight; const top=Math.max(0,Math.round(numberOfPlayers/5)-Math.min(Math.abs(ordinal-1),Math.abs(reversedOrdinal)))*quarterHeight;
playerPositions.push(lib.init.sheet([ playerPositions.push(lib.init.sheet([
`#arena[data-number='${numberOfPlayers}']>.player[data-position='${ordinal}']{`, `#arena[data-number='${numberOfPlayers}']>.player[data-position='${ordinal}']{`,