private string GetJsonSchemaType(CollectionPropertyItemController controller) { int typeIndex = controller.typeDropdown.value; string type = controller.typeDropdown.options[typeIndex].text; return(type == "Timestamp" ? "string" : type.ToLower()); }
private dynamic GetJsonSchemaDefault(CollectionPropertyItemController controller) { int typeIndex = controller.typeDropdown.value; string type = controller.typeDropdown.options[typeIndex].text; switch (type) { case "Boolean": TMP_Dropdown dropdown = controller.defaultBooleanDropdown; string booleanString = dropdown.options[dropdown.value].text; return(booleanString == "True"); case "Number": string numberString = controller.defaultNumberDropdown.text; return(string.IsNullOrEmpty(numberString) ? 0f : float.Parse(numberString, System.Globalization.CultureInfo.InvariantCulture)); case "String": return(string.IsNullOrEmpty(controller.defaultStringDropdown.text) ? "" : controller.defaultStringDropdown.text); } return(null); }
private string GetJsonSchemaFormat(CollectionPropertyItemController controller) { int typeIndex = controller.typeDropdown.value; string type = controller.typeDropdown.options[typeIndex].text; return(type == "Timestamp" ? "date-time" : null); }
private string GetFieldType(string field) { CollectionPropertyItemController[] controllers = propertiesContainer.GetComponentsInChildren <CollectionPropertyItemController>(); CollectionPropertyItemController controller = controllers.First(c => field == c.keyInput.text); return(controller.typeDropdown.options[controller.typeDropdown.value].text); }
public void AddProperty(string key, CollectionModel.JsonSchemaProperty jsonSchemaProperty) { GameObject gameObject = Instantiate( collectionPropertyItemController.gameObject, collectionPropertyItemController.transform.parent ); gameObject.SetActive(true); CollectionPropertyItemController cpItemController = gameObject.GetComponent <CollectionPropertyItemController>(); cpItemController.SetJsonSchemaProperty(key, jsonSchemaProperty); }