/// <summary> /// Get the lobby server. /// </summary> /// <param name="secure">If set to <c>true</c> secure.</param> /// <param name="lobbyLoaded">after lobby loaded.</param> public void GetLobbyServer(bool secure = true, Action <PlayGameServer> lobbyLoaded = null) { var lobbyGetCmd = new PlayCommand() { RelativeUrl = "/router", UrlParameters = new Dictionary <string, object>() { { "appId", AVClient.CurrentConfiguration.ApplicationId }, { "secure", secure } }, }; Play.RunHttpCommand(lobbyGetCmd, done: (request, response) => { var gameServer = Play.GameServer = PlayGameServer.FetchFromPublicCloud(response); if (lobbyLoaded != null) { lobbyLoaded(gameServer); } }); }
internal static void DoConnectToGameSever(PlayGameServer server, Action connected) { if (string.IsNullOrEmpty(server.Url)) { LogError("can NOT connect Room withouth remote addresss"); return; } RoomConnection.Open(server.Url); Log(string.Format("try to connect with server address:{0}", server.Url)); Action onOpened = null; onOpened = () => { Log(string.Format("connected with server address:{0}", server.Url)); RoomConnection.OnOpened -= onOpened; if (connected != null) { connected(); } }; RoomConnection.OnOpened += onOpened; }