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

            if (conversationTrigger != null)
            {
                EditorGUILayout.LabelField(string.Format("Conversation: '{0}'{1} {2}", conversationTrigger.conversation, conversationTrigger.once ? " (once)" : string.Empty, conversationTrigger.trigger));
            }
            else
            {
                EditorGUILayout.LabelField("Conversation: None");
            }
            BarkTrigger barkTrigger = npcObject.GetComponentInChildren <BarkTrigger>();

            if (barkTrigger != null)
            {
                EditorGUILayout.LabelField(string.Format("Triggered Bark: '{0}' ({1}) {2}", barkTrigger.conversation, barkTrigger.barkOrder, barkTrigger.trigger));
            }
            else
            {
                EditorGUILayout.LabelField("Triggered Bark: None");
            }
            BarkOnIdle barkOnIdle = npcObject.GetComponentInChildren <BarkOnIdle>();

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

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (persistentPositionData != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        private void DrawDatabaseList()
        {
            EditorWindowTools.StartIndentedSection();
            DialogueDatabase databaseToDelete = null;

            for (int i = 0; i < prefs.databases.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                prefs.databases[i] = EditorGUILayout.ObjectField(prefs.databases[i], typeof(DialogueDatabase), false) as DialogueDatabase;
                if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.Width(22)))
                {
                    databaseToDelete = prefs.databases[i];
                }
                EditorGUILayout.EndHorizontal();
            }
            if (databaseToDelete != null)
            {
                prefs.databases.Remove(databaseToDelete);
            }
            EditorWindowTools.EndIndentedSection();
        }
Beispiel #4
0
        private void DrawPersistenceStage()
        {
            EditorGUILayout.LabelField("Persistence", EditorStyles.boldLabel);
            PersistentPositionData persistentPositionData = npcObject.GetComponent <PersistentPositionData>();

            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("The NPC can be configured to record its position in the Dialogue System's Lua environment so it will be preserved when saving and loading games.", MessageType.Info);
            EditorGUILayout.BeginHorizontal();
            bool hasPersistentPosition = EditorGUILayout.Toggle((persistentPositionData != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("NPC records position for saved games", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasPersistentPosition)
            {
                if (persistentPositionData == null)
                {
                    persistentPositionData = npcObject.AddComponent <PersistentPositionData>();
                }
                if (string.IsNullOrEmpty(persistentPositionData.overrideActorName))
                {
                    EditorGUILayout.HelpBox(string.Format("Position data will be saved to the Actor['{0}'] (the name of the NPC GameObject) or the Override Actor Name if defined. You can override the name below.", npcObject.name), MessageType.None);
                }
                else
                {
                    EditorGUILayout.HelpBox(string.Format("Position data will be saved to the Actor['{0}']. To use the name of the NPC GameObject instead, clear the field below.", persistentPositionData.overrideActorName), MessageType.None);
                }
                persistentPositionData.overrideActorName = EditorGUILayout.TextField("Actor Name", persistentPositionData.overrideActorName);
            }
            else
            {
                DestroyImmediate(persistentPositionData);
            }
            if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
            {
                Selection.activeGameObject = npcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
 private void DrawDisplaySettings()
 {
     foldouts.displaySettingsFoldout = EditorWindowTools.EditorGUILayoutFoldout("Display Settings", "Settings related to display and input.", foldouts.displaySettingsFoldout);
     if (foldouts.displaySettingsFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             EditorGUILayout.PropertyField(displaySettingsProperty.FindPropertyRelative("dialogueUI"), true);
             DrawLocalizationSettings();
             DrawSubtitleSettings();
             DrawCameraSettings();
             DrawInputSettings();
             DrawBarkSettings();
             DrawAlertSettings();
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
Beispiel #6
0
        private void DrawDisableControlsSection()
        {
            EditorWindowTools.StartIndentedSection();
            SetEnabledOnDialogueEvent enabler = FindConversationEnabler();

            if (setEnabledFlag)
            {
                if (enabler == null)
                {
                    enabler = pcObject.AddComponent <SetEnabledOnDialogueEvent>();
                }
                enabler.trigger = DialogueEvent.OnConversation;
                enabler.onStart = GetPlayerControls(enabler.onStart, Toggle.False);
                enabler.onEnd   = GetPlayerControls(enabler.onEnd, Toggle.True);
                ShowDisabledComponents(enabler.onStart);
            }
            else
            {
                DestroyImmediate(enabler);
            }
            EditorWindowTools.EndIndentedSection();
        }
        protected virtual void DrawSequenceAction()
        {
            foldouts.sequenceFoldout = EditorWindowTools.EditorGUILayoutFoldout("Play Sequence", "Play a sequence.", foldouts.sequenceFoldout, false);
            if (foldouts.sequenceFoldout)
            {
                try
                {
                    EditorWindowTools.EditorGUILayoutBeginGroup();
                    EditorGUILayout.BeginHorizontal();
                    if (DialogueTriggerEventDrawer.IsEnableOrStartEnumIndex(triggerProperty.enumValueIndex))
                    {
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("waitOneFrameOnStartOrEnable"), new GUIContent("Wait 1 Frame", "Tick to wait one frame to allow other components to finish their OnStart/OnEnable"), true);
                    }
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(14)))
                    {
                        serializedObject.FindProperty("sequence").stringValue = string.Empty;
                        showPlaySequenceAction = false;
                    }
                    EditorGUILayout.EndHorizontal();
                    serializedObject.ApplyModifiedProperties();
                    EditorGUI.BeginChangeCheck();
                    var newSequence = SequenceEditorTools.DrawLayout(new GUIContent("Sequence"), trigger.sequence, ref sequenceRect, ref sequenceSyntaxState);
                    var changed     = EditorGUI.EndChangeCheck();
                    serializedObject.Update();
                    if (changed)
                    {
                        serializedObject.FindProperty("sequence").stringValue = newSequence;
                    }

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("sequenceSpeaker"), true);
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("sequenceListener"), true);
                }
                finally
                {
                    EditorWindowTools.EditorGUILayoutEndGroup();
                }
            }
        }
Beispiel #8
0
        private void DrawDisableControlsSection()
        {
            EditorWindowTools.StartIndentedSection();
            SetComponentEnabledOnDialogueEvent enabler = FindConversationEnabler();

            if (setEnabledFlag)
            {
                if (enabler == null)
                {
                    enabler = pcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.DialogueSystem.SetComponentEnabledOnDialogueEvent))) as SetComponentEnabledOnDialogueEvent;
                }
                enabler.trigger = DialogueEvent.OnConversation;
                enabler.onStart = GetPlayerControls(enabler.onStart, Toggle.False);
                enabler.onEnd   = GetPlayerControls(enabler.onEnd, Toggle.True);
                ShowDisabledComponents(enabler.onStart);
            }
            else
            {
                DestroyImmediate(enabler);
            }
            EditorWindowTools.EndIndentedSection();
        }
 protected virtual void DrawAlertAction()
 {
     foldouts.alertFoldout = EditorWindowTools.EditorGUILayoutFoldout("Show Alert", "Show an alert message.", foldouts.alertFoldout, false);
     if (foldouts.alertFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             EditorGUILayout.BeginHorizontal();
             EditorGUILayout.PropertyField(serializedObject.FindProperty("alertMessage"), true);
             if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(14)))
             {
                 serializedObject.FindProperty("alertMessage").stringValue = string.Empty;
                 showAlertAction = false;
             }
             EditorGUILayout.EndHorizontal();
             EditorGUILayout.PropertyField(serializedObject.FindProperty("textTable"), true);
             var  alertDurationProperty = serializedObject.FindProperty("alertDuration");
             bool specifyAlertDuration  = !Mathf.Approximately(0, alertDurationProperty.floatValue);
             specifyAlertDuration = EditorGUILayout.Toggle(new GUIContent("Specify Duration", "Tick to specify an alert duration; untick to use the default"), specifyAlertDuration);
             if (specifyAlertDuration)
             {
                 if (Mathf.Approximately(0, alertDurationProperty.floatValue))
                 {
                     alertDurationProperty.floatValue = 5;
                 }
                 EditorGUILayout.PropertyField(serializedObject.FindProperty("alertDuration"), true);
             }
             else
             {
                 alertDurationProperty.floatValue = 0;
             }
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
Beispiel #10
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorWindowTools.DrawDeprecatedTriggerHelpBox();
            var trigger = target as BarkTrigger;

            if (trigger == null)
            {
                return;
            }
            EditorGUILayout.PropertyField(serializedObject.FindProperty("trigger"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("conversation"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("barkOrder"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("conversant"), new GUIContent("Barker", "The actor speaking the bark. If unassigned, this GameObject."), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("target"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("once"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("skipIfNoValidEntries"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("allowDuringConversations"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("cacheBarkLines"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("condition"), true);
            serializedObject.ApplyModifiedProperties();
        }
 private void DrawOtherSettings()
 {
     foldouts.otherSettingsFoldout = EditorWindowTools.EditorGUILayoutFoldout("Other Settings", "Miscellaneous settings.", foldouts.otherSettingsFoldout);
     if (foldouts.otherSettingsFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             EditorGUILayout.PropertyField(serializedObject.FindProperty("allowOnlyOneInstance"), true);
             EditorGUILayout.PropertyField(serializedObject.FindProperty("dontDestroyOnLoad"), true);
             EditorGUILayout.PropertyField(serializedObject.FindProperty("preloadResources"), true);
             EditorGUILayout.PropertyField(serializedObject.FindProperty("instantiateDatabase"), true);
             EditorGUILayout.PropertyField(serializedObject.FindProperty("includeSimStatus"), true);
             EditorGUILayout.PropertyField(serializedObject.FindProperty("dialogueTimeMode"), true);
             EditorGUILayout.PropertyField(serializedObject.FindProperty("debugLevel"), true);
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
Beispiel #12
0
        private void DrawControlStage()
        {
            EditorGUILayout.LabelField("Control", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            PixelCrushers.DialogueSystem.SimpleController simpleController = pcObject.GetComponent <PixelCrushers.DialogueSystem.SimpleController>();
            NavigateOnMouseClick navigateOnMouseClick = pcObject.GetComponent <NavigateOnMouseClick>();
            ControlStyle         controlStyle         = (simpleController != null)
                                ? ControlStyle.ThirdPersonShooter
                                : (navigateOnMouseClick != null)
                                        ? ControlStyle.FollowMouseClicks
                                        : ControlStyle.Custom;

            EditorGUILayout.HelpBox("How will the player control movement? (Select Custom to provide your own control components instead of using the Dialogue System's.)", MessageType.Info);
            controlStyle = (ControlStyle)EditorGUILayout.EnumPopup("Control", controlStyle);
            switch (controlStyle)
            {
            case ControlStyle.ThirdPersonShooter:
                DestroyImmediate(navigateOnMouseClick);
                DrawSimpleControllerSection(simpleController ?? pcObject.AddComponent <PixelCrushers.DialogueSystem.SimpleController>());
                break;

            case ControlStyle.FollowMouseClicks:
                DestroyImmediate(simpleController);
                DrawNavigateOnMouseClickSection(navigateOnMouseClick ?? pcObject.AddComponent <NavigateOnMouseClick>());
                break;

            default:
                DestroyImmediate(simpleController);
                DestroyImmediate(navigateOnMouseClick);
                break;
            }
            if (GUILayout.Button("Select Player", GUILayout.Width(100)))
            {
                Selection.activeGameObject = pcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Beispiel #13
0
 private void DrawUIStage()
 {
     EditorGUILayout.LabelField("User Interface", EditorStyles.boldLabel);
     EditorWindowTools.StartIndentedSection();
     EditorGUILayout.HelpBox("Assign a dialogue UI. You can find pre-built UIs in Prefabs/Unity UI Prefabs and Prefabs/Legacy Unity GUI Prefabs. To assign a prefab for a different GUI system, import its support package found in Third Party Support. You can also assign a UI scene object.", MessageType.Info);
     if (DialogueManager.Instance.displaySettings == null)
     {
         DialogueManager.Instance.displaySettings = new DisplaySettings();
     }
     DialogueManager.Instance.displaySettings.dialogueUI = EditorGUILayout.ObjectField("Dialogue UI", DialogueManager.Instance.displaySettings.dialogueUI, typeof(GameObject), true) as GameObject;
     if (DialogueManager.Instance.displaySettings.dialogueUI == null)
     {
         EditorGUILayout.HelpBox("If you continue without assigning a UI, the Dialogue System will use a very plain default UI.", MessageType.Warning);
     }
     else
     {
         var legacy = DialogueManager.Instance.displaySettings.dialogueUI.GetComponentsInChildren <PixelCrushers.DialogueSystem.UnityGUI.UnityDialogueUI>(true);
         if (legacy.Length > 0)
         {
             EditorGUILayout.HelpBox("This is a Legacy Unity GUI dialogue UI.", MessageType.None);
         }
         else
         {
             var newUIs = DialogueManager.Instance.displaySettings.dialogueUI.GetComponentsInChildren <UnityUIDialogueUI>(true);
             if (newUIs.Length > 0)
             {
                 EditorGUILayout.HelpBox("This is a Unity UI dialogue UI.", MessageType.None);
                 HandleUnityUIDialogueUI(newUIs[0], DialogueManager.Instance);
             }
             else
             {
                 EditorGUILayout.HelpBox("Make sure this GameObject has an active dialogue UI component.", MessageType.None);
             }
         }
     }
     EditorWindowTools.EndIndentedSection();
     DrawNavigationButtons(true, true, false);
 }
Beispiel #14
0
        private void DrawSelector(SelectorType selectorType)
        {
            DestroyImmediate(pcObject.GetComponent <ProximitySelector>());
            Selector selector = pcObject.GetComponent <Selector>() ?? pcObject.AddComponent <Selector>();

            EditorWindowTools.StartIndentedSection();
            switch (selectorType)
            {
            case SelectorType.CenterOfScreen:
                EditorGUILayout.HelpBox("Usable objects in the center of the screen will be targeted.", MessageType.None);
                selector.selectAt = Selector.SelectAt.CenterOfScreen;
                break;

            case SelectorType.MousePosition:
                EditorGUILayout.HelpBox("Usable objects under the mouse cursor will be targeted. Specify which mouse button activates the targeted object.", MessageType.None);
                selector.selectAt = Selector.SelectAt.MousePosition;
                MouseButtonChoice mouseButtonChoice = string.Equals(selector.useButton, "Fire2") ? MouseButtonChoice.RightMouseButton : MouseButtonChoice.LeftMouseButton;
                mouseButtonChoice  = (MouseButtonChoice)EditorGUILayout.EnumPopup("Select With", mouseButtonChoice);
                selector.useButton = (mouseButtonChoice == MouseButtonChoice.RightMouseButton) ? "Fire2" : "Fire1";
                break;

            default:
            case SelectorType.CustomPosition:
                EditorGUILayout.HelpBox("Usable objects will be targeted at a custom screen position. You are responsible for setting the Selector component's CustomPosition property.", MessageType.None);
                selector.selectAt = Selector.SelectAt.CustomPosition;
                break;
            }
            if (selector.reticle != null)
            {
                selector.reticle.inRange    = EditorGUILayout.ObjectField("In-Range Reticle", selector.reticle.inRange, typeof(Texture2D), false) as Texture2D;
                selector.reticle.outOfRange = EditorGUILayout.ObjectField("Out-of-Range Reticle", selector.reticle.outOfRange, typeof(Texture2D), false) as Texture2D;
            }
            DrawSelectorUIPosition();
            selector.useKey    = (KeyCode)EditorGUILayout.EnumPopup("'Use' Key", selector.useKey);
            selector.useButton = EditorGUILayout.TextField("'Use' Button", selector.useButton);
            EditorGUILayout.HelpBox("Click Select Player to customize the Selector.", MessageType.None);
            EditorWindowTools.EndIndentedSection();
        }
Beispiel #15
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);
        }
 private void DrawLocalizationSettings()
 {
     foldouts.localizationSettingsFoldout = EditorWindowTools.EditorGUILayoutFoldout("Localization Settings", "Language localization settings.", foldouts.localizationSettingsFoldout, false);
     if (foldouts.localizationSettingsFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             var localizationSettings = displaySettingsProperty.FindPropertyRelative("localizationSettings");
             EditorGUILayout.PropertyField(localizationSettings.FindPropertyRelative("language"), true);
             EditorGUILayout.PropertyField(localizationSettings.FindPropertyRelative("useSystemLanguage"), true);
             EditorGUILayout.PropertyField(localizationSettings.FindPropertyRelative("textTable"), true);
             if (GUILayout.Button(new GUIContent("Reset Language PlayerPrefs", "Delete the language selection saved in PlayerPrefs.")))
             {
                 ResetLanguagePlayerPrefs();
             }
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
Beispiel #17
0
        private void DrawConversationStage()
        {
            EditorGUILayout.LabelField("Conversation", EditorStyles.boldLabel);
            ConversationTrigger conversationTrigger = npcObject.GetComponentInChildren <ConversationTrigger>();

            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("If the NPC has an interactive conversation (for example, with the player), tick the checkbox below.", MessageType.Info);
            EditorGUILayout.BeginHorizontal();
            bool hasConversation = EditorGUILayout.Toggle((conversationTrigger != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("NPC has an interactive conversation", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasConversation)
            {
                EditorWindowTools.StartIndentedSection();
                if (conversationTrigger == null)
                {
                    conversationTrigger = npcObject.AddComponent <ConversationTrigger>();
                }
                EditorGUILayout.HelpBox("Select the NPC's conversation and what event will trigger it. If the NPC will only engage in this conversation once, tick Once Only. Click Select NPC to further customize the Conversation Trigger in the inspector, such as setting conditions on when the conversation can occur.",
                                        string.IsNullOrEmpty(conversationTrigger.conversation) ? MessageType.Info : MessageType.None);
                conversationTrigger.conversation = DrawConversationPopup(conversationTrigger.conversation);
                conversationTrigger.once         = EditorGUILayout.Toggle("Once Only", conversationTrigger.once);
                conversationTrigger.trigger      = DrawTriggerPopup(conversationTrigger.trigger);
                if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
                {
                    Selection.activeGameObject = npcObject;
                }
                EditorWindowTools.EndIndentedSection();
            }
            else
            {
                DestroyImmediate(conversationTrigger);
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Beispiel #18
0
        private void Export()
        {
            string newFilename = EditorUtility.SaveFilePanel("Export to CSV", EditorWindowTools.GetDirectoryName(csvFilename), csvFilename, "csv");

            if (!string.IsNullOrEmpty(newFilename))
            {
                csvFilename = newFilename;
                if (Application.platform == RuntimePlatform.WindowsEditor)
                {
                    csvFilename = csvFilename.Replace("/", "\\");
                }
                using (StreamWriter file = new StreamWriter(csvFilename, false, EncodingTypeTools.GetEncoding(encodingType)))
                {
                    // Write heading:
                    StringBuilder sb = new StringBuilder();
                    sb.Append("Field");
                    foreach (var language in table.languages)
                    {
                        sb.AppendFormat(",{0}", CSVExporter.CleanField(language));
                    }
                    file.WriteLine(sb);

                    // Write fields:
                    foreach (var field in table.fields)
                    {
                        sb = new StringBuilder();
                        sb.Append(CSVExporter.CleanField(field.name));
                        foreach (var value in field.values)
                        {
                            sb.AppendFormat(",{0}", CSVExporter.CleanField(value));
                        }
                        file.WriteLine(sb);
                    }
                }
                EditorUtility.DisplayDialog("Export Complete", "The localized text table was exported to CSV (comma-separated values) format. ", "OK");
            }
        }
Beispiel #19
0
        private void DrawPersistenceStage()
        {
            EditorGUILayout.LabelField("Persistence", EditorStyles.boldLabel);
            var positionSaver = pcObject.GetComponent <PositionSaver>();

            EditorWindowTools.StartIndentedSection();
            if (positionSaver == null)
            {
                EditorGUILayout.HelpBox("The player can be configured to record its position in the Dialogue System's Lua environment so it will be preserved when saving and loading games.", MessageType.Info);
            }
            EditorGUILayout.BeginHorizontal();
            bool hasPersistentPosition = EditorGUILayout.Toggle((positionSaver != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("Player records position for saved games", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasPersistentPosition)
            {
                if (positionSaver == null)
                {
                    positionSaver     = pcObject.AddComponent(TypeUtility.GetWrapperType(typeof(PixelCrushers.PositionSaver))) as PositionSaver;
                    positionSaver.key = "Player";
                }
                if (positionSaverEditor == null)
                {
                    positionSaverEditor = Editor.CreateEditor(positionSaver);
                }
                positionSaverEditor.OnInspectorGUI();
            }
            else
            {
                DestroyImmediate(positionSaver);
                positionSaver       = null;
                positionSaverEditor = null;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
 protected virtual void DrawLuaAction()
 {
     foldouts.luaFoldout = EditorWindowTools.EditorGUILayoutFoldout("Run Lua Code", "Run Lua code.", foldouts.luaFoldout, false);
     if (foldouts.luaFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             if (EditorTools.selectedDatabase != luaScriptWizard.database)
             {
                 luaScriptWizard.database = EditorTools.selectedDatabase;
                 luaScriptWizard.RefreshWizardResources();
             }
             serializedObject.ApplyModifiedProperties();
             EditorGUI.BeginChangeCheck();
             var newLuaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run when the condition is true."), trigger.luaCode);
             var changed    = EditorGUI.EndChangeCheck();
             serializedObject.Update();
             if (changed)
             {
                 serializedObject.FindProperty("luaCode").stringValue = newLuaCode;
             }
             EditorGUILayout.BeginHorizontal();
             GUILayout.FlexibleSpace();
             if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(14)))
             {
                 serializedObject.FindProperty("luaCode").stringValue = string.Empty;
                 showRunLuaCodeAction = false;
             }
             EditorGUILayout.EndHorizontal();
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            EditorWindowTools.DrawDeprecatedTriggerHelpBox();
            var trigger = target as LuaTrigger;

            if (trigger == null || luaScriptWizard == null)
            {
                return;
            }
            EditorGUILayout.PropertyField(serializedObject.FindProperty("trigger"), true);

            var newDatabase = EditorGUILayout.ObjectField("Reference Database", luaScriptWizard.database, typeof(DialogueDatabase), false) as DialogueDatabase;

            if (newDatabase != luaScriptWizard.database)
            {
                EditorTools.selectedDatabase = newDatabase;
                luaScriptWizard.database     = newDatabase;
                luaScriptWizard.RefreshWizardResources();
            }

            // Lua code / wizard:
            serializedObject.ApplyModifiedProperties();
            EditorGUI.BeginChangeCheck();
            var newLuaCode = luaScriptWizard.Draw(new GUIContent("Lua Code", "The Lua code to run."), trigger.luaCode);
            var changed    = EditorGUI.EndChangeCheck();

            serializedObject.Update();
            if (changed)
            {
                serializedObject.FindProperty("luaCode").stringValue = newLuaCode;
            }

            EditorGUILayout.PropertyField(serializedObject.FindProperty("once"), true);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("condition"), true);
            serializedObject.ApplyModifiedProperties();
        }
        private void DrawLanguages()
        {
            // Draw Languages foldout and menu:
            EditorGUILayout.BeginHorizontal();
            languagesFoldout = EditorGUILayout.Foldout(languagesFoldout, "Languages");
            DrawMenu();
            if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(22)))
            {
                languagesFoldout = true;
                table.languages.Add(string.Empty);
            }
            EditorGUILayout.EndHorizontal();

            // Draw languages:
            if (languagesFoldout)
            {
                int languageIndexToDelete = -1;
                EditorWindowTools.StartIndentedSection();
                for (int i = 0; i < table.languages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    table.languages[i] = EditorGUILayout.TextField(table.languages[i]);
                    EditorGUI.BeginDisabledGroup(i == 0);
                    if (GUILayout.Button("-", EditorStyles.miniButton, GUILayout.Width(22)))
                    {
                        languageIndexToDelete = i;
                    }
                    EditorGUI.EndDisabledGroup();
                    EditorGUILayout.EndHorizontal();
                }
                EditorWindowTools.EndIndentedSection();
                if (languageIndexToDelete != -1)
                {
                    DeleteLanguage(languageIndexToDelete);
                }
            }
        }
Beispiel #23
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();
            DrawOverrideNameSubsection();
            if (GUILayout.Button("Select Player", GUILayout.Width(100)))
            {
                Selection.activeGameObject = pcObject;
            }
            DrawNavigationButtons(true, true, false);
        }
        public override void OnInspectorGUI()
        {
            var trigger = target as SequenceTrigger;

            if (trigger == null)
            {
                return;
            }

            trigger.trigger = (DialogueTriggerEvent)EditorGUILayout.EnumPopup(new GUIContent("Trigger", "The event that triggers the sequence"), trigger.trigger);
            if (trigger.trigger == DialogueTriggerEvent.OnEnable || trigger.trigger == DialogueTriggerEvent.OnStart)
            {
                trigger.waitOneFrameOnStartOrEnable = EditorGUILayout.Toggle(new GUIContent("Wait 1 Frame", "Tick to wait one frame to allow other components to finish their OnStart/OnEnable"), trigger.waitOneFrameOnStartOrEnable);
            }
            EditorGUILayout.LabelField(new GUIContent("Sequence", "The sequence to play"));
            EditorWindowTools.StartIndentedSection();
            trigger.sequence = EditorGUILayout.TextArea(trigger.sequence);
            EditorWindowTools.EndIndentedSection();
            trigger.speaker  = EditorGUILayout.ObjectField(new GUIContent("Speaker", "The GameObject referenced by 'speaker'. If unassigned, this GameObject"), trigger.speaker, typeof(Transform), true) as Transform;
            trigger.listener = EditorGUILayout.ObjectField(new GUIContent("Listener", "The GameObject referenced by 'listener'. If unassigned, the GameObject that triggered this sequence"), trigger.listener, typeof(Transform), true) as Transform;
            trigger.once     = EditorGUILayout.Toggle(new GUIContent("Only Once", "Only trigger once, then destroy this component"), trigger.once);
            EditorTools.DrawReferenceDatabase();
            EditorTools.DrawSerializedProperty(serializedObject, "condition");
        }
Beispiel #25
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var manager = target as BarkGroupManager;

            foreach (var kvp in manager.groups)
            {
                EditorGUILayout.LabelField(kvp.Key, EditorStyles.boldLabel);
                EditorWindowTools.StartIndentedSection();
                foreach (var member in kvp.Value)
                {
                    if (member == null)
                    {
                        continue;
                    }
                    if (GUILayout.Button(member.name))
                    {
                        Selection.activeGameObject = member.gameObject;
                    }
                }
                EditorWindowTools.EndIndentedSection();
            }
        }
Beispiel #26
0
        private void DrawTransitionStage()
        {
            EditorGUILayout.LabelField("Gameplay/Conversation Transition", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            SetComponentEnabledOnDialogueEvent setEnabled = pcObject.GetComponent <SetComponentEnabledOnDialogueEvent>();

            setEnabledFlag = setEnabledFlag || (setEnabled != null);
            if (!setEnabledFlag)
            {
                EditorGUILayout.HelpBox("Gameplay components, such as movement and camera control, will interfere with conversations. If you want to disable gameplay components during conversations, tick the checkbox below. There are many ways to disable gameplay components. You can add a Dialogue System Events component and configure it in the inspector, or add Dialogue System Triggers set to OnConversationStart and OnConversationEnd. Or you can add a Set Component Enabled On Dialogue Event component, which is what the checkbox below does.", MessageType.None);
            }
            EditorGUILayout.BeginHorizontal();
            setEnabledFlag = EditorGUILayout.Toggle(setEnabledFlag, GUILayout.Width(ToggleWidth));
            EditorGUILayout.LabelField("Add Set Component Enabled On Dialogue Event component", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            DrawDisableControlsSection();
            DrawShowCursorSection();
            if (GUILayout.Button("Select Player", GUILayout.Width(100)))
            {
                Selection.activeGameObject = pcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
 private void DrawCameraSettings()
 {
     foldouts.cameraSettingsFoldout = EditorWindowTools.EditorGUILayoutFoldout("Camera & Cutscene Settings", "Camera and cutscene sequencer settings.", foldouts.cameraSettingsFoldout, false);
     if (foldouts.cameraSettingsFoldout)
     {
         try
         {
             EditorWindowTools.EditorGUILayoutBeginGroup();
             var cameraSettings = displaySettingsProperty.FindPropertyRelative("cameraSettings");
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("sequencerCamera"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("alternateCameraObject"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("cameraAngles"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("defaultSequence"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("defaultPlayerSequence"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("defaultResponseMenuSequence"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("entrytagFormat"), true);
             EditorGUILayout.PropertyField(cameraSettings.FindPropertyRelative("disableInternalSequencerCommands"), true);
         }
         finally
         {
             EditorWindowTools.EditorGUILayoutEndGroup();
         }
     }
 }
Beispiel #28
0
        private void DrawTransitionStage()
        {
            EditorGUILayout.LabelField("Gameplay/Conversation Transition", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            SetEnabledOnDialogueEvent setEnabled = pcObject.GetComponent <SetEnabledOnDialogueEvent>();

            setEnabledFlag = setEnabledFlag || (setEnabled != null);
            if (!setEnabledFlag)
            {
                EditorGUILayout.HelpBox("Gameplay components, such as movement and camera control, will interfere with conversations. If you want to disable gameplay components during conversations, tick the checkbox below.", MessageType.None);
            }
            EditorGUILayout.BeginHorizontal();
            setEnabledFlag = EditorGUILayout.Toggle(setEnabledFlag, GUILayout.Width(ToggleWidth));
            EditorGUILayout.LabelField("Disable gameplay components during conversations", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            DrawDisableControlsSection();
            DrawShowCursorSection();
            if (GUILayout.Button("Select Player", GUILayout.Width(100)))
            {
                Selection.activeGameObject = pcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
Beispiel #29
0
        private void DrawControls()
        {
            EditorGUIUtility.LookLikeControls();

            // Project Format:
            EditorGUILayout.BeginHorizontal();
            ChatMapperProjectFormat newFormat = (ChatMapperProjectFormat)EditorGUILayout.Popup(new GUIContent("Project Format", "Converting from CMP requires Chat Mapper Commercial."), (int)prefs.projectFormat, FormatOptions);

            if (newFormat != prefs.projectFormat)
            {
                for (int i = 0; i < prefs.projectFilenames.Count; i++)
                {
                    if (newFormat == ChatMapperProjectFormat.Cmp)
                    {
                        prefs.projectFilenames[i] = prefs.projectFilenames[i].Replace("xml", "cmp");
                    }
                    else
                    {
                        prefs.projectFilenames[i] = prefs.projectFilenames[i].Replace("cmp", "xml");
                    }
                }
                prefs.projectFormat        = newFormat;
                GUIUtility.keyboardControl = 0;
            }
            EditorGUILayout.EndHorizontal();

            // Path to ChatMapper.exe:
            if (prefs.projectFormat == ChatMapperProjectFormat.Cmp)
            {
                if (string.IsNullOrEmpty(prefs.pathToChatMapperExe))
                {
                    EditorGUILayout.HelpBox("To directly convert CMP files, the Dialogue System will run ChatMapper.exe in the background. Specify the location of ChatMapper.exe in the field below.", MessageType.Info);
                }
            }
            EditorGUILayout.BeginHorizontal();
            prefs.pathToChatMapperExe = EditorGUILayout.TextField(new GUIContent("Path to ChatMapper.exe", "Optional if converting XML. Also used to open CMP files in Project with double-click."), prefs.pathToChatMapperExe);
            if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
            {
                prefs.pathToChatMapperExe  = EditorUtility.OpenFilePanel("Path to ChatMapper.exe", "", "exe");
                GUIUtility.keyboardControl = 0;
            }
            EditorGUILayout.EndHorizontal();

            // Paths to Chat Mapper Projects:
            if (!HasValidProjectFilenames())
            {
                EditorGUILayout.HelpBox("Specify the Chat Mapper project(s) to convert. Click '+' to add a Chat Mapper project", MessageType.Info);
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Chat Mapper Projects", "Specify project to convert here."));
            if (GUILayout.Button(new GUIContent("+", "Add another Chat Mapper project to convert"), EditorStyles.miniButtonRight, GUILayout.Width(22)))
            {
                prefs.projectFilenames.Add(string.Empty);
                prefs.includeProjectFilenames.Add(true);
            }
            EditorGUILayout.EndHorizontal();
            if (prefs.includeProjectFilenames.Count < prefs.projectFilenames.Count)
            {
                for (int i = prefs.includeProjectFilenames.Count; i < prefs.projectFilenames.Count; i++)
                {
                    prefs.includeProjectFilenames.Add(true);
                }
            }
            int projectFilenameToDelete = -1;

            for (int i = 0; i < prefs.projectFilenames.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                prefs.projectFilenames[i]        = EditorGUILayout.TextField("    Filename", prefs.projectFilenames[i]);
                prefs.includeProjectFilenames[i] = EditorGUILayout.Toggle(prefs.includeProjectFilenames[i], GUILayout.Width(16));
                if (GUILayout.Button("...", EditorStyles.miniButtonMid, GUILayout.Width(22)))
                {
                    prefs.projectFilenames[i]  = EditorUtility.OpenFilePanel("Select Chat Mapper Project", EditorWindowTools.GetDirectoryName(prefs.projectFilenames[i]), GetFormatExtension(prefs.projectFormat));
                    GUIUtility.keyboardControl = 0;
                }
                if (GUILayout.Button(new GUIContent("-", "Remove this slot."), EditorStyles.miniButtonRight, GUILayout.Width(22)))
                {
                    projectFilenameToDelete = i;
                }
                EditorGUILayout.EndHorizontal();
            }
            if (projectFilenameToDelete >= 0)
            {
                prefs.projectFilenames.RemoveAt(projectFilenameToDelete);
            }

            // Portrait Folder:
            EditorGUILayout.BeginHorizontal();
            prefs.portraitFolder = EditorGUILayout.TextField(new GUIContent("Portrait Folder", "Optional folder containing actor portrait textures. The converter will search this folder for textures matching any actor pictures defined in the Chat Mapper project."), prefs.portraitFolder);
            if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
            {
                prefs.portraitFolder       = EditorUtility.OpenFolderPanel("Location of Portrait Textures", prefs.portraitFolder, "");
                prefs.portraitFolder       = "Assets" + prefs.portraitFolder.Replace(Application.dataPath, string.Empty);
                GUIUtility.keyboardControl = 0;
            }
            EditorGUILayout.EndHorizontal();

            // Save To:
            if (string.IsNullOrEmpty(prefs.outputFolder))
            {
                EditorGUILayout.HelpBox("In the field below, specify the folder to create the dialogue database asset(s) in.", MessageType.Info);
            }
            EditorGUILayout.BeginHorizontal();
            prefs.outputFolder = EditorGUILayout.TextField(new GUIContent("Save To", "Folder where dialogue database assets will be saved."), prefs.outputFolder);
            if (GUILayout.Button("...", EditorStyles.miniButtonRight, GUILayout.Width(22)))
            {
                prefs.outputFolder         = EditorUtility.SaveFolderPanel("Path to Save Database", prefs.outputFolder, "");
                prefs.outputFolder         = "Assets" + prefs.outputFolder.Replace(Application.dataPath, string.Empty);
                GUIUtility.keyboardControl = 0;
            }
            EditorGUILayout.EndHorizontal();

            // Project/Database Name:
            bool hasMultipleProjects = (prefs.projectFilenames.Count > 1);

            if (hasMultipleProjects)
            {
                prefs.useProjectName = true;
            }
            EditorGUI.BeginDisabledGroup(hasMultipleProjects);
            prefs.useProjectName = EditorGUILayout.Toggle(new GUIContent("Use Project Name", "Tick to use project name defined in Chat Mapper project, untick to specify a name."), prefs.useProjectName);
            EditorGUI.EndDisabledGroup();
            if (!prefs.useProjectName)
            {
                prefs.databaseName = EditorGUILayout.TextField(new GUIContent("Dialogue Database Name", "Filename to create in Save To folder."), prefs.databaseName);
            }

            // Overwrite:
            prefs.overwrite = EditorGUILayout.Toggle(new GUIContent("Overwrite", "Tick to overwrite the dialogue database if it exists, untick to create a new copy."), prefs.overwrite);

            // Buttons:
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Clear", GUILayout.Width(100)))
            {
                ClearPrefs();
            }
            bool disabled = (string.IsNullOrEmpty(prefs.pathToChatMapperExe) && (prefs.projectFormat == ChatMapperProjectFormat.Cmp)) ||
                            !HasValidProjectFilenames() ||
                            string.IsNullOrEmpty(prefs.outputFolder) ||
                            (!prefs.useProjectName && string.IsNullOrEmpty(prefs.databaseName));

            EditorGUI.BeginDisabledGroup(disabled);
            if (GUILayout.Button("Convert", GUILayout.Width(100)))
            {
                ConvertChatMapperProjects();
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();

            if (GUI.changed)
            {
                SavePrefs();
            }
        }
Beispiel #30
0
        public static string DrawLayout(GUIContent guiContent, string sequence, ref Rect rect)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(guiContent);
            if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(26)))
            {
                DrawContextMenu(sequence);
            }
            EditorGUILayout.EndHorizontal();
            if (menuResult != MenuResult.Unselected)
            {
                sequence   = ApplyMenuResult(menuResult, sequence);
                menuResult = MenuResult.Unselected;
            }

            EditorWindowTools.StartIndentedSection();
            var newSequence = EditorGUILayout.TextArea(sequence);

            if (!string.Equals(newSequence, sequence))
            {
                sequence    = newSequence;
                GUI.changed = true;
            }

            switch (Event.current.type)
            {
            case EventType.Repaint:
                rect = GUILayoutUtility.GetLastRect();
                break;

            case EventType.DragUpdated:
            case EventType.DragPerform:
                if (rect.Contains(Event.current.mousePosition))
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                    if (Event.current.type == EventType.DragPerform)
                    {
                        DragAndDrop.AcceptDrag();
                        foreach (var obj in DragAndDrop.objectReferences)
                        {
                            if (obj is AudioClip)
                            {
                                // Drop audio clip according to selected audio command:
                                var clip = obj as AudioClip;
                                var path = AssetDatabase.GetAssetPath(clip);
                                if (path.Contains("Resources"))
                                {
                                    sequence    = AddCommandToSequence(sequence, GetCurrentAudioCommand() + "(" + GetResourceName(path) + ")");
                                    GUI.changed = true;
                                }
                                else
                                {
                                    EditorUtility.DisplayDialog("Not in Resources Folder", "Audio clips must be located in the hierarchy of a Resources folder or an AssetBundle.", "OK");
                                }
                            }
                            else if (obj is GameObject)
                            {
                                // Drop GameObject.
                                var go = obj as GameObject;
                                if (sequence.EndsWith("("))
                                {
                                    // If sequence ends in open paren, add GameObject and close:
                                    sequence += go.name + ")";
                                }
                                else
                                {
                                    // Drop GameObject according to selected GameObject command:
                                    var command = Event.current.alt ? alternateGameObjectDragDropCommand : gameObjectDragDropCommand;
                                    sequence = AddCommandToSequence(sequence, GetCurrentGameObjectCommand(command, go.name));
                                }
                                GUI.changed = true;
                            }
                        }
                    }
                }
                break;
            }

            EditorWindowTools.EndIndentedSection();

            return(sequence);
        }