示例#1
0
        public Client(RenderWindow window, ImageManager imageManager)
            : base(window, imageManager)
        {
            this.window = window;
            world = new RenderImage(800, 600);

            inputManager = new InputManager(this);

            ticker = new Ticker();

            window.ShowMouseCursor (false);
            window.SetFramerateLimit (60);

            NetPeerConfiguration netConfiguration = new NetPeerConfiguration("2dThing");
            client = new NetClient(netConfiguration);

            uMsgBuffer = new UserMessageBuffer();
            otherClients = new Dictionary<int, NetworkClient>();
            chat = new Chat(this);

            LoadRessources();

            blockTypeDisplay = new Cube(blockType, imageManager);
            blockTypeDisplay.Position = new Vector2f(window.Width - 2*Cube.WIDTH, window.Height - 2* Cube.HEIGHT);
            layerDisplay = new LayerDisplay(imageManager);
            layerDisplay.Position = blockTypeDisplay.Position - new Vector2f(0, 50);

            mouse = new Sprite (imageManager.GetImage("mouse"));
        }
示例#2
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);
        }
示例#3
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);
 }
示例#4
0
 public LayerDisplay(ImageManager imageManager)
 {
     this.imageManager = imageManager;
     layer = new Sprite(imageManager.GetImage("layer"));
 }