Exemplo n.º 1
0
 public Menu()
 {
     Zoom = 1.5;
     BackgroundColor = Color.Sky;
     var list = new UI.ElementList();
     int port = 11000;
     list.Add(new UI.Button("Start", () => {
         var server = new Server(port);
         var view = new ClientView("127.0.0.1", port);
         server.Start();
         view.OnClose += server.Stop;
         PushState(view);
     }));
     list.Add(new UI.Button("Start splitscreen", () => {
         var server = new Server(port);
         var view = new SplitScreen("127.0.0.1", port);
         server.Start();
         view.OnClose += server.Stop;
         PushState(view);
     }));
     var l2 = new UI.ElementList();
     l2.Horizontal = true;
     var ipInput = new UI.TextInput(200);
     l2.Add(ipInput);
     l2.Add(new UI.Button("Connect", () => {
         PushState(new ClientView(ipInput.Value, port));
     }));
     list.Add(l2);
     list.Anchor = list.Origin = new Vec2(0.5, 0.5);
     Frame.Add(list);
 }
Exemplo n.º 2
0
        public Menu()
        {
            Zoom            = 1.5;
            BackgroundColor = Color.Sky;
            var list = new UI.ElementList();
            int port = 11000;

            list.Add(new UI.Button("Start", () => {
                var server = new Server(port);
                var view   = new ClientView("127.0.0.1", port);
                server.Start();
                view.OnClose += server.Stop;
                PushState(view);
            }));
            list.Add(new UI.Button("Start splitscreen", () => {
                var server = new Server(port);
                var view   = new SplitScreen("127.0.0.1", port);
                server.Start();
                view.OnClose += server.Stop;
                PushState(view);
            }));
            var l2 = new UI.ElementList();

            l2.Horizontal = true;
            var ipInput = new UI.TextInput(200);

            l2.Add(ipInput);
            l2.Add(new UI.Button("Connect", () => {
                PushState(new ClientView(ipInput.Value, port));
            }));
            list.Add(l2);
            list.Anchor = list.Origin = new Vec2(0.5, 0.5);
            Frame.Add(list);
        }