Exemplo n.º 1
0
        public CoinStackView(TableView ParentTable, CoinStack SubjectStack, bool invert, bool penalty = false)
        {
            InitializeComponent();
            sprite       = whiteSprite;
            parent       = ParentTable;
            subject      = SubjectStack;
            Width        = sprite.Width + 2;
            Height       = viewLimit * 50 + 2;
            sprites      = new PictureBox[viewLimit];
            BackColor    = Color.Transparent;
            selected     = false;
            this.invert  = invert;
            this.penalty = penalty;

            indexBubble            = new ToolTip();
            indexBubble.IsBalloon  = true;
            indexBubble.UseFading  = false;
            indexBubble.ShowAlways = true;


            for (int i = 0; i < viewLimit; i++)
            {
                sprites[i]        = new PictureBox();
                sprites[i].Width  = sprite.Width;
                sprites[i].Height = sprite.Height;
                sprites[i].Image  = sprite;
                sprites[i].SendToBack();
                sprites[i].MouseEnter += new System.EventHandler(this.CoinStackView_MouseEnter);
                sprites[i].MouseLeave += new System.EventHandler(this.CoinStackView_MouseLeave);
                sprites[i].MouseClick += new System.Windows.Forms.MouseEventHandler(this.CoinStackView_MouseClick);

                Controls.Add(sprites[i]);
                sprites[i].Location = new Point(0, i * sprite.Height);
            }


            overflowLabel      = new Label();
            overflowLabel.Font = new Font("Arial", 14, FontStyle.Bold);
            if (invert)
            {
                overflowLabel.Location = new Point(Location.X + labelXOffset, Location.Y + labelYOffset);
            }
            else
            {
                overflowLabel.Location = new Point(Location.X + labelXOffset, Location.Y + Height - labelYOffset * 2);
            }
            overflowLabel.Visible = false;
            Controls.Add(overflowLabel);


            UpdateView();
            BringToFront();
        }
Exemplo n.º 2
0
        public Table(Player[] players)
        {
            gameTable = new CoinStack[26];

            for (int i = 0; i < 26; i++)
            {
                gameTable[i] = new CoinStack(i);
            }

            int[,] init = new int[, ] {
                { 6, 5 }, { 8, 3 }, { 13, 5 }, { 24, 2 }
            };

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < init[i, 1]; j++)
                {
                    gameTable[init[i, 0]].AddCoin(players[0]);
                    gameTable[25 - init[i, 0]].AddCoin(players[1]);
                }
            }
        }