示例#1
0
/*
 *      public void ReloadContent(ContentManager content, Camera camera, Map.Map map, StackScreenManager screenManager, ref Director director)
 *      {
 *          director.GetInputManager.FlagForAddition(this);
 *          mFont = content.Load<SpriteFont>("LibSans14");
 *          mCamera = camera;
 *          mMap = map;
 *          mScreenManager = screenManager;
 *      }
 */

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            spriteBatch.FillRectangle(new Rectangle(10, 0, 400, 550), new Color(Color.Black, 0.8f));
            spriteBatch.DrawRectangle(new Rectangle(10, 0, 400, 550), Color.Black, 10f);

            spriteBatch.DrawString(mFont, "Camera", new Vector2(15, 15), Color.White);
            spriteBatch.DrawString(mFont, "ScreenX: " + mCamera.GetRelativePosition().X, new Vector2(30, 50), Color.White);
            spriteBatch.DrawString(mFont, "ScreenY: " + mCamera.GetRelativePosition().Y, new Vector2(30, 70), Color.White);
            spriteBatch.DrawString(mFont, "Width: " + mCamera.GetSize().X, new Vector2(30, 90), Color.White);
            spriteBatch.DrawString(mFont, "Height: " + mCamera.GetSize().Y, new Vector2(30, 110), Color.White);
            spriteBatch.DrawString(mFont, "Zoom: " + mCamera.GetZoom(), new Vector2(30, 130), Color.White);

            spriteBatch.DrawLine(100, 24, 300, 24, Color.White);
            spriteBatch.DrawLine(20, 50, 20, 170, Color.White);
            spriteBatch.DrawLine(20, 170, 300, 170, Color.White);
            spriteBatch.DrawLine(300, 24, 300, 170, Color.White);



            spriteBatch.DrawString(mFont, "GameObjects", new Vector2(15, 200), Color.White);
            spriteBatch.DrawString(mFont, "PlatformCount: " + mMap.GetStructureMap().GetPlatformList().Count + ", " + mActivePlatforms + ", " + mDeactivePlatforms, new Vector2(30, 235), Color.White);
            spriteBatch.DrawString(mFont, "GraphCount: " + mMap.GetStructureMap().GetGraphCount(), new Vector2(30, 255), Color.White);
            spriteBatch.DrawString(mFont, "MilitaryUnitCount: " + mDirector.GetMilitaryManager.TotalUnitCount, new Vector2(30, 275), Color.White);
            spriteBatch.DrawString(mFont, "GeneralUnitCount: " + mGenUnitCount, new Vector2(30, 295), Color.White);

            spriteBatch.DrawLine(150, 209, 300, 209, Color.White);
            spriteBatch.DrawLine(20, 235, 20, 335, Color.White);
            spriteBatch.DrawLine(20, 335, 300, 335, Color.White);
            spriteBatch.DrawLine(300, 209, 300, 335, Color.White);


            spriteBatch.DrawString(mFont, "EnemyDifficulty: " + mDirector.GetStoryManager.Level.Ai?.Difficulty, new Vector2(15, 355), Color.White);
            spriteBatch.DrawString(mFont, "FPS: " + mFps, new Vector2(15, 395), Color.White);
            spriteBatch.DrawString(mFont, "UPS: " + mUps, new Vector2(15, 415), Color.White);

            mFowButton.Draw(spriteBatch);
            mWinButton.Draw(spriteBatch);
            mLoseButton.Draw(spriteBatch);

            //spriteBatch.DrawString(mFont, "FPS: " + mCurrentFps, new Vector2(15, 200), Color.White);
            spriteBatch.End();
        }
示例#2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            // if you're interested in whats going on here, refer to the documentation of the FogOfWar class.

            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, mTransformMatrix);

            foreach (var drawable in mDrawables)
            {
                drawable.Draw(spriteBatch);
            }

            spriteBatch.End();

            if (GlobalVariables.FowEnabled)
            {
                mFow.DrawMasks(spriteBatch);

                spriteBatch.Begin(SpriteSortMode.FrontToBack,
                                  BlendState.AlphaBlend,
                                  null,
                                  mFow.GetApplyMaskStencilState(),
                                  null,
                                  null,
                                  mTransformMatrix);

                mMap.GetStructureMap().Draw(spriteBatch);
                mMap.GetResourceMap().Draw(spriteBatch);

                foreach (var spatial in mSpatialObjects)
                {
                    spatial.Draw(spriteBatch);
                }

                spriteBatch.End();

                mFow.FillInvertedMask(spriteBatch);
            }
            else
            {
                spriteBatch.Begin(SpriteSortMode.FrontToBack,
                                  BlendState.AlphaBlend,
                                  null,
                                  null,
                                  null,
                                  null,
                                  mTransformMatrix);

                mMap.GetStructureMap().Draw(spriteBatch);
                mMap.GetResourceMap().Draw(spriteBatch);

                foreach (var spatial in mSpatialObjects)
                {
                    spatial.Draw(spriteBatch);
                }

                spriteBatch.End();
            }

            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, mTransformMatrix);

            mMap.GetStructureMap().DrawAboveFow(spriteBatch);

            spriteBatch.End();
        }