Field custom drawers
Posted: Tue Mar 17, 2015 6:38 pm
Hello.
I added small, but very useful feature to the system.
Now you can define custom drawers for field type.
For example:
I changed few lines in source code, so now there's interface to add your own drawer to field type:
public enum SceneType {
MainMenu,
Fight,
Map
}
[CustomFieldTypeService.Name("Scene Type")]
public class CustomFieldType_SceneType : CustomFieldType {
public override string Draw (string currentValue, DialogueDatabase dataBase) {
if (currentValue == string.Empty)
currentValue = SceneType.MainMenu.ToString();
SceneType enumValue = (SceneType) Enum.Parse(typeof(SceneType), currentValue, true);
return EditorGUILayout.EnumPopup(enumValue).ToString();
}
}
Hope this feature will be useful not only for us and dialogue system developers will add it someday.
I attached all needed files below, so you can use it as reference.
I added small, but very useful feature to the system.
Now you can define custom drawers for field type.
For example:
I changed few lines in source code, so now there's interface to add your own drawer to field type:
public enum SceneType {
MainMenu,
Fight,
Map
}
[CustomFieldTypeService.Name("Scene Type")]
public class CustomFieldType_SceneType : CustomFieldType {
public override string Draw (string currentValue, DialogueDatabase dataBase) {
if (currentValue == string.Empty)
currentValue = SceneType.MainMenu.ToString();
SceneType enumValue = (SceneType) Enum.Parse(typeof(SceneType), currentValue, true);
return EditorGUILayout.EnumPopup(enumValue).ToString();
}
}
Hope this feature will be useful not only for us and dialogue system developers will add it someday.
I attached all needed files below, so you can use it as reference.