Пример #1
0
        public MainMenu(RenderWindow window, ImageManager imageManager, Client client, Server server)
            : base(window, imageManager)
        {
            imageManager = new ImageManager();
            p = new Player(null, imageManager);
            mouse = new Sprite(imageManager.GetImage("mouse"));
            pImage = new RenderImage(window.Width, window.Height);
            pImage.DefaultView.Zoom(0.08F);
            pImage.DefaultView.Center = p.Center + new Vector2f(0, -30);
            pImage.SetView(pImage.DefaultView);

            this.window = window;
            this.client = client;
            this.server = server;
            items = new MenuItem[nbrItem];
            items[0] = new MenuItem("Local Game", new Vector2f(0, 100), StartLocal);
            items[1] = new MenuItem("Connect", new Vector2f(0, 130), Connect);
            items[2] = new MenuItem("Options", new Vector2f(0, 160), Option);
            items[3] = new MenuItem("Load map", new Vector2f(0, 190), LoadMap);
            items[4] = new MenuItem("Save map", new Vector2f(0, 220), SaveMap);
            items[5] = new MenuItem("Exit", new Vector2f(0, 280), Exit);

            foreach (MenuItem i in items)
                i.CenterX((int)window.Width);
        }
Пример #2
0
 public ConnectMenu(RenderWindow window, ImageManager imageManager, Client client, Server server)
     : base(window, imageManager)
 {
     this.server = server;
     this.client = client;
     p = new Player(null, imageManager);
     randomiser = new Random();
     pImage = new RenderImage(window.Width, window.Height);
     pImage.DefaultView.Zoom(0.08F);
     pImage.DefaultView.Center = p.Center + new Vector2f(0, -40);
     pImage.DefaultView.Rotate(135);
     pImage.SetView(pImage.DefaultView);
     mouse = new Sprite(imageManager.GetImage("mouse"));
     title = new MenuItem("Enter an IP to connect to...", new Vector2f(0, 100), null);
     title.CenterX((int)window.Width);
     ip = new MenuItem("", new Vector2f(0, 150), null);
     ip.CenterX((int)window.Width);
     connecting = new MenuItem("Connecting...", new Vector2f(0, 180), null);
     connecting.CenterX((int)window.Width);
 }