bool DrawPackParameter(EditorProp parameter) { //name bool nameChanged = GUIUtils.DrawTextProp(parameter[nameField], GUIUtils.TextFieldType.Normal, false, "param name", GUILayout.MinWidth(32)); //type GUILayoutOption pFieldWidth = GUILayout.Width(100); GUIUtils.DrawEnumProp( parameter[CustomParameterEditor.typeField], (int i) => (CustomParameter.ParamType)i, (Enum s) => (int)((CustomParameter.ParamType)s), pFieldWidth ); //value GUIUtils.DrawProp(CustomParameterEditor.GetParamValueProperty(parameter), GUILayout.Width(128)); return(nameChanged); }
bool DrawPackFields(EditorProp pack) { GUILayoutOption w = GUILayout.Width(100); bool changedVar = false; GUIUtils.StartBox(1); //name changedVar = GUIUtils.DrawTextProp(pack[nameField], new GUIContent("Pack Name"), GUIUtils.TextFieldType.Normal, false, "name", w) || changedVar; GUIUtils.DrawToggleProp(pack[isCustomField], new GUIContent("Custom Objects", "Does the pack consist of custom objects that arent represented by assets in the project?"), w); GUIUtils.Space(); bool isCustom = pack[isCustomField].boolValue; if (!isCustom) { //asset type changedVar = CheckedVariable(pack[assetTypeField], new GUIContent("Asset Type", "The asset type or component the pack targets.\nMust inherit from UnityEngine.Object"), w) || changedVar; DrawHelpBox(pack[assetTypeField], IsValidTypeString, InvalidAssetTypeError); //directory changedVar = GUIUtils.DrawDirectoryField(pack[dirField], new GUIContent("Objects Directory", "The directory where the assets are held"), true, w) || changedVar; DrawHelpBox(pack[dirField], IsValidDirectory, InvalidDirectoryError); //file extensions changedVar = CheckedVariable(pack[extensionsField], new GUIContent("File Extensions", "The file extensions to look for in the directory, seperated by commas.\nExample: '.fbx, .wav, .mp3'"), w) || changedVar; DrawHelpBox(pack[extensionsField], FileExtensionValid, InvalidFileExtensionsError); } else { changedVar = CheckedVariable(pack[assetTypeField], new GUIContent("Icon Asset Type", "The asset type or component to use for the icon.\nMust inherit from UnityEngine.Object"), w) || changedVar; DrawHelpBox(pack[assetTypeField], IsValidTypeString, InvalidAssetTypeError); } GUIUtils.EndBox(1); return(changedVar); }
bool CheckedVariable(EditorProp variable, GUIContent content, GUILayoutOption option) { return(GUIUtils.DrawTextProp(variable, content, GUIUtils.TextFieldType.Normal, false, " var ", option)); }