コード例 #1
0
        //device.DrawUserPrimitives(PrimitiveType.TriangleList
        public BeginGameLayer(Player player,GameController controller)
        {
            this.controller = controller;
            this.player = player;
            this.locksMouse = true;
            this.locksKeyboard = false;
            float x = GM.AppWindow.GraphicsParameters.WindowSize.Width / 2;
            float y = GM.AppWindow.GraphicsParameters.WindowSize.Height - 300;

            GM.GUIStyleManager.SetCurrentStyle("mystyle");
            joinKnights = new GuiButton("Rycerze", new System.Drawing.RectangleF(x - 50, y, 100, 34));
            joinAssassins = new GuiButton("Zabójcy", new System.Drawing.RectangleF(x - 50, y + 40, 100, 34));
            startGame = new GuiButton("Start", new System.Drawing.RectangleF(x - 80, y, 160, 70));
            AddControl(joinKnights);
            AddControl(joinAssassins);

            joinKnights.OnClick += new ButtonEventHandler(joinKnights_OnClick);
            joinAssassins.OnClick += new ButtonEventHandler(joinAssassins_OnClick);
            startGame.OnClick += new ButtonEventHandler(startGame_OnClick);

            verts[2]=new CustomVertex.TransformedColored(0, 0, 0, 1, Color.FromArgb(127, 200, 200, 200).ToArgb());
            verts[0]=new CustomVertex.TransformedColored(GM.AppWindow.GraphicsParameters.WindowSize.Width, 0, 0, 1, Color.FromArgb(127, 200, 200, 200).ToArgb());
            verts[3]=new CustomVertex.TransformedColored(0, GM.AppWindow.GraphicsParameters.WindowSize.Height, 0, 1, Color.FromArgb(127, 200, 200, 200).ToArgb());
            verts[1] = new CustomVertex.TransformedColored(GM.AppWindow.GraphicsParameters.WindowSize.Width, GM.AppWindow.GraphicsParameters.WindowSize.Height, 0, 1, Color.FromArgb(127, 200, 200, 200).ToArgb());

            System.Windows.Forms.Cursor.Show();
        }
コード例 #2
0
        public JoinGameDialog()
            : base("Dołącz się do gry", new RectangleF(GM.AppWindow.GraphicsParameters.WindowSize.Width / 2 - 190,
            GM.AppWindow.GraphicsParameters.WindowSize.Height / 2 - 200, 380, 400))
        {
            ok = new GuiButton("Start", new RectangleF(240, 300, 100, 34));
            cancel = new GuiButton("Anuluj", new RectangleF(155, 300, 80, 34));

            ok.OnClick += new ButtonEventHandler(OnOK);
            ok.Disable();
            cancel.OnClick += new ButtonEventHandler(Close);
            AddControl(ok);
            AddControl(cancel);

            AddControl(new GuiTextLabel("Nick:", new RectangleF(20, 10, 150, 22), 22));
            AddControl(new GuiTextLabel("Lista Gier:", new RectangleF(20, 35, 150, 22), 22));
            gameList = new GuiListBox(new RectangleF(20, 60, 320, 230), 8);
            gameList.OnSelectionChange += this.UpdateSelection;

            playerName = new GuiEditBox(Properties.Settings.Default.PlayerName, new RectangleF(190, 10, 150, 22), 18);

            AddControl(playerName);
            AddControl(gameList);

            //LoadShipData();
            //LoadMapData();

            clientSide = new UDPClientServerCommons.Client.ClientSide(4444);
            bool ret=clientSide.StartLookingForLANGames();
        }
コード例 #3
0
        public NewGameDialog()
            : base("Stwórz grê",new RectangleF(GM.AppWindow.GraphicsParameters.WindowSize.Width/2-190,
            GM.AppWindow.GraphicsParameters.WindowSize.Height/2-200, 380,190))
        {
            ok = new GuiButton("Start", new RectangleF(240, 100, 100, 34));
            cancel = new GuiButton("Anuluj", new RectangleF(155, 100, 80, 34));

            ok.OnClick+=new ButtonEventHandler(OnOK);
            //ok.Disable();
            cancel.OnClick+=new ButtonEventHandler(Close);
            AddControl(ok);
            AddControl(cancel);

            AddControl(new GuiTextLabel("Nick", new RectangleF(20, 10, 150, 22), 22));
            AddControl(new GuiTextLabel("Nazwa gry:",new RectangleF(20, 35, 150, 22),22));
            AddControl(new GuiTextLabel("Max. graczy", new RectangleF(20, 60, 150, 22),22));

            playerName = new GuiEditBox(Properties.Settings.Default.PlayerName, new RectangleF(190, 10, 150, 22), 18);
            serverName = new GuiEditBox("Nowa gra", new RectangleF(190, 35, 150, 22), 18);
            maxPlayers = new GuiNumberBox(4, new RectangleF(190, 60, 150, 22), 18);
            AddControl(playerName);
            AddControl(serverName);
            AddControl(maxPlayers);

            //LoadShipData();
            //LoadMapData();
        }
コード例 #4
0
ファイル: MainMenu.cs プロジェクト: kensniper/castle-butcher
        private void InitializeButtons()
        {
            //Usuwamy poprzednie przyciski jesli takie by³y
            if (resumeGame!=null)
                RemoveControl(resumeGame);
            if (newGame != null)
                RemoveControl(newGame);
            if (joinGame != null)
                RemoveControl(joinGame);
            if (exitGame != null)
                RemoveControl(exitGame);

            orientationPoint = new PointF(GM.AppWindow.GraphicsParameters.WindowSize.Width / 2 - 100, (int)(GM.AppWindow.GraphicsParameters.WindowSize.Height/2 -200));

            GM.GUIStyleManager.SetCurrentStyle("mystyle");
            resumeGame = new GuiButton("Wróæ do gry", new RectangleF(new PointF(orientationPoint.X, orientationPoint.Y - 50), new SizeF(200, 40)));
            resumeGame.OnClick += new ButtonEventHandler(this.ReturnToGame);
            //rtgButton = button;

            if (GameInProgress)
            {
                AddControl(resumeGame);
                rtgButtonAdded = true;
            }
            else
                rtgButtonAdded = false;

            newGame = new GuiButton("Nowa gra", new RectangleF(orientationPoint, new SizeF(200, 40)));
            newGame.OnClick += new ButtonEventHandler(this.NewGame);
            AddControl(newGame);

            joinGame = new GuiButton("Po³¹cz z serwerem", new RectangleF(new PointF(orientationPoint.X, orientationPoint.Y + 50), new SizeF(200, 40)));
            joinGame.OnClick += new ButtonEventHandler(this.Join);
            AddControl(joinGame);

            exitGame = new GuiButton("Wyjœcie", new RectangleF(new PointF(orientationPoint.X, orientationPoint.Y + 100), new SizeF(200, 40)));
            exitGame.OnClick += new ButtonEventHandler(this.ExitGame);
            AddControl(exitGame);
        }