//Confirming of putting card on the table private void BattleWindow_ConfirmButtonClick(object sender, ConfirmPutBattleCardOnTheTableEventArgs e) { //demanding options demandedRankRequest = e.DemandedRank; demandedSuitRequest = e.DemandedSuit; if (MatchingCardInBattleMode.CompareTo(new PlayingCard(e.NewSuit, e.NewRank, MatchingCardInBattleMode.DeckNumber)) == 0) { SendMovementDataToHost(GeneratePerformingAMoveRequestData(true, new List <PlayingCard>() { MatchingCardInBattleMode }, false)); } else { losingBattleCardAutoResponse = true; autoresponseCard = new PlayingCard(MatchingCardInBattleMode.Suit, MatchingCardInBattleMode.Rank, MatchingCardInBattleMode.DeckNumber); autoresponseCard.ChangeCardFromJocker(e.NewSuit, e.NewRank); EngineHostDataOperator Operator = new EngineHostDataOperator(); Operator.ResponseArrived += Operator_ResponseArrived; Operator.ChangeJokerIntoAnotherCard(GenerateJokerChangeRequest( MatchingCardInBattleMode, e.NewRank, e.NewSuit), ThisPlayerControl, SynchCont); } }
//method which starts sending the data about move private void SendMovementDataToHost(MakeAMoveRequest request) { EngineHostDataOperator Operator = new EngineHostDataOperator(); Operator.MakeAMove(request, SynchCont); ResetUIAfterMakingMoveOrCancelingMove(); }
//cclosing joker window event handler private void JokerWindow_OKButtonClick(object sender, MakaoGraphicsRepresentation.JokerWindowEventArgs e) { if (e.CardSuit != CardSuits.None && e.CardRank != CardRanks.None) { EngineHostDataOperator Operator = new EngineHostDataOperator(); Operator.ChangeJokerIntoAnotherCard(GenerateJokerChangeRequest(currentCard, e.CardRank, e.CardSuit), ThisPlayerControl, SynchCont); } }
//changing card from joker into another or backwards private void ThisPlayerControl_CardJokerClick(object sender, MainUserEventArgs e) { currentCard = e.PlayingCard; if (e.PlayingCard.Rank == CardRanks.Joker && e.WasMadeByJoker == false) { Windows.JokerChange JokerWindow = new Windows.JokerChange() { Owner = this }; JokerWindow.JokerWindowClosing += JokerWindow_OKButtonClick; JokerWindow.ShowDialog(); MemoryManagement.FlushMemory(); } else if (e.WasMadeByJoker == true) { EngineHostDataOperator Operator = new EngineHostDataOperator(); Operator.ChangeJokerBackFromAnotherCard(GenerateJokerChangeBackRequest(e.PlayingCard), ThisPlayerControl, SynchCont); } }