public static FieldData ConvertParsedField(ParsedField parsedField) { bool success = Enum.TryParse(parsedField.type, out ReturnType type); if (!success) { throw new UnexpectedEnumException("Bad return type: " + parsedField.type); } EnterValueType enterType = EnterValueType.NONE; switch (type) { case ReturnType.BOOL: enterType = EnterValueType.BOOL; break; case ReturnType.NUMBER: enterType = EnterValueType.NUMBER; break; case ReturnType.TEXT: enterType = EnterValueType.TEXT; break; } return(new FieldData() { text = parsedField.desc, enterValue = enterType, returnType = type, attributes = parsedField.attributes }); }
public FrmEnterAValue(string question = null, EnterValueType type = EnterValueType.Text) { InitializeComponent(); textEdit.Focus(); this.Question = question; if (question != null) { groupControl.Text = this.Question; Text = string.Empty; } if (type == EnterValueType.Integer) { textEdit.Properties.Mask.MaskType = MaskType.RegEx; textEdit.Properties.Mask.EditMask = @"\d+"; } }
public FrmEnterAValue(string question = null, EnterValueType type = EnterValueType.Text) { InitializeComponent(); textEdit.Focus(); this.Question = question; if (question != null) { groupControl.Text = this.Question; Text = string.Empty; } if (type == EnterValueType.Integer) { textEdit.Properties.Mask.MaskType = MaskType.RegEx; textEdit.Properties.Mask.EditMask = @"\d+"; } }
public void Input(bool active, EnterValueType type = EnterValueType.NONE) { textInput.gameObject.SetActive(active); textInput.text = ""; submitInputButton.gameObject.SetActive(active); switch (type) { case EnterValueType.NUMBER: textInput.contentType = InputField.ContentType.IntegerNumber; break; case EnterValueType.TEXT: textInput.contentType = InputField.ContentType.Standard; break; case EnterValueType.NONE: break; default: Debug.Log($"Unhandled enter-value type: {type}"); break; } }