private void LobbyClientOnDataReceviedCaller(object sender, DataRecType type, object data) { // Dispatcher.Invoke(new Action(() => this.LobbyClientOnOnDataReceived(sender, type, data))); //} //private void LobbyClientOnOnDataReceived(object sender, DataRecType type, object data) //{ try { if (type == DataRecType.HostedGameReady) { var port = data as Int32?; if (port == null) { throw new Exception("Could not start game."); } var game = this.Game; Program.LobbyClient.CurrentHostedGamePort = (int)port; Program.GameSettings.UseTwoSidedTable = true; Program.Game = new Game(GameDef.FromO8G(game.FullPath), Program.LobbyClient.Me.UserName); Program.IsHost = true; var hostAddress = Dns.GetHostAddresses(Program.GameServerPath).First(); Program.Client = new Client(hostAddress, (int)port); Program.Client.Connect(); SuccessfulHost = true; } } catch (Exception e) { Debug.WriteLine(e.Message); Debug.WriteLine(e.StackTrace); } }
void LobbyClient_OnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.GameList || type == DataRecType.GamesNeedRefresh) { //RefreshGameList(null,null); } }
void LobbyClient_OnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.GameInvite) { if (Program.IsGameRunning) { return; } var idata = data as InviteToGame; Task.Factory.StartNew(() => { var hostedgame = new ApiClient().GetGameList().FirstOrDefault(x => x.Id == idata.SessionId); var endTime = DateTime.Now.AddSeconds(15); while (hostedgame == null && DateTime.Now < endTime) { hostedgame = new ApiClient().GetGameList().FirstOrDefault(x => x.Id == idata.SessionId); } if (hostedgame == null) { Log.WarnFormat( "Tried to read game invite from {0}, but there was no matching running game", idata.From.UserName); return; } var game = GameManager.Get().GetById(hostedgame.GameId); if (game == null) { throw new UserMessageException("Game is not installed."); } WindowManager.GrowlWindow.AddNotification(new GameInviteNotification(idata, hostedgame, game)); }); } }
private void LobbyClientOnOnDataRecieved(object sender, DataRecType type, object data) { if (type == DataRecType.FriendList) { RefreshList(); } }
private void LobbyClientOnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.FriendList) { //this.InvokeFriendList(); } }
private void LobbyClientOnDataReceviedCaller(object sender, DataRecType type, object data) { try { if (type == DataRecType.HostedGameReady) { var gameData = data as HostedGameData; if (gameData == null) { throw new Exception("Could not start game."); } var game = this.Game; Program.LobbyClient.CurrentHostedGamePort = (int)gameData.Port; //Program.GameSettings.UseTwoSidedTable = true; Program.GameEngine = new GameEngine(game, Program.LobbyClient.Me.UserName, false, this.Password); Program.IsHost = true; Program.IsMatchmaking = false; var hostAddress = Dns.GetHostAddresses(AppConfig.GameServerPath).First(); // Should use gameData.IpAddress sometime. Program.Client = new ClientSocket(hostAddress, (int)gameData.Port); Program.Client.Connect(); SuccessfulHost = true; } } catch (Exception e) { Debug.WriteLine(e.Message); Debug.WriteLine(e.StackTrace); } }
void LobbyClient_OnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.GameList || type == DataRecType.GamesNeedRefresh) { Log.Info("Games List Received"); RefreshGameList(); } }
void LobbyClient_OnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.GameList || type == DataRecType.GamesNeedRefresh) { RefreshGameList(); IsRefreshingGameList = false; } }
private void LobbyClientOnOnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.UserSubChanged) { needsRefresh = true; //InvokeResetUserList(); } }
void LobbyClient_OnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.GameList || type == DataRecType.GamesNeedRefresh) { Trace.WriteLine("Games Received"); RefreshGameList(); waitingForGames = false; } }
private void LobbyClientOnOnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.UserSubChanged) { var d = data as User; if (d == null) { return; } if (d.Equals(_user)) { OnPropertyChanged("IsSub"); } } }
void lobbyClient_OnDataRecieved(DataRecType type, object e) { if (type == DataRecType.ServerMessage) { string m = e as string; if (m != null && !String.IsNullOrWhiteSpace(m)) { MessageBox.Show(m,"Server Message",MessageBoxButton.OK,MessageBoxImage.Information); } } }
private void LobbyClientOnDataReceviedCaller(object sender, DataRecType type, object data) { // Dispatcher.Invoke(new Action(() => this.LobbyClientOnOnDataReceived(sender, type, data))); //} //private void LobbyClientOnOnDataReceived(object sender, DataRecType type, object data) //{ try { if (type == DataRecType.HostedGameReady) { var port = data as Int32?; if (port == null) throw new Exception("Could not start game."); var game = this.Game; Program.LobbyClient.CurrentHostedGamePort = (int)port; Program.GameSettings.UseTwoSidedTable = true; Program.GameEngine = new GameEngine(game,Program.LobbyClient.Me.UserName); Program.IsHost = true; var hostAddress = Dns.GetHostAddresses(AppConfig.GameServerPath).First(); Program.Client = new Client(hostAddress, (int)port); Program.Client.Connect(); SuccessfulHost = true; } } catch (Exception e) { Debug.WriteLine(e.Message); Debug.WriteLine(e.StackTrace); } }
private void LobbyClientOnOnDataRecieved(object sender ,DataRecType type , object data) { if(type ==DataRecType.GameList) ReloadGameList(); else if (type ==DataRecType.GamesNeedRefresh) { Dispatcher.Invoke(new Action(() => { bRefreshing.Visibility = Visibility.Visible; Program.LobbyClient.BeginGetGameList(); })); } }
void LobbyClient_OnDataReceived(object sender, DataRecType type, object data) { if (type == DataRecType.GameInvite) { if (Program.IsGameRunning) return; var idata = data as InviteToGame; Task.Factory.StartNew(() => { var hostedgame = new ApiClient().GetGameList().FirstOrDefault(x => x.Id == idata.SessionId); var endTime = DateTime.Now.AddSeconds(15); while (hostedgame == null && DateTime.Now < endTime) { hostedgame = new ApiClient().GetGameList().FirstOrDefault(x => x.Id == idata.SessionId); } if (hostedgame == null) { Log.WarnFormat( "Tried to read game invite from {0}, but there was no matching running game", idata.From.UserName); return; } var game = GameManager.Get().GetById(hostedgame.GameId); if (game == null) { throw new UserMessageException("Game is not installed."); } WindowManager.GrowlWindow.AddNotification(new GameInviteNotification(idata, hostedgame, game)); }); } }
private void LobbyClientOnDataReceviedCaller(object sender, DataRecType type, object data) { try { if (type == DataRecType.HostedGameReady) { var gameData = data as HostedGameData; if (gameData == null) throw new Exception("Could not start game."); var game = this.Game; Program.LobbyClient.CurrentHostedGamePort = (int)gameData.Port; //Program.GameSettings.UseTwoSidedTable = true; Program.GameEngine = new GameEngine(game,Program.LobbyClient.Me.UserName,false,this.Password); Program.IsHost = true; Program.IsMatchmaking = false; var hostAddress = Dns.GetHostAddresses(AppConfig.GameServerPath).First(); // Should use gameData.IpAddress sometime. Program.Client = new ClientSocket(hostAddress, (int)gameData.Port); Program.Client.Connect(); SuccessfulHost = true; } } catch (Exception e) { Debug.WriteLine(e.Message); Debug.WriteLine(e.StackTrace); } }
private void lobbyClient_OnDataRecieved(DataRecType type, object e) { if(type == DataRecType.FriendList) { RefreshList(); } }