|
628 | 628 | local function SortPlayers(a, b) |
629 | 629 | local sA = battleLobby:GetUserBattleStatus(a.name) |
630 | 630 | local sB = battleLobby:GetUserBattleStatus(b.name) |
631 | | - --Spring.Echo("battleLobbybattleLobby", sA, (sA and sA.joinTime), (sB and sB.joinTime)) |
632 | | - local joinA = (sA and sA.joinTime) or "" |
633 | | - local joinB = (sB and sB.joinTime) or "" |
| 631 | + --Spring.Echo("battleLobbybattleLobby", sA, (sA and sA.queueOrder), (sB and sB.queueOrder)) |
| 632 | + local joinA = (sA and sA.queueOrder) or 0 |
| 633 | + local joinB = (sB and sB.queueOrder) or 0 |
634 | 634 | return joinA < joinB |
635 | 635 | end |
636 | 636 |
|
@@ -825,7 +825,11 @@ local function SetupPlayerPanel(playerParent, spectatorParent, battle, battleID) |
825 | 825 |
|
826 | 826 | local function UpdatePlayerPositions() |
827 | 827 | local maxPlayers = (battleLobby:GetBattle(battleID) and battleLobby:GetBattle(battleID).maxPlayers) or 300 |
| 828 | + local maxEvenPlayers = (battleLobby:GetBattle(battleID) and battleLobby:GetBattle(battleID).maxEvenPlayers) or 0 |
828 | 829 | table.sort(teamStack.children, SortPlayers) |
| 830 | + if (#teamStack.children)%2 == 1 and #teamStack.children < maxEvenPlayers then |
| 831 | + maxPlayers = #teamStack.children - 1 |
| 832 | + end |
829 | 833 | local position = 0 |
830 | 834 | local waitingListPosition = false |
831 | 835 | for i = 1, #teamStack.children do |
@@ -1006,6 +1010,10 @@ local function SetupPlayerPanel(playerParent, spectatorParent, battle, battleID) |
1006 | 1010 | PositionChildren(parentStack, parentScroll.height) |
1007 | 1011 | end |
1008 | 1012 |
|
| 1013 | + function teamData.UpdateMaxPlayers() |
| 1014 | + UpdatePlayerPositions() |
| 1015 | + end |
| 1016 | + |
1009 | 1017 | team[teamIndex] = teamData |
1010 | 1018 | end |
1011 | 1019 | return team[teamIndex] |
@@ -1088,6 +1096,12 @@ local function SetupPlayerPanel(playerParent, spectatorParent, battle, battleID) |
1088 | 1096 | RemovePlayerFromTeam(botName) |
1089 | 1097 | end |
1090 | 1098 |
|
| 1099 | + function externalFunctions.UpdateMaxPlayers() |
| 1100 | + for teamIndex, teamData in pairs(team) do |
| 1101 | + teamData.UpdateMaxPlayers() |
| 1102 | + end |
| 1103 | + end |
| 1104 | + |
1091 | 1105 | return externalFunctions |
1092 | 1106 | end |
1093 | 1107 |
|
@@ -1947,6 +1961,9 @@ local function InitializeControls(battleID, oldLobby, topPoportion, setupData) |
1947 | 1961 | end |
1948 | 1962 |
|
1949 | 1963 | infoHandler.UpdateBattleInfo(updatedBattleID, newInfo) |
| 1964 | + if newInfo.maxPlayers or newInfo.maxEvenPlayers then |
| 1965 | + playerHandler.UpdateMaxPlayers() |
| 1966 | + end |
1950 | 1967 | end |
1951 | 1968 |
|
1952 | 1969 | local function OnLeftBattle(listener, leftBattleID, userName) |
|
0 commit comments