示例#1
0
        public MenuModule Create(Bank bank, Dictionary <string, Shape> shipList,
                                 Dictionary <string, Level> levelList, IReceiveMenuData receiver, ExitGame exit)
        {
            //spawn asteroids
            Level           menuScene     = levelList["MenuScene"];
            EntityHandler   entityHandler = new EntityHandler(null, menuScene.PlayArea);
            AsteroidFactory asteroidFac   = new AsteroidFactory(entityHandler);
            string          asteroidPath  = SwinGame.AppPath() + "\\resources\\data\\asteroids\\asteroid.json";

            for (int i = 0; i < menuScene.AsteroidsToSpawn; i++)
            {
                Asteroid toSpawn = asteroidFac.Create(asteroidPath, menuScene.PlayArea);
                entityHandler.Track(toSpawn);
            }

            MenuModule result = new MenuModule(new MenuSendData(receiver), bank, shipList, levelList, menuScene, entityHandler, exit);

            MenuFactory menuFac = new MenuFactory(dirPath, result);

            result.AddMenu(menuFac.CreateNormalMenu("\\help.json"));
            result.AddMenu(menuFac.CreateHighscoreMenu("\\highscores.json"));
            result.AddMenu(menuFac.CreateNormalMenu("\\main.json"));
            result.AddMenu(menuFac.CreateNormalMenu("\\options.json"));
            result.AddMenu(menuFac.CreateNormalMenu("\\scorescreen.json"));
            result.AddMenu(menuFac.CreateSelectMenu("\\select.json", shipList, levelList));

            result.ChangeMenu("Main");

            return(result);
        }
示例#2
0
 public MenuSendData(IReceiveMenuData receiver)
 {
     selections    = new Dictionary <SelectionType, string>();
     this.receiver = receiver;
 }