public FormWellcome(MDIParent1 mdiForm)
 {
     mainForm = mdiForm;
     InitializeComponent();
 }
예제 #2
0
        public FormGame(ucGame uc, MDIParent1 mdi)
        {
            InitializeComponent();
            mainForm      = mdi;
            currentUcGame = uc;
            //רישום לאירוע
            currentUcGame.eComputerFinished += new dComputerFinishedEventHandler(currentUcGame_eComputerFinished);

            currentUcGame.eLoadChangesFinished += new dLoadChangesFinishedEventHandler(currentUcGame_eLoadChangesFinished);//@@

            this.Text = "משחק";

            if (mainForm.isNetworkGame)
            {
                if (currentUcGame.playersBoards[0].name == mainForm.userName)
                {
                    indCurrPlayer = 0;
                }
                else
                {
                    indCurrPlayer = 1;
                }

                uc.playersBoards[indCurrPlayer].Location = new Point(pnlMainPlayBoard.Location.X + 100, pnlMainPlayBoard.Location.Y + pnlMainPlayBoard.Height + 5);
                uc.playersBoards[indCurrPlayer].Name     = "ucPlayerBoard1";
            }

            else
            {
                //this.pnlPlayer1.Controls.Add(uc.playersBoards[0]);
                //uc.playersBoards[0].Location = new Point(103, 551);
                uc.playersBoards[uc.turn].Location = new Point(pnlMainPlayBoard.Location.X + 100, pnlMainPlayBoard.Location.Y + pnlMainPlayBoard.Height + 5);
                uc.playersBoards[uc.turn].Name     = "ucPlayerBoard" + (uc.turn + 1).ToString();
            }

            #region network//@@
            if (currentUcGame.netWorkGame)
            {
                if (currentUcGame.turn == 0)
                {
                    if (mainForm.userName == currentUcGame.playersBoards[0].name)
                    {
                        lblPlayerName.Text = currentUcGame.playersBoards[0].name;
                    }
                    else
                    {
                        lblPlayerName.Text = currentUcGame.playersBoards[1].name;
                    }
                }
                else
                {
                    if (mainForm.userName == currentUcGame.playersBoards[1].name)
                    {
                        lblPlayerName.Text = currentUcGame.playersBoards[1].name;
                    }
                    else
                    {
                        lblPlayerName.Text = currentUcGame.playersBoards[0].name;
                    }
                }
                currentUcGame.setCurrentName(mainForm.userName);
            }
            else
            {
                lblPlayerName.Text = currentUcGame.playersBoards[currentUcGame.turn].name;
            }
            #endregion
            // uc.playersBoards[0].Name = "ucPlayerBoard1";
            if (mainForm.isNetworkGame)
            {
                this.Controls.Add(uc.playersBoards[indCurrPlayer]);
            }
            else
            {
                this.Controls.Add(uc.playersBoards[uc.turn]);
            }
            //  this.pnlPlayer2.Controls.Add(uc.playersBoards[1]);
            //labelnmp1.Text = uc.playersBoards[0].name;
            //labelnp2.Text = uc.playersBoards[1].name;
            if (uc.playersBoards.Count() > 2)
            {
                this.BackgroundImage = global::RammyCube.Properties.Resources._2;
                //pnlPlayer3.Visible = true;//כשמוסיפיפ תמונה- למחק
                // this.pnlPlayer3.Controls.Add(uc.playersBoards[2]);
            }
            if (uc.playersBoards.Count() > 3)
            {
                this.BackgroundImage = global::RammyCube.Properties.Resources._3;
                // pnlPlayer4.Visible = true;//כשמוסיפיפ תמונה- למחק
                // this.pnlPlayer4.Controls.Add(uc.playersBoards[3]);
            }
            if (mainForm.isOpenSaveGame)
            {
                LoadSerias("SavedGame");
            }
        }
예제 #3
0
 public FormOpen(MDIParent1 mdiForm)
 {
     mainForm = mdiForm;
     InitializeComponent();
 }