public BlockingScreen(View messageView, ButtonDelegate buttonDelegate = null) { AllowsDrawPrevious = true; AllowsUpdatePrevious = true; m_delegate = buttonDelegate; View contentView = new RectView(0, 0, 366, 182, Color.Black, Color.White); contentView.x = 0.5f * width; contentView.y = 0.5f * height; contentView.alignX = contentView.alignY = View.ALIGN_CENTER; messageView.x = 0.5f * contentView.width; messageView.y = 0.5f * contentView.height; messageView.alignX = messageView.alignY = View.ALIGN_CENTER; contentView.AddView(messageView); Button cancelButton = new TempButton("Cancel"); cancelButton.x = 0.5f * contentView.width; cancelButton.y = contentView.height - 12; cancelButton.alignX = View.ALIGN_CENTER; cancelButton.alignY = View.ALIGN_MAX; cancelButton.buttonDelegate = CancelButtonDelegate; SetCancelButton(cancelButton); contentView.AddView(cancelButton); AddView(contentView); }
public Button AddButton(String title, int id, ButtonDelegate buttonDelegate) { Button button = new TempButton(title); button.id = id; button.buttonDelegate = buttonDelegate; AddView(button); LayoutVer(10); ResizeToFitViewsVer(); return button; }
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 MainMenuScreen(ButtonDelegate buttonDelegate) : base((int)MenuController.ScreenID.MainMenu) { Font font = Helper.fontButton; View rootView = new View(); TextButton button = new TempButton("Play"); button.id = (int)ButtonId.Play; button.buttonDelegate = buttonDelegate; rootView.AddView(button); button = new TempButton("Test"); button.id = (int)ButtonId.Test; button.buttonDelegate = buttonDelegate; rootView.AddView(button); button = new TempButton("Join server"); button.id = (int)ButtonId.DebugStartClient; button.buttonDelegate = buttonDelegate; rootView.AddView(button); button = new TempButton("Start server"); button.id = (int)ButtonId.DebugStartServer; button.buttonDelegate = buttonDelegate; rootView.AddView(button); //button = new TempButton("Multiplayer", font, 0, 0, w, h); //button.id = (int)ButtonId.Multiplayer; //button.SetDelegate(buttonDelegate); //rootView.AddView(button); button = new TempButton("Settings"); button.id = (int)ButtonId.Settings; button.buttonDelegate = buttonDelegate; rootView.AddView(button); button = new TempButton("Exit"); button.id = (int)ButtonId.Exit; button.buttonDelegate = buttonDelegate; rootView.AddView(button); rootView.LayoutVer(20); rootView.ResizeToFitViews(); AddView(rootView); rootView.x = 0.5f * (width - rootView.width); rootView.y = 0.5f * (height - rootView.height); }
public GameResultScreen(Game game, ButtonDelegate buttonDelegate) { Font font = Helper.fontButton; TextView text = new TextView(font, "GAME ENDED"); text.alignX = View.ALIGN_CENTER; text.alignY = View.ALIGN_CENTER; text.x = 0.5f * width; text.y = 0.5f * height; Button button = new TempButton("EXIT"); button.alignX = View.ALIGN_CENTER; button.buttonDelegate = buttonDelegate; button.id = (int)ButtonId.Exit; button.x = 0.5f * width; button.y = text.y + 50; AddView(button); SetCancelButton(button); }
public SettingsScreen(ButtonDelegate buttonDelegate) : base((int)MenuController.ScreenID.Settings) { Font font = Helper.fontButton; View rootView = new View(); rootView.alignX = rootView.alignY = View.ALIGN_CENTER; TextButton button = new TempButton("Back"); button.id = (int)ButtonId.Back; button.buttonDelegate = OnButtonPressed; rootView.AddView(button); rootView.LayoutVer(20); rootView.ResizeToFitViewsVer(); AddView(rootView); rootView.x = 0.5f * width; rootView.y = 0.5f * height; }
public NetworkConnectionScreen(String message = "Connecting...") { Font font = Helper.fontButton; statusTextView = new TextView(font, message); statusTextView.alignX = statusTextView.alignY = View.ALIGN_CENTER; statusTextView.x = 0.5f * width; statusTextView.y = 0.5f * height; AddView(statusTextView); Button cancelButton = new TempButton("Cancel"); cancelButton.buttonDelegate = OnButtonPress; cancelButton.id = (int)ButtonId.Cancel; cancelButton.alignX = View.ALIGN_CENTER; cancelButton.x = 0.5f * width; cancelButton.y = statusTextView.y + 1.5f * statusTextView.height + 10; SetCancelButton(cancelButton); AddView(cancelButton); }
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 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); }
protected override void OnStart() { if (mode == Mode.Client) { RegisterNotification(NetworkNotifications.ConnectedToServer, ConnectedToServerNotification); StartDiscovery(); } else if (mode == Mode.Server) { RegisterNotification(NetworkNotifications.ClientConnected, ClientConnectedNotification); RegisterNotification(NetworkNotifications.LocalClientDiscovered, LocalClientDiscoveredNotification); StartServer(); } Screen screen = new Screen(); Button button = new TempButton("Cancel"); button.id = (int)ButtonId.Cancel; button.buttonDelegate = OnCancelButtonPressed; button.alignX = button.alignY = button.parentAlignX = button.parentAlignY = View.ALIGN_CENTER; screen.AddView(button); screen.SetCancelButton(button); Font font = Helper.fontSystem; TextView textView = new TextView(font, mode.ToString()); textView.alignX = View.ALIGN_CENTER; textView.x = 0.5f * screen.width; textView.y = 10; screen.AddView(textView); StartScreen(screen); }
public DialogPopup(DialogPopupDelegate popupDelegate, String title, String message, PopupButton cancelButton, params PopupButton[] buttons) { this.popupDelegate = popupDelegate; AddView(new RectView(0, 0, width, height, new Color(0.0f, 0.0f, 0.0f, 0.25f), Color.Black)); RectView frameView = new RectView(0, 0, 0.75f * width, 0, new Color(0.0f, 0.0f, 0.0f, 0.75f), Color.Black); View content = new View(); content.width = frameView.width - 2 * 50; content.alignX = content.alignY = View.ALIGN_CENTER; Font font = Helper.fontSystem; // title TextView titleView = new TextView(font, title); titleView.alignX = titleView.parentAlignX = View.ALIGN_CENTER; content.AddView(titleView); // message TextView messageView = new TextView(font, message, (int)content.width); messageView.alignX = messageView.parentAlignX = View.ALIGN_CENTER; content.AddView(messageView); // buttons Button button = new TempButton(cancelButton.title); button.id = (int)cancelButton.id; button.buttonDelegate = OnButtonPress; button.alignX = View.ALIGN_CENTER; button.parentAlignX = View.ALIGN_CENTER; SetCancelButton(button); content.AddView(button); content.LayoutVer(10); content.ResizeToFitViewsVer(); frameView.AddView(content); frameView.ResizeToFitViewsVer(20, 20); frameView.alignX = frameView.alignY = frameView.parentAlignX = frameView.parentAlignY = View.ALIGN_CENTER; AddView(frameView); content.x = 0.5f * frameView.width; content.y = 0.5f * frameView.height; }
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); }