Пример #1
0
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <ShowAlertBehaviour> inputPlayable = (ScriptPlayable <ShowAlertBehaviour>)playable.GetInput(i);
                    ShowAlertBehaviour input = inputPlayable.GetBehaviour();
                    var message  = input.message;
                    var duration = input.useTextLengthForDuration ? 0 : (float)inputPlayable.GetDuration();
                    if (Application.isPlaying)
                    {
                        DialogueManager.ShowAlert(message, duration);
                    }
                    else
                    {
                        PreviewUI.ShowMessage(message, duration, -1);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            GameObject trackBinding = playerData as GameObject;

            Transform speaker = (trackBinding != null) ? trackBinding.transform : null;

            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <PlaySequenceBehaviour> inputPlayable = (ScriptPlayable <PlaySequenceBehaviour>)playable.GetInput(i);
                    PlaySequenceBehaviour input = inputPlayable.GetBehaviour();
                    var sequence = input.sequence;
                    if (Application.isPlaying)
                    {
                        DialogueManager.PlaySequence(sequence, speaker, input.listener);
                    }
                    else
                    {
                        PreviewUI.ShowMessage(sequence, 3, -1);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    if (Application.isPlaying)
                    {
                        DialogueManager.instance.BroadcastMessage("OnConversationContinueAll", SendMessageOptions.DontRequireReceiver);
                    }
                    else
                    {
                        PreviewUI.ShowMessage("Continue", 3, -1);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <SetQuestStateBehaviour> inputPlayable = (ScriptPlayable <SetQuestStateBehaviour>)playable.GetInput(i);
                    SetQuestStateBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        if (input.setQuestState)
                        {
                            QuestLog.SetQuestState(input.quest, input.questState);
                        }
                        if (input.setQuestEntryState)
                        {
                            QuestLog.SetQuestEntryState(input.quest, input.questEntryNumber, input.questEntryState);
                        }
                    }
                    else
                    {
                        var message = string.Empty;
                        if (input.setQuestState)
                        {
                            message = "Set quest " + input.quest + " to " + input.questState;
                            if (input.setQuestEntryState)
                            {
                                message += " and entry #" + input.questEntryNumber + " to " + input.questEntryState;
                            }
                        }
                        else if (input.setQuestEntryState)
                        {
                            message = "Set quest " + input.quest + " entry #" + input.questEntryNumber + " to " + input.questEntryState;
                        }
                        if (!string.IsNullOrEmpty(message))
                        {
                            PreviewUI.ShowMessage(message, 2, -2);
                        }
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            GameObject trackBinding = playerData as GameObject;

            if (!trackBinding)
            {
                return;
            }

            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <BarkBehaviour> inputPlayable = (ScriptPlayable <BarkBehaviour>)playable.GetInput(i);
                    BarkBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        if (input.useConversation)
                        {
                            DialogueManager.Bark(input.conversation, trackBinding.transform, input.listener);
                        }
                        else
                        {
                            DialogueManager.BarkString(input.text, trackBinding.transform, input.listener);
                        }
                    }
                    else
                    {
                        var message = DialogueActor.GetActorName(trackBinding.transform) + " bark: " + input.GetEditorBarkText();
                        if (input.useConversation)
                        {
                            message += " (may vary)";
                        }
                        PreviewUI.ShowMessage(message, 2, 1);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
Пример #6
0
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            GameObject trackBinding = playerData as GameObject;

            if (!trackBinding)
            {
                return;
            }

            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <StartConversationBehaviour> inputPlayable = (ScriptPlayable <StartConversationBehaviour>)playable.GetInput(i);
                    StartConversationBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        if (input.entryID <= 0)
                        {
                            DialogueManager.StartConversation(input.conversation, trackBinding.transform, input.conversant);
                        }
                        else
                        {
                            DialogueManager.StartConversation(input.conversation, trackBinding.transform, input.conversant, input.entryID);
                        }
                    }
                    else
                    {
                        var message = OverrideActorName.GetActorName(trackBinding.transform) + " conversation: " + input.conversant;
                        PreviewUI.ShowMessage(message, 2, 0);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            GameObject trackBinding = playerData as GameObject;

            Transform actorTransform = (trackBinding != null) ? trackBinding.transform : null;

            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <StartConversationBehaviour> inputPlayable = (ScriptPlayable <StartConversationBehaviour>)playable.GetInput(i);
                    StartConversationBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        if (input.jumpToSpecificEntry && input.entryID > 0)
                        {
                            DialogueManager.StartConversation(input.conversation, actorTransform, input.conversant, input.entryID);
                        }
                        else
                        {
                            DialogueManager.StartConversation(input.conversation, actorTransform, input.conversant);
                        }
                    }
                    else
                    {
                        var message = "Conversation (" + DialogueActor.GetActorName(actorTransform) + "->" + DialogueActor.GetActorName(input.conversant) + "): [" + input.conversation + "] '" + input.GetEditorDialogueText() + "' (may vary)";
                        PreviewUI.ShowMessage(message, 2, 0);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    var inputPlayable = (ScriptPlayable <ContinueConversationBehaviour>)playable.GetInput(i);
                    ContinueConversationBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        switch (input.operation)
                        {
                        case ContinueConversationBehaviour.Operation.Continue:
                            DialogueManager.instance.BroadcastMessage("OnConversationContinueAll", SendMessageOptions.DontRequireReceiver);
                            break;

                        case ContinueConversationBehaviour.Operation.ClearSubtitleText:
                            var standardDialogueUI = DialogueManager.dialogueUI as StandardDialogueUI;
                            if (standardDialogueUI != null)
                            {
                                if (input.clearAllPanels)
                                {
                                    for (int j = 0; j < standardDialogueUI.conversationUIElements.subtitlePanels.Length; j++)
                                    {
                                        if (standardDialogueUI.conversationUIElements.subtitlePanels[j] == null)
                                        {
                                            continue;
                                        }
                                        standardDialogueUI.conversationUIElements.subtitlePanels[j].ClearText();
                                    }
                                }
                                else if (0 <= input.clearPanelNumber && input.clearPanelNumber < standardDialogueUI.conversationUIElements.subtitlePanels.Length &&
                                         standardDialogueUI.conversationUIElements.subtitlePanels[input.clearPanelNumber] != null)
                                {
                                    standardDialogueUI.conversationUIElements.subtitlePanels[input.clearPanelNumber].ClearText();
                                }
                            }
                            break;
                        }
                    }
                    else
                    {
                        switch (input.operation)
                        {
                        case ContinueConversationBehaviour.Operation.Continue:
                            PreviewUI.ShowMessage(GetEditorContinueText(playable), 3, -1);
                            break;

                        case ContinueConversationBehaviour.Operation.ClearSubtitleText:
                            break;
                        }
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }