Esempio n. 1
0
        protected void LateInit()
        {
            levelSelect = new Menu();
            res.AddView("levelSelect", levelSelect);
            mainMenu = new Menu();
            res.AddView("mainMenu", mainMenu);

            var tempPos = new Vector2(Globals.SCREEN_WIDTH / 6, 280);

            Directory.EnumerateFiles("Levels").ToList().ForEach(element =>
            {
                res.AddView(element, Parser.ParseLevel(element, res));
                levelSelect.AddInteractive(new Button(
                                               System.IO.Path.GetFileNameWithoutExtension(element),
                                               res.GetFont("Forced"),
                                               tempPos,
                                               Color.White,
                                               Color.Yellow,
                                               ViewEvent.ChangeView(res.GetView(element))));
                if (tempPos.Y < Globals.SCREEN_HEIGHT - 100)
                {
                    tempPos.Y += 100;
                }
                else
                {
                    tempPos.Y += 280; tempPos.X += Globals.SCREEN_WIDTH / 6;
                }
            });


            levelSelect.AddStatic(new Text("Select Level", res.GetFont("Earth Orbiter"), new Vector2(Globals.SCREEN_WIDTH / 2, 100), Color.Yellow, Align.Center));
            levelSelect.BackEvent = ViewEvent.ChangeView(res.GetView("mainMenu"));

            mainMenu.AddStatic(new Text(
                                   "Void Warrior",
                                   res.GetFont("Earth Orbiter"),
                                   new Vector2(Globals.SCREEN_WIDTH / 2, 100),
                                   Color.Yellow,
                                   Align.Center));
            mainMenu.AddInteractive(new Button(
                                        "Start",
                                        res.GetFont("Guardians"),
                                        new Vector2(Globals.SCREEN_WIDTH / 2, 400),
                                        Color.White, Color.Yellow,
                                        ViewEvent.ChangeView(levelSelect),
                                        Align.Center));
            mainMenu.AddInteractive(new Button(
                                        "Quit",
                                        res.GetFont("Guardians"),
                                        new Vector2(Globals.SCREEN_WIDTH / 2, 500),
                                        Color.White, Color.Yellow,
                                        ViewEvent.Back,
                                        Align.Center));

            currentView = mainMenu;



            //controllerStatus = new Text(Input.GamepadConnected.ToString(), res.GetFont("Guardians"), 0, 0, Color.White);
            parallax = new Parallax(res.GetTexture("BackgroundBack"), res.GetTexture("BackgroundFront"));
        }