Exemple #1
0
        private void StandardInitialization(ContentManager content)
        {
            //Load stuff
            var platformConeTexture  = content.Load <Texture2D>("Cones");
            var platformCylTexture   = content.Load <Texture2D>("Cylinders");
            var platformBlankTexture = content.Load <Texture2D>("PlatformBasic");
            var platformDomeTexture  = content.Load <Texture2D>("Dome");
            var mapBackground        = content.Load <Texture2D>("backgroundGrid");
            var libSans12            = content.Load <SpriteFont>("LibSans12");

            PlatformFactory.Init(platformConeTexture, platformCylTexture, platformDomeTexture, platformBlankTexture, libSans12);
            StructureLayoutHolder.Initialize(ref mDirector);

            //Map related stuff
            Camera = new Camera(mGraphics.GraphicsDevice, ref mDirector);
            mFow   = new FogOfWar(Camera, mGraphics.GraphicsDevice);

            var map = new Map.Map(mapBackground, 60, 60, mFow, Camera, ref mDirector);

            Map = map;
            var milUnitSheet  = content.Load <Texture2D>("UnitSpriteSheet");
            var milGlowSheet  = content.Load <Texture2D>("UnitGlowSprite");
            var genUnitSprite = content.Load <Texture2D>("GenUnit");

            MilitaryUnit.mMilSheet      = milUnitSheet;
            MilitaryUnit.mGlowTexture   = milGlowSheet;
            GeneralUnit.mGenUnitTexture = genUnitSprite;

            mDirector.GetMilitaryManager.SetMap(ref map);

            //INITIALIZE SCREENS
            GameScreen = new GameScreen(mGraphics.GraphicsDevice, ref mDirector, Map, Camera, mFow);
            Ui         = new UserInterfaceScreen(ref mDirector, Map, Camera, mScreenManager);
            mDirector.GetUserInterfaceController.ControlledUserInterface = Ui; // the UI needs to be added to the controller

            // the input manager keeps this from not getting collected by the GC
            mDebugscreen = new DebugScreen((StackScreenManager)mScreenManager, Camera, Map, ref mDirector);

            mDirector.GetInputManager.FlagForAddition(this);

            if (Ai != null)
            {
                GameScreen.AddObject(Ai);
            }
        }
Exemple #2
0
        public void ReloadContent(ContentManager content, GraphicsDeviceManager graphics, ref Director director, IScreenManager screenmanager)
        {
            mScreenManager = screenmanager;
            mGraphics      = graphics;
            //Load stuff
            var platformConeTexture  = content.Load <Texture2D>("Cones");
            var platformCylTexture   = content.Load <Texture2D>("Cylinders");
            var platformBlankTexture = content.Load <Texture2D>("PlatformBasic");
            var platformDomeTexture  = content.Load <Texture2D>("Dome");

            MilitaryUnit.mMilSheet    = content.Load <Texture2D>("UnitSpriteSheet");
            MilitaryUnit.mGlowTexture = content.Load <Texture2D>("UnitGlowSprite");
            var mapBackground = content.Load <Texture2D>("backgroundGrid");
            var libSans12     = content.Load <SpriteFont>("LibSans12");

            PlatformFactory.Init(platformConeTexture, platformCylTexture, platformDomeTexture, platformBlankTexture, libSans12);
            PlatformBlank.mLibSans12 = libSans12;
            director.ReloadContent(mDirector, Map.GetMeasurements(), content, mGraphics);
            mDirector = director;

            //Map related stuff
            Camera.ReloadContent(mGraphics, ref mDirector);
            mFow.ReloadContent(mGraphics, Camera);
            Ui = new UserInterfaceScreen(ref mDirector, Map, Camera, mScreenManager);
            Ui.LoadContent(content);
            Ui.Loaded = true;
            //This has to be after ui creation, because the ui graphid dictionary is updated in the structuremap.reloadcontent method
            Map.ReloadContent(mapBackground, Camera, mFow, ref mDirector, content, Ui);
            GameScreen.ReloadContent(content, graphics, Map, mFow, Camera, ref mDirector, Ui);
            mDirector.GetUserInterfaceController.ReloadContent(ref mDirector);
            mDirector.GetUserInterfaceController.ControlledUserInterface = Ui; // the UI needs to be added to the controller

            // Reload map for the military manager
            var map = Map;

            director.GetMilitaryManager.ReloadSetMap(ref map);
            // the input manager keeps this from not getting collected by the GC
            mDebugscreen = new DebugScreen((StackScreenManager)mScreenManager, Camera, Map, ref mDirector);
            mDirector.GetInputManager.FlagForAddition(this);

            //AI Stuff
            Ai?.ReloadContent(ref mDirector);
            StructureLayoutHolder.Initialize(ref mDirector);
        }