Esempio n. 1
0
 public CardHolder(int x, int y, int w, int h)
 {
     this.xPos = x;
     this.yPos = y;
     this.Width = w;
     this.Height = h;
     this.Holding = false;
     this.currentCard = null;
 }
Esempio n. 2
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.ApplyChanges();

            CardWidth = Convert.ToInt32(graphics.PreferredBackBufferWidth / 6);
            CardHeight = Convert.ToInt32(graphics.PreferredBackBufferHeight / 2);

            CardSeperation = (graphics.PreferredBackBufferWidth - (CardWidth * 5)) / 6;

            this.IsMouseVisible = true;
            int Seed = (int)DateTime.Now.Ticks;
            Random rnd = new Random(Seed);
            for (int i = 0; i < cards.Length; i++)
            {

                int type = rnd.Next(1,4);

                cards[i] = new Card(type);
                cards[i].DeckPosX = Convert.ToInt32(graphics.PreferredBackBufferWidth/2 - (CardWidth/2*2.5) + (CardWidth/2* i) + (CardSeperation/2*i) - CardWidth/4);
                cards[i].xPos = cards[i].DeckPosX;
                cards[i].DeckPosY = graphics.PreferredBackBufferHeight - CardHeight / 10 * 4;
                cards[i].yPos = cards[i].DeckPosY;
                cards[i].Width = CardWidth / 2;
                cards[i].Height = CardHeight / 2;
                cards[i].InDeck = true;

                holders[i] = new CardHolder(((i + 1) * CardSeperation) + (i * CardWidth), CardHeight / 100 * 2, CardWidth, CardHeight);

            }

            int w = CardWidth / 3;
            int h = CardHeight / 3;
            for (int i = 0; i < opHolders.Length; i++)
            {
                opHolders[i] = new CardHolder(holders[i].xPos + holders[i].Width - ((w - CardSeperation) / 2), Convert.ToInt32(holders[i].yPos + holders[i].Height * 1.2), w, h);
            }

            string comb = Comb[rnd.Next(0, Comb.Length + 1)];
            Debug.WriteLine(comb);
            int[] index = new int[5];
            for(int i = 0; i < comb.Length; i++)
            {
                index[i] = Convert.ToInt32(comb.Substring(i, 1));
            }

            Goal = cards[index[0]].GetRating() + cards[index[1]].GetRating() - cards[index[2]].GetRating() * cards[index[3]].GetRating() / cards[index[4]].GetRating();

            Debug.WriteLine(Goal);

            base.Initialize();
        }