private void DrawPanel() { panelRect = new Rect(position.width - panelWidth, TOOLBAR_HEIGHT, panelWidth, position.height - TOOLBAR_HEIGHT); if (panelStyle.normal.background == null) { InitGUIStyles(); } GUILayout.BeginArea(panelRect, panelStyle); GUILayout.BeginVertical(); panelVerticalScroll = GUILayout.BeginScrollView(panelVerticalScroll); GUI.SetNextControlName("CONTROL_TITLE"); GUILayout.Space(10); if (CurrentlySelectedNode != null) { bool differentNodeSelected = (m_cachedSelectedNode != CurrentlySelectedNode); m_cachedSelectedNode = CurrentlySelectedNode; if (differentNodeSelected) { GUI.FocusControl(CONTROL_NAME); } if (CurrentlySelectedNode is UISpeechNode) { EditableSpeechNode node = (CurrentlySelectedNode.Info as EditableSpeechNode); GUILayout.Label("[" + node.ID + "] NPC Dialogue Node.", panelTitleStyle); EditorGUILayout.Space(); GUILayout.Label("Character Name", EditorStyles.boldLabel); GUI.SetNextControlName(CONTROL_NAME); node.Name = GUILayout.TextField(node.Name); EditorGUILayout.Space(); GUILayout.Label("Dialogue", EditorStyles.boldLabel); node.Text = GUILayout.TextArea(node.Text); EditorGUILayout.Space(); // Advance if (node.Speech != null || node.Options == null || node.Options.Count == 0) { GUILayout.Label("Auto-Advance options", EditorStyles.boldLabel); node.AdvanceDialogueAutomatically = EditorGUILayout.Toggle("Automatically Advance", node.AdvanceDialogueAutomatically); if (node.AdvanceDialogueAutomatically) { node.AutoAdvanceShouldDisplayOption = EditorGUILayout.Toggle("Display continue option", node.AutoAdvanceShouldDisplayOption); node.TimeUntilAdvance = EditorGUILayout.FloatField("Dialogue Time", node.TimeUntilAdvance); if (node.TimeUntilAdvance < 0.1f) { node.TimeUntilAdvance = 0.1f; } } EditorGUILayout.Space(); } GUILayout.Label("Icon", EditorStyles.boldLabel); node.Icon = (Sprite)EditorGUILayout.ObjectField(node.Icon, typeof(Sprite), false, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); GUILayout.Label("Audio Options", EditorStyles.boldLabel); GUILayout.Label("Audio"); node.Audio = (AudioClip)EditorGUILayout.ObjectField(node.Audio, typeof(AudioClip), false); GUILayout.Label("Audio Volume"); node.Volume = EditorGUILayout.Slider(node.Volume, 0, 1); EditorGUILayout.Space(); GUILayout.Label("TMP Font", EditorStyles.boldLabel); node.TMPFont = (TMPro.TMP_FontAsset)EditorGUILayout.ObjectField(node.TMPFont, typeof(TMPro.TMP_FontAsset), false); EditorGUILayout.Space(); // Events { NodeEventHolder NodeEvent = CurrentAsset.GetNodeData(node.ID); if (differentNodeSelected) { CurrentAsset.Event = NodeEvent.Event; } if (NodeEvent != null && NodeEvent.Event != null) { // Load the object and property of the node SerializedObject o = new SerializedObject(NodeEvent); SerializedProperty p = o.FindProperty("Event"); // Load the dummy event SerializedObject o2 = new SerializedObject(CurrentAsset); SerializedProperty p2 = o2.FindProperty("Event"); // Draw dummy event GUILayout.Label("Events:", EditorStyles.boldLabel); EditorGUILayout.PropertyField(p2); // Apply changes to dummy o2.ApplyModifiedProperties(); // Copy dummy changes onto the nodes event p = p2; o.ApplyModifiedProperties(); } } } else if (CurrentlySelectedNode is UIOptionNode) { EditableOptionNode node = (CurrentlySelectedNode.Info as EditableOptionNode); GUILayout.Label("[" + node.ID + "] Option Node.", panelTitleStyle); GUILayout.Label("Option text:", EditorStyles.boldLabel); node.Text = GUILayout.TextArea(node.Text); GUILayout.Label("TMP Font", EditorStyles.boldLabel); node.TMPFont = (TMPro.TMP_FontAsset)EditorGUILayout.ObjectField(node.TMPFont, typeof(TMPro.TMP_FontAsset), false); } } else { GUILayout.Label("Conversation options.", panelTitleStyle); GUILayout.Label("Default name:", EditorStyles.boldLabel); CurrentAsset.DefaultName = EditorGUILayout.TextField(CurrentAsset.DefaultName); GUILayout.Label("Default Icon:", EditorStyles.boldLabel); CurrentAsset.DefaultSprite = (Sprite)EditorGUILayout.ObjectField(CurrentAsset.DefaultSprite, typeof(Sprite), false); GUILayout.Label("Default font:", EditorStyles.boldLabel); CurrentAsset.DefaultFont = (TMPro.TMP_FontAsset)EditorGUILayout.ObjectField(CurrentAsset.DefaultFont, typeof(TMPro.TMP_FontAsset), false); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndArea(); }