public override int CompareToOffsuitHand(OffsuitHandBase other) { var otherHighCard = other as HighCard; if (otherHighCard == null) { return(HandRank.CompareTo(other.HandRank)); } if (Card1 != otherHighCard.Card1) { return(Card1.CompareTo(otherHighCard.Card1)); } if (Card2 != otherHighCard.Card2) { return(Card2.CompareTo(otherHighCard.Card2)); } if (Card3 != otherHighCard.Card3) { return(Card3.CompareTo(otherHighCard.Card3)); } if (Card4 != otherHighCard.Card4) { return(Card4.CompareTo(otherHighCard.Card4)); } return(Card5.CompareTo(otherHighCard.Card5)); }
public ActionResult Index(Card1 model, FormCollection form) { try { ViewBag.Packages = new SelectList(entity.Packages.Where(models => models.Active == true), "PackagesId", "PackageName"); string statusDDLValue = form["Statusddl"].ToString(); string packageDDLValue = form["PackagesId"].ToString(); if (ModelState.IsValid) { using (var context = new LoyaltyManagementSystemEntities()) { var addCard = new LMS_Datas.Card1() { CardName = model.CardName, persons = model.persons, discountPer = model.discountPer, ValidFrom = model.ValidFrom, ValidTo = model.ValidTo, Activate = Boolean.Parse(statusDDLValue), PackagesId = Convert.ToInt32(packageDDLValue) }; context.Card1.Add(addCard); context.SaveChanges(); ViewBag.alert = "Success"; } } return(View()); } catch (Exception e1) { ViewBag.alert = "Error"; return(View()); } }
/**************************************************************************************** * Method: ShuffleButton_Click() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: disable shuffle button, for loop to choose new cards, while loop to * ensure no two cards chosen are the same, displays cards to the screen. * Input(s)/Output(s): No inputs, outputs new cards to the screen. * *************************************************************************************/ private void ShuffleButton_Click(object sender, RoutedEventArgs e) { // Disable the Shuffle Button so it cannot be clicked twice. ShuffleButton.IsEnabled = false; // Advise the user to choose a card WinText.Text = "Choose a card"; // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } // While loop to ensure no duplicate cards are chosen while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2]) { // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } } // Display the cards Card1.DisplayCard(Cards[0]); Card2.DisplayCard(Cards[1]); Card3.DisplayCard(Cards[2]); }
private void Start_Click(object sender, RoutedEventArgs e) { StatusMessage.Text = "Choose a card"; PickCard1.IsEnabled = true; PickCard2.IsEnabled = true; PickCard3.IsEnabled = true; Shuffle.IsEnabled = true; for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(2, 14); Cards[i] = CardValue; } while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2]) { for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(2, 14); Cards[i] = CardValue; } } Card1.DisplayCard(Cards[0]); Card2.DisplayCard(Cards[1]); Card3.DisplayCard(Cards[2]); }
public void MoveState(int index) { GameObject Card1; GameObject Card2; if (State == "Inicial") { baraja[index].GetComponent <Cardscript>().Toggle(); CardsUp[0] = index; State = "carta_descubierta"; } else if (State == "carta_descubierta" && CardsUp[0] != index) { baraja[index].GetComponent <Cardscript>().Toggle(); CardsUp[1] = index; Card1 = baraja[CardsUp[0]]; Card2 = baraja[CardsUp[1]]; if ((Card1.GetComponent <Cardscript>().Value) == (Card2.GetComponent <Cardscript>().Value)) { Debug.Log("Las cartas son pareja."); parejas++; Marcador.GetComponent <Text>().text = "Parejas " + parejas; //Desactivar las cartas baraja[CardsUp[0]].gameObject.SetActive(false); baraja[CardsUp[1]].gameObject.SetActive(false); State = "Inicial"; if (parejas == 5) { Marcador.GetComponent <Text>().text = "Fin del Juego"; } else { Marcador.GetComponent <Text>().text = "Parejas " + parejas; } } //NO ACIERTO else { //baraja[CardsUp[1]].GetComponent<Cardscript>().Toggle(); baraja[CardsUp[0]].GetComponent <Cardscript>().Toggle(); baraja[CardsUp[1]].GetComponent <Cardscript>().Toggle(); State = "Inicial"; //Dar la vuelta a las cartas. } } }
private void Card1_Loaded_1(object sender, RoutedEventArgs e) { PlayerCard.DisplayCard(game.PlayerCards[0]); Card1.DisplayCard(0); Card1.IsEnabled = false; Shuffle_Button.IsEnabled = false; game.SetPlayerCard(game.PlayerCards[0]); ComputerCard.DisplayCard(game.ComputerSelectedCard); }
public void OnDrawCard(int C) { //Add card to hand Card1 Draw = MapCard(C); myHand.Add((GameObject)Instantiate(Resources.Load(cardName[C]), player1.transform.position, Quaternion.identity)); myHand.Last().GetComponent <CardScript1> ().setCard(new Card1(Draw.value, Draw.suite)); myHand.Last().transform.SetParent(player1.transform); Debug.Log("Played and Draw " + C); }
public void ShuffleDeck() { for (int i = 0; i < _allCards.Length; i++) { int rand = Random.Range(0, _allCards.Length); Card1 temp = _allCards[rand]; _allCards[rand] = _allCards[i]; _allCards[i] = temp; } }
private Card1 MapCard(int CardNo) { int Suite = CardNo / 13; int Value = CardNo % 13; Card1.Value V = Card1.Value.ACE; Card1.Suite S = Card1.Suite.CLUBS; switch (Suite) { case 0: S = Card1.Suite.CLUBS; break; case 1: S = Card1.Suite.DIAMONDS; break; case 2: S = Card1.Suite.HEARTS; break; case 3: S = Card1.Suite.SPADES; break; default: break; } switch (Value) { case 1: V = Card1.Value.TWO; break; case 2: V = Card1.Value.THREE; break; case 3: V = Card1.Value.FOUR; break; case 4: V = Card1.Value.FIVE; break; case 5: V = Card1.Value.SIX; break; case 6: V = Card1.Value.SEVEN; break; case 7: V = Card1.Value.EIGHT; break; case 8: V = Card1.Value.NINE; break; case 9: V = Card1.Value.TEN; break; case 10: V = Card1.Value.JACK; break; case 11: V = Card1.Value.QUEEN; break; case 12: V = Card1.Value.KING; break; case 0: V = Card1.Value.ACE; break; default: break; } Card1 Out = new Card1(V, S); return(Out); }
// Use this for initialization void Start() { TextAsset cardData = Resources.Load <TextAsset>("cards"); string[] linesFromFile = cardData.text.Split('\n'); foreach (string line in linesFromFile) { data.Add(line); } for (int i = 0; i < data.Count - 3; i += 4) { // Debug.Log ("Data: " + data[i]); int x = int.Parse(data[i + 3]); // Debug.Log ("X: " + x); for (int j = 0; j < x; j++) { newCard = new Card1(); newCard.name = data[i]; newCard.desc = data[i + 1]; newCard.cost = int.Parse(data[i + 2]); deck.Add(newCard); // Debug.Log("Count: " + deck.Count); } } List <Card1> tempdeck = new List <Card1>(); for (int i = 0; i < deck.Count; i++) { tempdeck.Add(deck [i]); } for (int i = 0; i < deck.Count; i++) { int randomIndex = rd.Next(0, tempdeck.Count); shuffleddeck.Add(tempdeck [randomIndex]); tempdeck.Remove(tempdeck[randomIndex]); } foreach (Card1 card in shuffleddeck) { // Debug.Log("Card: " + card.name); } DrawHand(); }
private void DisplayCards() { Card1.DisplayCard(game.PlayerHand[0].CardName); Card2.DisplayCard(game.PlayerHand[1].CardName); Card3.DisplayCard(game.PlayerHand[2].CardName); upFaced.DisplayCard(game.upFacedCard.CardName); Card4.DisplayCard(game.ComputerHand[0].CardName); Card5.DisplayCard(game.ComputerHand[1].CardName); Card6.DisplayCard(game.ComputerHand[2].CardName); }
public static bool operator !=(Card Card1, Card Card2) { if (Card1.IsValid() && Card2.IsValid()) { if (Card1.Mask != Card2.Mask) { return(true); } } return(false); }
private void GenerateDeck() { for (int i = 0; i < _allCards.Length; i++) { int random1 = Random.Range(2, 5); _allCards[i] = new Card1(); _allCards[i].RecoverActions(random1, Random.Range(1, 5)); } CheckDeckLimit(); }
private void ShowCards() { Card1.DisplayCards(0); Card2.DisplayCards(1); Card3.DisplayCards(2); compCard1.DisplayCards(3); compCard2.DisplayCards(3); compCard3.DisplayCards(3); compCard1.IsEnabled = false; compCard2.IsEnabled = false; compCard3.IsEnabled = false; }
private void DisplayCards() { Card1.DisplayCard(game.PlayerHand[0].CardName); Card2.DisplayCard(game.PlayerHand[1].CardName); Card3.DisplayCard(game.PlayerHand[2].CardName); Card4.DisplayCard(game.PlayerHand[3].CardName); Card5.DisplayCard(game.PlayerHand[4].CardName); Card6.DisplayCard(game.PlayerHand[5].CardName); Card7.DisplayCard(game.PlayerHand[6].CardName); Card8.DisplayCard(game.PlayerHand[7].CardName); UpCard.DisplayCard(game.upFacedCard.CardName); BackCard.DisplayCard("DC"); }
public Card1 PickCard() { Card1 temp = _allCards[0]; for (int i = 1; i < _allCards.Length; i++) { _allCards[i - 1] = _allCards[i]; } _allCards[_allCards.Length - 1] = temp; return(temp); }
public void SaveDeck() { CalculTotal(); Deck d = new Deck(); d.InitDeck(); for (int i = 0; i < allCards.Length; i++) { Actions action = null; switch (allCards[i].GetCardType() - 1) { case 0: action = new Arrow(); break; case 1: action = new Magic(); break; case 2: action = new Sword(); break; case 3: action = new Move(); break; case 4: action = new Shield(); break; } action.InitAction(); action.SetCardAmount(allCards[i].GetStrength()); Card1 c = new Card1(); c.SetCard(action); d.AddCard(c, i); } if (lastCalcul < 100 && deckText.text != "") { FileReader.GetInstance().SaveDeck(deckText.text, d); } }
private int MapCard2(Card1 C) { int Out = 0; switch (C.suite) { case Card1.Suite.CLUBS: Out += 0; break; case Card1.Suite.DIAMONDS: Out += 13; break; case Card1.Suite.HEARTS: Out += 26; break; case Card1.Suite.SPADES: Out += 39; break; default: break; } switch (C.value) { case Card1.Value.ACE: Out += 0; break; case Card1.Value.TWO: Out += 1; break; case Card1.Value.THREE: Out += 2; break; case Card1.Value.FOUR: Out += 3; break; case Card1.Value.FIVE: Out += 4; break; case Card1.Value.SIX: Out += 5; break; case Card1.Value.SEVEN: Out += 6; break; case Card1.Value.EIGHT: Out += 7; break; case Card1.Value.NINE: Out += 8; break; case Card1.Value.TEN: Out += 9; break; case Card1.Value.JACK: Out += 10; break; case Card1.Value.QUEEN: Out += 11; break; case Card1.Value.KING: Out += 12; break; default: break; } return(Out); }
private void SetupGame() { Start.IsEnabled = true; PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; Card1.DisplayCard(1); Card2.DisplayCard(1); Card3.DisplayCard(1); PlayerCard.DisplayCard(1); CPUCard.DisplayCard(1); StatusMessage.Text = "Press Start!"; }
private void PickCard3_Click(object sender, RoutedEventArgs e) { PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; Shuffle.IsEnabled = false; PlayerCard.DisplayCard(Cards[2]); Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); int PlayerIndex = Cards[2]; GameRules(PlayerIndex); }
public void OnStartMatch(int matchID, int PlayerNo, int Card1, int Card2, int Card3, int Card4) { //Show Match ID Debug.Log("Match ID : " + matchID); //set Player No. _PlayerNo = PlayerNo; Debug.Log("Player No : " + PlayerNo); //set Hand[] Card1 A = MapCard(Card1); Card1 B = MapCard(Card2); Card1 C = MapCard(Card3); Card1 D = MapCard(Card4); //Show Card on screen myHand.Add((GameObject)Instantiate(Resources.Load(cardName[Card1]), player1.transform.position, Quaternion.identity)); myHand.Last().GetComponent <CardScript1> ().setCard(new Card1(A.value, A.suite)); myHand.Last().transform.SetParent(player1.transform); myHand.Add((GameObject)Instantiate(Resources.Load(cardName[Card2]), player1.transform.position, Quaternion.identity)); myHand.Last().GetComponent <CardScript1> ().setCard(new Card1(B.value, B.suite)); myHand.Last().transform.SetParent(player1.transform); myHand.Add((GameObject)Instantiate(Resources.Load(cardName[Card3]), player1.transform.position, Quaternion.identity)); myHand.Last().GetComponent <CardScript1> ().setCard(new Card1(C.value, C.suite)); myHand.Last().transform.SetParent(player1.transform); myHand.Add((GameObject)Instantiate(Resources.Load(cardName[Card4]), player1.transform.position, Quaternion.identity)); myHand.Last().GetComponent <CardScript1> ().setCard(new Card1(D.value, D.suite)); myHand.Last().transform.SetParent(player1.transform); Debug.Log("Card On Hand After Start:" + myHand.Count()); //Check Player No if (PlayerNo == 0) { //set Turn _isMyTurn = true; refreshButton(); //set play time playtime = Time.time; } if (_isMyTurn) { TurnText.text = "Ore no Turn!"; } else { TurnText.text = "Waiting Player " + (_NextTurn + 1); } }
public void OnHideShowCardsEventHandler() { if (HideToggleButtonText == "Hide") { Card1.SetVisible(false); Card2.SetVisible(false); HideToggleButtonText = "Show"; } else if (HideToggleButtonText == "Show") { Card1.SetVisible(true); Card2.SetVisible(true); HideToggleButtonText = "Hide"; } base.StateHasChanged(); }
/**************************************************************************************** * Method: SetupGame() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: This method enables/disables starting buttons, sets up the backs of the * cards, and tells the user to press the start button. * Input(s)/Output(s): No inputs, outputs a card picture and a message to the screen. * *************************************************************************************/ private void SetupGame() { // Ensure only the start game button is waiting to be pressed StartGameButton.IsEnabled = true; PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; ShuffleButton.IsEnabled = false; // Start the game seeing the backs of the cards Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); ChosenCard.DisplayCard(14); OpponentCard.DisplayCard(14); // Notify User to press Start Game Button WinText.Text = "Click The Start Game Button!"; PlayerScoreText.Text = $"Player Score: {PlayerScore}"; OpponentScoreText.Text = $"Opponent Score: {OpponentScore}"; }
/**************************************************************************************** * Method: Start_Click() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: Display the back of cards, enable buttons, for loop to pick new cards, * while loop to ensure no two cards picked were the same, output cards to the screen. * Input(s)/Output(s): No inputs, removes text message, enables buttons, outputs new * cards to the screen. * *************************************************************************************/ private void Start_Click(object sender, RoutedEventArgs e) { // Set the text of the start Game Button back to "Start Game" and clear the Card Value text Box StartGameButton.Content = "Start Game"; CardValueText.Text = "Card Value = "; // Start the game seeing the backs of the cards ChosenCard.DisplayCard(14); OpponentCard.DisplayCard(14); // Advise the user to choose a card WinText.Text = "Choose a card"; // Enable the game buttons PickCard1.IsEnabled = true; PickCard2.IsEnabled = true; PickCard3.IsEnabled = true; ShuffleButton.IsEnabled = true; // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } // While loop to ensure no duplicate cards are chosen while (Cards[0] == Cards[1] || Cards[0] == Cards[2] || Cards[1] == Cards[2]) { // For loop to choose the cards for (int i = 0; i < Cards.Length; i++) { int CardValue = RandomGenerator.Next(1, 14); Cards[i] = CardValue; } } // Display Cards Card1.DisplayCard(Cards[0]); Card2.DisplayCard(Cards[1]); Card3.DisplayCard(Cards[2]); }
public string EditCard(Card1 Model, FormCollection form) { string msgClient = null; string statusDDLValue = form["PackageName"].ToString(); Model.PackagesId = (from pack in entity.Packages where pack.PackageName == statusDDLValue select pack.PackagesId).FirstOrDefault(); if (Model.PackagesId != null) { try { if (ModelState.IsValid) { var enditedCardValue = new LMS_Datas.Card1 { Activate = true, CardName = Model.CardName, discountPer = Model.discountPer, ValidFrom = Model.ValidFrom, ValidTo = Model.ValidTo, PackagesId = Model.PackagesId }; entity.Card1.Attach(enditedCardValue); entity.SaveChanges(); } else { msgClient = "Validation data not successfully"; } } catch (Exception ex) { msgClient = "Error in Retriving Data"; } } else { msgClient = "Invalid Package Selected"; } return(msgClient); }
/**************************************************************************************** * Method: PickCard3Button_Click() * Programmer(s): Jayce Merinchuk, Upma Sharma * Date: August 09, 2018 * Description: Disables buttons, puts chosen card in box, changes 3 cards to display * the back of the card, runs the ApplyGameRules() method. * Input(s)/Output(s): Input - button is clicked, Output: Back of cards displayed, chosen * card is placed in ChosenCard Box. * *************************************************************************************/ private void PickCard3Button_Click(object sender, RoutedEventArgs e) { // Disable other buttons once a card has been chosen PickCard1.IsEnabled = false; PickCard2.IsEnabled = false; PickCard3.IsEnabled = false; ShuffleButton.IsEnabled = false; // Put chosen card in the Chosen Card box ChosenCard.DisplayCard(Cards[2]); // Show the back of cards in the 3 upper boxes Card1.DisplayCard(14); Card2.DisplayCard(14); Card3.DisplayCard(14); // Player Index Chosen int PlayerIndex = Cards[2]; // Run the rules of the game ApplyGameRules(PlayerIndex); }
public bool IsValid() { if (Street < 1 || Street > 3) { return(false); } if (Street == 1) { return(Card1.IsValid() && Card2.IsValid() && Card3.IsValid()); } if (Street == 2) { return(Card1.IsValid() && Card2.IsValid() && Card3.IsValid() && Card4.IsValid()); } if (Street == 3) { return(Card1.IsValid() && Card2.IsValid() && Card3.IsValid() && Card4.IsValid() && Card5.IsValid()); } return(false); }
public bool IsValid() { return(Card1.IsValid() && Card2.IsValid()); }
public void SetCard(Card1 type1, Card1 type2) { _leftAction = type1; _rightAction = type2; }
private void DisplayCards() { Card1.DisplayCard(game.PlayerCards[0]); Card2.DisplayCard(game.PlayerCards[1]); Card3.DisplayCard(game.PlayerCards[2]); }