void AmbientDetails() { // BARKING EditorGUIExtension.FoldoutBox("Ambient Dialogue (Barking)", ref myTarget.BarkFoldout, (myTarget.AmbientDialogue.Enabled) ? 1 : 0, delegate() { EditorGUI.indentLevel--; DrawPropertyField("AmbientDialogue.Enabled", "Enable"); var prop = GetProperty("AmbientDialogue.Enabled"); if (prop.boolValue) { EditorGUILayout.Space(); DrawPropertyField("AmbientDialogue.Once", new GUIContent("Once", "If this option is turned on, the ambient dialogue only appears once when it's triggered")); if (!myTarget.AmbientDialogue.Once) { DrawPropertyField("AmbientDialogue.Time", new GUIContent("Time", "The ambient dialogue will activate after this amount of seconds (if not active currently)")); } EditorGUILayout.Space(); DrawPropertyField("AmbientDialogue.Trigger.Mode", "Trigger"); EditorGUI.indentLevel++; // Player Tag if (myTarget.AmbientDialogue.Trigger.Mode == Trigger.Modes.TriggerEnter || myTarget.AmbientDialogue.Trigger.Mode == Trigger.Modes.Use) { DrawPropertyField("AmbientDialogue.Trigger.PlayerTag", "Player Tag"); } // Distance if (myTarget.AmbientDialogue.Trigger.Mode == Trigger.Modes.Use) { DrawPropertyField("AmbientDialogue.Trigger.Distance", "Distance"); } if (myTarget.AmbientDialogue.Trigger.Mode == Trigger.Modes.Custom) { EditorGUILayout.HelpBox("You can call the StartBark() method from script directly.", MessageType.Info); } EditorGUI.indentLevel--; // OFFSET EditorGUILayout.Space(); DrawPropertyField("AmbientDialogue.Offset", new GUIContent("Offset", "The offset position for the ambient dialogue ui.")); EditorGUILayout.Space(); // +Culling } EditorGUI.indentLevel++; }); EditorGUILayout.Space(); }
void ExternalEvents() { EditorGUIExtension.FoldoutBox("External Events " + ((myTarget.ExternalEventEnable) ? "[" + myTarget.Events.Count + "]" : ""), ref myTarget.ExternalEventFoldout, (myTarget.ExternalEventEnable) ? 1 : 0, delegate() { EditorGUI.indentLevel--; DrawPropertyField("ExternalEventEnable", "Enable"); var prop = GetProperty("ExternalEventEnable"); if (prop.boolValue) { EditorGUILayout.Space(); for (int cnt = 0; cnt < myTarget.Events.Count; cnt++) { var element = serializedObject.FindProperty("Events").GetArrayElementAtIndex(cnt); EditorGUIExtension.SimpleBox("", 5, "ShurikenModuleBG", delegate() { EditorGUILayout.BeginHorizontal(); var eventNameProp = element.FindPropertyRelative("EventName"); DrawPropertyField(eventNameProp, new GUIContent("Event Name", "This is the name you want to call from the graph")); //myTarget.Events[cnt].EventName = EditorGUILayout.TextField(new GUIContent("Event Name", "This is the name you want to call from the graph"), myTarget.Events[cnt].EventName); if (GUILayout.Button("X", GUILayout.Width(20))) { Undo.RecordObject(myTarget, "Removed External Event"); myTarget.Events.RemoveAt(cnt); PrefabUtility.RecordPrefabInstancePropertyModifications(myTarget); return; } EditorGUILayout.EndHorizontal(); var eventProperty = element.FindPropertyRelative("uEvent"); DrawPropertyField(eventProperty, new GUIContent("Event: " + myTarget.Events[cnt].EventName)); }); GUILayout.Space(10); } if (GUILayout.Button("Add Event")) { Undo.RecordObject(myTarget, "Added External Event"); myTarget.Events.Add(new DialogueBehaviour.ExternalEvent()); PrefabUtility.RecordPrefabInstancePropertyModifications(myTarget); Repaint(); } } }); EditorGUILayout.Space(); }
void ActorDetails() { EditorGUIExtension.FoldoutBox("Actor", ref myTarget.ActorFoldout, (myTarget.ActorEnabled) ? 1 : 0, delegate() { EditorGUI.indentLevel--; DrawPropertyField("ActorEnabled", "Enable"); var prop = GetProperty("ActorEnabled"); if (prop.boolValue) { GUIContent label = new GUIContent("Actor Name", "The dialogue system will use this name as Actor name. If it's not set, the name will be the name of the GameObject."); DrawPropertyField("ActorName", label); DrawPropertyField("ActorPortrait", "Portrait"); } EditorGUI.indentLevel++; }); EditorGUILayout.Space(); }
public override void OnInspectorGUI() { RunemarkGUI.inspectorTitle.Draw("Dialogue System UI Skin", ""); serializedObject.Update(); SkinSettings(); ActorDetails(); AnswerSettings(); EditorGUIExtension.FoldoutBox("Test", ref _testFoldout, -1, delegate() { EditorGUILayout.HelpBox(_testMessage, _testMessageType); if (GUILayout.Button("Test Skin")) { _testMessageType = (myTarget.Test(out _testMessage)) ? MessageType.Error : MessageType.Info; } }); serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); if (_textArea == null) { _textArea = new GUIStyle(GUI.skin.textArea); _textArea.wordWrap = true; } TextNode myTarget = (TextNode)target; // NPC Details EditorGUIExtension.SimpleBox("", 5, "", delegate() { myTarget.ActorName = EditorGUILayout.TextField(new GUIContent("Actor Name*", "Name of the Actor who 'says' the text. If no value is set, the system uses the name you defined in the Dialogue Behaviour Component."), myTarget.ActorName); EditorGUI.BeginChangeCheck(); myTarget.Portrait = (Sprite)EditorGUILayout.ObjectField("Portrait", myTarget.Portrait, typeof(Sprite), false); if (EditorGUI.EndChangeCheck()) { _portraitWarning = CheckSpriteProblem(myTarget.Portrait); } if (_portraitWarning) { EditorGUILayout.HelpBox( "The visual editor can't visualize this sprite right above the node." + "To fix this, please set the Read/Write enable in the sprite import settings." + "\n This issue is not affects runtime functionality! ", MessageType.Warning); } }); EditorGUILayout.Space(); EditorGUIExtension.SimpleBox("Text", 5, "", delegate() { myTarget.Text = EditorGUILayout.TextArea(myTarget.Text, _textArea, GUILayout.Height(100)); EditorGUILayout.Space(); _answers.Draw(); }); EditorGUILayout.Space(); // AUDIO EditorGUIExtension.FoldoutBox("Audio", ref myTarget.AudioFoldout, (myTarget.Audio != null) ? 1 : 0, delegate() { EditorGUI.indentLevel--; EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); myTarget.Audio = (AudioClip)EditorGUILayout.ObjectField("Audio Clip", myTarget.Audio, typeof(AudioClip), false); if (EditorGUI.EndChangeCheck()) { myTarget.AudioDelay = 0; myTarget.AudioEndTime = (myTarget.Audio != null) ? myTarget.Audio.length : 0; myTarget.AudioStartTime = 0; } EditorGUI.indentLevel++; if (myTarget.Audio != null) { myTarget.AudioDelay = EditorGUILayout.FloatField(new GUIContent("Play delay", "Seconds after the audio clip started to play after the textnode is appeared."), myTarget.AudioDelay); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Playback (seconds)", "Seconds of the audio clip where it should start")); myTarget.AudioStartTime = EditorGUILayout.FloatField(myTarget.AudioStartTime, GUILayout.Width(75)); EditorGUILayout.MinMaxSlider(ref myTarget.AudioStartTime, ref myTarget.AudioEndTime, 0, myTarget.Audio.length); myTarget.AudioEndTime = EditorGUILayout.FloatField(myTarget.AudioEndTime, GUILayout.Width(75)); EditorGUILayout.EndHorizontal(); GUILayout.Space(10); if (!_audioIsPlaying && GUILayout.Button(EditorGUIUtility.FindTexture("PlayButton"))) { int start = (int)System.Math.Ceiling(myTarget.Audio.samples * (myTarget.AudioStartTime / myTarget.Audio.length)); EditorAudioPlayer.Play(myTarget.Audio, start); _audioIsPlaying = true; _stopTime = EditorApplication.timeSinceStartup + myTarget.AudioEndTime; } if (_audioIsPlaying && GUILayout.Button(EditorGUIUtility.FindTexture("PlayButton On"))) { EditorAudioPlayer.Stop(); _audioIsPlaying = false; } } EditorGUILayout.Space(); }); EditorGUILayout.Space(); // CAMERA string title = "Custom Camera"; if (myTarget.CustomCameraEnable) { title += " [index: " + myTarget.CameraIndex + "]"; } EditorGUIExtension.FoldoutBox(title, ref myTarget.CameraFoldout, (myTarget.CustomCameraEnable) ? 1 : 0, delegate() { EditorGUI.indentLevel--; EditorGUILayout.Space(); myTarget.CustomCameraEnable = EditorGUILayout.Toggle("Enable", myTarget.CustomCameraEnable); if (myTarget.CustomCameraEnable) { myTarget.CameraIndex = EditorGUILayout.IntField("Camera Index", myTarget.CameraIndex); } EditorGUILayout.Space(); EditorGUI.indentLevel++; }); // ADVANCED EditorGUIExtension.FoldoutBox("Advanced Settings", ref myTarget.AdvancedSettingsFoldout, -1, delegate() { EditorGUI.indentLevel--; EditorGUILayout.Space(); myTarget.CustomSkinEnable = EditorGUILayout.Toggle("Use Custom Skin", myTarget.CustomSkinEnable); if (myTarget.CustomSkinEnable) { // NAME if (_skinNames.DrawGUI()) { myTarget.Skin = SkinDatabase.Instance.Skins[_skinNames.Index].Name; } } EditorGUILayout.Space(); EditorGUI.indentLevel++; }); if (EditorGUI.EndChangeCheck()) { myTarget.HasChanges = true; } }
void ConversationDetails() { EditorGUIExtension.FoldoutBox("Conversation", ref myTarget.ConversationFoldout, (myTarget.Conversation.Enabled) ? 1 : 0, delegate() { EditorGUI.indentLevel--; DrawPropertyField("Conversation.Enabled", "Enable"); var prop = GetProperty("Conversation.Enabled"); if (prop.boolValue) { EditorGUILayout.Space(); DrawPropertyField("Conversation.Trigger.Mode", "Trigger"); EditorGUI.indentLevel++; // Player Tag if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.TriggerEnter || myTarget.Conversation.Trigger.Mode == Trigger.Modes.Use) { DrawPropertyField("Conversation.Trigger.PlayerTag", "Player Tag"); } // Distance if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.Use) { DrawPropertyField("Conversation.Trigger.Distance", "Distance"); } // Custom if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.Custom) { EditorGUILayout.HelpBox("You can call the StartDialogue() method from script directly.", MessageType.Info); } // On Start if (myTarget.Conversation.Trigger.Mode != Trigger.Modes.OnStart) { DrawPropertyField("Conversation.UseAutoExit"); var useAutoExit = GetProperty("Conversation.UseAutoExit"); if (useAutoExit.boolValue) { DrawPropertyField("Conversation.ExitDelay"); string s = ""; if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.TriggerEnter) { s = " exitst the trigger."; } if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.Use) { s = " is further from the actor than the use distance."; } if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.Custom) { s = " is further from the actor than the exit distance."; } EditorGUILayout.HelpBox("The dialogue will close if the player" + s, MessageType.Info); } } // Exit Distance if (myTarget.Conversation.Trigger.Mode == Trigger.Modes.Custom) { DrawPropertyField("Conversation.ExitDistance", new GUIContent("Exit Distance", "Distance between the player and the actor, when the dialogue should be closed.")); } EditorGUI.indentLevel--; EditorGUILayout.Space(); // CONVERSATION - PLAYER POSITION DrawPropertyField("Conversation.OverridePlayerPosition", new GUIContent("Override Player Position", "You can specify a position for the player during this conversation")); var overridePlayerPos = GetProperty("Conversation.OverridePlayerPosition"); if (overridePlayerPos.boolValue) { EditorGUI.indentLevel++; DrawPropertyField("Conversation.PlayerTag", "Player Tag"); DrawPropertyField("Conversation.PlayerPosition", "Position"); EditorGUI.indentLevel--; } EditorGUILayout.Space(); // CONVERSATION - CUSTOM CAMERA Undo.RecordObject(myTarget, "Dialogue Behaviour Camera Settings"); if (myTarget.Conversation.CameraController.DrawInspectorGUI()) { PrefabUtility.RecordPrefabInstancePropertyModifications(myTarget); } EditorGUILayout.Space(); // CONVERSATION - SKIN DrawPropertyField("Conversation.UseDefaultSkin", "Use Custom Skin"); var customSkin = GetProperty("Conversation.UseDefaultSkin"); if (customSkin.boolValue) { if (_skinNames.DrawGUI()) { Undo.RecordObject(myTarget, "Changed Skin Name"); myTarget.Conversation.DefaultSkin = SkinDatabase.Instance.Skins[_skinNames.Index].Name; PrefabUtility.RecordPrefabInstancePropertyModifications(myTarget); } } // +Culling } EditorGUI.indentLevel++; }); EditorGUILayout.Space(); }