Exemplo n.º 1
0
        private void DrawReviewStage()
        {
            EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Your NPC is ready! Below is a summary of your NPC's configuration.\n\nNPC configuration can sometimes be complex. This wizard can't anticipate every possible character design. If your NPC doesn't behave the way you expect, please examine the components on the NPC and make adjustments as necessary.", MessageType.Info);
            var dialogueActor = npcObject.GetComponent <DialogueActor>();

            if (dialogueActor != null)
            {
                EditorGUILayout.LabelField("Dialogue Actor: " + dialogueActor.actor);
            }
            if (npcObject.GetComponent <Usable>() != null)
            {
                EditorGUILayout.LabelField("Usable: Yes");
            }
            var dialogueSystemTrigger = npcObject.GetComponentInChildren <DialogueSystemTrigger>();

            if (dialogueSystemTrigger != null)
            {
                EditorGUILayout.LabelField("Dialogue System Trigger: " + GetDialogueSystemTriggerSummary(dialogueSystemTrigger) + " " + dialogueSystemTrigger.trigger);
            }
            BarkOnIdle barkOnIdle = npcObject.GetComponentInChildren <BarkOnIdle>();

            if (barkOnIdle != null)
            {
                EditorGUILayout.LabelField(string.Format("Timed Bark: '{0}' ({1}) every {2}-{3} seconds", barkOnIdle.conversation, barkOnIdle.barkOrder, barkOnIdle.minSeconds, barkOnIdle.maxSeconds));
            }
            PositionSaver positionSaver = npcObject.GetComponentInChildren <PositionSaver>();

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (positionSaver != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }
Exemplo n.º 2
0
        private void DrawSelectDBStage()
        {
            EditorGUILayout.LabelField("Select Dialogue Database", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            if (dialogueManager == null)
            {
                dialogueManager = FindObjectOfType <DialogueSystemController>();
            }
            if (database == null && dialogueManager != null)
            {
                database = dialogueManager.initialDatabase;
            }
            if (dialogueManager == null || dialogueManager.initialDatabase == null || database != dialogueManager.initialDatabase)
            {
                EditorGUILayout.HelpBox("Assign the dialogue database that the NPC will use for conversations and barks.", MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox("Assign the dialogue database that the NPC will use for conversations and barks. Since your scene has a Dialogue Manager, by default we'll use the database assigned to the Dialogue Manager.", MessageType.Info);
            }
            DialogueDatabase newDatabase = EditorGUILayout.ObjectField("Dialogue Database", database, typeof(DialogueDatabase), true) as DialogueDatabase;

            if (newDatabase != database)
            {
                database = newDatabase;
            }
            if (dialogueManager != null && database != null && dialogueManager.initialDatabase != database)
            {
                EditorGUILayout.HelpBox("This is not the initial database assigned to the Dialogue Manager. Remember to load this database at runtime before using the NPC. You can use the Extra Databases component or DialogueManager.AddDatabase() in script. Also make sure the internal IDs are unique across databases. You can use the Unique ID Tool to do this.", MessageType.Warning);
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, (database != null), false);
        }
Exemplo n.º 3
0
        private bool DrawBarkUISection()
        {
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.BeginHorizontal();
            IBarkUI barkUI        = npcObject.GetComponentInChildren(typeof(IBarkUI)) as IBarkUI;
            bool    hasBarkUI     = (barkUI != null);
            var     dialogueActor = npcObject.GetComponent <DialogueActor>();

            if (!hasBarkUI)
            {
                dialogueActor = npcObject.GetComponent <DialogueActor>();
                if (dialogueActor != null)
                {
                    hasBarkUI = (dialogueActor.barkUISettings.barkUI != null);
                    if (!hasBarkUI)
                    {
                        dialogueActor.barkUISettings.barkUI = dialogueActor.GetComponentInChildren <AbstractBarkUI>();
                        hasBarkUI = (dialogueActor.barkUISettings.barkUI != null);
                    }
                }
            }
            EditorGUILayout.LabelField("Bark UI", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            EditorWindowTools.StartIndentedSection();
            if (hasBarkUI)
            {
                EditorGUILayout.HelpBox("The NPC has a bark UI, so it will be able to display barks.", MessageType.None);
            }
            else
            {
                if (dialogueActor != null)
                {
                    EditorGUILayout.HelpBox("The NPC needs a bark UI to be able to display barks. Assign a bark UI instance or bark UI prefab below. This will be assigned to the NPC's Dialogue Actor component.", MessageType.Info);
                    EditorGUILayout.BeginHorizontal();
                    dialogueActor.barkUISettings.barkUI = EditorGUILayout.ObjectField("Bark UI", dialogueActor.barkUISettings.barkUI, typeof(AbstractBarkUI), true) as AbstractBarkUI;
                    if (GUILayout.Button("Add Basic Bark UI", GUILayout.Width(180)))
                    {
                        var basicBarkUI = npcObject.AddComponent <PixelCrushers.DialogueSystem.UnityGUI.UnityBarkUI>();
                        dialogueActor.barkUISettings.barkUI = basicBarkUI;
                    }
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    EditorGUILayout.HelpBox("The NPC needs a bark UI to be able to display barks. You can add a Dialogue Actor component, which will allow you to assign a bark UI prefab that will be instantiated at runtime, or click Basic Bark UI to add very basic bark UI.", MessageType.Info);
                    EditorGUILayout.BeginHorizontal();
                    if (GUILayout.Button("Add Dialogue Actor", GUILayout.Width(180)))
                    {
                        npcObject.AddComponent <PixelCrushers.DialogueSystem.UnityGUI.UnityBarkUI>();
                    }
                    if (GUILayout.Button("Add Basic Bark UI", GUILayout.Width(180)))
                    {
                        npcObject.AddComponent <PixelCrushers.DialogueSystem.UnityGUI.UnityBarkUI>();
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorWindowTools.EndIndentedSection();
            return(hasBarkUI);
        }
Exemplo n.º 4
0
        public static void DrawOverrideNameSubsection(GameObject character)
        {
            EditorGUILayout.LabelField("Override Actor Name", EditorStyles.boldLabel);
            OverrideActorName overrideActorName = character.GetComponent <OverrideActorName>();

            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox(string.Format("By default, the dialogue UI will use the name of the GameObject ({0}). You can override it below.", character.name), MessageType.Info);
            EditorGUILayout.BeginHorizontal();
            bool hasOverrideActorName = EditorGUILayout.Toggle((overrideActorName != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("Override actor name", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasOverrideActorName)
            {
                if (overrideActorName == null)
                {
                    overrideActorName = character.AddComponent <OverrideActorName>();
                }
                overrideActorName.overrideName = EditorGUILayout.TextField("Actor Name", overrideActorName.overrideName);
            }
            else
            {
                DestroyImmediate(overrideActorName);
            }
            EditorWindowTools.EndIndentedSection();
            EditorWindowTools.DrawHorizontalLine();
        }
Exemplo n.º 5
0
        private void DrawTargetingStage()
        {
            DrawOverrideNameSubsection(npcObject);
            EditorGUILayout.LabelField("Targeting", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            ConversationTrigger conversationTrigger = npcObject.GetComponentInChildren <ConversationTrigger>();
            BarkTrigger         barkTrigger         = npcObject.GetComponentInChildren <BarkTrigger>();
            bool hasOnTriggerEnter = ((conversationTrigger != null) && (conversationTrigger.trigger == DialogueTriggerEvent.OnTriggerEnter)) ||
                                     ((barkTrigger != null) && (barkTrigger.trigger == DialogueTriggerEvent.OnTriggerEnter));
            bool hasOnUse = ((conversationTrigger != null) && (conversationTrigger.trigger == DialogueTriggerEvent.OnUse)) ||
                            ((barkTrigger != null) && (barkTrigger.trigger == DialogueTriggerEvent.OnUse));
            bool needsColliders          = hasOnTriggerEnter || hasOnUse;
            bool hasAppropriateColliders = false;

            if (hasOnTriggerEnter)
            {
                hasAppropriateColliders = DrawTargetingOnTriggerEnter();
            }
            if (hasOnUse)
            {
                hasAppropriateColliders = DrawTargetingOnUse() || hasAppropriateColliders;
            }
            if (!needsColliders)
            {
                EditorGUILayout.HelpBox("The NPC doesn't need any targeting components. Click Next to proceed.", MessageType.Info);
            }
            if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
            {
                Selection.activeGameObject = npcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, (hasAppropriateColliders || !needsColliders), false);
        }
Exemplo n.º 6
0
        private bool DrawBarkUISection()
        {
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.BeginHorizontal();
            IBarkUI barkUI    = npcObject.GetComponentInChildren(typeof(IBarkUI)) as IBarkUI;
            bool    hasBarkUI = (barkUI != null);

            EditorGUILayout.LabelField("Bark UI", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            EditorWindowTools.StartIndentedSection();
            if (hasBarkUI)
            {
                EditorGUILayout.HelpBox("The NPC has a bark UI, so it will be able to display barks.", MessageType.None);
            }
            else
            {
                EditorGUILayout.HelpBox("The NPC needs a bark UI to be able to display barks. Click Default Bark UI to add a default Unity GUI bark UI, or assign one manually from Window > Dialogue System > Component > UI.", MessageType.Info);
                if (GUILayout.Button("Default Bark UI", GUILayout.Width(160)))
                {
                    npcObject.AddComponent <PixelCrushers.DialogueSystem.UnityGUI.UnityBarkUI>();
                    hasBarkUI = true;
                }
            }
            EditorWindowTools.EndIndentedSection();
            return(hasBarkUI);
        }
Exemplo n.º 7
0
 private void DrawUIStage()
 {
     EditorGUILayout.LabelField("User Interface", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("Assign a dialogue UI. You can find pre-built Unity GUI dialogue UI prefabs in Prefabs/Unity Dialogue UIs. To assign a prefab for a different GUI system, import its support package found in Third Party Support. You can also assign a UI scene object.", MessageType.Info);
     if (DialogueManager.Instance.displaySettings == null)
     {
         DialogueManager.Instance.displaySettings = new DisplaySettings();
     }
     DialogueManager.Instance.displaySettings.dialogueUI = EditorGUILayout.ObjectField("Dialogue UI", DialogueManager.Instance.displaySettings.dialogueUI, typeof(GameObject), true) as GameObject;
     if (DialogueManager.Instance.displaySettings.dialogueUI == null)
     {
         EditorGUILayout.HelpBox("If you continue without assigning a UI, the Dialogue System will use a very plain default UI.", MessageType.Warning);
     }
     else
     {
         IDialogueUI ui = DialogueManager.Instance.displaySettings.dialogueUI.GetComponent(typeof(IDialogueUI)) as IDialogueUI;
         if (ui == null)
         {
             DialogueManager.Instance.displaySettings.dialogueUI = null;
         }
     }
     EditorWindowTools.EndIndentedSection();
     DrawNavigationButtons(true, true, false);
 }
Exemplo n.º 8
0
 private void DrawDatabaseStage()
 {
     EditorGUILayout.LabelField("Dialogue Database", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("This wizard will help you configure the Dialogue Manager GameObject.\n\nThe Dialogue Manager coordinates all Dialogue System activity. It should be in the first scene that uses any Dialogue System functionality.\n\nThe first step is to assign an initial dialogue database asset. This asset contains your conversations and related data.", MessageType.Info);
     EditorGUILayout.BeginHorizontal();
     if (DialogueManager.Instance == null)
     {
         EditorGUILayout.LabelField("Dialogue Manager object is null. Creating a new instance...");
         if (DialogueManager.Instance == null)
         {
             new GameObject("Dialogue Manager").AddComponent <DialogueSystemController>();
         }
     }
     else
     {
         DialogueManager.Instance.initialDatabase = EditorGUILayout.ObjectField("Database", DialogueManager.Instance.initialDatabase, typeof(DialogueDatabase), false) as DialogueDatabase;
         bool disabled = (DialogueManager.Instance.initialDatabase != null);
         EditorGUI.BeginDisabledGroup(disabled);
         if (GUILayout.Button("Create New", GUILayout.Width(100)))
         {
             createNewDatabase = true;
         }
         EditorGUI.EndDisabledGroup();
     }
     EditorGUILayout.EndHorizontal();
     EditorWindowTools.EndIndentedSection();
     if (DialogueManager.Instance != null)
     {
         DrawNavigationButtons(false, (DialogueManager.Instance.initialDatabase != null), false);
     }
 }
Exemplo n.º 9
0
        private bool DrawBarkTriggerSection()
        {
            EditorGUILayout.BeginHorizontal();
            BarkTrigger barkTrigger    = npcObject.GetComponentInChildren <BarkTrigger>();
            bool        hasBarkTrigger = EditorGUILayout.Toggle((barkTrigger != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("NPC barks when triggered", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasBarkTrigger)
            {
                EditorWindowTools.StartIndentedSection();
                if (barkTrigger == null)
                {
                    barkTrigger = npcObject.AddComponent <BarkTrigger>();
                }
                EditorGUILayout.HelpBox("Select the conversation containing the NPC's bark lines, the order in which to display them, and when barks should be triggered.", string.IsNullOrEmpty(barkTrigger.conversation) ? MessageType.Info : MessageType.None);
                barkTrigger.conversation = DrawConversationPopup(barkTrigger.conversation);
                barkTrigger.barkOrder    = (BarkOrder)EditorGUILayout.EnumPopup("Order of Lines", barkTrigger.barkOrder);
                barkTrigger.trigger      = DrawTriggerPopup(barkTrigger.trigger);
                EditorWindowTools.EndIndentedSection();
            }
            else
            {
                DestroyImmediate(barkTrigger);
            }
            return(hasBarkTrigger);
        }
Exemplo n.º 10
0
        private void DrawTargetingStage()
        {
            EditorGUILayout.LabelField("Targeting", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            SelectorType selectorType = GetSelectorType();

            if (selectorType == SelectorType.None)
            {
                EditorGUILayout.HelpBox("Specify how the player will target NPCs to trigger conversations and barks.", MessageType.Info);
            }
            selectorType = (SelectorType)EditorGUILayout.EnumPopup("Target NPCs By", selectorType);
            switch (selectorType)
            {
            case SelectorType.Proximity:
                DrawProximitySelector();
                break;

            case SelectorType.CenterOfScreen:
            case SelectorType.MousePosition:
            case SelectorType.CustomPosition:
                DrawSelector(selectorType);
                break;

            default:
                DrawNoSelector();
                break;
            }
            EditorWindowTools.EndIndentedSection();
            EditorWindowTools.DrawHorizontalLine();
            if (GUILayout.Button("Select Player", GUILayout.Width(100)))
            {
                Selection.activeGameObject = pcObject;
            }
            DrawNavigationButtons(true, true, false);
        }
Exemplo n.º 11
0
        private void DrawAlertsStage()
        {
            if (DialogueManager.Instance.displaySettings.alertSettings == null)
            {
                DialogueManager.Instance.displaySettings.alertSettings = new DisplaySettings.AlertSettings();
            }
            EditorGUILayout.LabelField("Alerts", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Alerts are gameplay messages. They can be delivered from conversations or other sources.", MessageType.Info);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.Instance.displaySettings.alertSettings.allowAlertsDuringConversations = EditorGUILayout.Toggle("Allow In Conversations", DialogueManager.Instance.displaySettings.alertSettings.allowAlertsDuringConversations);
            EditorGUILayout.HelpBox("Tick to allow alerts to be displayed while in conversations. If unticked, alerts won't be displayed until the conversation has ended.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            bool monitorAlerts = EditorGUILayout.Toggle("Monitor Alerts", (DialogueManager.Instance.displaySettings.alertSettings.alertCheckFrequency > 0));

            EditorGUILayout.HelpBox("Tick to constantly monitor the Lua value \"Variable['Alert']\" and display its contents as an alert. This runs as a background process. The value is automatically checked at the end of conversations, and you can check it manually. Unless you have a need to constantly monitor the value, it's more efficient to leave this unticked.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            if (monitorAlerts)
            {
                if (Tools.ApproximatelyZero(DialogueManager.Instance.displaySettings.alertSettings.alertCheckFrequency))
                {
                    DialogueManager.Instance.displaySettings.alertSettings.alertCheckFrequency = DefaultAlertCheckFrequency;
                }
                DialogueManager.Instance.displaySettings.alertSettings.alertCheckFrequency = EditorGUILayout.FloatField("Frequency (Seconds)", DialogueManager.Instance.displaySettings.alertSettings.alertCheckFrequency);
            }
            else
            {
                DialogueManager.Instance.displaySettings.alertSettings.alertCheckFrequency = 0;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Draws the destination section. You can override this if you want to draw
 /// more than the default controls.
 /// </summary>
 protected override void DrawDestinationSection()
 {
     base.DrawDestinationSection();
     EditorWindowTools.StartIndentedSection();
     sortByID = EditorGUILayout.Toggle("Sort By ID", sortByID);
     EditorWindowTools.EndIndentedSection();
 }
        private void DrawDatabaseList()
        {
            EditorGUI.BeginChangeCheck();
            EditorWindowTools.StartIndentedSection();
            DialogueDatabase databaseToDelete = null;

            for (int i = 0; i < prefs.databases.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                prefs.databases[i] = EditorGUILayout.ObjectField(prefs.databases[i], typeof(DialogueDatabase), false) as DialogueDatabase;
                if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.Width(22)))
                {
                    databaseToDelete = prefs.databases[i];
                }
                EditorGUILayout.EndHorizontal();
            }
            if (databaseToDelete != null)
            {
                prefs.databases.Remove(databaseToDelete);
            }
            EditorWindowTools.EndIndentedSection();
            if (EditorGUI.EndChangeCheck())
            {
                prefs.Save();
            }
        }
Exemplo n.º 14
0
        private bool DrawBarkOnIdleSection()
        {
            EditorGUILayout.BeginHorizontal();
            BarkOnIdle barkOnIdle    = npcObject.GetComponentInChildren <BarkOnIdle>();
            bool       hasBarkOnIdle = EditorGUILayout.Toggle((barkOnIdle != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("NPC barks on a timed basis", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasBarkOnIdle)
            {
                EditorWindowTools.StartIndentedSection();
                if (barkOnIdle == null)
                {
                    barkOnIdle = npcObject.AddComponent <BarkOnIdle>();
                }
                EditorGUILayout.HelpBox("Select the conversation containing the NPC's bark lines, the order in which to display them, and the time that should pass between barks.",
                                        string.IsNullOrEmpty(barkOnIdle.conversation) ? MessageType.Info : MessageType.None);
                barkOnIdle.conversation = DrawConversationPopup(barkOnIdle.conversation);
                barkOnIdle.barkOrder    = (BarkOrder)EditorGUILayout.EnumPopup("Order of Lines", barkOnIdle.barkOrder);
                barkOnIdle.minSeconds   = EditorGUILayout.FloatField("Min Seconds", barkOnIdle.minSeconds);
                barkOnIdle.maxSeconds   = EditorGUILayout.FloatField("Max Seconds", barkOnIdle.maxSeconds);
                EditorWindowTools.EndIndentedSection();
            }
            else
            {
                DestroyImmediate(barkOnIdle);
            }
            return(hasBarkOnIdle);
        }
Exemplo n.º 15
0
 private void DrawSimpleControllerSection(PixelCrushers.DialogueSystem.SimpleController simpleController)
 {
     EditorWindowTools.StartIndentedSection();
     if ((simpleController.idle == null) || (simpleController.runForward == null))
     {
         EditorGUILayout.HelpBox("The player uses third-person shooter style controls. At a minimum, Idle and Run animations are required. Click Select Player to customize further.", MessageType.Info);
     }
     simpleController.idle       = EditorGUILayout.ObjectField("Idle Animation", simpleController.idle, typeof(AnimationClip), false) as AnimationClip;
     simpleController.runForward = EditorGUILayout.ObjectField("Run Animation", simpleController.runForward, typeof(AnimationClip), false) as AnimationClip;
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.LabelField("Optional", EditorStyles.boldLabel);
     simpleController.runSpeed = EditorGUILayout.FloatField("Run Speed", simpleController.runSpeed);
     simpleController.runBack  = EditorGUILayout.ObjectField("Run Back", simpleController.runBack, typeof(AnimationClip), false) as AnimationClip;
     simpleController.aim      = EditorGUILayout.ObjectField("Aim", simpleController.aim, typeof(AnimationClip), false) as AnimationClip;
     simpleController.fire     = EditorGUILayout.ObjectField("Fire", simpleController.fire, typeof(AnimationClip), false) as AnimationClip;
     if (simpleController.fire != null)
     {
         if (simpleController.upperBodyMixingTransform == null)
         {
             EditorGUILayout.HelpBox("Specify the upper body mixing transform for the fire animation.", MessageType.Info);
         }
         simpleController.upperBodyMixingTransform = EditorGUILayout.ObjectField("Upper Body Transform", simpleController.upperBodyMixingTransform, typeof(Transform), true) as Transform;
         simpleController.fireLayerMask            = EditorGUILayout.LayerField("Fire Layer", simpleController.fireLayerMask);
         simpleController.fireSound = EditorGUILayout.ObjectField("Fire Sound", simpleController.fireSound, typeof(AudioClip), false) as AudioClip;
         AudioSource audioSource = pcObject.GetComponent <AudioSource>();
         if (audioSource == null)
         {
             audioSource             = pcObject.AddComponent <AudioSource>();
             audioSource.playOnAwake = false;
             audioSource.loop        = false;
         }
     }
     EditorWindowTools.EndIndentedSection();
     EditorWindowTools.EndIndentedSection();
 }
 private void DrawInputSettings()
 {
     foldouts.inputSettingsFoldout = EditorWindowTools.EditorGUILayoutFoldout("Input Settings", "Input and response menu settings.", foldouts.inputSettingsFoldout, false);
     if (foldouts.inputSettingsFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             var inputSettings = displaySettingsProperty.FindPropertyRelative("inputSettings");
             EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("alwaysForceResponseMenu"), true);
             EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("includeInvalidEntries"), true);
             EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("responseTimeout"), true);
             EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("responseTimeoutAction"), true);
             EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("emTagForOldResponses"), new GUIContent("[em#] Tag For Old Responses", "The [em#] tag to wrap around responses that have been previously chosen."), true);
             EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("emTagForInvalidResponses"), new GUIContent("[em#] Tag For Invalid Responses", "The [em#] tag to wrap around invalid responses. These responses are only shown if Include Invalid Entries is ticked."), true);
             try
             {
                 EditorWindowTools.StartIndentedSection();
                 EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("qteButtons"), new GUIContent("QTE Input Buttons", "Input buttons mapped to QTEs."), true);
                 EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("cancel"), new GUIContent("Cancel Subtitle Input", "Key or button that cancels subtitle sequences."), true);
                 EditorGUILayout.PropertyField(inputSettings.FindPropertyRelative("cancelConversation"), new GUIContent("Cancel Conversation Input", "Key or button that cancels active conversation while in response menu."), true);
             }
             finally
             {
                 EditorWindowTools.EndIndentedSection();
             }
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
        private void DrawCutscenesStage()
        {
            if (DialogueManager.instance.displaySettings.cameraSettings == null)
            {
                DialogueManager.instance.displaySettings.cameraSettings = new DisplaySettings.CameraSettings();
            }
            EditorGUILayout.LabelField("Camera & Cutscene Settings", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("The Dialogue System uses an integrated, text-based cutscene sequencer. Every line of dialogue can have a cutscene sequence -- for example to move the camera, play animations on the speaker, or play a lip-synced voiceover.", MessageType.Info);
            EditorWindowTools.DrawHorizontalLine();

            EditorGUILayout.HelpBox("You can set up a camera object or prefab specifically for sequences. This can be useful to apply depth of field effects or other filters that you wouldn't normally apply to your gameplay camera. If you've set up a sequencer camera, assign it below. Otherwise the sequencer will just use the current main camera.", MessageType.None);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.cameraSettings.sequencerCamera = EditorGUILayout.ObjectField("Sequencer Camera", DialogueManager.instance.displaySettings.cameraSettings.sequencerCamera, typeof(UnityEngine.Camera), true) as UnityEngine.Camera;
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.HelpBox((DialogueManager.instance.displaySettings.cameraSettings.sequencerCamera == null) ? "Will use Main Camera." : "Will instantiate a copy of this camera for sequences.", MessageType.None);
            EditorWindowTools.DrawHorizontalLine();

            EditorGUILayout.HelpBox("Cutscene sequence commands can reference camera angles defined on a camera angle prefab. You can set up your own custom camera angle prefab. Otherwise the sequencer will use a default camera angle prefab with basic angles such as Closeup, Medium, and Wide.", MessageType.None);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.instance.displaySettings.cameraSettings.cameraAngles = EditorGUILayout.ObjectField("Camera Angles", DialogueManager.instance.displaySettings.cameraSettings.cameraAngles, typeof(GameObject), true) as GameObject;
            EditorGUILayout.EndHorizontal();
            if (DialogueManager.instance.displaySettings.cameraSettings.cameraAngles == null)
            {
                EditorGUILayout.HelpBox("Will use default camera angles.", MessageType.None);
            }
            EditorWindowTools.DrawHorizontalLine();

            EditorGUILayout.HelpBox("If a dialogue entry doesn't define its own cutscene sequence, it will use the default sequence below.", MessageType.None);
            DialogueManager.instance.displaySettings.cameraSettings.defaultSequence = SelectSequence("Default Sequence", DialogueManager.instance.displaySettings.cameraSettings.defaultSequence);
            DialogueManager.instance.displaySettings.cameraSettings.defaultSequence = EditorGUILayout.TextField("Default Sequence", DialogueManager.instance.displaySettings.cameraSettings.defaultSequence);

            var usePlayerSequence = !string.IsNullOrEmpty(DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence);

            usePlayerSequence = EditorGUILayout.Toggle(new GUIContent("Player-Specific Default", "Tick to override Default Sequence for player lines"), usePlayerSequence);
            if (!usePlayerSequence)
            {
                DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence = string.Empty;
            }
            else
            {
                if (string.IsNullOrEmpty(DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence))
                {
                    DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence = DefaultCameraAngleSequence;
                }
                DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence = SelectSequence("Player-Specific Default", DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence);
            }

            if (usePlayerSequence)
            {
                DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence = EditorGUILayout.TextField("Player-Specific Default", DialogueManager.instance.displaySettings.cameraSettings.defaultPlayerSequence);
            }
            else
            {
                EditorGUILayout.HelpBox("Will use Default Sequence for players and NPCs.", MessageType.None);
            }
            EditorGUILayout.HelpBox("In default sequences, you can use '{{end}}' to refer to the duration of the subtitle as determined by Chars/Second and Min Seconds.", MessageType.None);
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Exemplo n.º 18
0
        private void DrawInputsStage()
        {
            if (DialogueManager.Instance.displaySettings.inputSettings == null)
            {
                DialogueManager.Instance.displaySettings.inputSettings = new DisplaySettings.InputSettings();
            }
            EditorGUILayout.LabelField("Input Settings", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("In this section, you'll specify input settings for the dialogue UI.", MessageType.Info);
            EditorWindowTools.StartIndentedSection();

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Player Response Menu", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.Instance.displaySettings.inputSettings.alwaysForceResponseMenu = EditorGUILayout.Toggle("Always Force Menu", DialogueManager.Instance.displaySettings.inputSettings.alwaysForceResponseMenu);
            EditorGUILayout.HelpBox("Tick to always force the response menu. If unticked, then when the player only has one valid response, the UI will automatically select it without showing the response menu.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            bool useTimeout = EditorGUILayout.Toggle("Timer", (DialogueManager.Instance.displaySettings.inputSettings.responseTimeout > 0));

            EditorGUILayout.HelpBox("Tick to make the response menu timed. If unticked, players can take as long as they want to make their selection.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            if (useTimeout)
            {
                if (Tools.ApproximatelyZero(DialogueManager.Instance.displaySettings.inputSettings.responseTimeout))
                {
                    DialogueManager.Instance.displaySettings.inputSettings.responseTimeout = DefaultResponseTimeoutDuration;
                }
                DialogueManager.Instance.displaySettings.inputSettings.responseTimeout       = EditorGUILayout.FloatField("Timeout Seconds", DialogueManager.Instance.displaySettings.inputSettings.responseTimeout);
                DialogueManager.Instance.displaySettings.inputSettings.responseTimeoutAction = (ResponseTimeoutAction)EditorGUILayout.EnumPopup("If Time Runs Out", DialogueManager.Instance.displaySettings.inputSettings.responseTimeoutAction);
            }
            else
            {
                DialogueManager.Instance.displaySettings.inputSettings.responseTimeout = 0;
            }

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Quick Time Event (QTE) Trigger Buttons", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("QTE trigger buttons may be defined on the Dialogue Manager object's inspector under Display Settings > Input Settings > Qte Buttons.", MessageType.None);
            if (GUILayout.Button("Inspect Dialogue Manager object", GUILayout.Width(240)))
            {
                Selection.activeObject = DialogueManager.Instance;
            }

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Cancel", EditorStyles.boldLabel);
            EditorGUILayout.BeginHorizontal();
            DialogueManager.Instance.displaySettings.inputSettings.cancel.key = (KeyCode)EditorGUILayout.EnumPopup("Key", DialogueManager.Instance.displaySettings.inputSettings.cancel.key);
            EditorGUILayout.HelpBox("Pressing this key cancels the response menu or conversation.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            DialogueManager.Instance.displaySettings.inputSettings.cancel.buttonName = EditorGUILayout.TextField("Button Name", DialogueManager.Instance.displaySettings.inputSettings.cancel.buttonName);
            EditorGUILayout.HelpBox("Pressing this button cancels the response menu or conversation.", MessageType.None);
            EditorGUILayout.EndHorizontal();

            EditorWindowTools.EndIndentedSection();
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Exemplo n.º 19
0
 private void DrawNoSelector()
 {
     DestroyImmediate(pcObject.GetComponent <Selector>());
     DestroyImmediate(pcObject.GetComponent <ProximitySelector>());
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("The player will not use a Dialogue System-provided targeting component.", MessageType.None);
     EditorWindowTools.EndIndentedSection();
 }
Exemplo n.º 20
0
        private void DrawCutscenesStage()
        {
            if (DialogueManager.Instance.displaySettings.cameraSettings == null)
            {
                DialogueManager.Instance.displaySettings.cameraSettings = new DisplaySettings.CameraSettings();
            }
            EditorGUILayout.LabelField("Cutscene Sequences", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("The Dialogue System uses an integrated cutscene sequencer. Every line of dialogue can have a cutscene sequence -- for example to move the camera, play animations on the speaker, or play a lip-synced voiceover.", MessageType.Info);
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.HelpBox("You can set up a camera object or prefab specifically for sequences. This can be useful to apply depth of field effects or other filters that you wouldn't normally apply to your gameplay camera. If you've set up a sequencer camera, assign it below. Otherwise the sequencer will just use the current main camera.", MessageType.None);
            DialogueManager.Instance.displaySettings.cameraSettings.sequencerCamera = EditorGUILayout.ObjectField("Sequencer Camera", DialogueManager.Instance.displaySettings.cameraSettings.sequencerCamera, typeof(UnityEngine.Camera), true) as UnityEngine.Camera;
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.HelpBox("Cutscene sequence commands can reference camera angles defined on a camera angle prefab. If you've set up a camera angle prefab, assign it below. Otherwise the sequencer will use a default camera angle prefab with basic angles such as Closeup, Medium, and Wide.", MessageType.None);
            DialogueManager.Instance.displaySettings.cameraSettings.cameraAngles = EditorGUILayout.ObjectField("Camera Angles", DialogueManager.Instance.displaySettings.cameraSettings.cameraAngles, typeof(GameObject), true) as GameObject;
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.HelpBox("If a dialogue entry doesn't define its own cutscene sequence, it will use the default sequence below.", MessageType.None);
            EditorGUILayout.BeginHorizontal();
            DefaultSequenceStyle style = string.Equals(DefaultCameraAngleSequence, DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence)
                                ? DefaultSequenceStyle.DefaultCameraAngles
                                        : string.Equals(DefaultCloseupSequence, DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence)
                                                ? DefaultSequenceStyle.Closeups
                                                : (string.Equals(DefaultWaitForSubtitleSequence, DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence)
                                                        ? DefaultSequenceStyle.WaitForSubtitle
                                                        : DefaultSequenceStyle.Custom);
            DefaultSequenceStyle newStyle = (DefaultSequenceStyle)EditorGUILayout.EnumPopup("Default Sequence", style);

            if (newStyle != style)
            {
                style = newStyle;
                switch (style)
                {
                case DefaultSequenceStyle.DefaultCameraAngles: DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence = DefaultCameraAngleSequence; break;

                case DefaultSequenceStyle.Closeups: DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence = DefaultCloseupSequence; break;

                case DefaultSequenceStyle.WaitForSubtitle: DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence = DefaultWaitForSubtitleSequence; break;

                default: break;
                }
            }
            switch (style)
            {
            case DefaultSequenceStyle.DefaultCameraAngles: EditorGUILayout.HelpBox("Changes to the speaker's default camera angle. At the end of the subtitle, changes to the listener's default angle. If angles aren't specified on the speaker or listener, the default is Closeup. Don't use this if your player is a body-less first person controller, since focusing the camera on the player probably doesn't make sense in this case.", MessageType.None); break;

            case DefaultSequenceStyle.Closeups: EditorGUILayout.HelpBox("Does a camera closeup of the speaker. At the end of the subtitle, changes to a closeup of the listener. Don't use this if your player is a body-less first person controller, since a closeup doesn't make sense in this case.", MessageType.None); break;

            case DefaultSequenceStyle.WaitForSubtitle: EditorGUILayout.HelpBox("Just waits for the subtitle to finish. Doesn't touch the camera.", MessageType.None); break;

            default: EditorGUILayout.HelpBox("Custom default sequence defined below.", MessageType.None); break;
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.HelpBox("In the default sequence, you can use '{{end}}' to refer to the duration of the subtitle as determined by Chars/Second and Min Seconds.", MessageType.None);
            DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence = EditorGUILayout.TextField("Default Sequence", DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence);
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Exemplo n.º 21
0
 private void DrawSelectNPCStage()
 {
     EditorGUILayout.LabelField("Select NPC Object", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("This wizard will help you configure a Non Player Character (NPC) object to work with the Dialogue System. First, assign the NPC's GameObject below.", MessageType.Info);
     npcObject = EditorGUILayout.ObjectField("NPC Object", npcObject, typeof(GameObject), true) as GameObject;
     EditorWindowTools.EndIndentedSection();
     DrawNavigationButtons(false, (npcObject != null), false);
 }
        public override void OnInspectorGUI()
        {
            var trigger = target as ConditionObserver;

            if (trigger == null)
            {
                return;
            }

            // Reference database:
            EditorTools.selectedDatabase = EditorGUILayout.ObjectField("Reference Database", EditorTools.selectedDatabase, typeof(DialogueDatabase), false) as DialogueDatabase;

            // Frequency, once, observeGameObject:
            trigger.frequency         = EditorGUILayout.FloatField(new GUIContent("Frequency", "Frequency in seconds between checks"), trigger.frequency);
            trigger.once              = EditorGUILayout.Toggle(new GUIContent("Only Once", "Destroy after the condition is true"), trigger.once);
            trigger.observeGameObject = EditorGUILayout.ObjectField(new GUIContent("Observe GameObject", "Refer to this GameObject when evaluating the Condition"), trigger.observeGameObject, typeof(GameObject), false) as GameObject;

            // Condition:
            EditorTools.DrawSerializedProperty(serializedObject, "condition");

            actionFoldout = EditorGUILayout.Foldout(actionFoldout, "Action");
            if (!actionFoldout)
            {
                return;
            }

            EditorWindowTools.StartIndentedSection();

            // Lua code / wizard:
            if (EditorTools.selectedDatabase != luaScriptWizard.database)
            {
                luaScriptWizard.database = EditorTools.selectedDatabase;
                luaScriptWizard.RefreshWizardResources();
            }
            trigger.luaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run when the condition is true"), trigger.luaCode);

            // Quest:
            if (EditorTools.selectedDatabase != questPicker.database)
            {
                questPicker.database = EditorTools.selectedDatabase;
                questPicker.UpdateTitles();
            }
            questPicker.Draw();
            trigger.questName          = questPicker.currentQuest;
            trigger.useQuestNamePicker = questPicker.usePicker;
            trigger.questState         = (QuestState)EditorGUILayout.EnumPopup(new GUIContent("Quest State", "The new quest state"), trigger.questState);

            // Alert message:
            trigger.alertMessage       = EditorGUILayout.TextField(new GUIContent("Alert Message", "Optional alert message to display when triggered"), trigger.alertMessage);
            trigger.localizedTextTable = EditorGUILayout.ObjectField(new GUIContent("Localized Text Table", "The localized text table to use for the alert message text"), trigger.localizedTextTable, typeof(LocalizedTextTable), true) as LocalizedTextTable;

            // Send Messages list:
            EditorTools.DrawSerializedProperty(serializedObject, "sendMessages");

            EditorWindowTools.EndIndentedSection();
        }
Exemplo n.º 23
0
 private void DrawSimpleControllerSection(PixelCrushers.DialogueSystem.Demo.SimpleController simpleController)
 {
     EditorWindowTools.StartIndentedSection();
     if (simpleControllerEditor == null)
     {
         simpleControllerEditor = Editor.CreateEditor(simpleController);
     }
     simpleControllerEditor.OnInspectorGUI();
     EditorWindowTools.EndIndentedSection();
 }
Exemplo n.º 24
0
 private void DrawNavigateOnMouseClickSection(PixelCrushers.DialogueSystem.Demo.NavigateOnMouseClick navigateOnMouseClick)
 {
     EditorWindowTools.StartIndentedSection();
     if (navMouseClickEditor == null)
     {
         navMouseClickEditor = Editor.CreateEditor(navigateOnMouseClick);
     }
     navMouseClickEditor.OnInspectorGUI();
     EditorWindowTools.EndIndentedSection();
 }
Exemplo n.º 25
0
        private void DrawProximitySelector()
        {
            DestroyImmediate(pcObject.GetComponent <Selector>());
            ProximitySelector proximitySelector = pcObject.GetComponent <ProximitySelector>() ?? pcObject.AddComponent <ProximitySelector>();

            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("The player can target usable objects (e.g., conversations on NPCs) when inside their trigger areas. Click Select Player to customize the Proximity Selector.", MessageType.None);
            DrawSelectorUIPosition();
            proximitySelector.useKey    = (KeyCode)EditorGUILayout.EnumPopup("'Use' Key", proximitySelector.useKey);
            proximitySelector.useButton = EditorGUILayout.TextField("'Use' Button", proximitySelector.useButton);
            EditorWindowTools.EndIndentedSection();
        }
Exemplo n.º 26
0
 private void DrawNavigateOnMouseClickSection(NavigateOnMouseClick navigateOnMouseClick)
 {
     EditorWindowTools.StartIndentedSection();
     if ((navigateOnMouseClick.idle == null) || (navigateOnMouseClick.run == null))
     {
         EditorGUILayout.HelpBox("The player clicks on the map to move. At a minimum, Idle and Run animations are required. Click Select Player to customize further.", MessageType.Info);
     }
     navigateOnMouseClick.idle        = EditorGUILayout.ObjectField("Idle Animation", navigateOnMouseClick.idle, typeof(AnimationClip), false) as AnimationClip;
     navigateOnMouseClick.run         = EditorGUILayout.ObjectField("Run Animation", navigateOnMouseClick.run, typeof(AnimationClip), false) as AnimationClip;
     navigateOnMouseClick.mouseButton = (NavigateOnMouseClick.MouseButtonType)EditorGUILayout.EnumPopup("Mouse Button", navigateOnMouseClick.mouseButton);
     EditorWindowTools.EndIndentedSection();
 }
 private void DrawDatabaseStage()
 {
     if (DialogueManager.instance == null)
     {
         EditorGUILayout.LabelField("Dialogue Manager", EditorStyles.boldLabel);
         EditorWindowTools.StartIndentedSection();
         EditorGUILayout.HelpBox("This wizard will help you configure the Dialogue Manager GameObject.\n\nThe Dialogue Manager coordinates all Dialogue System activity. It should be in the first scene that uses any Dialogue System functionality. By default, it's configured to persist across scene changes, replacing any Dialogue Managers in the newly-loaded scene. This allows you to retain your runtime dialogue information as you change scenes.\n\n" +
                                 "This scene doesn't have a Dialogue Manager. The recommended way to add a Dialogue Manager is to add the prefab located in " +
                                 "Plugins / Pixel Crushers / Dialogue System / Prefabs / Dialogue Manager.", MessageType.Info);
         EditorGUILayout.BeginHorizontal();
         if (GUILayout.Button(new GUIContent("Add Prefab", "Add Dialogue Manager starter prefab to scene."), GUILayout.Width(100)))
         {
             var prefab = AssetDatabase.LoadMainAssetAtPath("Assets/Plugins/Pixel Crushers/Dialogue System/Prefabs/Dialogue Manager.prefab");
             if (prefab == null)
             {
                 EditorUtility.DisplayDialog("Prefab Not Found", "This wizard can't find the Dialogue Manager prefab. You may have moved the Dialogue System to a different folder in your project. You'll need to add the prefab manually.", "OK");
             }
             else
             {
                 PrefabUtility.InstantiatePrefab(prefab);
                 UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene());
             }
         }
         //--- Discourage blank. Use prefab:
         //if (GUILayout.Button(new GUIContent("Create Blank", "Create a blank Dialogue Manager that you'll need to configure from scratch."), GUILayout.Width(100)))
         //{
         //    new GameObject("Dialogue Manager").AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.DialogueSystemController)));
         //}
         EditorGUILayout.EndHorizontal();
     }
     else
     {
         EditorGUILayout.LabelField("Dialogue Database", EditorStyles.boldLabel);
         EditorWindowTools.StartIndentedSection();
         EditorGUILayout.HelpBox("The first step is to assign a dialogue database asset. This asset contains your conversations and related data.", MessageType.Info);
         EditorGUILayout.BeginHorizontal();
         DialogueManager.instance.initialDatabase = EditorGUILayout.ObjectField("Database", DialogueManager.instance.initialDatabase, typeof(DialogueDatabase), false) as DialogueDatabase;
         bool disabled = (DialogueManager.instance.initialDatabase != null);
         EditorGUI.BeginDisabledGroup(disabled);
         if (GUILayout.Button("Create New", GUILayout.Width(100)))
         {
             createNewDatabase = true;
         }
         EditorGUI.EndDisabledGroup();
         EditorGUILayout.EndHorizontal();
     }
     EditorWindowTools.EndIndentedSection();
     if (DialogueManager.instance != null)
     {
         DrawNavigationButtons(false, (DialogueManager.instance.initialDatabase != null), false);
     }
 }
 private void DrawSubtitlesStage()
 {
     if (DialogueManager.instance.displaySettings.subtitleSettings == null)
     {
         DialogueManager.instance.displaySettings.subtitleSettings = new DisplaySettings.SubtitleSettings();
     }
     EditorGUILayout.LabelField("Subtitle Settings", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("In this section, you'll specify how subtitles are displayed.", MessageType.Info);
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.showNPCSubtitlesDuringLine = EditorGUILayout.Toggle("NPC Subtitles During Line", DialogueManager.instance.displaySettings.subtitleSettings.showNPCSubtitlesDuringLine);
     EditorGUILayout.HelpBox("Tick to display NPC subtitles while NPCs are speaking. Subtitles are the lines of dialogue defined in your dialogue database asset. You might untick this if, for example, you use lip-synced voiceovers without onscreen text.", MessageType.None);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.showNPCSubtitlesWithResponses = EditorGUILayout.Toggle("     With Response Menu", DialogueManager.instance.displaySettings.subtitleSettings.showNPCSubtitlesWithResponses);
     EditorGUILayout.HelpBox("Tick to display the last NPC subtitle during the player response menu. This helps remind the players what they're responding to.", MessageType.None);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.showPCSubtitlesDuringLine = EditorGUILayout.Toggle("PC Subtitles", DialogueManager.instance.displaySettings.subtitleSettings.showPCSubtitlesDuringLine);
     EditorGUILayout.HelpBox("Tick to display PC subtitles while the PC is speaking. If you use different Menu Text and Dialogue Text, this should probably be ticked. Otherwise you may choose to leave it unticked.", MessageType.None);
     EditorGUILayout.EndHorizontal();
     if (DialogueManager.instance.displaySettings.subtitleSettings.showPCSubtitlesDuringLine)
     {
         EditorGUILayout.BeginHorizontal();
         DialogueManager.instance.displaySettings.subtitleSettings.skipPCSubtitleAfterResponseMenu = EditorGUILayout.Toggle("     Skip After Menu", DialogueManager.instance.displaySettings.subtitleSettings.skipPCSubtitleAfterResponseMenu);
         EditorGUILayout.HelpBox("Tick to skip showing PC subtitles that come from response menu selections.", MessageType.None);
         EditorGUILayout.EndHorizontal();
     }
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.subtitleCharsPerSecond = EditorGUILayout.FloatField("Chars/Second", DialogueManager.instance.displaySettings.subtitleSettings.subtitleCharsPerSecond);
     EditorGUILayout.HelpBox("Determines how long the subtitle is displayed before moving to the next stage of the conversation. If the subtitle is 90 characters and Chars/Second is 30, then it will be displayed for 3 seconds.", MessageType.None);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.minSubtitleSeconds = EditorGUILayout.FloatField("Min Seconds", DialogueManager.instance.displaySettings.subtitleSettings.minSubtitleSeconds);
     EditorGUILayout.HelpBox("Min Seconds below is the guaranteed minimum amount of time that a subtitle will be displayed (if its corresponding checkbox is ticked).", MessageType.None);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.continueButton = (DisplaySettings.SubtitleSettings.ContinueButtonMode)EditorGUILayout.EnumPopup("Continue Button", DialogueManager.instance.displaySettings.subtitleSettings.continueButton);
     //.waitForContinueButton = EditorGUILayout.Toggle("Use Continue Button", DialogueManager.Instance.displaySettings.subtitleSettings.waitForContinueButton);
     EditorGUILayout.HelpBox("- Never: Conversation automatically moves to next stage when subtitle is done." +
                             "\n- Always: Requires player to click a continue button to progress past each subtitle." +
                             "\n- Optional Before Response Menu: If player response menu is next, shows but doesn't require clicking." +
                             "\n- Never Before Response Menu: If player response menu is next, doesn't show." +
                             "\nFor any setting other than Never, your UI must contain continue button(s).", MessageType.None);
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.BeginHorizontal();
     DialogueManager.instance.displaySettings.subtitleSettings.richTextEmphases = EditorGUILayout.Toggle("Rich Text", DialogueManager.instance.displaySettings.subtitleSettings.richTextEmphases);
     EditorGUILayout.HelpBox("By default, emphasis tags embedded in dialogue text are applied to the entire subtitle. To convert them to rich text tags instead, tick this checkbox. This allows emphases to affect only parts of the text, but your GUI system must support rich text.", MessageType.None);
     EditorGUILayout.EndHorizontal();
     EditorWindowTools.EndIndentedSection();
     DrawNavigationButtons(true, true, false);
 }
Exemplo n.º 29
0
 private void ShowDisabledComponents(SetEnabledOnDialogueEvent.SetEnabledAction[] actionList)
 {
     EditorGUILayout.LabelField("The following components will be disabled during conversations:");
     EditorWindowTools.StartIndentedSection();
     foreach (SetEnabledOnDialogueEvent.SetEnabledAction action in actionList)
     {
         if (action.target != null)
         {
             EditorGUILayout.LabelField(action.target.GetType().Name);
         }
     }
     EditorWindowTools.EndIndentedSection();
 }
Exemplo n.º 30
0
        private void DrawReviewStage()
        {
            EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Your Player is ready! Below is a summary of the configuration.\n\nPlayer configuration can sometimes be complex. This wizard can't anticipate every possible character design. If your player doesn't behave the way you expect, " +
                                    "please examine the components on the player and make adjustments as necessary. Often, you may need to add additional gameplay components, such as your own controller or camera scripts, to the Set Component Enabled On Dialogue Event component in the Gameplay/Conversation Transition section.", MessageType.Info);
            var simpleController     = pcObject.GetComponent <PixelCrushers.DialogueSystem.Demo.SimpleController>();
            var navigateOnMouseClick = pcObject.GetComponent <PixelCrushers.DialogueSystem.Demo.NavigateOnMouseClick>();

            if (simpleController != null)
            {
                EditorGUILayout.LabelField("Control: Third-Person Shooter Style");
            }
            else if (navigateOnMouseClick != null)
            {
                EditorGUILayout.LabelField("Control: Follow Mouse Clicks");
            }
            else
            {
                EditorGUILayout.LabelField("Control: Custom");
            }
            switch (GetSelectorType())
            {
            case SelectorType.CenterOfScreen: EditorGUILayout.LabelField("Targeting: Center of Screen"); break;

            case SelectorType.CustomPosition: EditorGUILayout.LabelField("Targeting: Custom Position (you must set Selector.CustomPosition)"); break;

            case SelectorType.MousePosition: EditorGUILayout.LabelField("Targeting: Mouse Position"); break;

            case SelectorType.Proximity: EditorGUILayout.LabelField("Targeting: Proximity"); break;

            default: EditorGUILayout.LabelField("Targeting: None"); break;
            }
            SetComponentEnabledOnDialogueEvent enabler = FindConversationEnabler();

            if (enabler != null)
            {
                ShowDisabledComponents(enabler.onStart);
            }
            ShowCursorOnConversation showCursor = pcObject.GetComponentInChildren <ShowCursorOnConversation>();

            if (showCursor != null)
            {
                EditorGUILayout.LabelField("Show Cursor During Conversations: Yes");
            }
            var positionSaver = pcObject.GetComponentInChildren <PositionSaver>();

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (positionSaver != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }