Пример #1
0
 /// <summary>
 ///     Set param1's shape,color and amount to the current button.
 /// </summary>
 /// <param name="card"></param>
 public void setWithoutImgButton(Card card)
 {
     this.shape  = card.shape;
     this.color  = card.color;
     this.amount = card.amount;
 }
Пример #2
0
 /// <summary>
 ///     Copy C'tor.
 ///     For an object to be copied deeply.
 /// </summary>
 /// <param name="card"></param>
 public Card(Card card)
 {
     shape = card.shape;
     color = card.color;
     amount = card.amount;
 }
Пример #3
0
        /// <summary>
        ///     Initiating the 2 dimentional array of buttons with a blank image.
        /// </summary>
        private void initiateButtonsArray(){
            try{
                // Allocate the array of cards, which contains the properties.
                buttonsArray = new Card[SIZE, SIZE];
                // Instantiate with white properties.
                for (int i = 0; i < SIZE; i++){
                    for (int j = 0; j < SIZE; j++){
                       buttonsArray[i, j] = new Card( "blank", "white", 0); 
                    }
                }
                
                // Initialize the button 
                outerImage = new Card("blank", "white", 0);
                outerButton = FindViewById<ImageButton>(Resource.Id.outerImgBtn);
                outerButton.SetImageResource(Resource.Drawable.blank);
               
                // Allocate the two dimensional array of image buttons.
                gameImgButtons = new ImageButton[SIZE, SIZE];

                //  Initialize Image buttons array.
                for (int i = 0; i < SIZE; i++){
                    for (int j = 0; j < SIZE; j++){
                        gameImgButtons[i, j] = new ImageButton(this);
                    }
                }

                // Set all images with the blank image.
                for (int i = 0; i < SIZE; i++){
                    for (int j = 0; j < SIZE; j++){
                        gameImgButtons[i, j].SetImageResource(Resource.Drawable.blank);
                    }
                }
            }
            catch (Exception){
                showMessage("Something went wrong in game initialization");
            }
            
    }
Пример #4
0
 /// <summary>
 ///     C'tor.
 /// </summary>
 /// <param name="arrayOfButtons"></param>
 /// <param name="newSize"></param>
 public GameRules(Card[,] arrayOfButtons,ImageButton[,] arrayOfImgs,int newSize)
 {
     gameBoard = arrayOfButtons;
     gameImages = arrayOfImgs;
     SIZE = newSize;
 }
Пример #5
0
        /// <summary>
        ///     Create an array of all images.
        ///     A help array will exist, which will be holding the counting of each card in.
        /// </summary>
        private void initiateSetOfImages(){
            try{
                int localCnt = 0;

                // Initialize all game cards.
                gameCards = new Card[NUM_CARDS];
                numOfCards = new int[NUM_CARDS];

                // Initialize amount  -  Responsible for amount of cards per type.
                for (int i = 0; i < NUM_CARDS; i++){
                    numOfCards[i] = 4 * NUM_PACKETS;
                }

                // Initialize the cards symbols,color and amount.
                // Order : Green , Red , Yellow.
                // Type  : Cherry, Mushroom , Strawberry.

                // Green
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("cherry", "green", i + 1);
                }
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card( "mushroom", "green", i + 1);
                }
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("straw", "green", i + 1);
                }

                // Red
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("cherry", "red", i + 1);
                }
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("mushroom", "red", i + 1);
                }
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("straw", "red", i + 1);
                }

                // Yellow
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("cherry", "yellow", i + 1);
                }
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("mushroom", "yellow", i + 1);
                }
                for (int i = 0; i < 4; i++, localCnt++)
                {
                    gameCards[localCnt] = new Card("straw", "yellow", i + 1);
                }
            }
            catch (Exception){
                showMessage("Error in assiging cards.");
            }
            
        }