Наследование: MenuComponent
Пример #1
0
        public WinScreen(bool won)
        {
            buttons = new List<MenuComponent>();

            if (won) message = new TextLine(new Rectangle(300, 200, 200, 40), "You Won! The Galaxy is yours.");
            else message = new TextLine(new Rectangle(300, 200, 200, 40), "You Lost! Everyone is dead.");
            buttons.Add(message);

            //buttons.Add(new MenuButton(new Rectangle(325, 200, 150, 40), "Singleplayer", MenuManager.ClickMapSelect));
            //buttons.Add(new MenuButton(new Rectangle(325, 250, 150, 40), "Multiplayer", MenuManager.ClickGlobalLobby));
            buttons.Add(new MenuButton(new Rectangle(325, 300, 150, 40), "OK", MenuManager.ClickTitle));
        }
Пример #2
0
        public TopMenu(Rectangle r, GameScreen gs)
            : base(r)
        {
            //wierd syntax
            padding = 5;
            gamescreen = gs;
            this.currentcolor = new Color(0, 0, 0, 150);

            this.Add(new TextLine(this.area,gamescreen.space.ToString()));
            this.Add(new MenuButton(new Rectangle(area.Left + 200, area.Top, 100, area.Height), "Options", MenuManager.ClickMusicOptions ));
            this.Add(new MenuButton(new Rectangle(area.Left + 350, area.Top, 100, area.Height), "Quit", Quitter));

            resource = new TextLine(new Rectangle(area.Right - 100, area.Top, 100, area.Height), "banana");
            this.Add(resource);
        }
Пример #3
0
        public TelescopeMenu(Rectangle r, Player p)
        {
            plyr = p;
            area = r;
            texture = new Texture2D(MenuManager.batch.GraphicsDevice, 1, 1, true, SurfaceFormat.Color);
            texture.SetData(new[] { Color.White });
            planets = new TextLine(new Rectangle(area.Left + 5, area.Top + 30, 200, 20), "dummy1");
            asteroids = new TextLine(new Rectangle(area.Left + 5, area.Top + 50, 200, 20), "dummy2");
            ships = new TextLine(new Rectangle(area.Left + 5, area.Top + 70, 200, 20), "dummy3");
            header = new TextLine(new Rectangle(area.Left + 5, area.Top + 10, 200, 20), "Object:    Friend Foe Total");

            menucomponents.Add(header);
            menucomponents.Add(planets);
            //add healthBar before health Line
            menucomponents.Add(asteroids);
            menucomponents.Add(ships);
        }
Пример #4
0
        public StatusMenu(Rectangle r)
        {
            area = r;
            texture = new Texture2D(MenuManager.batch.GraphicsDevice, 1, 1, true, SurfaceFormat.Color);
            texture.SetData(new[] { Color.White });
            nameline = new TextLine(new Rectangle(area.Left + 5, area.Top + 10, 200, 20), "dummy");
            healthline = new TextLine(new Rectangle(area.Left + 5, area.Top + 30, 100, 20), "dummy2");
            healthBar = new ProgressBar(area.Left + 55, area.Top + 39, 70, 20, 10, false, Color.Green);

            buildLine = new TextLine(new Rectangle(area.Left + 5, area.Top + 55, 100, 20), "dummy3");
            buildBar = new ProgressBar(area.Left + 82, area.Top + 55 + 9, 70, 20, 10, false, Color.Brown);
            upComingLine = new TextLine(new Rectangle(area.Left + 5, area.Top + 77, 100, 20), "");

            menucomponents.Add(nameline);
            //add healthBar before health Line
            menucomponents.Add(healthBar);
            menucomponents.Add(healthline);

            menucomponents.Add(buildBar);
            menucomponents.Add(buildLine);
            menucomponents.Add(upComingLine);
        }
Пример #5
0
        public GameScreen(bool h, String ipstring, int numclients, Map m)
        {
            host = h;
            selectedhex = nullhex;
            if (m == null)
            {
                if (h) { map = new Map(2, 0, "test galaxy", (long)CommonRNG.rand.NextDouble()); }
                //else { map = new Map(2, numclients, "test galaxy", (long)1); }
            }
            else { map = m; }

            driver = new SlaveDriver(this); //dont use until middleman created

            if (host)
            {
                middleman = new Host(map, driver, numclients, this);
                //((Host)middleman).SendMap();
            }
            else middleman = new Client(ipstring, driver, this);

            //test for failure here

            map = driver.GetMap();

            if (map == null) { MenuManager.screen = new TitleScreen(MenuManager.batch, MenuManager.font); return; }
            Player temp = map.GetInstancePlayer();
            int num = map.players.IndexOf(temp);
            map.players[num] = map.players[0];
            map.players[0] = temp;

            if (!host) map.SetPlayer(numclients);

            galaxy = map.galaxy;
            player = map.GetInstancePlayer();
            space = map.GetHomeSystem();

            int x = Game1.device.Viewport.Width;
            int y = Game1.device.Viewport.Height;
            galaxybutton = new IconButton(new Rectangle(40, y-40, 120, 40), "GalaxyButton.png", "SystemButton.png", GalaxyClick);
            components.Add(galaxybutton);

            shipmenu = new CommandMenu(new Rectangle(x-200, y-200, 200, 200),this);
            shipmenu.AddShipStuff();
            components.Add(shipmenu);

            planetmenu = new CommandMenu(new Rectangle(x-200, y-200, 200, 200),this);

            components.Add(planetmenu);
            planetmenu.AddShipCommand(0, 0, "StarCruiserButton.png", StarCruiser.creator);
            planetmenu.AddShipCommand(2, 0, "FighterButton.png", FighterShip.creator);
            planetmenu.AddShipCommand(0, 1, "MinerButton.png", MiningShip.creator);
            planetmenu.AddShipCommand(1, 0, "ColonistButton.png", ColonyShip.creator);
            planetmenu.AddShipCommand(1, 1, "TransportButton.png", Transport.creator);
            planetmenu.AddShipCommand(1, 2, "TelescopeButton.png", Telescope.creator);
            planetmenu.AddNewCommand(0, 2, "ShieldButton.png", UpgradeClick);

            waitingmessage = new TextLine(new Rectangle(0, 20, 400, 20), "Waiting for other players.");

            //planetmenu.showbackround = false;
            //shipmenu.showbackround = false;

            statusmenu = new StatusMenu(new Rectangle(0, y - 150, 300, 150));
            statusmenu.visible = false;
            telescopemenu = new TelescopeMenu(new Rectangle(0, y - 150, 300, 150), player);
            telescopemenu.visible = false;

            topmenu = new TopMenu(new Rectangle(0, 0, x, 40), this);
            components.Add(topmenu);
        }