public virtual void LoadContent(GraphicsDevice graphicsDevice,
                                        ContentManager contentManager, ScreenDescription screenDescription)
        {
            ExecutionState = InnerExecutionState.INIT;
            var width  = (int)screenDescription.ScreenSizeInformation.WidhtInnerScreen;
            var height = (int)screenDescription.ScreenSizeInformation.HeightInnerScreen;

            _spriteBatch = new SpriteBatch(graphicsDevice);

            List <GameObject> gameObjects = new List <GameObject>();

            foreach (GameObjectDescription description in screenDescription.Items)
            {
                var texture = contentManager.Load <Texture2D>(description.AssetName);
                var obj     = GameObjectBuilder.Create()
                              .SetPosition(description.CurrentPosition.X, description.CurrentPosition.Y)
                              .SetOrientation(description.ObjectOrientation)
                              .SetAssetName(description.AssetName)
                              .SetSize((int)description.Width, (int)description.Height)
                              .SetObjectType(description.GameObjectType)
                              .Build(contentManager);
                gameObjects.Add(obj);
            }

            var background = contentManager.Load <Texture2D>(screenDescription.AssetNameBackground);

            _gameMediator = new GameMediator(screenDescription.ScreenSizeInformation);
            _gameMediator.Set(gameObjects.ToArray());

            _gameMediator.SetBackground(background);

            // TODO remove after test
            _gameMediator.Set(contentManager.Load <SpriteFont>("Labels/LabelLarge"));
        }
        internal static ScreenDescription CreateTestLevelScreen(ScreenSizeInformation info)
        {
            float WALL_THICKNESS = 10 * info.ScaleFactor;

            float width  = info.WidhtInnerScreen;
            float height = info.HeightInnerScreen;

            List <GameObjectDescription> descriptions = new List <GameObjectDescription>
            {
                new GameObjectDescription()
                {
                    AssetName         = "wallvertical",
                    CurrentPosition   = new Vector2(150, 200),
                    Width             = WALL_THICKNESS * info.ScaleFactor,
                    Height            = 500 * info.ScaleFactor,
                    ObjectOrientation = ObjectOrientation.Vertical,
                    Stability         = 100000,
                    GameObjectType    = GameObjectType.WALL
                },
                new GameObjectDescription()
                {
                    AssetName         = "blockredgray",
                    CurrentPosition   = new Vector2(350, 700),
                    Width             = 50 * info.ScaleFactor,
                    Height            = 50 * info.ScaleFactor,
                    ObjectOrientation = ObjectOrientation.Vertical,
                    Stability         = 1000,
                    GameObjectType    = GameObjectType.BLOCK
                }
            };

            descriptions.AddRange(CreateArenaBorder(width, height, info.ScaleFactor));
            descriptions.Add(CreateBall(info.ScaleFactor));

            ScreenDescription testscreen = ScreenDescription.Create(info, descriptions, "BackgroundMamor",
                                                                    WellKnownGameScreenExecutions.RUNNING_GAME_BALANCE_SCREEN, TimeSpan.FromDays(1));

            return(testscreen);
        }
 private void LoadGameLevelScreen(GraphicsDevice graphicsDevice, ContentManager contentManager, ScreenDescription desc)
 {
     _currentExecutionScreen = GameScreenExecutionProvider.CreateGameScreenExecution(graphicsDevice, contentManager, desc);
 }
 private void LoadScreen(GraphicsDevice graphicsDevice, ContentManager contentManager, ScreenDescription desc)
 {
     LoadGameLevelScreen(graphicsDevice, contentManager, desc);
 }
        internal static IGameScreenExecution CreateGameScreenExecution(GraphicsDevice graphicsDevice,
                                                                       ContentManager contentManager, ScreenDescription screenDescription)
        {
            IGameScreenExecution execution = null;

            if (screenDescription.Id.Equals(WellKnownGameScreenExecutions.MENUE_MAIN_SCREEN))
            {
                var item   = new MainMenue();
                var screen = GlobalScreenDescriptionCreator
                             .CreateMainScreen(screenDescription.ScreenSizeInformation);
                item.LoadContent(graphicsDevice, contentManager, screen);
                return(item);
            }
            else if (screenDescription.Id.Equals(WellKnownGameScreenExecutions.RUNNING_GAME_BALANCE_SCREEN))
            {
                var item   = new BallBallanceLevel();
                var screen = GlobalScreenDescriptionCreator
                             .CreateTestLevelScreen(screenDescription.ScreenSizeInformation);
                item.LoadContent(graphicsDevice, contentManager, screen);
                return(item);
            }

            return(execution);
        }
Exemple #6
0
 public void LoadContent(GraphicsDevice graphicsDevice, ContentManager contentManager, ScreenDescription screenDescription)
 {
     throw new NotImplementedException();
 }
        internal static ScreenDescription CreateMainScreen(ScreenSizeInformation info)
        {
            ScreenDescription mainscreen = ScreenDescription.Create(info, null, "RollingBallsMainScreen", WellKnownGameScreenExecutions.MENUE_MAIN_SCREEN, TimeSpan.FromDays(360));

            return(mainscreen);
        }
 public override void LoadContent(GraphicsDevice graphicsDevice,
                                  ContentManager contentManager, ScreenDescription screenDescription)
 {
     base.LoadContent(graphicsDevice, contentManager, screenDescription);
 }