private void InitCard(CardsDuel cardDuel) { for (int i = 0; i < cardDuel.cards.Count; i++) { cardDuel.cards[i].hasAttacked = false; cardDuel.cards[i].hasBeenChosen = false; } }
private void InitDuelCard(Game duelGame) { CardsDuel cardDuel1 = duelGame.cardDuel1; CardsDuel cardDuel2 = duelGame.cardDuel2; InitCard(cardDuel1); InitCard(cardDuel2); }
private void DuelButton2_Click(object sender, EventArgs e) { if (gameHasStarted == true) { Button button = (Button)sender; CardsDuel theCardDuel = duelGame.cardDuel2; if (duelGame.speakPlayer == 2) { ChooseTheFirstCard(theCardDuel, button); } else if (duelGame.speakPlayer == 1 && Game.recentDuelCardAttack != null) { ChooseTheSecondCard(theCardDuel, button); } } }
private void ChooseTheSecondCard(CardsDuel theCardDuel, Button button) { int cardIndex = Convert.ToInt32(button.Tag); if (cardIndex < theCardDuel.cards.Count) { Card beforeChosenCard = Game.recentDuelCardAttacked; if (beforeChosenCard != null && beforeChosenCard.hasBeenChosen == true) { InitBeforeButton(beforeChosenToAttackedButton); } Game.recentDuelCardAttacked = theCardDuel.cards[cardIndex]; Game.recentDuelCardAttacked.hasBeenChosen = true; button.Text = "已被选中"; beforeChosenToAttackedButton = button; } }
private void InitializeGame() { GameStatus.SetStatusInfo("游戏已经开始"); player1Life = 4000; player2Life = 4000; cardFactory1 = new CardsFactory("C:\\Users\\yuwei\\Desktop\\编程文件\\c++&c#\\duel\\duel\\duelInfo.txt", 1); cardFactory2 = new CardsFactory("C:\\Users\\yuwei\\Desktop\\编程文件\\c++&c#\\duel\\duel\\duelInfo.txt", 2); cardManager1 = new CardsManager(1); cardManager2 = new CardsManager(2); cardDuel1 = new CardsDuel(1); cardDuel2 = new CardsDuel(2); cardFactory1.ShowCardsAmount(); cardFactory2.ShowCardsAmount(); InitStart(); speakPlayer = 1; timesAmount = 1; }