//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 MainView(ProgressReporter reporter, UIPlayer player, GameController controller)
            : base()
        {
            this.isTransparent = true;
            this.RecievesEmptyMouse = true;
            RecievesEmptyMouse = true;

            this.reporter = reporter;
            this.player = player;
            gameController = controller;

            this.player.CurrentCharacter = new SpectatingCharacter(player, null, new MyVector(0, 24, -107), MyQuaternion.FromEulerAngles(0, 0/*(float)Math.PI*/, 0));
        }
        public PlayerControlLayer(Player player,GameController controller)
            : base()
        {
            this.isTransparent = true;
            this.RecievesEmptyMouse = true;
            RecievesEmptyMouse = true;

            gameController = controller;
            slay = new SteeringLayer(player);
            SizeF size = GM.AppWindow.GraphicsParameters.WindowSize;
            GM.GUIStyleManager.SetCurrentStyle("PlayerInfo");
            this.isTransparent = true;
            this.locksKeyboard = false;
            this.locksMouse = false;
            velocity = new GuiTextLabel("", new RectangleF(10, 40, 150, 18), 18);
            shield = new GuiTextLabel("", new RectangleF(100, 60, 70, 18), 18);
            slash = new GuiTextLabel("", new RectangleF(80, 60, 10, 18), 18);
            hp = new GuiTextLabel("100", new RectangleF(10, 60, 70, 18), 18);
            numObjects = new GuiTextLabel("", new RectangleF(10, 80, 200, 18), 18);

            int bottom = (int)GM.AppWindow.GraphicsParameters.WindowSize.Height;
            currentWeapon = new GuiTextLabel("", new RectangleF(10, bottom - 100, 250, 18), 18);
            currentRocket = new GuiTextLabel("", new RectangleF(10, bottom - 80, 150, 18), 18);
            weaponAmmo = new GuiTextLabel("", new RectangleF(10, bottom - 60, 100, 18), 18);
            weaponEnergy = new GuiTextLabel("", new RectangleF(10, bottom - 60, 150, 18), 18);

            numFrags = new GuiTextLabel("0", new RectangleF(10, bottom - 40, 150, 18), 18);
            numDeaths = new GuiTextLabel("0", new RectangleF(10, bottom - 20, 150, 18), 18);
            statusInfo = new GuiTextLabel("", new RectangleF(0, 100, size.Width, 40), 40, "Ghotic",
                Align.Center, Color.Black);
            AddControl(statusInfo);

            AddControl(velocity);
            //AddControl(shield);
            AddControl(hp);
            AddControl(slash);
            AddControl(numObjects);

            AddControl(currentWeapon);
            //AddControl(currentRocket);
            AddControl(weaponAmmo);
            //AddControl(weaponEnergy);

            AddControl(numFrags);
            AddControl(numDeaths);

            crosshair = new CastleButcher.UI.HUD.CrosshairControl(new PointF(size.Width / 2, size.Height / 2));
            AddControl(crosshair);
            castleMap = new CastleButcher.UI.HUD.CastleMap(new PointF(size.Width / 2, size.Height / 2));
            RenderCrosshair = false;

            //radar = new CastleButcher.UI.HUD.RadarControl(new PointF(size.Width - 256, size.Height - 256));
            ////AddControl(radar);

            //speedometer = new CastleButcher.UI.HUD.SpeedometerControl(player.CharacterClass.MovementParameters.MaxVelocity,
            //    new PointF(size.Width / 2, size.Height - 200));
            //AddControl(speedometer);

            playerList = new HUD.PlayerList(new RectangleF(100, 100, size.Width - 200, size.Height - 200),gameController);

            World.Instance.OnPlayerAdded += new PlayerEventHandler(playerList.AddPlayer);
            World.Instance.OnPlayerRemoved += new PlayerEventHandler(playerList.RemovePlayer);

            World.Instance.OnPlayerKilled += new PlayerEventHandler(delegate(Player pl)
            {
                if (pl == this.player)
                {
                    if (!playerListAdded)
                    {
                        AddControl(playerList);
                        playerListAdded = true;
                    }
                }
            });

            World.Instance.OnPlayerRespawned += new PlayerEventHandler(delegate(Player pl)
            {
                if (pl == this.player)
                {
                    if (playerListAdded)
                    {
                        RemoveControl(playerList);
                        playerListAdded = false;
                    }

                }
            });

            playerList.AddPlayer(player);

            this.player = player;
        }
示例#4
0
 public PlayerList(RectangleF rect, GameController controller)
     : base(rect, GM.GetUniqueName())
 {
     gameController = controller;
     ProcessRect(rect);
 }
示例#5
0
        void JoinServer(object d)
        {
            if (gameController != null)
                gameController.EndGame();
            waitingForJoin = true;
            JoinGameData data = (JoinGameData)d;
            ProgressReporter reporter = new ProgressReporter();
            Thread bkgLoader = new Thread(new ParameterizedThreadStart(delegate(object o)
            {
                object[] tab = (object[])o;
                World.FromFileBkg((string)tab[0], (ProgressReporter)tab[1]);
            }));
            bkgLoader.Start(new object[] { AppConfig.MapPath + "respawn_config.xml", reporter });
            //World.FromFileBkg("respawn_config.xml", reporter);
            //World.Instance=new
            //ShipClass shipClass=ObjectCache.Instance.GetShipClass(data.PlayerShip);
            frameworkWindow.RemoveLayer(mainView);
            UIPlayer player = new UIPlayer(data.PlayerName, null);
            gameController = new RemoteGameController(player, data.ClientSide, data.GameInfo);
            mainView = new MainView(reporter, player, gameController);

            frameworkWindow.RemoveLayer(mainMenu);
            frameworkWindow.PushLayer(mainView);
            Cursor.Hide();
        }