Exemplo n.º 1
0
        private void HandleRightButtonDown(MouseEventArgs e)
        {
            Position pos = GameGraphics.TranslateMousePosition(e.Location);

            if (!_isCreatingBuilding && !_isCreatingUnit)
            {
                BoardObject bo = boardObjectAt(pos);
                if (bo != null)
                {
                    _gameLogic.AttackOrder(bo);
                }
                else
                {
                    _gameLogic.MoveOrder(pos);
                }
                return;
            }

            if (_isCreatingBuilding)
            {
                _buildManager.OnBadLocation(_objectCreatorId);
            }

            _isCreatingUnit = false;
            InfoLog.WriteInfo("_isCreatingUnit = false; in HandleRightButtonDown", EPrefix.BMan);
            _isCreatingBuilding = false;
        }
Exemplo n.º 2
0
        private void openGLView_MouseMove(object sender, MouseEventArgs e)
        {
            if (_wasScrolled)
            {
                _wasScrolled = false;
                return;
            }

            if (_scrolling)
            {
                int dx = e.X - _mousePos.X;
                int dy = e.Y - _mousePos.Y;

                GameGraphics.OffsetX(-dx * 0.05f);
                GameGraphics.OffsetY(dy * 0.05f);                 //opengl uses different coordinate system

                _wasScrolled    = true;
                Cursor.Position = mapView.PointToScreen(_mousePos);
            }

            if (e.Button == MouseButtons.Left)
            {
                if (!_selecting)
                {
                    //_selectionStart = GameGraphics.TranslateMousePosition(e.Location);
                    //_selecting = true;
                }
                else
                {
                    _selectionEnd = e.Location;
                }
            }
        }
Exemplo n.º 3
0
        // Draws a rectangle with gradient path using the properties above
        public void Show(System.IntPtr winHandle)
        {
            //  If we wish to draw a simple solid triangle with a coloured border, we can use:
            //        GameGraphics.FillRectangle(New SolidBrush(ForeColor), Location.X, Location.Y, Size.Width, Size.Height)
            //        GameGraphics.FillRectangle(New SolidBrush(BackColor), Location.X + 1, Location.Y + 1, Size.Width - 2, Size.Height - 2)
            Graphics          GameGraphics;
            GraphicsPath      graphPath;
            PathGradientBrush brushSquare;

            Color[]   surroundColor;
            Rectangle rectSquare;

            // Gets the Graphics object of the background picture
            GameGraphics = Graphics.FromHwnd(winHandle);

            // Create a path consisting of one rectangle
            graphPath  = new GraphicsPath();
            rectSquare = new Rectangle(Location.X, Location.Y, Size.Width, Size.Height);
            graphPath.AddRectangle(rectSquare);

            // Creates the gradient brush which will draw the square
            // Note: Theres one center color and an array of border colors
            brushSquare                = new PathGradientBrush(graphPath);
            brushSquare.CenterColor    = ForeColor;
            surroundColor              = new Color[] { BackColor };
            brushSquare.SurroundColors = surroundColor;

            // Finally draws the square
            GameGraphics.FillPath(brushSquare, graphPath);
        }
Exemplo n.º 4
0
        public void MonoColorShow(System.IntPtr WinHandle)
        {
            Graphics          GameGraphics;
            GraphicsPath      graphPath;
            PathGradientBrush brushSquare;

            Color[]   surroundColor;
            Rectangle rectSquare;

            //获取Graphics对象
            GameGraphics = Graphics.FromHwnd(WinHandle);

            //创建一个由一个矩形构成的路径
            graphPath  = new GraphicsPath();
            rectSquare = new Rectangle(Location.X, Location.Y, size.Width, size.Height);
            graphPath.AddRectangle(rectSquare);

            //创建用于画矩形的路径画刷
            brushSquare                = new PathGradientBrush(graphPath);
            brushSquare.CenterColor    = ForeColor;
            surroundColor              = new Color[] { ForeColor };
            brushSquare.SurroundColors = surroundColor;

            //根据以上设置画出矩形路径
            GameGraphics.FillPath(brushSquare, graphPath);
        }
Exemplo n.º 5
0
        private void ShowHand_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            //绘画背景
            //CImageHandle ImageHandle(&m_ImageBack);
            GameGraphics.DrawImage(g, m_ImageBack, 0, 0, m_ImageBack.Width, m_ImageBack.Height, 0, 0);

            //设置 DC
            //dc.SetBkMode(TRANSPARENT);
            Brush textbrush = new SolidBrush(Color.Black);
            //dc.SetTextColor(RGB(0,0,0));
            //dc.SelectObject(CSkinResourceManager::GetDefaultFont());

            //创建字体
            Font ViewFont = new Font("Arial", 15);
            //ViewFont.CreateFont(-15,0,0,0,400,0,0,0,134,3,2,1,1,TEXT("Arial"));
            //CFont *pOldFont=dc.SelectObject(&ViewFont);

            string tCh = string.Format("{0}", m_bTimes);
            //TCHAR tCh[128]=TEXT("");
            //_snprintf(tCh,sizeof(tCh),TEXT("%ld"),m_bTimes);

            Rectangle rcScore = new Rectangle(85, 10, 85 + 65, 10 + 19);

            GameGraphics.DrawString(g, tCh, ViewFont, textbrush, rcScore);

            //还原字体
            //dc.SelectObject(pOldFont);
            //ViewFont.DeleteObject();
        }
Exemplo n.º 6
0
        //用梯度路径根据以上属性画矩形
        public void Show(System.IntPtr WinHandle)
        {
            Graphics          GameGraphics;
            GraphicsPath      graphPath;
            PathGradientBrush brushSquare;

            Color[]   surroundColor;
            Rectangle rectSquare;

            //获取Graphics对象
            GameGraphics = Graphics.FromHwnd(WinHandle);

            //创建一个由一个矩形构成的路径
            graphPath  = new GraphicsPath();
            rectSquare = new Rectangle(Location.X, Location.Y, size.Width, size.Height);
            graphPath.AddRectangle(rectSquare);

            //创建用于画矩形的路径画刷
            brushSquare                = new PathGradientBrush(graphPath);
            brushSquare.CenterColor    = ForeColor;
            surroundColor              = new Color[] { BackColor };
            brushSquare.SurroundColors = surroundColor;

            //根据以上设置画出矩形路径
            GameGraphics.FillPath(brushSquare, graphPath);

            SolidBrush BackColorBrush = new SolidBrush(GameField.BackColor);

            GameGraphics.FillRectangle(BackColorBrush, new Rectangle(Location, new Size(GameField.SquareRoundCorner, GameField.SquareRoundCorner)));
            GameGraphics.FillRectangle(BackColorBrush, new Rectangle(Location.X + size.Width - GameField.SquareRoundCorner, Location.Y, GameField.SquareRoundCorner, GameField.SquareRoundCorner));
            GameGraphics.FillRectangle(BackColorBrush, new Rectangle(Location.X, Location.Y + size.Height - GameField.SquareRoundCorner, GameField.SquareRoundCorner, GameField.SquareRoundCorner));
            GameGraphics.FillRectangle(BackColorBrush, new Rectangle(Location.X + size.Width - GameField.SquareRoundCorner, Location.Y + size.Height - GameField.SquareRoundCorner, GameField.SquareRoundCorner, GameField.SquareRoundCorner));
        }
Exemplo n.º 7
0
        public void HideToDelete(System.IntPtr WinHandle)
        {
            Graphics          GameGraphics;
            Rectangle         rectSquare;
            GraphicsPath      graphPath;
            PathGradientBrush brushSquare;

            Color[] surroundColor;

            DrawFrame(WinHandle);

            //获取Graphics对象
            GameGraphics = Graphics.FromHwnd(WinHandle);
            rectSquare   = new Rectangle(Location.X, Location.Y, size.Width, size.Height);
            graphPath    = new GraphicsPath();
            graphPath.AddRectangle(rectSquare);

            //创建用于画矩形的路径画刷
            brushSquare                = new PathGradientBrush(graphPath);
            brushSquare.CenterColor    = Color.FromArgb(133, 129, 166);
            surroundColor              = new Color[] { Color.FromArgb(37, 36, 52) };
            brushSquare.SurroundColors = surroundColor;

            //根据以上设置画出矩形路径
            GameGraphics.FillPath(brushSquare, graphPath);
        }
Exemplo n.º 8
0
        //调整控件
        void RectifyControl()
        {
            this.Left   = m_BasicPoint.X - m_nWidth;
            this.Top    = m_BasicPoint.Y - CONTROL_HEIGHT;
            this.Width  = m_nWidth;
            this.Height = CONTROL_HEIGHT;

            Rectangle  rcButton = new Rectangle();
            IntPtr     hDwp     = GameGraphics.BeginDeferWindowPos(32);
            const uint uFlags   = GameGraphics.SWP_NOACTIVATE | GameGraphics.SWP_NOZORDER | GameGraphics.SWP_NOCOPYBITS | GameGraphics.SWP_NOSIZE;

            //最大按钮
            //m_btMaxScore.GetWindowRect(&rcButton);
            rcButton.Width  = 47;
            rcButton.Height = 28;
            GameGraphics.DeferWindowPos(hDwp, m_btMaxScore.Handle, 0, 6, 7, 0, 0, uFlags);

            //最小按钮
            GameGraphics.DeferWindowPos(hDwp, m_btMinScore.Handle, 0, 6, CONTROL_HEIGHT - rcButton.Height - 9, 0, 0, uFlags);

            //确定按纽
            GameGraphics.DeferWindowPos(hDwp, m_btOK.Handle, 0, m_nWidth - rcButton.Width - 6, 7, 0, 0, uFlags);

            //加注按钮
            GameGraphics.DeferWindowPos(hDwp, m_btCancel.Handle, 0, m_nWidth - rcButton.Width - 6, CONTROL_HEIGHT - rcButton.Height - 9, 0, 0, uFlags);


            //结束移动
            GameGraphics.EndDeferWindowPos(hDwp);
            return;
        }
Exemplo n.º 9
0
        public GameScreen(Level level) : base()
        {
            _level = level;

            _gameLogic.Level = level;
            _gameGraphics    = new GameGraphics(level);

            _gameLogic.GameScreen = this;

            _inputManager.AddProlongedUserActionMapping(Key.W, UserAction.MoveUp);
            _inputManager.AddProlongedUserActionMapping(Key.A, UserAction.MoveLeft);
            _inputManager.AddProlongedUserActionMapping(Key.S, UserAction.MoveDown);
            _inputManager.AddProlongedUserActionMapping(Key.D, UserAction.MoveRight);

            _inputManager.AddProlongedUserActionMapping(Key.Up, UserAction.MoveUp);
            _inputManager.AddProlongedUserActionMapping(Key.Left, UserAction.MoveLeft);
            _inputManager.AddProlongedUserActionMapping(Key.Down, UserAction.MoveDown);
            _inputManager.AddProlongedUserActionMapping(Key.Right, UserAction.MoveRight);

            _inputManager.AddProlongedUserActionMapping(Key.E, UserAction.RotateMirrorCW);
            _inputManager.AddProlongedUserActionMapping(Key.Q, UserAction.RotateMirrorCCW);

            _inputManager.AddSingleUserActionMapping(Key.F, UserAction.ToggleMirrorLock);
            //_inputManager.AddSingleUserActionMapping(Key.G, UserAction.ToggleGodMode);
            _inputManager.AddSingleUserActionMapping(Key.P, UserAction.TogglePauseGame);
            //_inputManager.AddSingleUserActionMapping(Key.N, UserAction.ResetLevel);
            _inputManager.AddSingleUserActionMapping(Key.Escape, UserAction.OpenGameMenu);

            _gameLogic.InputManager = _inputManager;
        }
Exemplo n.º 10
0
 public Entities(Entities parent)
 {
     // copy
     this._graphics = parent._graphics;
     this._list     = parent._list;
     this._logic    = parent._logic;
 }
Exemplo n.º 11
0
 public Entity(Entities parent, EntityNames name = EntityNames.None)
     : base(parent)
 {
     this._graphics = parent.Graphics;
     this._logic    = parent.Logic;
     this._parent   = parent;
     this._uid      = name;
 }
Exemplo n.º 12
0
        public override void Start(Object swapChainPanel, int Width, int Height)
        {
            GameGraphics gg = new GameGraphics(swapChainPanel, Width, Height);

            Service.Register <GameGraphics>(gg);

            StartAfter();
        }
Exemplo n.º 13
0
        public Level8(
            GameState gameState,
            ScreenSpace screenSpace,
            GameGraphics graphics,
            ScreenController screenController)
            : base("Level 8", graphics, screenController, gameState, screenSpace)
        {
            var map =
                new Map(
                    screenSpace,
                    tileMap,
                    graphics
                    );

            entities.Add(map);

            levelState.Door = new Door(graphics.Door, 25, 1, screenSpace, levelState);
            entities.Add(levelState.Door);

            entities.Add(new LivesIndicator(graphics.Life, screenSpace, gameState));

            //entities.Add(new Bomb(graphics, 20, 32, 60, screenSpace, tileMap));
            //entities.Add(new Bomb(graphics, 12, 10, 15, screenSpace, tileMap));
            //entities.Add(new Bomb(graphics, 26, 5, 7, screenSpace, tileMap));

            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 7, 20, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 7, 30, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 21, 10, screenSpace));
            //  levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 18, 1, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 10, 7, screenSpace));
            //     levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 14, 1, screenSpace));

            //     levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 5, 5, screenSpace));
            entities.AddRange(levelState.Enemies);

            levelState.Evidence =
                new Evidence(
                    levelState,
                    graphics.Evidence,
                    //5, 3,
                    14, 2,
                    screenSpace
                    );

            entities.Add(levelState.Evidence);

            entities.Add(
                new Player(
                    gameState,
                    screenController,
                    graphics,
                    screenSpace,
                    map,
                    levelState,
                    screenSpace.GetTilePosition(1, 38)
                    )
                );
        }
Exemplo n.º 14
0
        public GameForm()
        {
            InitializeComponent();

            if (!Directory.Exists(gameFolder))
            {
                Directory.CreateDirectory(gameFolder);
            }

            settings = GameGraphicsSettings.LoadOrDefault(gameFolder + "graphics.json");
            chkShowTileLocations.Checked = settings.ShowTileNames;
            graphics         = new GameGraphics(gamePanel, settings);
            game             = new VolcanoGame();
            game.OnMoveMade += Game_OnMoveMade;

            gameTimer.Start();

            engines = new EngineHelper();
            engines.Add <BarricadeEngine>("Barricade");
            engines.Add <RandomEngine>("Random");
            engines.Add <DeepBeelineEngine>("Deep Beeline");
            engines.Add <MonteCarloBarricadeEngine>("Monte Carlo Barricade");
            engines.Add <MonteCarloBeelineRandParallelEngine>("Parallel MCTS Beeline");
            engines.Add <MonteCarloTreeSearchParallelEngine>("Parallel MCTS");
            engines.Add <MonteCarloBeelineThreeEngine>("Monte Carlo Beeline 3");
            engines.Add <MonteCarloBeelineFourEngine>("Monte Carlo Beeline 4");
            engines.Add <MonteCarloTreeSearchEngine>("Monte Carlo Tree Search");
            //engines.Add<MonteCarloBeelineParallelEngine>("Parallel MCTS Beeline Full");
            //engines.Add<MonteCarloBeelineParallelDeepEngine>("Parallel MCTS Beeline Sim");

            cbPlayerOne.Items.Add("Human");
            cbPlayerTwo.Items.Add("Human");
            cbPlayerOne.SelectedIndex = 0;
            cbPlayerTwo.SelectedIndex = 0;
            foreach (string engine in engines.EngineNames)
            {
                cbPlayerOne.Items.Add(engine);
                cbPlayerTwo.Items.Add(engine);
            }

            cbSeconds.SelectedIndex = 1;

            ConfigureComputer();

            menuStrip1.Renderer = new MenuProfessionalRenderer(new MenuColorTable());
            toolStrip1.Renderer = new MenuProfessionalRenderer(new MenuColorTable());
            toolStripContainer1.ContentPanel.RenderMode = ToolStripRenderMode.System;

            if (!string.IsNullOrEmpty(VolcanoGame.Settings.CustomSettingsFile))
            {
                lblStatusBar.Text = VolcanoGame.Settings.CustomSettingsFile + " loaded " + VolcanoGame.Settings.CustomSettingsTitle;
            }

            FileSystemWatcher graphicsSettingsFsw = new FileSystemWatcher(".", gameFolder + "graphics.json");

            graphicsSettingsFsw.EnableRaisingEvents = true;
            graphicsSettingsFsw.Changed            += GraphicsSettingsFsw_Changed;
        }
Exemplo n.º 15
0
 //==========================================================================
 //Draw map
 //==========================================================================
 public void DrawMap()
 {
     if (INITIALIZED && RUNNING)
     {
         GameGraphics.SmoothingMode = SmoothingMode.AntiAlias;
         GameGraphics.DrawImage(MapOutput, Character.GetPoint(Canvas));
         GameGraphics.DrawImage(Character.OImage, Canvas.Width / 2, Canvas.Height / 2);
     }
 }
Exemplo n.º 16
0
 private void miniMap_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         Position p = GameGraphics.TranslateMinimapMousePosition(e.Location);
         GameGraphics.centerOn(p);
         Console.Out.WriteLine(e.Location + " -> " + p);
     }
 }
Exemplo n.º 17
0
        //重画函数
        private void GoldControl_Paint(object sender, PaintEventArgs e)
        {
            if (GetGold() >= m_lMinGold)
            {
                m_btOK.Enabled = true;
            }
            else
            {
                m_btOK.Enabled = false;
            }

            Graphics g = e.Graphics;

            //获取位置
            Rectangle ClientRect = this.ClientRectangle;
            //GetClientRect(&ClientRect);

            //建立缓冲图
            Bitmap   BufferBmp  = new Bitmap(ClientRect.Width, ClientRect.Height, g);
            Graphics BackFaceDC = Graphics.FromImage(BufferBmp);

            //加载资源
            //CImageHandle ImageMidHandle(&m_ImageMid);
            //CImageHandle ImageLeftHandle(&m_ImageLeft);
            //CImageHandle ImageRightHandle(&m_ImageRight);

            //绘画背景
            GameGraphics.DrawImage(BackFaceDC, m_ImageLeft, 0, 0, m_ImageLeft.Width, m_ImageLeft.Height, 0, 0);

            Rectangle dstRect = new Rectangle(m_ImageLeft.Width, 0, ClientRect.Width - m_ImageRight.Width, m_ImageMid.Height);
            Rectangle srcRect = new Rectangle(0, 0, m_ImageMid.Width, m_ImageMid.Height);

            g.DrawImage(m_ImageMid, dstRect, srcRect, GraphicsUnit.Pixel);

            //GameGraphics.DrawImage(BackFaceDC, m_ImageMid, m_ImageLeft.Width, 0, , , 0, 0);
            GameGraphics.DrawImage(BackFaceDC, m_ImageRight, ClientRect.Width - m_ImageRight.Width, 0, m_ImageRight.Width, m_ImageRight.Height, 0, 0);

            //绘画金币
            int nXExcursion = ClientRect.Width - RIGHT_WIDTH;

            for (int i = 0; i < m_nCellCount; i++)
            {
                //绘画逗号
                if ((i != 0) && (i % 3) == 0)
                {
                    nXExcursion -= IMAGE_WIDTH;
                    DrawGoldCell(BackFaceDC, nXExcursion, 12, 10);
                }

                //绘画数字
                nXExcursion -= IMAGE_WIDTH;
                DrawGoldCell(BackFaceDC, nXExcursion, 12, m_lGoldCell[i]);
            }

            //绘画界面
            GameGraphics.DrawImage(g, BufferBmp, 0, 0, ClientRect.Width, ClientRect.Height, 0, 0);
        }
Exemplo n.º 18
0
 private void HandleLeftButtonUp(MouseEventArgs e)
 {
     if (_selecting)
     {
         _selecting         = false;
         this._selectionEnd = e.Location;
         _gameLogic.Select(GameGraphics.TranslateMousePosition(_selectionStart), GameGraphics.TranslateMousePosition(_selectionEnd));
     }
 }
Exemplo n.º 19
0
        public Level9(
            GameState gameState,
            ScreenSpace screenSpace,
            GameGraphics graphics,
            ScreenController screenController)
            : base("Level 9", graphics, screenController, gameState, screenSpace)
        {
            var map =
                new Map(
                    screenSpace,
                    tileMap,
                    graphics
                    );

            entities.Add(map);

            levelState.Door = new Door(graphics.Door, 25, 1, screenSpace, levelState);
            entities.Add(levelState.Door);

            entities.Add(new LivesIndicator(graphics.Life, screenSpace, gameState));

            entities.Add(new Bomb(graphics, 18, 16, 30, screenSpace, tileMap));
            entities.Add(new Bomb(graphics, 13, 9, 15, screenSpace, tileMap));
            entities.Add(new Bomb(graphics, 26, 5, 7, screenSpace, tileMap));

            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 26, 13, screenSpace));
            //      levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 23, 31, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 26, 31, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 26, 38, screenSpace));
            //  levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 5, 5, screenSpace));
            entities.AddRange(levelState.Enemies);

            levelState.Evidence =
                new Evidence(
                    levelState,
                    graphics.Evidence,
                    3, 37,
                    // 26, 10,
                    screenSpace
                    );

            entities.Add(levelState.Evidence);

            entities.Add(
                new Player(
                    gameState,
                    screenController,
                    graphics,
                    screenSpace,
                    map,
                    levelState,
                    //   screenSpace.GetTilePosition(screenSpace.LastRow - 6, 34)
                    screenSpace.GetTilePosition(screenSpace.LastRow - 2, 1)
                    )
                );
        }
Exemplo n.º 20
0
        // 在指定位置绘制一张牌, bCardData为0时绘制背面
        public void DrawOneCard(Graphics g, byte bCardData, int nX, int nY)
        {
            //变量定义

            Color clrTrans = Color.FromArgb(255, 0, 255);

            //CImageHandle HandleCard(&m_ImageCard);

            GameGraphics.DrawAlphaImage(g, m_ImageCard, nX, nY, SMALL_CARD_WIDTH, SMALL_CARD_HEIGHT, 0, 0, clrTrans);
            return;
        }
Exemplo n.º 21
0
        void Instance_GameInitialization(object sender, GameInitEventArgs e)
        {
            //Jeœli nie bêdzie jednostki to siê samo nie wycentruje
            List <Unit> units = _gameLogic.CurrentPlayer.GetAllUnits();

            if (units.Count == 0)
            {
                return;
            }
            GameGraphics.centerOn(units[0].Position);
        }
Exemplo n.º 22
0
        //消去矩形
        public void Hide(System.IntPtr WinHandle)
        {
            Graphics  GameGraphics;
            Rectangle rectSquare;

            //获取Graphics对象
            GameGraphics = Graphics.FromHwnd(WinHandle);

            //消去图形
            rectSquare = new Rectangle(Location.X, Location.Y, size.Width, size.Height);
            GameGraphics.FillRectangle(new SolidBrush(GameField.BackColor), rectSquare);
        }
Exemplo n.º 23
0
        public void Hide(System.IntPtr winHandle)
        {
            Graphics  GameGraphics;
            Rectangle rectSquare;

            // Gets the Graphics object of the background picture
            GameGraphics = Graphics.FromHwnd(winHandle);

            // Since we are working in a solid background, we can just draw a solid rectangle in order to "hide" the current square
            rectSquare = new Rectangle(Location.X, Location.Y, Size.Width, Size.Height);
            GameGraphics.FillRectangle(new SolidBrush(GameField.BackColor), rectSquare);
        }
Exemplo n.º 24
0
        //绘画金币
        void DrawGoldCell(Graphics g, int nXPos, int nYPox, int lGold)
        {
            //CImageHandle ImageNumberHandle(&m_ImageNumber);
            if (lGold < 10)
            {
                GameGraphics.DrawImage(g, m_ImageNumber, nXPos, nYPox, IMAGE_WIDTH, IMAGE_HEIGHT, lGold * IMAGE_WIDTH, 0);
            }
            else
            {
                GameGraphics.DrawImage(g, m_ImageNumber, nXPos, nYPox, IMAGE_WIDTH, IMAGE_HEIGHT, 10 * IMAGE_WIDTH, 0);
            }

            return;
        }
Exemplo n.º 25
0
        private void HandleLeftButtonDown(MouseEventArgs e)
        {
            Position pos = GameGraphics.TranslateMousePosition(e.Location);

            if (this._isCreatingBuilding)
            {
                _gameLogic.CreateBuilding(pos, _objectToCreateId, _objectCreatorId);
                this._isCreatingBuilding = false;
                InfoLog.WriteInfo("_isCreatingUnit = false; in HandleLeftButtonDown", EPrefix.BMan);
                return;
            }

            _selecting      = true;
            _selectionStart = _selectionEnd = e.Location;
        }
Exemplo n.º 26
0
        public Level4(
            GameState gameState,
            ScreenSpace screenSpace,
            GameGraphics graphics,
            ScreenController screenController)
            : base("Level 4", graphics, screenController, gameState, screenSpace)
        {
            var map =
                new Map(
                    screenSpace,
                    tileMap,
                    graphics
                    );

            entities.Add(map);

            levelState.Door = new Door(graphics.Door, 18, 10, screenSpace, levelState);
            entities.Add(levelState.Door);

            entities.Add(new LivesIndicator(graphics.Life, screenSpace, gameState));

            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 26, 25, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 26, 32, screenSpace));
            levelState.Enemies.Add(new EnemyStyle1(graphics.Enemy, map, 26, 37, screenSpace));
            entities.AddRange(levelState.Enemies);

            levelState.Evidence =
                new Evidence(
                    levelState,
                    graphics.Evidence,
                    5, 3,
                    screenSpace
                    );

            entities.Add(levelState.Evidence);

            entities.Add(
                new Player(
                    gameState,
                    screenController,
                    graphics,
                    screenSpace,
                    map,
                    levelState,
                    screenSpace.GetTilePosition(screenSpace.LastRow - 2, 1)
                    )
                );
        }
Exemplo n.º 27
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameGraphics.Load(Content);

            State = GameState.Prototype;

            PresentationParameters pp = GraphicsDevice.PresentationParameters;

            renderTarget = new RenderTarget2D(GraphicsDevice, NativeResolution.Width, NativeResolution.Height, true, GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24);


            // TODO: use this.Content to load your game content here
        }
Exemplo n.º 28
0
        private void HandleMiniMapRightButtonDown(MouseEventArgs e)
        {
            Position p = GameGraphics.TranslateMinimapMousePosition(e.Location);

            validateMapPosition(ref p);
            BoardObject bo = boardObjectAt(p);

            if (bo != null)
            {
                _gameLogic.AttackOrder(bo);
            }
            else
            {
                _gameLogic.MoveOrder(p);
            }
        }
Exemplo n.º 29
0
        public Level2(
            GameState gameState,
            ScreenSpace screenSpace,
            GameGraphics graphics,
            ScreenController screenController)
            : base("Level 2", graphics, screenController, gameState, screenSpace)
        {
            var map =
                new Map(
                    screenSpace,
                    tileMap,
                    graphics
                    );

            entities.Add(map);

            levelState.Door = new Door(graphics.Door, 25, 1, screenSpace, levelState);
            entities.Add(levelState.Door);

            entities.Add(new LivesIndicator(graphics.Life, screenSpace, gameState));

            entities.AddRange(levelState.Enemies);

            levelState.Evidence =
                new Evidence(
                    levelState,
                    graphics.Evidence,
                    26, 10,
                    screenSpace
                    );

            entities.Add(levelState.Evidence);

            entities.Add(
                new Player(
                    gameState,
                    screenController,
                    graphics,
                    screenSpace,
                    map,
                    levelState,
                    screenSpace.GetTilePosition(3, 37)
                    )
                );
        }
Exemplo n.º 30
0
        //设置光标
        private void GoldControl_MouseMove(object sender, MouseEventArgs e)
        {
            //获取鼠标
            Point point = e.Location;

            //设置光标
            int nHeadWidth     = LEFT_WIDTH;
            int nViewCellCount = (m_nCellCount - 1) / 3 + m_nCellCount;

            if ((point.Y > 5) && (point.Y < 65) && (point.X > nHeadWidth) && (point.X < (CELL_WIDTH * nViewCellCount + nHeadWidth)))
            {
                int iCellPos = (m_nCellCount - (point.X - nHeadWidth) / CELL_WIDTH);
                if ((iCellPos != 3) && (iCellPos != 7))
                {
                    this.Cursor = GameGraphics.LoadCursorFromResource(Properties.Resources.CARD_CUR);
                }
            }
        }