Exemple #1
0
 private void DrawDatabaseSection()
 {
     EditorGUILayout.LabelField(database.name, EditorStyles.boldLabel);
     EditorGUILayout.LabelField("Database Properties", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.BeginVertical(GroupBoxStyle);
     database.author  = EditorGUILayout.TextField("Author", database.author);
     database.version = EditorGUILayout.TextField("Version", database.version);
     EditorGUILayout.LabelField("Description");
     database.description = EditorGUILayout.TextArea(database.description);
     EditorGUILayout.LabelField(new GUIContent("Global User Script", "Optional Lua code to run when this database is loaded at runtime."));
     database.globalUserScript         = EditorGUILayout.TextArea(database.globalUserScript);
     databaseFoldouts.emphasisSettings = EditorGUILayout.Foldout(databaseFoldouts.emphasisSettings, new GUIContent("Emphasis Settings", "Settings to use for [em#] tags in dialogue text."));
     if (databaseFoldouts.emphasisSettings)
     {
         DrawEmphasisSettings();
     }
     EditorGUILayout.EndVertical();
     EditorWindowTools.EndIndentedSection();
     databaseFoldouts.merge = EditorGUILayout.Foldout(databaseFoldouts.merge, new GUIContent("Merge Database", "Options to merge another database into this one."));
     if (databaseFoldouts.merge)
     {
         DrawMergeSection();
     }
     databaseFoldouts.export = EditorGUILayout.Foldout(databaseFoldouts.export, new GUIContent("Export Database", "Options to export the database to Chat Mapper XML format."));
     if (databaseFoldouts.export)
     {
         DrawExportSection();
     }
 }
        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);
        }
Exemple #3
0
 private void DrawSimpleControllerSection(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 DrawQuestEntries(Item item)
        {
            EditorWindowTools.StartIndentedSection();
            int entryCount    = Field.LookupInt(item.fields, "Entry Count");
            int entryToDelete = -1;

            for (int i = 1; i <= entryCount; i++)
            {
                DrawQuestEntry(item, i, entryCount, ref entryToDelete);
            }
            if (entryToDelete != -1)
            {
                DeleteQuestEntry(item, entryToDelete, entryCount);
            }
            if (GUILayout.Button(new GUIContent("Add New Quest Entry", "Adds a new quest entry to this quest.")))
            {
                entryCount++;
                Field.SetValue(item.fields, "Entry Count", entryCount);
                Field.SetValue(item.fields, string.Format("Entry {0} State", entryCount), "unassigned");
                Field.SetValue(item.fields, string.Format("Entry {0}", entryCount), string.Empty);
                List <string> questLanguages = new List <string>();
                item.fields.ForEach(field => {
                    if (field.title.StartsWith("Description "))
                    {
                        string language = field.title.Substring("Description ".Length);
                        questLanguages.Add(language);
                        languages.Add(language);
                    }
                });
                questLanguages.ForEach(language => item.fields.Add(new Field(string.Format("Entry {0} {1}", entryCount, language), string.Empty, FieldType.Localization)));
            }
            EditorWindowTools.EndIndentedSection();
        }
        private void DrawEmphasisSettings()
        {
            EditorWindowTools.StartIndentedSection();
            var newLength = EditorGUILayout.IntField("Size", database.emphasisSettings.Length);

            newLength = Mathf.Max(DialogueDatabase.NumEmphasisSettings, newLength);
            if (newLength != database.emphasisSettings.Length)
            {
                var temp = new EmphasisSetting[newLength];
                for (int i = 0; i < newLength; i++)
                {
                    temp[i] = (i < database.emphasisSettings.Length) ? database.emphasisSettings[i] : new EmphasisSetting(Color.white, false, false, false);
                }
                database.emphasisSettings = temp;
            }
            for (int i = 0; i < database.emphasisSettings.Length; i++)
            {
                if (i >= databaseFoldouts.emphasisSetting.Count)
                {
                    databaseFoldouts.emphasisSetting.Add(false);
                }
                databaseFoldouts.emphasisSetting[i] = EditorGUILayout.Foldout(databaseFoldouts.emphasisSetting[i], string.Format("Emphasis {0}", i + 1));
                if (databaseFoldouts.emphasisSetting[i])
                {
                    DrawEmphasisSetting(database.emphasisSettings[i]);
                }
            }
            EditorWindowTools.EndIndentedSection();
        }
 private void DrawMergeSection()
 {
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.BeginVertical(GroupBoxStyle);
     EditorGUILayout.HelpBox("Use this feature to add the contents of another database to this database.", MessageType.None);
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField("Database to Merge into " + database.name);
     databaseToMerge = EditorGUILayout.ObjectField(databaseToMerge, typeof(DialogueDatabase), false) as DialogueDatabase;
     EditorGUILayout.EndHorizontal();
     mergeProperties    = EditorGUILayout.Toggle("Merge DB Properties", mergeProperties);
     mergeActors        = EditorGUILayout.Toggle("Merge Actors", mergeActors);
     mergeItems         = EditorGUILayout.Toggle("Merge Items", mergeItems);
     mergeLocations     = EditorGUILayout.Toggle("Merge Locations", mergeLocations);
     mergeVariables     = EditorGUILayout.Toggle("Merge Variables", mergeVariables);
     mergeConversations = EditorGUILayout.Toggle("Merge Conversations", mergeConversations);
     EditorGUILayout.BeginHorizontal();
     conflictingIDRule = (DatabaseMerger.ConflictingIDRule)EditorGUILayout.EnumPopup(new GUIContent("If IDs Conflict", "Replace Existing IDs: If the same ID exists in both databases, replace the original one with the new one.\nAllow Conflicting IDs: Append assets even if IDs conflict.\nAssign Unique IDs: Append and assign new IDs to assets from source database."), conflictingIDRule, GUILayout.Width(300));
     GUILayout.FlexibleSpace();
     EditorGUI.BeginDisabledGroup(databaseToMerge == null);
     if (GUILayout.Button("Merge...", GUILayout.Width(100)))
     {
         if (ConfirmMerge())
         {
             MergeDatabase();
         }
     }
     EditorGUI.EndDisabledGroup();
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.EndVertical();
     EditorWindowTools.EndIndentedSection();
 }
Exemple #7
0
        private void DrawLocalizedVersions(List <Field> fields, string titleFormat, bool alwaysAdd, FieldType fieldType, List <Field> alreadyDrawn)
        {
            bool indented = false;

            foreach (var language in languages)
            {
                string localizedTitle = string.Format(titleFormat, language);
                Field  field          = Field.Lookup(fields, localizedTitle);
                if ((field == null) && (alwaysAdd || (Field.FieldExists(template.dialogueEntryFields, localizedTitle))))
                {
                    field = new Field(localizedTitle, string.Empty, fieldType);
                    fields.Add(field);
                }
                if (field != null)
                {
                    if (!indented)
                    {
                        indented = true;
                        EditorWindowTools.StartIndentedSection();
                    }
                    EditorGUILayout.LabelField(localizedTitle);
                    field.value = EditorGUILayout.TextArea(field.value);
                    if (alreadyDrawn != null)
                    {
                        alreadyDrawn.Add(field);
                    }
                }
            }
            if (indented)
            {
                EditorWindowTools.EndIndentedSection();
            }
        }
        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);
        }
        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);
        }
Exemple #10
0
 private void DrawMergeSection()
 {
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.BeginVertical(GroupBoxStyle);
     EditorGUILayout.HelpBox("Use this feature to add the contents of another database to this database.", MessageType.None);
     EditorGUILayout.BeginHorizontal();
     EditorGUILayout.LabelField("Database to Merge into " + database.name);
     databaseToMerge = EditorGUILayout.ObjectField(databaseToMerge, typeof(DialogueDatabase), false) as DialogueDatabase;
     EditorGUILayout.EndHorizontal();
     mergeProperties    = EditorGUILayout.Toggle("Merge DB Properties", mergeProperties);
     mergeActors        = EditorGUILayout.Toggle("Merge Actors", mergeActors);
     mergeItems         = EditorGUILayout.Toggle("Merge Items", mergeItems);
     mergeLocations     = EditorGUILayout.Toggle("Merge Locations", mergeLocations);
     mergeVariables     = EditorGUILayout.Toggle("Merge Variables", mergeVariables);
     mergeConversations = EditorGUILayout.Toggle("Merge Conversations", mergeConversations);
     EditorGUILayout.BeginHorizontal();
     conflictingIDRule = (DatabaseMerger.ConflictingIDRule)EditorGUILayout.EnumPopup("If IDs Conflict", conflictingIDRule, GUILayout.Width(300));
     GUILayout.FlexibleSpace();
     EditorGUI.BeginDisabledGroup(databaseToMerge == null);
     if (GUILayout.Button("Merge...", GUILayout.Width(100)))
     {
         if (ConfirmMerge())
         {
             MergeDatabase();
         }
     }
     EditorGUI.EndDisabledGroup();
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.EndVertical();
     EditorWindowTools.EndIndentedSection();
 }
Exemple #11
0
        private void DrawExportSection()
        {
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.BeginVertical(GroupBoxStyle);
            EditorGUILayout.HelpBox("Use this feature to export your database to CSV or Chat Mapper XML format.\nIf exporting to Chat Mapper, you must also prepare a Chat Mapper template project that contains all the fields defined in this database. You can use the Dialogue System Chat Mapper template project as a base.", MessageType.None);
            exportActors        = EditorGUILayout.Toggle("Export Actors", exportActors);
            exportItems         = EditorGUILayout.Toggle("Export Items/Quests", exportItems);
            exportLocations     = EditorGUILayout.Toggle("Export Locations", exportLocations);
            exportVariables     = EditorGUILayout.Toggle("Export Variables", exportVariables);
            exportConversations = EditorGUILayout.Toggle("Export Conversations", exportConversations);
            entrytagFormat      = (EntrytagFormat)EditorGUILayout.EnumPopup("Entrytag Format", entrytagFormat, GUILayout.Width(400));
            EditorGUILayout.BeginHorizontal();
            exportFormat = (ExportFormat)EditorGUILayout.EnumPopup("Format", exportFormat, GUILayout.Width(280));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Export...", GUILayout.Width(100)))
            {
                switch (exportFormat)
                {
                case ExportFormat.ChatMapperXML:
                    TryExportToChatMapperXML();
                    break;

                case ExportFormat.CSV:
                    TryExportToCSV();
                    break;

                case ExportFormat.VoiceoverScript:
                    TryExportToVoiceoverScript();
                    break;
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            EditorWindowTools.EndIndentedSection();
        }
        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);
        }
        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();
        }
Exemple #14
0
        private void DrawWatchSection()
        {
            if (EditorApplication.isPlaying && DialogueManager.instance != null && DialogueManager.masterDatabase != null)
            {
                if (database == null)
                {
                    database = DialogueManager.instance.initialDatabase;
                }

                if (watches == null)
                {
                    watches = new List <Watch>();
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Watches", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                DrawWatchMenu();
                EditorGUILayout.EndHorizontal();

                EditorWindowTools.StartIndentedSection();
                DrawGlobalWatchControls();
                DrawWatches();
                EditorWindowTools.EndIndentedSection();
            }
        }
Exemple #15
0
 private void DrawFieldsSection(List <Field> fields, List <string> primaryFieldTitles = null)
 {
     EditorWindowTools.StartIndentedSection();
     DrawFieldsHeading(primaryFieldTitles != null);
     DrawFieldsContent(fields, primaryFieldTitles);
     EditorWindowTools.EndIndentedSection();
 }
        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);
        }
Exemple #17
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();
 }
 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);
 }
        private bool DrawMultinodeFieldsSection()
        {
            EditorWindowTools.StartIndentedSection();
            DrawFieldsHeading();
            var changed = DrawMultinodeFieldsContent();

            EditorWindowTools.EndIndentedSection();
            return(changed);
        }
Exemple #20
0
 private void DrawAsset <T>(T asset, int index, AssetFoldouts foldouts) where T : Asset
 {
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.BeginVertical("button");
     DrawAssetSpecificPropertiesFirstPart(asset);
     DrawFieldsFoldout <T>(asset, index, foldouts);
     DrawAssetSpecificPropertiesSecondPart(asset, index, foldouts);
     EditorGUILayout.EndVertical();
     EditorWindowTools.EndIndentedSection();
 }
 private void DrawEmphasisSetting(EmphasisSetting setting)
 {
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.BeginVertical(GroupBoxStyle);
     setting.color     = EditorGUILayout.ColorField("Color", setting.color);
     setting.bold      = EditorGUILayout.Toggle("Bold", setting.bold);
     setting.italic    = EditorGUILayout.Toggle("Italic", setting.italic);
     setting.underline = EditorGUILayout.Toggle("Underline", setting.underline);
     EditorGUILayout.EndVertical();
     EditorWindowTools.EndIndentedSection();
 }
Exemple #22
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 Inspect to customize the Proximity Selector.", MessageType.None);
            proximitySelector.useKey    = (KeyCode)EditorGUILayout.EnumPopup("'Use' Key", proximitySelector.useKey);
            proximitySelector.useButton = EditorGUILayout.TextField("'Use' Button", proximitySelector.useButton);
            EditorWindowTools.EndIndentedSection();
        }
Exemple #23
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();
 }
Exemple #24
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();
 }
Exemple #25
0
 private void DrawEmphasisSettings()
 {
     EditorWindowTools.StartIndentedSection();
     for (int i = 0; i < DialogueDatabase.NumEmphasisSettings; i++)
     {
         databaseFoldouts.emphasisSetting[i] = EditorGUILayout.Foldout(databaseFoldouts.emphasisSetting[i], string.Format("Emphasis {0}", i + 1));
         if (databaseFoldouts.emphasisSetting[i])
         {
             DrawEmphasisSetting(database.emphasisSettings[i]);
         }
     }
     EditorWindowTools.EndIndentedSection();
 }
        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(Camera), true) as 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(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.Closeups: DialogueManager.Instance.displaySettings.cameraSettings.defaultSequence = DefaultCloseupSequence; break;

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

                default: break;
                }
            }
            switch (style)
            {
            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);
        }
Exemple #27
0
        private void DrawLocalizationSection()
        {
            EditorWindowTools.StartIndentedSection();

            if (exportLanguageList == null)
            {
                exportLanguageList = new ReorderableList(localizationLanguages.languages, typeof(string), true, true, true, true);
                exportLanguageList.drawHeaderCallback += OnDrawExportLanguageListHeader;
                exportLanguageList.drawElementCallback = OnDrawExportLanguageListElement;
                exportLanguageList.onAddCallback      += OnAddExportLanguageListElement;
            }
            exportLanguageList.DoLayoutList();

            exportLocalizationConversationTitle = EditorGUILayout.ToggleLeft(exportLocalizationConversationTitleLabel, exportLocalizationConversationTitle);
            EditorGUILayout.BeginHorizontal();
            exportLocalizationKeyField = EditorGUILayout.ToggleLeft(exportLocalizationKeyFieldLabel, exportLocalizationKeyField, GUILayout.Width(200));
            if (exportLocalizationKeyField)
            {
                localizationKeyField = EditorGUILayout.TextField(GUIContent.none, localizationKeyField, GUILayout.Width(200));
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Find Languages", GUILayout.Width(120)))
            {
                FindLanguagesForLocalizationExportImport();
            }
            EditorGUI.BeginDisabledGroup(exportLocalizationKeyField && string.IsNullOrEmpty(localizationKeyField));
            if (GUILayout.Button("Export...", GUILayout.Width(100)))
            {
                var newOutputFolder = EditorUtility.OpenFolderPanel("Export Localization Files", localizationLanguages.outputFolder, string.Empty);
                if (!string.IsNullOrEmpty(newOutputFolder))
                {
                    localizationLanguages.outputFolder = newOutputFolder;
                    ExportLocalizationFiles();
                }
            }
            if (GUILayout.Button("Import...", GUILayout.Width(100)))
            {
                var newOutputFolder = EditorUtility.OpenFolderPanel("Import Localization Files", localizationLanguages.outputFolder, string.Empty);
                if (!string.IsNullOrEmpty(newOutputFolder))
                {
                    localizationLanguages.outputFolder = newOutputFolder;
                    ImportLocalizationFiles();
                }
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();
            EditorWindowTools.EndIndentedSection();
        }
Exemple #28
0
 private void DrawConversation()
 {
     if (currentConversation == null)
     {
         return;
     }
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.BeginVertical("HelpBox");
     DrawConversationProperties();
     DrawConversationFieldsFoldout();
     DrawDialogueTreeFoldout();
     EditorGUILayout.EndVertical();
     EditorWindowTools.EndIndentedSection();
 }
 private void DrawReviewStage()
 {
     EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("Your Dialogue Manager is ready! Below is a brief summary of the configuration.", MessageType.Info);
     EditorGUILayout.LabelField(string.Format("Dialogue database: {0}", DialogueManager.Instance.initialDatabase.name));
     EditorGUILayout.LabelField(string.Format("Dialogue UI: {0}", (DialogueManager.Instance.displaySettings.dialogueUI == null) ? "(use default)" : DialogueManager.Instance.displaySettings.dialogueUI.name));
     EditorGUILayout.LabelField(string.Format("Show subtitles: {0}", GetSubtitlesInfo()));
     EditorGUILayout.LabelField(string.Format("Always force response menu: {0}", DialogueManager.Instance.displaySettings.inputSettings.alwaysForceResponseMenu));
     EditorGUILayout.LabelField(string.Format("Response menu timeout: {0}", Tools.ApproximatelyZero(DialogueManager.Instance.displaySettings.inputSettings.responseTimeout) ? "Unlimited Time" : DialogueManager.Instance.displaySettings.inputSettings.responseTimeout.ToString()));
     EditorGUILayout.LabelField(string.Format("Allow alerts during conversations: {0}", DialogueManager.Instance.displaySettings.alertSettings.allowAlertsDuringConversations));
     EditorWindowTools.EndIndentedSection();
     DrawNavigationButtons(true, true, true);
 }
Exemple #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.", MessageType.Info);
            SimpleController     simpleController     = pcObject.GetComponent <SimpleController>();
            NavigateOnMouseClick navigateOnMouseClick = pcObject.GetComponent <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;
            }
            SetEnabledOnDialogueEvent enabler = FindConversationEnabler();

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

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

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