Пример #1
0
        //the all important constructors
        public FormPoker()
        {
            InitializeComponent();
            this.Icon    = new Icon("Poker.ico");
            timerCount   = 0;
            screenWidth  = Screen.PrimaryScreen.Bounds.Width;
            screenHeight = Screen.PrimaryScreen.Bounds.Height;
            width_ratio  = (screenWidth / this.Width);
            height_ratio = (screenHeight / this.Height);

            SizeF scale = new SizeF(width_ratio, height_ratio);

            pbMain.Scale(scale);
            this.Size = pbMain.Size;
            foreach (Control control in this.Controls)
            {
                control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
            }
            cardWidth  = Convert.ToInt32(71f * width_ratio);
            cardHeight = Convert.ToInt32(96f * height_ratio);
            user       = new UserAccount();
            Random rand = new Random();
            Player me   = new Player(playerName, BuyInAmount);

            playerList = new PlayerList();
            playerList.Add(me);
            lblName.Text = me.Name;
            List <int> AI = new List <int>(playerAmount);

            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(BuyInAmount, difficulty, AI[i - 1]));
                //labelListName[i].Text = playerList[i].Name;
            }
            FormInformation Information = new FormInformation(playerList);

            Information.StartPosition = FormStartPosition.CenterScreen;
            Information.ShowDialog();
            Information.Dispose();
            pokerTable = new Table(playerList);
            SoundPlayer sound = new SoundPlayer();
        }
Пример #2
0
        //the all important constructors
        public FormPoker()
        {
            InitializeComponent();
            this.Icon = new Icon("Poker.ico");
            timerCount = 0;
            screenWidth = Screen.PrimaryScreen.Bounds.Width;
            screenHeight = Screen.PrimaryScreen.Bounds.Height;
            width_ratio = (screenWidth / this.Width);
            height_ratio = (screenHeight / this.Height);

            SizeF scale = new SizeF(width_ratio, height_ratio);
            pbMain.Scale(scale);
            this.Size = pbMain.Size;
            foreach (Control control in this.Controls)
            {
                control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
            }
            cardWidth = Convert.ToInt32(71f * width_ratio);
            cardHeight = Convert.ToInt32(96f * height_ratio);
            user = new UserAccount();
            Random rand = new Random();
            Player me = new Player(playerName, BuyInAmount);
            playerList = new PlayerList();
            playerList.Add(me);
            lblName.Text = me.Name;
            List<int> AI = new List<int>(playerAmount);
            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(BuyInAmount, difficulty, AI[i - 1]));
                //labelListName[i].Text = playerList[i].Name;
            }
            FormInformation Information = new FormInformation(playerList);
            Information.StartPosition = FormStartPosition.CenterScreen;
            Information.ShowDialog();
            Information.Dispose();
            pokerTable = new Table(playerList);
            SoundPlayer sound = new SoundPlayer();
        }
Пример #3
0
        public FormPoker(string playerName, int BuyInAmount, int playerAmount, int difficulty, UserAccount user)
        {
            InitializeComponent();
            this.Icon = new Icon("Poker.ico");
            this.playerName = playerName;
            if (playerName == null)
                throw new ArgumentOutOfRangeException();
            if (playerAmount < 2)
                throw new ArgumentOutOfRangeException();
            this.difficulty = difficulty;
            if (difficulty > 2)
                throw new ArgumentOutOfRangeException();
            this.BuyInAmount = BuyInAmount;
            this.playerAmount = playerAmount;
            timerCount = 0;
            //code to resize screen
            screenWidth = Screen.PrimaryScreen.Bounds.Width;
            screenHeight = Screen.PrimaryScreen.Bounds.Height;
            width_ratio = (screenWidth / 1366f);
            height_ratio = (screenHeight / 768f);
            SizeF scale = new SizeF(width_ratio, height_ratio);
            this.Scale(scale);
            foreach (Control control in this.Controls)
            {
                control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
            }

            cardWidth = Convert.ToInt32(71f * width_ratio);
            cardHeight = Convert.ToInt32(96f * height_ratio);
            this.user = new UserAccount(user);
            //add 3 archetytes randomly to list
            Random rand = new Random();
            Player me = new Player(playerName, BuyInAmount);
            playerList = new PlayerList();
            playerList.Add(me);
            lblName.Text = me.Name;
            List<int> AI = new List<int>(playerAmount);
            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(BuyInAmount, difficulty, AI[i - 1]));
                //labelListName[i].Text = playerList[i].Name;
            }
            FormInformation Information = new FormInformation(playerList);
            Information.StartPosition = FormStartPosition.CenterScreen;
            Information.ShowDialog();
            Information.Dispose();
            pokerTable = new Table(playerList);
        }
Пример #4
0
        public FormPoker(string playerName, int BuyInAmount, int playerAmount, int difficulty, UserAccount user)
        {
            InitializeComponent();
            this.Icon       = new Icon("Poker.ico");
            this.playerName = playerName;
            if (playerName == null)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (playerAmount < 2)
            {
                throw new ArgumentOutOfRangeException();
            }
            this.difficulty = difficulty;
            if (difficulty > 2)
            {
                throw new ArgumentOutOfRangeException();
            }
            this.BuyInAmount  = BuyInAmount;
            this.playerAmount = playerAmount;
            timerCount        = 0;
            //code to resize screen
            screenWidth  = Screen.PrimaryScreen.Bounds.Width;
            screenHeight = Screen.PrimaryScreen.Bounds.Height;
            width_ratio  = (screenWidth / 1366f);
            height_ratio = (screenHeight / 768f);
            SizeF scale = new SizeF(width_ratio, height_ratio);

            this.Scale(scale);
            foreach (Control control in this.Controls)
            {
                control.Font = new Font(control.Font.Name, control.Font.SizeInPoints * height_ratio * width_ratio, control.Font.Style);
            }

            cardWidth  = Convert.ToInt32(71f * width_ratio);
            cardHeight = Convert.ToInt32(96f * height_ratio);
            this.user  = new UserAccount(user);
            //add 3 archetytes randomly to list
            Random rand = new Random();
            Player me   = new Player(playerName, BuyInAmount);

            playerList = new PlayerList();
            playerList.Add(me);
            lblName.Text = me.Name;
            List <int> AI = new List <int>(playerAmount);

            for (int i = 0; i < 3; i++)
            {
                AI.Add(i);
            }
            for (int i = 0; i < 4 - playerAmount; i++)
            {
                AI.Remove(rand.Next(AI.Count));
            }
            AI = shuffle(AI);
            for (int i = 1; i < playerAmount; i++)
            {
                playerList.Add(new AIPlayer(BuyInAmount, difficulty, AI[i - 1]));
                //labelListName[i].Text = playerList[i].Name;
            }
            FormInformation Information = new FormInformation(playerList);

            Information.StartPosition = FormStartPosition.CenterScreen;
            Information.ShowDialog();
            Information.Dispose();
            pokerTable = new Table(playerList);
        }