Skip to content

Commit

Permalink
fix: 🐛 fix server playerNum constantly=10 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Grange007 committed Mar 29, 2024
1 parent 632dd5f commit 8a6a90d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions logic/Server/RpcServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,18 @@ public override async Task AddPlayer(PlayerMsg request, IServerStreamWriter<Mess
{
if (semaDict0.TryAdd(request.PlayerId, temp))
{
start = Interlocked.Increment(ref playerCountNow) == (playerNum * 2);
start = Interlocked.Increment(ref playerCountNow) == (playerNum * TeamCount);
Console.WriteLine($"PlayerCountNow: {playerCountNow}");
Console.WriteLine($"PlayerNum: {playerNum * 2}");
Console.WriteLine($"PlayerNum: {playerNum * TeamCount}");
}
}
else if (request.TeamId == 1)
{
if (semaDict1.TryAdd(request.PlayerId, temp))
{
start = Interlocked.Increment(ref playerCountNow) == (playerNum * 2);
start = Interlocked.Increment(ref playerCountNow) == (playerNum * TeamCount);
Console.WriteLine($"PlayerCountNow: {playerCountNow}");
Console.WriteLine($"PlayerNum: {playerNum * 2}");
Console.WriteLine($"PlayerNum: {playerNum * TeamCount}");
}
}
}
Expand Down

0 comments on commit 8a6a90d

Please sign in to comment.