示例#1
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();
        }
 private void DrawExtraFeatures()
 {
     if (icon == null)
     {
         icon = FindIcon();
     }
     if (dialogueSystemController == null || icon == null)
     {
         return;
     }
     if (iconButtonStyle == null)
     {
         iconButtonStyle = new GUIStyle(EditorStyles.label);
         iconButtonStyle.normal.background = icon;
         iconButtonStyle.active.background = icon;
     }
     if (iconButtonContent == null)
     {
         iconButtonContent = new GUIContent(string.Empty, "Click to open Dialogue Editor.");
     }
     GUILayout.BeginHorizontal();
     if (GUILayout.Button(iconButtonContent, iconButtonStyle, GUILayout.Width(icon.width), GUILayout.Height(icon.height)))
     {
         Selection.activeObject = dialogueSystemController.initialDatabase;
         PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.OpenDialogueEditorWindow();
     }
     GUILayout.FlexibleSpace();
     if (GUILayout.Button("Wizard...", GUILayout.Width(64)))
     {
         DialogueManagerWizard.Init();
     }
     GUILayout.EndHorizontal();
     EditorWindowTools.DrawHorizontalLine();
 }
        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);
        }
        private void DrawExtraFeatures()
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Edit...", EditorStyles.miniButton, GUILayout.Width(80)))
            {
                OpenDialogueEditorWindow();
            }
            GUILayout.FlexibleSpace();
            EditorGUI.BeginDisabledGroup(refreshSource == RefreshSource.None);
            var clickedReconvert = GUILayout.Button("Reconvert...", EditorStyles.miniButton, GUILayout.Width(80));

            EditorGUI.EndDisabledGroup();
            refreshSource = (RefreshSource)EditorGUILayout.EnumPopup(refreshSource, GUILayout.Width(100));
            EditorGUILayout.EndHorizontal();
            EditorWindowTools.DrawHorizontalLine();
            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
            if (clickedReconvert)
            {
                ReconvertDatabase();
                EditorUtility.SetDirty(target);
            }
        }
示例#5
0
        private void DrawShowCursorSection()
        {
            EditorWindowTools.DrawHorizontalLine();
            ShowCursorOnConversation showCursor = pcObject.GetComponent <ShowCursorOnConversation>();
            bool showCursorFlag = (showCursor != null);

            if (!showCursorFlag)
            {
                EditorGUILayout.HelpBox("If regular gameplay hides the mouse cursor, tick Show Mouse Cursor to enable it during conversations.", MessageType.Info);
            }
            EditorGUILayout.BeginHorizontal();
            showCursorFlag = EditorGUILayout.Toggle(showCursorFlag, GUILayout.Width(ToggleWidth));
            EditorGUILayout.LabelField("Show mouse cursor during conversations", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (showCursorFlag)
            {
                if (showCursor == null)
                {
                    showCursor = pcObject.AddComponent <ShowCursorOnConversation>();
                }
            }
            else
            {
                DestroyImmediate(showCursor);
            }
        }
        private void DrawExtraFeatures()
        {
            var dialogueSystemController = target as DialogueSystemController;

            if (icon == null)
            {
                string iconFilename = EditorGUIUtility.isProSkin ? DarkSkinIconFilename : LightSkinIconFilename;
                icon = AssetDatabase.LoadAssetAtPath(iconFilename, typeof(Texture2D)) as Texture2D;
            }
            if (dialogueSystemController == null || icon == null)
            {
                return;
            }
            //---Was: GUILayout.Label(icon);
            if (iconButtonStyle == null)
            {
                iconButtonStyle = new GUIStyle(EditorStyles.label);
                iconButtonStyle.normal.background = icon;
                iconButtonStyle.active.background = icon;
            }
            if (iconButtonContent == null)
            {
                iconButtonContent = new GUIContent(string.Empty, "Click to open Dialogue Editor.");
            }
            if (GUILayout.Button(iconButtonContent, iconButtonStyle, GUILayout.Width(icon.width), GUILayout.Height(icon.height)))
            {
                Selection.activeObject = dialogueSystemController.initialDatabase;
                PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.OpenDialogueEditorWindow();
            }
            EditorWindowTools.DrawHorizontalLine();
        }
示例#7
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);
        }
示例#8
0
        private void DrawBarkGroupSection()
        {
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Bark Group", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("If an NPC is a member of a bark group, then when one member barks, the others will hide their barks to reduce audiovisual clutter.", MessageType.None);
            var barkGroupMember    = npcObject.GetComponent <BarkGroupMember>();
            var hasBarkGroupMember = barkGroupMember != null;

            var wantsBarkGroupMember = EditorGUILayout.Toggle("Is Bark Group Member", hasBarkGroupMember);

            if (wantsBarkGroupMember && !hasBarkGroupMember)
            {
                barkGroupMember    = npcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.BarkGroupMember))) as BarkGroupMember;
                hasBarkGroupMember = true;
            }
            else if (!wantsBarkGroupMember && hasBarkGroupMember)
            {
                DestroyImmediate(barkGroupMember);
                hasBarkGroupMember = false;
            }
            if (hasBarkGroupMember)
            {
                barkGroupMember.groupId = EditorGUILayout.TextField(new GUIContent("Group", "Name of group this NPC belongs to. Can contain [lua] and [var] markup tags."), barkGroupMember.groupId);
            }
        }
示例#9
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);
        }
示例#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);
        }
示例#11
0
 /// <summary>
 /// Draws our custom inspector.
 /// </summary>
 public override void OnInspectorGUI()
 {
     table = target as LocalizedTextTable;
     if (table == null)
     {
         return;
     }
     EditorGUILayout.HelpBox("Localized Text Tables have been superceded by Text Tables. To save the contents of this Localized Text Table as a Text Table, click the 'Save As Text Table...' button below.", MessageType.Info);
     if (GUILayout.Button("Save As Text Table..."))
     {
         SaveAsTextTable();
     }
     else
     {
         DrawLanguages();
         EditorWindowTools.DrawHorizontalLine();
         if (showSearchBar)
         {
             DrawSearchBar();
             EditorWindowTools.DrawHorizontalLine();
         }
         DrawFields();
         if (GUI.changed)
         {
             EditorUtility.SetDirty(table);
         }
     }
 }
示例#12
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);
        }
示例#13
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);
        }
示例#14
0
 private void DrawProgressIndicator()
 {
     EditorGUI.BeginDisabledGroup(true);
     EditorGUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     GUILayout.Toolbar((int)stage, stageLabels, GUILayout.Width(700));
     GUILayout.FlexibleSpace();
     EditorGUILayout.EndHorizontal();
     EditorGUI.EndDisabledGroup();
     EditorWindowTools.DrawHorizontalLine();
 }
 /// <summary>
 /// Draws our custom inspector.
 /// </summary>
 public override void OnInspectorGUI()
 {
     table = target as LocalizedTextTable;
     if (table == null)
     {
         return;
     }
     DrawLanguages();
     EditorWindowTools.DrawHorizontalLine();
     DrawFields();
     if (GUI.changed)
     {
         EditorUtility.SetDirty(table);
     }
 }
示例#16
0
        /// <summary>
        /// Draws the destination section. You can override this if you want to draw
        /// more than the default controls.
        /// </summary>
        protected virtual void DrawDestinationSection()
        {
            EditorWindowTools.DrawHorizontalLine();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Save As", EditorStyles.boldLabel);
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            EditorWindowTools.StartIndentedSection();
            DrawOutputFolder();
            DrawDatabaseFilename();
            DrawEncodingPopup();
            DrawOverwriteCheckbox();
            EditorWindowTools.EndIndentedSection();
        }
示例#17
0
        private bool DrawTargetingOnUse()
        {
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Collider", EditorStyles.boldLabel);
            Collider nontriggerCollider = null;

            foreach (var collider in npcObject.GetComponentsInChildren <Collider>())
            {
                if (!collider.isTrigger)
                {
                    nontriggerCollider = collider;
                }
            }
            Usable usable = npcObject.GetComponent <Usable>();

            if ((nontriggerCollider != null) && (usable != null))
            {
                EditorGUILayout.HelpBox("The NPC has a collider and a Usable component. The player's Selector component will be able to target it to send OnUse messages.", MessageType.None);
                EditorGUILayout.LabelField("'Usable' Customization", EditorStyles.boldLabel);
                EditorWindowTools.StartIndentedSection();
                usable.maxUseDistance     = EditorGUILayout.FloatField("Max Usable Distance", usable.maxUseDistance);
                usable.overrideName       = EditorGUILayout.TextField("Override Actor Name (leave blank to use main override)", usable.overrideName);
                usable.overrideUseMessage = EditorGUILayout.TextField("Override Use Message", usable.overrideUseMessage);
                EditorWindowTools.EndIndentedSection();
            }
            else
            {
                if (nontriggerCollider == null)
                {
                    EditorGUILayout.HelpBox("The NPC is configured to listen for OnUse messages. If these messages will be coming from the player's Selector component, the NPC needs a collider that the Selector can target. Click Add Collider to add a CharacterController. If OnUse will come from another source, you don't necessarily need a collider.", MessageType.Info);
                    if (GUILayout.Button("Add Collider", GUILayout.Width(160)))
                    {
                        npcObject.AddComponent <CharacterController>();
                    }
                }
                if (usable == null)
                {
                    EditorGUILayout.HelpBox("The NPC is configured to listen for OnUse messages. If these messages will be coming from the player's Selector component, the NPC needs a Usable component to tell the Selector that it's usable. Click Add Usable to add one.", MessageType.Info);
                    if (GUILayout.Button("Add Usable", GUILayout.Width(160)))
                    {
                        npcObject.AddComponent <Usable>();
                    }
                }
            }
            return(true);
        }
示例#18
0
        private bool DrawTargetingOnTriggerEnter()
        {
            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Trigger Collider", EditorStyles.boldLabel);
            Collider triggerCollider = null;

            foreach (var collider in npcObject.GetComponentsInChildren <Collider>())
            {
                if (collider.isTrigger)
                {
                    triggerCollider = collider;
                }
            }
            if (triggerCollider != null)
            {
                if (triggerCollider is SphereCollider)
                {
                    EditorGUILayout.HelpBox("The NPC has a trigger collider, so it's ready for OnTriggerEnter events. You can adjust its radius below. Make sure its layer collision properties are configured to detect when the intended colliders enter its area.", MessageType.None);
                    SphereCollider sphereCollider = triggerCollider as SphereCollider;
                    sphereCollider.radius = EditorGUILayout.FloatField("Radius", sphereCollider.radius);
                    return(true);
                }
                else
                {
                    EditorGUILayout.HelpBox("The NPC has a trigger collider, so it's ready for OnTriggerEnter events.", MessageType.None);
                }
                return(true);
            }
            else
            {
                EditorGUILayout.HelpBox("The NPC needs a trigger collider. Add Trigger to add a sphere trigger, or add one manually.", MessageType.Info);
                if (GUILayout.Button("Add Trigger", GUILayout.Width(160)))
                {
                    SphereCollider sphereCollider = npcObject.AddComponent <SphereCollider>();
                    sphereCollider.isTrigger = true;
                    sphereCollider.radius    = 1.5f;
                    return(true);
                }
            }
            return(false);
        }
示例#19
0
        private void DrawBarkStage()
        {
            EditorGUILayout.LabelField("Bark", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("If the NPC barks (says one-off lines during gameplay), tick either or both of the checkboxs below.", MessageType.Info);
            bool hasBarkTrigger = DrawBarkTriggerSection();

            EditorWindowTools.DrawHorizontalLine();
            bool hasBarkOnIdle    = DrawBarkOnIdleSection();
            bool hasBarkComponent = hasBarkTrigger || hasBarkOnIdle;
            bool hasBarkUI        = false;

            if (hasBarkComponent)
            {
                hasBarkUI = DrawBarkUISection();
            }
            if (hasBarkComponent && GUILayout.Button("Select NPC", GUILayout.Width(100)))
            {
                Selection.activeGameObject = npcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, (hasBarkUI || !hasBarkComponent), false);
        }
示例#20
0
        private void DrawDefines()
        {
            GUILayout.BeginArea(new Rect(5, 256, position.width - 10, position.height - 256));
            EditorGUILayout.LabelField("Current Build Target: " + ObjectNames.NicifyVariableName(EditorUserBuildSettings.activeBuildTarget.ToString()), EditorStyles.boldLabel);

            var define_USE_PHYSICS2D   = false;
            var define_USE_TIMELINE    = false;
            var define_USE_CINEMACHINE = false;
            var define_USE_ARTICY      = false;
            var define_USE_AURORA      = false;
            var define_TMP_PRESENT     = false;
            var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';');

            for (int i = 0; i < defines.Length; i++)
            {
                if (string.Equals(ScriptingSymbolNames.USE_PHYSICS2D, defines[i].Trim()))
                {
                    define_USE_PHYSICS2D = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_TIMELINE, defines[i].Trim()))
                {
                    define_USE_TIMELINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_CINEMACHINE, defines[i].Trim()))
                {
                    define_USE_CINEMACHINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_ARTICY, defines[i].Trim()))
                {
                    define_USE_ARTICY = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_AURORA, defines[i].Trim()))
                {
                    define_USE_AURORA = true;
                }
                if (string.Equals(ScriptingSymbolNames.TMP_PRESENT, defines[i].Trim()))
                {
                    define_TMP_PRESENT = true;
                }
            }
#if EVALUATION_VERSION || !UNITY_2018_1_OR_NEWER
            define_USE_PHYSICS2D = true;
            define_TMP_PRESENT   = false;
            define_USE_ARTICY    = true;
            define_USE_AURORA    = true;
#endif

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.LabelField(new GUIContent("Enable support for:", "NOTE: Enables Dialogue System support. You must still enable each package in Package Manager."));
#if UNITY_2018_1_OR_NEWER && !EVALUATION_VERSION
            var new_USE_PHYSICS2D = EditorGUILayout.ToggleLeft("2D Physics (USE_PHYSICS2D)", define_USE_PHYSICS2D);
#else
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("2D Physics (USE_PHYSICS2D)", "Support is built in for evaluation version or Unity 2017 and earlier."), define_USE_PHYSICS2D);
            EditorGUI.EndDisabledGroup();
            var new_USE_PHYSICS2D = define_USE_PHYSICS2D;
#endif

            var new_USE_TIMELINE    = EditorGUILayout.ToggleLeft(new GUIContent("Timeline (USE_TIMELINE)", "Enable Dialogue System support for Timeline. You must still enable Timeline in Package Manager."), define_USE_TIMELINE);
            var new_USE_CINEMACHINE = EditorGUILayout.ToggleLeft(new GUIContent("Cinemachine (USE_CINEMACHINE)", "Enable Dialogue System support for Cinemachine. You must still enable Cinemachine in Package Manager."), define_USE_CINEMACHINE);

#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
            EditorGUI.EndDisabledGroup();
            var new_USE_ARTICY = define_USE_ARTICY;
            var new_USE_AURORA = define_USE_AURORA;
#else
            var new_USE_ARTICY = EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            var new_USE_AURORA = EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
#endif

#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "TextMesh Pro support not available in evaluation version."), define_TMP_PRESENT);
            EditorGUI.EndDisabledGroup();
            var new_TMP_PRESENT = define_TMP_PRESENT;
#else
            var new_TMP_PRESENT = EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "Enable Dialogue System support for TextMesh Pro. You must still enable TextMesh Pro in Package Manager."), define_TMP_PRESENT);
#endif
            var changed = EditorGUI.EndChangeCheck();

            if (new_USE_PHYSICS2D != define_USE_PHYSICS2D)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_PHYSICS2D, new_USE_PHYSICS2D);
            }
            if (new_USE_TIMELINE != define_USE_TIMELINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_TIMELINE, new_USE_TIMELINE, true);
            }
            if (new_USE_CINEMACHINE != define_USE_CINEMACHINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_CINEMACHINE, new_USE_CINEMACHINE);
            }
            if (new_USE_ARTICY != define_USE_ARTICY)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_ARTICY, new_USE_ARTICY);
            }
            if (new_USE_AURORA != define_USE_AURORA)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_AURORA, new_USE_AURORA);
            }
            if (new_TMP_PRESENT != define_TMP_PRESENT)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.TMP_PRESENT, new_TMP_PRESENT);
            }

            EditorWindowTools.DrawHorizontalLine();
            GUILayout.EndArea();

            if (changed)
            {
                EditorTools.ReimportScripts();
            }
        }
示例#21
0
        private void DrawActorStage()
        {
            EditorGUILayout.LabelField("Dialogue Actor Component (Optional)", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("A Dialogue Actor component lets you specify which actor in the database this GameObject is associated with if the GameObject doesn't have the same name as the actor. You can also set actor-specific UI settings.", MessageType.Info);
            var dialogueActor    = npcObject.GetComponent <DialogueActor>();
            var hasDialogueActor = dialogueActor != null;

            if (dialogueActor == null)
            {
                dialogueActorEditor = null;
            }
            var useDialogueActor = EditorGUILayout.Toggle("Use Dialogue Actor", hasDialogueActor);

            if (useDialogueActor && !hasDialogueActor)
            {
                dialogueActor    = npcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.DialogueActor))) as DialogueActor;
                hasDialogueActor = true;
            }
            else if (!useDialogueActor && hasDialogueActor)
            {
                DestroyImmediate(dialogueActor);
                dialogueActor       = null;
                hasDialogueActor    = false;
                dialogueActorEditor = null;
            }
            if (hasDialogueActor)
            {
                if (dialogueActorEditor == null)
                {
                    dialogueActorEditor = Editor.CreateEditor(dialogueActor);
                }
                dialogueActorEditor.OnInspectorGUI();
            }

            EditorWindowTools.DrawHorizontalLine();
            var defaultCameraAngle    = npcObject.GetComponent <DefaultCameraAngle>();
            var hasDefaultCameraAngle = defaultCameraAngle != null;

            EditorGUILayout.BeginHorizontal();
            var useDefaultCameraAngle = EditorGUILayout.Toggle("Override Default Camera Angle", hasDefaultCameraAngle);

            EditorGUILayout.HelpBox("The default camera angle is 'Closeup'. You can override it here.", MessageType.None);
            EditorGUILayout.EndHorizontal();
            if (useDefaultCameraAngle && !hasDefaultCameraAngle)
            {
                defaultCameraAngle    = npcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.DefaultCameraAngle))) as DefaultCameraAngle;
                hasDefaultCameraAngle = true;
            }
            else if (!useDefaultCameraAngle && hasDefaultCameraAngle)
            {
                DestroyImmediate(defaultCameraAngle);
                defaultCameraAngle    = null;
                hasDefaultCameraAngle = false;
            }
            if (hasDefaultCameraAngle)
            {
                EditorGUILayout.BeginHorizontal();
                defaultCameraAngle.cameraAngle = EditorGUILayout.TextField("Angle", defaultCameraAngle.cameraAngle);
                EditorGUILayout.HelpBox("Specify the default camera angle for this NPC.", MessageType.None);
                EditorGUILayout.EndHorizontal();
            }

            DrawBarkGroupSection();
            if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
            {
                Selection.activeGameObject = npcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, (database != null), false);
        }
示例#22
0
        private void DrawActionsStage()
        {
            EditorGUILayout.LabelField("Actions", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.LabelField("Dialogue System Trigger", EditorStyles.boldLabel);
            var dialogueSystemTrigger = npcObject.GetComponent <DialogueSystemTrigger>();

            EditorGUILayout.HelpBox("A Dialogue System Trigger runs actions when an event occurs, such as when the player uses the NPC.", MessageType.None);
            var hasDialogueSystemTrigger = (dialogueSystemTrigger != null);

            hasDialogueSystemTrigger = EditorGUILayout.Toggle("Dialogue System Trigger", hasDialogueSystemTrigger);
            if (hasDialogueSystemTrigger && dialogueSystemTrigger == null)
            {
                dialogueSystemTrigger = npcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.DialogueSystemTrigger))) as DialogueSystemTrigger;
            }
            else if (!hasDialogueSystemTrigger && dialogueSystemTrigger != null)
            {
                DestroyImmediate(dialogueSystemTrigger);
                dialogueSystemTrigger       = null;
                hasDialogueSystemTrigger    = false;
                dialogueSystemTriggerEditor = null;
            }
            if (hasDialogueSystemTrigger)
            {
                if (dialogueSystemTriggerEditor == null)
                {
                    dialogueSystemTriggerEditor = Editor.CreateEditor(dialogueSystemTrigger);
                }
                dialogueSystemTriggerEditor.OnInspectorGUI();
            }

            EditorWindowTools.DrawHorizontalLine();
            EditorGUILayout.LabelField("Dialogue System Events", EditorStyles.boldLabel);
            var dialogueSystemEvents = npcObject.GetComponent <DialogueSystemEvents>();

            if (dialogueSystemEvents != null)
            {
                EditorGUILayout.HelpBox("A Dialogue System Events component is a handy way to configure activity such as disabling components and setting animator states when Dialogue System events occur. To configure Dialogue System Events in the Inspector view, click Select NPC.", MessageType.None);
            }
            else
            {
                EditorGUILayout.HelpBox("A Dialogue System Events component is a handy way to configure activity such as disabling components and setting animator states when Dialogue System events occur.", MessageType.None);
            }
            var hasDialogueSystemEvents = (dialogueSystemEvents != null);

            hasDialogueSystemEvents = EditorGUILayout.Toggle("Dialogue System Events", dialogueSystemEvents);
            if (hasDialogueSystemEvents && dialogueSystemEvents == null)
            {
                dialogueSystemEvents = npcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.DialogueSystemEvents))) as DialogueSystemEvents;
            }
            else if (!hasDialogueSystemEvents && dialogueSystemEvents != null)
            {
                DestroyImmediate(dialogueSystemEvents);
                dialogueSystemEvents    = null;
                hasDialogueSystemEvents = false;
            }

            EditorWindowTools.DrawHorizontalLine();
            DrawBarkOnIdleSection();

            if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
            {
                Selection.activeGameObject = npcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
示例#23
0
 private void DrawButtons()
 {
     GUILayout.BeginArea(new Rect(5, 40, position.width - 10, position.height - 40));
     try
     {
         EditorWindowTools.DrawHorizontalLine();
         EditorGUILayout.HelpBox("Welcome to the Dialogue System for Unity!\n\nThe buttons below are shortcuts to commonly-used functions. You can find even more in Tools > Pixel Crushers > Dialogue System.", MessageType.None);
         EditorWindowTools.DrawHorizontalLine();
         GUILayout.Label("Help", EditorStyles.boldLabel);
         GUILayout.BeginHorizontal();
         try
         {
             if (GUILayout.Button(new GUIContent("Quick\nStart\n", "Open Quick Start tutorial"), GUILayout.Width(ButtonWidth)))
             {
                 Application.OpenURL("http://www.pixelcrushers.com/dialogue_system/manual2x/html/quick_start.html");
             }
             if (GUILayout.Button(new GUIContent("\nManual\n", "Open online manual"), GUILayout.Width(ButtonWidth)))
             {
                 Application.OpenURL("http://www.pixelcrushers.com/dialogue_system/manual2x/html/");
             }
             if (GUILayout.Button(new GUIContent("\nVideos\n", "Open video tutorial list"), GUILayout.Width(ButtonWidth)))
             {
                 Application.OpenURL("http://www.pixelcrushers.com/dialogue-system-tutorials/");
             }
             if (GUILayout.Button(new GUIContent("Scripting\nReference\n", "Open scripting & API reference"), GUILayout.Width(ButtonWidth)))
             {
                 Application.OpenURL("http://www.pixelcrushers.com/dialogue_system/manual2x/html/scripting.html");
             }
             if (GUILayout.Button(new GUIContent("\nForum\n", "Go to the Pixel Crushers forum"), GUILayout.Width(ButtonWidth)))
             {
                 Application.OpenURL("http://www.pixelcrushers.com/phpbb");
             }
         }
         finally
         {
             GUILayout.EndHorizontal();
         }
         EditorWindowTools.DrawHorizontalLine();
         GUILayout.Label("Wizards & Resources", EditorStyles.boldLabel);
         GUILayout.BeginHorizontal();
         try
         {
             if (GUILayout.Button(new GUIContent("Dialogue\nEditor\n", "Open the Dialogue Editor window"), GUILayout.Width(ButtonWidth)))
             {
                 PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.OpenDialogueEditorWindow();
             }
             if (GUILayout.Button(new GUIContent("Dialogue\nManager\nWizard", "Configure a Dialogue Manager, the component that coordinates all Dialogue System activity"), GUILayout.Width(ButtonWidth)))
             {
                 DialogueManagerWizard.Init();
             }
             if (GUILayout.Button(new GUIContent("Player\nSetup\nWizard", "Configure a player GameObject to work with the Dialogue System"), GUILayout.Width(ButtonWidth)))
             {
                 PlayerSetupWizard.Init();
             }
             if (GUILayout.Button(new GUIContent("NPC\nSetup\nWizard", "Configure a non-player character or other interactive GameObject to work with the Dialogue System"), GUILayout.Width(ButtonWidth)))
             {
                 NPCSetupWizard.Init();
             }
             if (GUILayout.Button(new GUIContent("Free\nExtras\n", "Go to the Dialogue System free extras website"), GUILayout.Width(ButtonWidth)))
             {
                 Application.OpenURL("http://www.pixelcrushers.com/dialogue-system-extras/");
             }
         }
         finally
         {
             GUILayout.EndHorizontal();
         }
         EditorWindowTools.DrawHorizontalLine();
     }
     finally
     {
         GUILayout.EndArea();
     }
 }
示例#24
0
        private void DrawDefines()
        {
            GUILayout.BeginArea(new Rect(5, 256, position.width - 10, position.height - 256));
            EditorGUILayout.LabelField("Current Build Target: " + ObjectNames.NicifyVariableName(EditorUserBuildSettings.activeBuildTarget.ToString()), EditorStyles.boldLabel);

            var define_USE_PHYSICS2D   = false;
            var define_USE_NEW_INPUT   = false;
            var define_USE_TIMELINE    = false;
            var define_USE_CINEMACHINE = false;
            var define_USE_ARTICY      = false;
            var define_USE_AURORA      = false;
            var define_TMP_PRESENT     = false;
            var define_USE_STM         = false;
            var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup).Split(';');

            for (int i = 0; i < defines.Length; i++)
            {
                if (string.Equals(ScriptingSymbolNames.USE_PHYSICS2D, defines[i].Trim()))
                {
                    define_USE_PHYSICS2D = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_NEW_INPUT, defines[i].Trim()))
                {
                    define_USE_NEW_INPUT = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_TIMELINE, defines[i].Trim()))
                {
                    define_USE_TIMELINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_CINEMACHINE, defines[i].Trim()))
                {
                    define_USE_CINEMACHINE = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_ARTICY, defines[i].Trim()))
                {
                    define_USE_ARTICY = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_AURORA, defines[i].Trim()))
                {
                    define_USE_AURORA = true;
                }
                if (string.Equals(ScriptingSymbolNames.TMP_PRESENT, defines[i].Trim()))
                {
                    define_TMP_PRESENT = true;
                }
                if (string.Equals(ScriptingSymbolNames.USE_STM, defines[i].Trim()))
                {
                    define_USE_STM = true;
                }
            }
#if EVALUATION_VERSION || !UNITY_2018_1_OR_NEWER
            define_USE_PHYSICS2D = true;
            define_USE_NEW_INPUT = false;
            define_TMP_PRESENT   = false;
            define_USE_STM       = false;
            define_USE_ARTICY    = true;
            define_USE_AURORA    = true;
#endif

            EditorGUI.BeginChangeCheck();
            EditorGUILayout.LabelField(new GUIContent("Enable support for:", "NOTE: Enables Dialogue System support. You must still enable each package in Package Manager."));
#if UNITY_2018_1_OR_NEWER && !EVALUATION_VERSION
            var new_USE_PHYSICS2D = EditorGUILayout.ToggleLeft("2D Physics (USE_PHYSICS2D)", define_USE_PHYSICS2D);
            var new_USE_NEW_INPUT = EditorGUILayout.ToggleLeft("New Input System (USE_NEW_INPUT)", define_USE_NEW_INPUT);
#else
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("2D Physics (USE_PHYSICS2D)", "Support is built in for evaluation version or Unity 2017 and earlier."), define_USE_PHYSICS2D);
            EditorGUILayout.ToggleLeft(new GUIContent("New Input System (USE_NEW_INPUT)", "New Input System support not available in evaluation version."), define_USE_NEW_INPUT);
            EditorGUI.EndDisabledGroup();
            var new_USE_PHYSICS2D = define_USE_PHYSICS2D;
            var new_USE_NEW_INPUT = define_USE_NEW_INPUT;
#endif

            var new_USE_TIMELINE    = EditorGUILayout.ToggleLeft(new GUIContent("Timeline (USE_TIMELINE)", "Enable Dialogue System support for Timeline. You must still enable Timeline in Package Manager."), define_USE_TIMELINE);
            var new_USE_CINEMACHINE = EditorGUILayout.ToggleLeft(new GUIContent("Cinemachine (USE_CINEMACHINE)", "Enable Dialogue System support for Cinemachine. You must still enable Cinemachine in Package Manager."), define_USE_CINEMACHINE);

#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
            EditorGUI.EndDisabledGroup();
            var new_USE_ARTICY = define_USE_ARTICY;
            var new_USE_AURORA = define_USE_AURORA;
#else
            var new_USE_ARTICY = EditorGUILayout.ToggleLeft(new GUIContent("articy:draft (USE_ARTICY)", "Enable Dialogue System support for articy:draft XML import."), define_USE_ARTICY);
            var new_USE_AURORA = EditorGUILayout.ToggleLeft(new GUIContent("Aurora Toolset (USE_AURORA)", "Enable Dialogue System support for Aurora (Neverwinter Nights) Toolset import."), define_USE_AURORA);
#endif

#if EVALUATION_VERSION
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "TextMesh Pro support not available in evaluation version."), define_TMP_PRESENT);
            EditorGUILayout.ToggleLeft(new GUIContent("Super Text Mesh (USE_STM)", "Super Text Mesh support not available in evaluation version."), define_USE_STM);
            EditorGUI.EndDisabledGroup();
            var new_TMP_PRESENT = define_TMP_PRESENT;
            var new_USE_STM     = define_USE_STM;
#else
            var new_TMP_PRESENT = EditorGUILayout.ToggleLeft(new GUIContent("TextMesh Pro (TMP_PRESENT)", "Enable Dialogue System support for TextMesh Pro. You must still enable TextMesh Pro in Package Manager."), define_TMP_PRESENT);
            var new_USE_STM     = EditorGUILayout.ToggleLeft(new GUIContent("Super Text Mesh (USE_STM)", "Enable Dialogue System support for Super Text Mesh. Requires Super Text Mesh in project."), define_USE_STM);
#endif
            var changed = EditorGUI.EndChangeCheck();

            if (new_USE_PHYSICS2D != define_USE_PHYSICS2D)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_PHYSICS2D, new_USE_PHYSICS2D);
            }
            if (new_USE_NEW_INPUT != define_USE_NEW_INPUT)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_NEW_INPUT, new_USE_NEW_INPUT);
            }
            if (new_USE_TIMELINE != define_USE_TIMELINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_TIMELINE, new_USE_TIMELINE, true);
            }
            if (new_USE_CINEMACHINE != define_USE_CINEMACHINE)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_CINEMACHINE, new_USE_CINEMACHINE);
            }
            if (new_USE_ARTICY != define_USE_ARTICY)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_ARTICY, new_USE_ARTICY);
            }
            if (new_USE_AURORA != define_USE_AURORA)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_AURORA, new_USE_AURORA);
            }
            if (new_TMP_PRESENT != define_TMP_PRESENT)
            {
                MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.TMP_PRESENT, new_TMP_PRESENT, true);
            }
            if (new_USE_STM != define_USE_STM)
            {
                if (new_USE_STM)
                {
                    if (EditorUtility.DisplayDialog("Enable Super Text Mesh Support", "This will enable Super Text Mesh support. Your project must already contain Super Text Mesh.\n\n*IMPORTANT*: Before pressing OK, you MUST move the Clavian folder into the Plugins folder!\n\nTo continue, press OK. If you need to install Super Text Mesh or move the folder first, press Cancel.", "OK", "Cancel"))
                    {
                        MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_STM, new_USE_STM);
                    }
                    else
                    {
                        changed = false;
                    }
                }
                else
                {
                    MoreEditorUtility.ToggleScriptingDefineSymbol(ScriptingSymbolNames.USE_STM, new_USE_STM);
                }
            }

            EditorWindowTools.DrawHorizontalLine();
            GUILayout.EndArea();

            if (changed)
            {
                EditorTools.ReimportScripts();
            }
        }
示例#25
0
 private bool DrawTargetingOnUse()
 {
     EditorWindowTools.DrawHorizontalLine();
     return(use2D ? Draw2DTargetingOnUse() : Draw3DTargetingOnUse());
 }