Ejemplo n.º 1
0
 public bool LoadStoryMode()
 {
     this.CustomGame = false;
     this._mapIndex++;
     if (File.Exists(string.Format("maps\\{0}.stage", _mapIndex)))
         this._map = new Map(string.Format("maps\\{0}.stage", _mapIndex));
     else
         return true;
     return false;
 }
Ejemplo n.º 2
0
        public static IScreen StartNewGame(bool story, int players, Map map)
        {
            OptionTextbox[] textboxes = new OptionTextbox[players];
            for (int i = 0; i < players; i++)
                textboxes[i] = new OptionTextbox("Player " + (i + 1), 12);

            Menu m = new Menu(new Option("-"), new Option("Start Game", 0), new Option("Back", 1));
            m.Options.InsertRange(0, textboxes);
            switch (m.Start(35, 7))
            {
                case 0:
                    for (int i = 0; i < players; i++)
                        if (string.IsNullOrEmpty(textboxes[i].Text))
                        {
                            m.Clear();
                            Menu msub = new Menu(Label.CreateLabelArrayFromText(
            "\nYou have to specify a name in\norder to start a new game."));
                            msub.Start(-1, 20);
                            msub.Clear();
                            return StartNewGame(story, players, map);
                        }
                    Game g = new Game();
                    for (int i = 0; i < players; i++)
                    {
                        Player p = new Player(i);
                        p.Name = textboxes[i].Text;
                        g.Players[i] = p;
                    }
                    for (int i = players; i < 4; i++)
                        g.Players[i] = null;

                    if (story)
                        g.LoadStoryMode();
                    else
                        g.Map = map;
                    g.CustomGame = !story;

                    if (Game.Network != null)
                    {
                        Game.Network.Dispose();
                        Game.Network = null;
                    }

                    return new Shop(g);

            }
            m.Clear();
            return null;
        }
Ejemplo n.º 3
0
 public Board(Game game, Map map)
     : this(game)
 {
     _map = map;
 }