Пример #1
0
        internal void CheckBuyHold(Models.Card card)
        {
            bool isBuyable  = game.checkBuy(card);
            bool isHoldable = game.checkHold(card);

            buyHoldSet(card, isBuyable, isHoldable);
        }
Пример #2
0
        //Function for Card to call when Buy is clicked
        public void buyClicked(Models.Card card)
        {
            int cardLevel = card.Level;
            int i         = 0;

            switch (cardLevel)
            {
            case 1:
                for (i = 0; i < game.board.Display1.Count; i++)
                {
                    if (game.board.Display1[i].Equals(card))
                    {
                        break;
                    }
                }
                game.board.replaceDeck1Card(i);
                game.currentPlayerBuysCard(card, false);    //ADD PLAYER BUY CARD
                parent.UpdateGame(game);
                parent.endActivePlayerTurn();
                break;

            case 2:
                for (i = 0; i < game.board.Display2.Count; i++)
                {
                    if (game.board.Display2[i].Equals(card))
                    {
                        break;
                    }
                }
                game.board.replaceDeck2Card(i);
                game.currentPlayerBuysCard(card, false);    //ADD PLAYER BUY CARD
                parent.UpdateGame(game);
                parent.endActivePlayerTurn();
                break;

            case 3:
                for (i = 0; i < game.board.Display3.Count; i++)
                {
                    if (game.board.Display3[i].Equals(card))
                    {
                        break;
                    }
                }
                game.board.replaceDeck3Card(i);
                game.currentPlayerBuysCard(card, false);    //ADD PLAYER BUY CARD
                parent.UpdateGame(game);
                parent.endActivePlayerTurn();
                break;
            }
        }
Пример #3
0
 public void buySet(Models.Card card, bool buy)
 {
     if (card.Equals(card1.card))
     {
         card1.enableBuyButton(buy);
     }
     else if (card.Equals(card2.card))
     {
         card2.enableBuyButton(buy);
     }
     else if (card.Equals(card3.card))
     {
         card3.enableBuyButton(buy);
     }
 }
Пример #4
0
        public void buyHoldSet(Models.Card card, bool buy, bool hold)
        {
            int level      = card.Level;
            int cardNumber = -1;

            switch (level)
            {
            case 1:
                for (int i = 0; i < game.board.Display1.Count; i++)
                {
                    if (game.board.Display1[i].Equals(card))
                    {
                        cardNumber = i;
                    }
                }
                break;

            case 2:
                for (int i = 0; i < game.board.Display2.Count; i++)
                {
                    if (game.board.Display2[i].Equals(card))
                    {
                        cardNumber = i;
                    }
                }
                break;

            case 3:
                for (int i = 0; i < game.board.Display3.Count; i++)
                {
                    if (game.board.Display3[i].Equals(card))
                    {
                        cardNumber = i;
                    }
                }
                break;
            }

            switch (level)
            {
            case 1:
                switch (cardNumber)
                {
                case 0:
                    card1_1.enableBuyButton(buy);
                    card1_1.enableHoldButton(hold);
                    break;

                case 1:

                    card1_2.enableBuyButton(buy);
                    card1_2.enableHoldButton(hold);
                    break;

                case 2:
                    card1_3.enableBuyButton(buy);
                    card1_3.enableHoldButton(hold);
                    break;

                case 3:
                    card1_4.enableBuyButton(buy);
                    card1_4.enableHoldButton(hold);
                    break;
                }
                break;

            case 2:
                switch (cardNumber)
                {
                case 0:
                    card2_1.enableBuyButton(buy);
                    card2_1.enableHoldButton(hold);
                    break;

                case 1:
                    card2_2.enableBuyButton(buy);
                    card2_2.enableHoldButton(hold);
                    break;

                case 2:
                    card2_3.enableBuyButton(buy);
                    card2_3.enableHoldButton(hold);
                    break;

                case 3:
                    card2_4.enableBuyButton(buy);
                    card2_4.enableHoldButton(hold);
                    break;
                }
                break;

            case 3:
                switch (cardNumber)
                {
                case 0:
                    card3_1.enableBuyButton(buy);
                    card3_1.enableHoldButton(hold);
                    break;

                case 1:
                    card3_2.enableBuyButton(buy);
                    card3_2.enableHoldButton(hold);
                    break;

                case 2:
                    card3_3.enableBuyButton(buy);
                    card3_3.enableHoldButton(hold);
                    break;

                case 3:
                    card3_4.enableBuyButton(buy);
                    card3_4.enableHoldButton(hold);
                    break;
                }
                break;
            }
        }
Пример #5
0
        //Function for Card to call when Hold is clicked
        public void holdClicked(Models.Card card)
        {
            int cardLevel = card.Level;
            int i         = 0;

            switch (cardLevel)
            {
            case 1:
                for (i = 0; i < game.board.Display1.Count; i++)
                {
                    if (game.board.Display1[i].Equals(card))
                    {
                        break;
                    }
                }

                if (game.currentPlayerHoldsCard(card))     //ADD PLAYER HOLD CARD
                {
                    removeCard(cardLevel, i);
                    game.board.replaceDeck1Card(i);
                    parent.UpdateGame(game);
                    parent.endActivePlayerTurn();
                }

                break;

            case 2:
                for (i = 0; i < game.board.Display2.Count; i++)
                {
                    if (game.board.Display2[i].Equals(card))
                    {
                        break;
                    }
                }
                if (game.currentPlayerHoldsCard(card))     //ADD PLAYER HOLD CARD
                {
                    removeCard(cardLevel, i);
                    game.board.replaceDeck2Card(i);
                    parent.UpdateGame(game);
                    parent.endActivePlayerTurn();
                }
                break;

            case 3:
                for (i = 0; i < game.board.Display3.Count; i++)
                {
                    if (game.board.Display3[i].Equals(card))
                    {
                        break;
                    }
                }
                if (game.currentPlayerHoldsCard(card))     //ADD PLAYER HOLD CARD
                {
                    removeCard(cardLevel, i);
                    game.board.replaceDeck3Card(i);
                    parent.UpdateGame(game);
                    parent.endActivePlayerTurn();
                }
                break;
            }
        }
Пример #6
0
        public void replaceCard(int level, int index, Models.Card card)
        {
            switch (level)
            {
            case 1:
                switch (index)
                {
                case 0:
                    card1_1.setCard(card, true);
                    break;

                case 1:
                    card1_2.setCard(card, true);
                    break;

                case 2:
                    card1_3.setCard(card, true);
                    break;

                case 3:
                    card1_4.setCard(card, true);
                    break;
                }
                break;

            case 2:
                switch (index)
                {
                case 0:
                    card2_1.setCard(card, true);
                    break;

                case 1:
                    card2_2.setCard(card, true);
                    break;

                case 2:
                    card2_3.setCard(card, true);
                    break;

                case 3:
                    card2_4.setCard(card, true);
                    break;
                }
                break;

            case 3:
                switch (index)
                {
                case 0:
                    card3_1.setCard(card, true);
                    break;

                case 1:
                    card3_2.setCard(card, true);
                    break;

                case 2:
                    card3_3.setCard(card, true);
                    break;

                case 3:
                    card3_4.setCard(card, true);
                    break;
                }
                break;
            }
        }
Пример #7
0
        public void removeCard(int level, int index)
        {
            Models.Card blankCard = new Models.Card(0, level, 0, 0, 0, 0, 0, 0);

            switch (level)
            {
            case 1:
                switch (index)
                {
                case 1:
                    card1_1.setCard(blankCard, true);
                    break;

                case 2:
                    card1_2.setCard(blankCard, true);
                    break;

                case 3:
                    card1_3.setCard(blankCard, true);
                    break;

                case 4:
                    card1_4.setCard(blankCard, true);
                    break;
                }
                break;

            case 2:
                switch (index)
                {
                case 1:
                    card2_1.setCard(blankCard, true);
                    break;

                case 2:
                    card2_2.setCard(blankCard, true);
                    break;

                case 3:
                    card2_3.setCard(blankCard, true);
                    break;

                case 4:
                    card2_4.setCard(blankCard, true);
                    break;
                }
                break;

            case 3:
                switch (index)
                {
                case 1:
                    card3_1.setCard(blankCard, true);
                    break;

                case 2:
                    card3_2.setCard(blankCard, true);
                    break;

                case 3:
                    card3_3.setCard(blankCard, true);
                    break;

                case 4:
                    card3_4.setCard(blankCard, true);
                    break;
                }
                break;
            }
        }
Пример #8
0
 internal void CheckBuy(Models.Card card)
 {
     buySet(card, game.players[game.ActivePlayer].IsCardBuyable(card));
 }
Пример #9
0
 internal void buyCard(Models.Card card)
 {
     game.currentPlayerBuysCard(card, true);
     this.parent.UpdateGame(game);
     this.parent.endActivePlayerTurn();
 }
Пример #10
0
        public void setCard(Models.Card card, bool shopCard)
        {
            this.ShopCard = shopCard;

            if (this.card == null || this.card != null && !this.card.Equals(card))
            {
                this.card = new Models.Card(card);

                if (firstTime)
                {
                    firstTime = false;

                    if (shopCard)
                    {
                        parentForm = (this.Parent as Shop);
                    }
                    else
                    {
                        playerStatusParent = (this.Parent as PlayerStatus);
                    }
                }

                this.BackgroundImage = (Image)ImageResizer.ResizeImage(new Bitmap(DirectorySelector.getBackgroundPath(card)), this.Width, this.Height);
                ColorImage.Image     = (Image)ImageResizer.ResizeImage(new Bitmap(DirectorySelector.getGemDirectory(card)), ColorImage.Width, ColorImage.Height);

                if (card.Points != 0)
                {
                    Score.Text = card.Points.ToString();
                }
                else
                {
                    Score.Text = "";
                }


                List <Colors> cardColors = new List <Colors>();

                ReqNum1.Text = "";
                ReqNum2.Text = "";
                ReqNum3.Text = "";
                ReqNum4.Text = "";

                requirementImage1.Visible = false;
                requirementImage2.Visible = false;
                requirementImage3.Visible = false;
                requirementImage4.Visible = false;

                var colors = new Dictionary <Colors, int>();

                if (card.BlackCost > 0)
                {
                    colors.Add(Colors.Black, card.BlackCost);
                }
                if (card.BlueCost > 0)
                {
                    colors.Add(Colors.Blue, card.BlueCost);
                }
                if (card.RedCost > 0)
                {
                    colors.Add(Colors.Red, card.RedCost);
                }
                if (card.WhiteCost > 0)
                {
                    colors.Add(Colors.White, card.WhiteCost);
                }
                if (card.GreenCost > 0)
                {
                    colors.Add(Colors.Green, card.GreenCost);
                }

                int markers = 1;

                if (colors.ContainsKey(Colors.Black))
                {
                    string circle = DirectorySelector.getReqCircle(Colors.Black);
                    string cost   = card.BlackCost.ToString();

                    requirementImage1.Image = (Image) new Bitmap(circle);
                    ReqNum1.Text            = cost;

                    requirementImage1.Visible = true;

                    markers++;

                    colors.Remove(Colors.Black);
                }

                if (colors.ContainsKey(Colors.Red))
                {
                    string circle = DirectorySelector.getReqCircle(Colors.Red);
                    string cost   = card.RedCost.ToString();

                    switch (markers)
                    {
                    case 1:
                        requirementImage1.Image   = (Image) new Bitmap(circle);
                        ReqNum1.Text              = cost;
                        requirementImage1.Visible = true;
                        break;

                    case 2:
                        requirementImage2.Image   = (Image) new Bitmap(circle);
                        ReqNum2.Text              = cost;
                        requirementImage2.Visible = true;
                        break;
                    }

                    markers++;

                    colors.Remove(Colors.Red);
                }

                if (colors.Count != 0 && colors.ContainsKey(Colors.Green))
                {
                    string circle = DirectorySelector.getReqCircle(Colors.Green);
                    string cost   = card.GreenCost.ToString();

                    switch (markers)
                    {
                    case 1:
                        requirementImage1.Image   = (Image) new Bitmap(circle);
                        ReqNum1.Text              = cost;
                        requirementImage1.Visible = true;
                        break;

                    case 2:
                        requirementImage2.Image   = (Image) new Bitmap(circle);
                        ReqNum2.Text              = cost;
                        requirementImage2.Visible = true;
                        break;

                    case 3:
                        requirementImage3.Image   = (Image) new Bitmap(circle);
                        ReqNum3.Text              = cost;
                        requirementImage3.Visible = true;
                        break;
                    }

                    markers++;

                    colors.Remove(Colors.Green);
                }

                if (colors.Count != 0 && colors.ContainsKey(Colors.Blue))
                {
                    string circle = DirectorySelector.getReqCircle(Colors.Blue);
                    string cost   = card.BlueCost.ToString();

                    switch (markers)
                    {
                    case 1:
                        requirementImage1.Image   = (Image) new Bitmap(circle);
                        ReqNum1.Text              = cost;
                        requirementImage1.Visible = true;
                        break;

                    case 2:
                        requirementImage2.Image   = (Image) new Bitmap(circle);
                        ReqNum2.Text              = cost;
                        requirementImage2.Visible = true;
                        break;

                    case 3:
                        requirementImage3.Image   = (Image) new Bitmap(circle);
                        ReqNum3.Text              = cost;
                        requirementImage3.Visible = true;
                        break;

                    case 4:
                        requirementImage4.Image   = (Image) new Bitmap(circle);
                        ReqNum4.Text              = cost;
                        requirementImage4.Visible = true;
                        break;
                    }

                    markers++;

                    colors.Remove(Colors.Blue);
                }

                if (colors.Count != 0 && colors.ContainsKey(Colors.White))
                {
                    string circle = DirectorySelector.getReqCircle(Colors.White);
                    string cost   = card.WhiteCost.ToString();

                    switch (markers)
                    {
                    case 1:
                        requirementImage1.Image   = (Image) new Bitmap(circle);
                        ReqNum1.Text              = cost;
                        requirementImage1.Visible = true;
                        break;

                    case 2:
                        requirementImage2.Image   = (Image) new Bitmap(circle);
                        ReqNum2.Text              = cost;
                        requirementImage2.Visible = true;
                        break;

                    case 3:
                        requirementImage3.Image   = (Image) new Bitmap(circle);
                        ReqNum3.Text              = cost;
                        requirementImage3.Visible = true;
                        break;

                    case 4:
                        requirementImage4.Image   = (Image) new Bitmap(circle);
                        ReqNum4.Text              = cost;
                        requirementImage4.Visible = true;
                        break;
                    }

                    markers++;

                    colors.Remove(Colors.White);
                }
            }
        }