Page 1 of 1

Field custom drawers

Posted: Tue Mar 17, 2015 6:38 pm
by markov
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.

Field custom drawers

Posted: Tue Mar 17, 2015 6:53 pm
by Tony Li
Hi,



Thank you for sharing this! The forum software doesn't allow certain upload types. I'll try to change that tomorrow. Would you mind emailing the unitypackage file to me at tony (at) pixelcrushers.com?



Thanks!



Tony

Field custom drawers

Posted: Tue Mar 17, 2015 7:20 pm
by markov
Okay, already did.