public override void OnInspectorGUI() { //base.OnInspectorGUI(); GUIUtils.StartCustomEditor(); EditorGUI.indentLevel++; GUIUtils.StartBox(); GUIUtils.DrawProp(so["gizmoColor"], new GUIContent("Gizmo Color")); GUIUtils.Space(); GUIUtils.DrawProp(so["behavior"], new GUIContent("Cue Behavior")); EditorProp repeats = so["repeats"]; GUIUtils.DrawProp(repeats, new GUIContent("Repeats", "How Many times this cue repeats")); if (repeats.intValue < 1) { repeats.SetValue(1); } if (HasSubCues()) { GUIUtils.DrawToggleProp(so["useRandomPlaylist"], new GUIContent("Use Random Sub-Cue", "Plays one sub-cue at random, not all sequentially")); } GUIUtils.EndBox(); EditorGUI.indentLevel--; GUIUtils.EndCustomEditor(so); }
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); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); bool isSmoothSnap = so[snapStyleField].enumValueIndex == (int)Cue.SnapPlayerStyle.Smooth; GUIUtils.StartCustomEditor(); GUIUtils.StartBox(0); EditorGUILayout.BeginHorizontal(); GUIUtils.Label(msgBlocksLabel); if (GUIUtils.SmallButton(new GUIContent("", "Paste"), Colors.green, Colors.black)) { for (int i = 0; i < 4; i++) { so[messageBlocksField][i].SetValue(copiedMessages[i]); } } if (GUIUtils.SmallButton(new GUIContent("", "Copy"), Colors.yellow, Colors.black)) { for (int i = 0; i < 4; i++) { copiedMessages[i] = so[messageBlocksField][i].stringValue; } } if (GUIUtils.SmallDeleteButton()) { for (int i = 0; i < 4; i++) { so[messageBlocksField][i].SetValue(""); } } EditorGUILayout.EndHorizontal(); GUIUtils.Tabs((isSmoothSnap ? 4 : 3).Generate(i => tabLbls[i]).ToArray(), ref currentMsgBlock); GUIUtils.DrawMultiLineExpandableString(so[messageBlocksField][currentMsgBlock], false, "mesage block", 50); GUIUtils.EndBox(1); GUIUtils.StartBox(1); EditorGUI.indentLevel++; GUIUtils.DrawEnumProp( so[snapStyleField], snapStyleGUI, (int i) => (Cue.SnapPlayerStyle)i, (System.Enum s) => (int)((Cue.SnapPlayerStyle)s) ); if (isSmoothSnap) { EditorGUI.indentLevel++; GUIUtils.DrawProp(so[smoothPosTimeField], positionTimeGUI); GUIUtils.DrawProp(so[smoothRotTimeField], rotationTimeGUI); GUIUtils.DrawToggleProp(so[playImmediateField], playImmediateGUI); EditorGUI.indentLevel--; } GUIUtils.DrawProp(so[positionOffsetField], positionOffsetGUI); GUIUtils.DrawProp(so[rotationOffsetField], rotationOffsetGUI); GUIUtils.EndBox(1); GUIUtils.Space(); EditorGUI.indentLevel--; GUIUtils.Label(new GUIContent("<b>The following variables wont be used if the cue has sub-cues:</b>")); EditorGUI.indentLevel++; GUIUtils.StartBox(1); GUIUtils.DrawProp(so[overrideDurationField], overrideDurationGUI); EditorGUI.indentLevel--; GUIUtils.Space(); GUIUtils.DrawObjArrayProp <Event>(so[eventsField]); GUIUtils.EndBox(1); GUIUtils.EndCustomEditor(so); }