public ScreenConnectToIp() { buttonConnect = new MenuWidget(); buttonConnect.text = "Connect"; buttonConnect.type = WidgetType.Button; buttonConnect.nextWidget = 3; textboxIp = new MenuWidget(); textboxIp.type = WidgetType.Textbox; textboxIp.text = ""; textboxIp.description = "Ip"; textboxIp.nextWidget = 2; textboxPort = new MenuWidget(); textboxPort.type = WidgetType.Textbox; textboxPort.text = ""; textboxPort.description = "Port"; textboxPort.nextWidget = 0; back = new MenuWidget(); back.text = "Back"; back.type = WidgetType.Button; back.nextWidget = 1; title = "Connect to IP"; widgets[0] = buttonConnect; widgets[1] = textboxIp; widgets[2] = textboxPort; widgets[3] = back; textboxIp.GetFocus(); }
public ScreenLogin() { login = new MenuWidget(); login.text = "Login"; login.type = WidgetType.Button; login.nextWidget = 9; loginUsername = new MenuWidget(); loginUsername.type = WidgetType.Textbox; loginUsername.text = ""; loginUsername.description = "Username"; loginUsername.nextWidget = 2; loginPassword = new MenuWidget(); loginPassword.type = WidgetType.Textbox; loginPassword.text = ""; loginPassword.description = "Password"; loginPassword.password = true; loginPassword.nextWidget = 3; loginRememberMe = new MenuWidget(); loginRememberMe.text = "Yes"; loginRememberMe.type = WidgetType.Button; loginRememberMe.description = "Remember me"; loginRememberMe.nextWidget = 0; createAccount = new MenuWidget(); createAccount.text = "Create account"; createAccount.type = WidgetType.Button; createAccountUsername = new MenuWidget(); createAccountUsername.text = ""; createAccountUsername.type = WidgetType.Textbox; createAccountUsername.description = "Username"; createAccountPassword = new MenuWidget(); createAccountPassword.text = ""; createAccountPassword.type = WidgetType.Textbox; createAccountPassword.description = "Password"; createAccountPassword.password = true; createAccountRememberMe = new MenuWidget(); createAccountRememberMe.text = "Yes"; createAccountRememberMe.type = WidgetType.Button; createAccountRememberMe.description = "Remember me"; back = new MenuWidget(); back.text = "Back"; back.type = WidgetType.Button; back.nextWidget = 1; title = "Login"; widgets[0] = login; widgets[1] = loginUsername; widgets[2] = loginPassword; widgets[3] = loginRememberMe; widgets[4] = createAccount; widgets[5] = createAccountUsername; widgets[6] = createAccountPassword; widgets[7] = createAccountRememberMe; widgets[9] = back; loginUsername.GetFocus(); loginResult = new LoginResultRef(); }
void MouseDown(int x, int y) { bool editingChange = false; for (int i = 0; i < WidgetCount; i++) { MenuWidget w = widgets[i]; if (w != null) { if (w.type == WidgetType.Button) { w.pressed = pointInRect(x, y, w.x, w.y, w.sizex, w.sizey); } if (w.type == WidgetType.Textbox) { w.pressed = pointInRect(x, y, w.x, w.y, w.sizex, w.sizey); bool wasEditing = w.editing; w.editing = w.pressed; if (w.editing && (!wasEditing)) { menu.p.ShowKeyboard(true); editingChange = true; } if ((!w.editing) && wasEditing && (!editingChange)) { menu.p.ShowKeyboard(false); } } if (w.pressed) { //Set focus to new element when clicked on AllLoseFocus(); w.GetFocus(); } } } }