void mw_Closed(object sender, EventArgs e) { MessageWindow m = sender as MessageWindow; if (GameFolder.GameData.opponent.Name != string.Empty) { if (m.DialogResult == true) { MainData.BmClient.StartGameAsync(MainData.UserName, GameFolder.GameData.opponent.Name); GameFolder.Game g = (GameFolder.Game)(this.MyParent).FindName("game1"); MainData.BmClient.RemovableWallAddAsync(GameFolder.GameData.GetRemovableWalls(), GameFolder.GameData.opponent.Name); //falak berajzolása g.RemovableWallsDraw(GameFolder.GameData.RemovableWalls); g.Start((short)GameFolder.Enums.PlayerControlledCharacterEnum.player2); } else { GameFolder.GameData.GameStatus = (short)GameFolder.Enums.GameStatusEnum.idle; GameFolder.GameData.opponent.Name = string.Empty; } } else { GameFolder.GameData.GameStatus = (short)GameFolder.Enums.GameStatusEnum.idle; GameFolder.GameData.opponent.Name = string.Empty; } }
void BmClient_StartGameGetReceived(object sender, StartGameGetReceivedEventArgs e) { if (mw != null) { mw.DialogResult = true; mw.Close(); } GameFolder.GameData.opponent.Name = e.name; GameFolder.Game g = (GameFolder.Game)(this.MyParent).FindName("game1"); g.Start((short)GameFolder.Enums.PlayerControlledCharacterEnum.player1); }