public void SendLeaveCommand() { NetCommandPackage Leave = new NetCommandPackage(); Leave.Command = ConfigurationManager.AppSettings["LeaveGameCommand"]; SendMessage(Leave); }
public void SendEndTurnCommand() { NetCommandPackage TurnEnd = new NetCommandPackage(); TurnEnd.Command = ConfigurationManager.AppSettings["TurnEndGameCommand"]; SendMessage(TurnEnd); }
public void SendPassedCommand() { NetCommandPackage Passed = new NetCommandPackage(); Passed.Command = ConfigurationManager.AppSettings["PassedGameCommand"]; SendMessage(Passed); }
private void SendGoodCommand() { NetCommandPackage GoodPkg = new NetCommandPackage(); GoodPkg.Command = ConfigurationManager.AppSettings["IsGood"]; SendMessage(GoodPkg); }
public void SendSyncCommand() { NetCommandPackage Sync = new NetCommandPackage(); Sync.Command = ConfigurationManager.AppSettings["SyncGameCommand"]; Sync.InDeckCardCount = battlegnd.InStackCards.Count; Sync.Scope = battlegnd.UserCardsPower; Sync.InHandCardCount = battlegnd.InHandCards.Count; SendMessage(Sync); }
private void ProcessCommand(Package pkg, ICommandable Command) { if (Command.Command == ConfigurationManager.AppSettings["StartGameCommand"]) { NetCommandPackage SyncPackage = new NetCommandPackage(); SyncPackage.Command = ConfigurationManager.AppSettings["SyncGameCommand"]; SyncPackage.InDeckCardCount = battlegnd.InStackCards.Count; SyncPackage.InHandCardCount = battlegnd.InHandCards.Count; SyncPackage.Scope = battlegnd.UserCardsPower; SendMessage(SyncPackage); } else if (Command.Command == ConfigurationManager.AppSettings["SyncGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { battlegnd.Sync(Convert.ToString(pkg.Scope), Convert.ToString(pkg.InDeckCardCount), Convert.ToString(pkg.InHandCardCount)); }); SendGoodCommand(); } else if (Command.Command == ConfigurationManager.AppSettings["TurnWaitGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { battlegnd.ShowNotMessage("Ходит ваш опонент, подождите"); battlegnd.IsUserTurn = false; }); SendGoodCommand(); } else if (Command.Command == ConfigurationManager.AppSettings["StartTurnGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { battlegnd.ShowNotMessage("Ваш ход"); battlegnd.IsUserTurn = true; }); SendGoodCommand(); } else if (Command.Command == ConfigurationManager.AppSettings["ConnectionLost"]) { battlegnd.Control.Dispatcher.Invoke(() => { MessageBox.Show("Потеряно соединение с другим пользователем, перенаправление в меню...", "Сообщение", MessageBoxButton.OK, MessageBoxImage.Exclamation); battlegnd.EndBattle(); }); } else if (Command.Command == ConfigurationManager.AppSettings["LeaveGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { MessageBox.Show("Ваш противник вышел из игры, перенаправление в меню...", "Сообщение", MessageBoxButton.OK, MessageBoxImage.Exclamation); battlegnd.EndBattle(); }); } else if (Command.Command == ConfigurationManager.AppSettings["PassedGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { battlegnd.Passed(); }); SendGoodCommand(); } else if (Command.Command == ConfigurationManager.AppSettings["LostRoundCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { battlegnd.ShowNotMessage("Вы проиграли раунд"); battlegnd.EndRound(); }); SendGoodCommand(); } else if (Command.Command == ConfigurationManager.AppSettings["WinRoundCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { battlegnd.ShowNotMessage("Вы выиграли раунд"); battlegnd.EndRound(); }); SendGoodCommand(); } else if (Command.Command == ConfigurationManager.AppSettings["LostGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { MessageBox.Show("Вы проиграли игру, перенаправление в меню...", "Сообщение", MessageBoxButton.OK, MessageBoxImage.Exclamation); battlegnd.EndBattle(); }); } else if (Command.Command == ConfigurationManager.AppSettings["WinGameCommand"]) { battlegnd.Control.Dispatcher.Invoke(() => { MessageBox.Show("Вы выиграли игру, перенаправление в меню...", "Сообщение", MessageBoxButton.OK, MessageBoxImage.Exclamation); battlegnd.EndBattle(); }); } }