Пример #1
0
        /// <summary>
        /// This method is called when the socket connection is successful
        /// This method sets up the world/drawingpanel/scoreboard
        /// </summary>
        /// <param name="newWorld"></param>
        /// <param name="Id"></param>
        private void Connected(World newWorld, int Id)
        {
            playerID = Id;

            this.Invoke(new MethodInvoker(delegate
            {
                theWorld   = newWorld;
                ClientSize = new Size(theWorld.WorldSize + 250, theWorld.WorldSize + 140);


                drawingPanel           = new DrawingPanel(theWorld);
                drawingPanel.Location  = new Point(0, 140);
                drawingPanel.Size      = new Size(theWorld.WorldSize, theWorld.WorldSize);
                drawingPanel.BackColor = Color.Black;
                drawingPanel.BringToFront();
                //drawingPanel.Size = new Size(theWorld.WorldSize,theWorld.WorldSize);

                scorePanel = new ScorePanel();
                scorePanel.startUp(newWorld);
                scorePanel.Location  = new Point(theWorld.WorldSize + 10, 140);
                scorePanel.Size      = new Size(220, theWorld.WorldSize);
                scorePanel.BackColor = Color.Black;
                BackColor            = Color.HotPink;

                this.Controls.Add(scorePanel);
                gamecontroller.RegisterShipUpdatorDied(new GameController.ShipUpdateToScoreDied(this.scorePanel.updateToShipsDied));
                gamecontroller.RegisterShipUpdatorNew(new GameController.ShipUpdateToScoreNew(this.scorePanel.updateToShipsNew));
                this.Controls.Add(drawingPanel);

                spacewarspicture.Location   = new Point((theWorld.WorldSize - 350) / 2, 28);
                ScoreBoardPicture.BackColor = Color.Black;
                ScoreBoardPicture.Visible   = true;

                ScoreBoardPicture.Location = new Point(theWorld.WorldSize + 20, 140);

                HelpButton.Visible  = true;
                HelpButton.Enabled  = true;
                HelpButton.Location = new Point(100, 5);
            }));
        }