示例#1
0
        SceneMenu(ContentManager content)
        {
            DataSystem.sound = content.Load<Song>(@"Audio/bgMusic");
            MediaPlayer.Volume = 0.5f;
            MediaPlayer.Play(DataSystem.sound);
            MediaPlayer.IsRepeating = true;

            List<String> lstName = new List<String>();
            List<Rectangle> lstRectangle = new List<Rectangle>();

            lstName.Add("NewGame");
            lstName.Add("Option");
            lstName.Add("About");
            lstName.Add("Quit");

            lstRectangle.Add(new Rectangle(50, 300, 960, 340));
            lstRectangle.Add(new Rectangle(50, 350, 960, 340));
            lstRectangle.Add(new Rectangle(50, 400, 960, 340));
            lstRectangle.Add(new Rectangle(50, 450, 960, 340));

            _bg = content.Load<Texture2D>(@"Images/Menu/BgMenu");
            for (int i = 0; i < lstName.Count; i++)
            {
                FrameButton _btnTemp = new FrameButton(content, lstName[i], FrameButton.MyButtonAlignment.Left, lstRectangle[i]);
                _btn.Add(_btnTemp);
            }
        }
        public ScenePromote(ContentManager content)
        {
            _tex = content.Load<Texture2D>(@"Images/Background/bgPromote");

            _queen = new FrameButton(content, "Queen", FrameButton.MyButtonAlignment.Left, new Rectangle(300, 340, 960, 340));
            _rook = new FrameButton(content, "Rook", FrameButton.MyButtonAlignment.Left, new Rectangle(500, 340, 960, 340));
            _bishop = new FrameButton(content, "Bishop", FrameButton.MyButtonAlignment.Left, new Rectangle(300, 400, 960, 340));
            _knight = new FrameButton(content, "Knight", FrameButton.MyButtonAlignment.Left, new Rectangle(500, 400, 960, 340));
        }
示例#3
0
 SceneMenu(ContentManager content, List<String> lstName, List<Rectangle> lstRectangle)
 {
     _bg = content.Load<Texture2D>(@"Images/Menu/BgMenu");
     for(int i = 0; i < lstName.Count; i++)
     {
         FrameButton _btnTemp = new FrameButton(content, lstName[i], FrameButton.MyButtonAlignment.Left, lstRectangle[i]);
         _btn.Add(_btnTemp);
     }
 }
示例#4
0
        public SceneOption(ContentManager content)
        {
            _tex = content.Load<Texture2D>(@"Images/Background/bgOption");

            _btnY = new FrameButton(content, "Yes", FrameButton.MyButtonAlignment.Left, new Rectangle(360, 340, 960, 340));
            _btnN = new FrameButton(content, "No", FrameButton.MyButtonAlignment.Left, new Rectangle(500, 340, 960, 340));

            _On = new FrameButton(content, "On", FrameButton.MyButtonAlignment.Left, new Rectangle(430, 420, 960, 340));
            _Off = new FrameButton(content, "Off", FrameButton.MyButtonAlignment.Left, new Rectangle(430, 420, 960, 340));
        }
        public SceneChessBoard(ContentManager content, GraphicsDevice graphicsDevice)
        {
            //Get the current presentation parameters
            var pp = graphicsDevice.PresentationParameters;
            //Create our new render target
            mainRenderTarget = new RenderTarget2D(graphicsDevice,
                                 pp.BackBufferWidth, //Same width as backbuffer
                                 pp.BackBufferHeight, //Same height
                                 false, //No mip-mapping
                                 pp.BackBufferFormat, //Same colour format
                                 pp.DepthStencilFormat); //Same depth stencil

            camera = new PerspectiveCamera();
            float t = Util.cellWidthSpace;
            ((PerspectiveCamera)camera).Initialize(
                new Vector3(-t * 4, 20, t * 4),
                new Vector3(t * 4, 0, t * 4),
                Vector3.Up,
                MathHelper.PiOver4,
                (float)Util.screenWidth /
                (float)Util.screenHeight,
                1, 1000);

            Vector3 rotation = Vector3.Zero;
            float scale = Util.chessPieceScale;

            for (int i = 0; i < 64; ++i)
            {
                int nk = _sampleBoard[i];
                switch (Math.Abs(nk))
                {
                    case 0:
                        pieces[i] = null;
                        break;
                    case 1:
                        pieces[i] = new Pawn(nk > 0, content, rotation, scale, i % 8, i / 8);
                        break;
                    case 2:
                        pieces[i] = new Rook(nk > 0, content, rotation, scale, i % 8, i / 8);
                        break;
                    case 3:
                        pieces[i] = new Knight(nk > 0, content, rotation, scale, i % 8, i / 8);
                        break;
                    case 4:
                        pieces[i] = new Bishop(nk > 0, content, rotation, scale, i % 8, i / 8);
                        break;
                    case 5:
                        pieces[i] = new Queen(nk > 0, content, rotation, scale, i % 8, i / 8);
                        break;
                    case 6:
                        pieces[i] = new King(nk > 0, content, rotation, scale, i % 8, i / 8);
                        break;
                }
            }

            board = new ChessBoard(@"Terrains/BoardGray128", content, Matrix.CreateScale(Util.boardScale));
            circlePos = new PlanarObject(content, @"Terrains/circlePos", 2);
            circleHover = new PlanarObject(content, @"Terrains/circleHover", 2);
            circleDie = new PlanarObject(content, @"Terrains/circleDie", 2);
            circleSpecial = new PlanarObject(content, @"Terrains/circleSpecial", 2);
            circleSelect = new PlanarObject(content, @"Terrains/circleSelect", 2);
            circleCheck = new PlanarObject(content, @"Terrains/circleCheck", 2);

            avatarW = content.Load<Texture2D>(@"Images/Avatar/avatarW");
            avatarB = content.Load<Texture2D>(@"Images/Avatar/avatarB");
            avatarBorder = content.Load<Texture2D>(@"Images/Avatar/avatarBorder");

            surrender = new FrameButton(content, "Surrender", FrameButton.MyButtonAlignment.Left, new Rectangle(360, avatarMargin, 960, 340));
            back = new FrameButton(content, "Back", FrameButton.MyButtonAlignment.Left, new Rectangle(600, avatarMargin, 960, 340));

            landscape = new Model3D(@"Models/scene_e", content, Matrix.Identity, new Vector3(7.2f, 0.8f, 4.8f * 3));
        }