From 44d95a70b7f1c516b18caf144d1b284549f2a6c1 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:10:17 -0700 Subject: [PATCH] Optimize game.asyncDraw. (cherry picked from commit 5bec139ebd9a42cff403d0c48f6f67c7772d07ba) --- game/game.js | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/game/game.js b/game/game.js index 4569b937b..a28acab4c 100644 --- a/game/game.js +++ b/game/game.js @@ -37431,27 +37431,15 @@ _status.pileTop=top; },game.roundNumber,ui.cardPile.childNodes.length,ui.cardPile.firstChild); }, - asyncDraw:function(players,num,drawDeck,bottom){ - for(var i=0;iplayers.forEach((value,index)=>{ + let num2=1; + if(typeof num=='number') num2=num; + else if(Array.isArray(num)) num2=num[index]; + else if(typeof num=='function') num2=num(value); + if(drawDeck&&drawDeck.drawDeck) value.draw(num2,false,drawDeck); + else if(bottom) value.draw(num2,'nodelay','bottom'); + else value.draw(num2,'nodelay'); + }), asyncDrawAuto:function(players,num,drawDeck){ if(players.length>1){ game.asyncDraw.apply(this,arguments);