public MultiplayerLobbyScreen(ServerInfo serverInfo, ButtonDelegate buttonDelegate, bool isServer)
        {
            this.serverInfo = serverInfo;
            viewsLookup = new Dictionary<NetConnection, ClientInfoView>();

            View contentView = new View(512, 363);
            contentView.alignX = View.ALIGN_CENTER;
            contentView.x = 0.5f * width;
            contentView.y = 48;

            Font font = GetDefaultFont();

            contentView.AddView(new View(215, 145));

            TextView serverName = new TextView(font, serverInfo.name);
            serverName.alignX = View.ALIGN_CENTER;
            serverName.x = 113;
            serverName.y = 155;

            contentView.AddView(serverName);

            clientsView = new View(286, contentView.height);
            clientsView.alignX = View.ALIGN_MAX;
            clientsView.x = contentView.width;
            contentView.AddView(clientsView);

            AddView(contentView);

            View buttons = new View();
            buttons.x = 0.5f * width;
            buttons.y = 432;
            buttons.alignX = View.ALIGN_CENTER;
            buttons.alignY = View.ALIGN_MAX;

            Button button = new TempButton("BACK");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Back;
            buttons.AddView(button);
            SetCancelButton(button);

            String label = isServer ? "START" : "READY";
            ButtonId buttonId = isServer ? ButtonId.Start : ButtonId.Ready;

            button = new TempButton(label);
            button.buttonDelegate = buttonDelegate;
            button.id = (int)buttonId;
            buttons.AddView(button);

            buttons.LayoutHor(10);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }
        public RoundResultScreen(Game game, ButtonDelegate buttonDelegate)
        {
            View contentView = new View(64, 48, 512, 384);

            // table
            View tableView = new View(0, 25, contentView.width, 330);

            float nameColWidth = 320;
            float winsColWidth = 0.5f * (tableView.width - nameColWidth);
            float suicidesColWidth = winsColWidth;

            Font font = Helper.fontButton;

            TextView textView = new TextView(font, "PLAYER");
            textView.alignX = View.ALIGN_CENTER;
            textView.x = 0.5f * nameColWidth;
            tableView.AddView(textView);

            textView = new TextView(font, "WINS");
            textView.alignX = View.ALIGN_CENTER;
            textView.x = nameColWidth + 0.5f * winsColWidth;
            tableView.AddView(textView);

            textView = new TextView(font, "SUICIDES");
            textView.alignX = View.ALIGN_CENTER;
            textView.x = nameColWidth + winsColWidth + 0.5f * suicidesColWidth;
            tableView.AddView(textView);

            List<Player> players = game.GetPlayersList();
            float px = 0.5f * nameColWidth;
            float py = textView.y + textView.height + 10;
            for (int i = 0; i < players.Count; ++i)
            {
                PlayerResultView pv = new PlayerResultView(players[i]);
                pv.alignX = View.ALIGN_CENTER;
                pv.x = px;
                pv.y = py;

                tableView.AddView(pv);

                py += pv.height + 10;
            }

            contentView.AddView(tableView);

            // buttons
            View buttons = new View(0.5f * contentView.width, contentView.height, 0, 0);
            buttons.alignX = View.ALIGN_CENTER;
            buttons.alignY = View.ALIGN_MAX;

            Button button = new TempButton("EXIT");
            button.id = (int)ButtonId.Exit;
            button.buttonDelegate = buttonDelegate;
            SetCancelButton(button);
            buttons.AddView(button);

            button = new TempButton("START!");
            button.id = (int)ButtonId.Continue; ;
            button.buttonDelegate = buttonDelegate;
            FocusView(button);

            SetConfirmButton(button);
            buttons.AddView(button);

            buttons.LayoutHor(20);
            buttons.ResizeToFitViews();
            contentView.AddView(buttons);

            AddView(contentView);
        }
        public MultiplayerScreen(ButtonDelegate buttonDelegate)
        {
            this.buttonDelegate = buttonDelegate;

            Font font = Helper.fontButton;

            TextView headerText = new TextView(font, "LOCAL SERVERS");
            headerText.alignX = View.ALIGN_CENTER;
            headerText.x = 0.5f * width;
            headerText.y = 31;
            AddView(headerText);

            contentView = new View(467, 333);
            contentView.alignX = View.ALIGN_CENTER;
            contentView.x = 0.5f * width;
            contentView.y = 73;
            contentView.visible = false;
            AddView(contentView);

            busyView = new View(467, 333);
            busyView.alignX = View.ALIGN_CENTER;
            busyView.x = 0.5f * width;
            busyView.y = 73;

            TextView busyText = new TextView(font, "Searching for local servers...");
            busyText.alignX = busyText.alignY = View.ALIGN_CENTER;
            busyText.x = 0.5f * busyView.width;
            busyText.y = 0.5f * busyView.height;
            busyView.AddView(busyText);

            AddView(busyView);

            View buttonGroup = new View();

            Button button = new TempButton("BACK");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Back;
            buttonGroup.AddView(button);
            SetCancelButton(button);

            button = new TempButton("REFRESH");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Refresh;
            buttonGroup.AddView(button);

            button = new TempButton("CREATE");
            button.buttonDelegate = buttonDelegate;
            button.id = (int)ButtonId.Create;
            buttonGroup.AddView(button);

            buttonGroup.LayoutHor(10);
            buttonGroup.ResizeToFitViews();

            buttonGroup.alignX = View.ALIGN_CENTER;
            buttonGroup.alignY = View.ALIGN_MAX;

            buttonGroup.x = 0.5f * width;
            buttonGroup.y = 432;

            AddView(buttonGroup);
        }
        public PlayersScreen(Scheme scheme, InputType[] inputTypes, InputTypeSelectDelegate selectDelegate, ButtonDelegate buttonDelegate)
        {
            View contentView = new View(64, 48, 521, 363);

            // scheme view
            contentView.AddView(new SchemeView(scheme, SchemeView.Style.Large));

            // input type selector
            int maxPlayers = inputTypes.Length;
            View inputTypeContainer = new View(226, 0, 286, 0);
            Font font = Helper.fontButton;
            for (int i = 0; i < maxPlayers; ++i)
            {
                InputTypeView typeView = new InputTypeView(i, inputTypes[i], font, inputTypeContainer.width, font.FontHeight());
                typeView.selectDelegate = selectDelegate;
                inputTypeContainer.AddView(typeView);
            }
            inputTypeContainer.LayoutVer(0);
            inputTypeContainer.ResizeToFitViewsHor();
            contentView.AddView(inputTypeContainer);

            AddView(contentView);

            // buttons
            View buttons = new View(0.5f * width, contentView.y + contentView.height, 0, 0);
            buttons.alignX = View.ALIGN_CENTER;

            Button button = new TempButton("BACK");
            button.id = (int)ButtonId.Back;
            button.buttonDelegate = buttonDelegate;
            SetCancelButton(button);
            buttons.AddView(button);

            button = new TempButton("START!");
            button.id = (int)ButtonId.Start;
            button.buttonDelegate = buttonDelegate;
            FocusView(button);
            SetConfirmButton(button);
            buttons.AddView(button);

            buttons.LayoutHor(20);
            buttons.ResizeToFitViews();
            AddView(buttons);
        }