Skip to content

Commit

Permalink
fix support for Unity 2020. #215
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Jun 24, 2023
1 parent 355cce5 commit fe93f83
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Assets/Colyseus/Runtime/Colyseus/Models/ColyseusClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ public async Task<ColyseusRoom<T>> ConsumeSeatReservation<T>(ColyseusMatchMakeRe

ColyseusRoom<T> targetRoom = previousRoom ?? room;

async void DevModeCloseCallback()
Action devModeCloseCallback = async () =>
{
Debug.Log($"<color=yellow>[Colyseus devMode]:</color> Re-establishing connection with room id {targetRoom.RoomId}");
int devModeRetryAttempt = 0;
Expand Down Expand Up @@ -337,10 +337,15 @@ async Task retryConnection()
await Task.Delay(2000);
await retryConnection();
}
};

targetRoom.SetConnection(CreateConnection(response.room, queryString, headers), targetRoom, response.devMode? DevModeCloseCallback
: null);
targetRoom.SetConnection(
CreateConnection(response.room, queryString, headers),
targetRoom,
(response.devMode)
? devModeCloseCallback
: null
);

TaskCompletionSource<ColyseusRoom<T>> tcs = new TaskCompletionSource<ColyseusRoom<T>>();

Expand Down Expand Up @@ -458,3 +463,4 @@ protected ColyseusConnection CreateConnection(ColyseusRoomAvailable room, Dictio
}
}
}

0 comments on commit fe93f83

Please sign in to comment.