コード例 #1
0
        public void SelectAnswer(int index)
        {
            var n = GetActiveNode(Conversation.EVENT_NAME);

            if (n == null)
            {
                n = GetActiveNode(AmbientDialogue.EVENT_NAME);
            }

            if (n != null && n.GetType() == typeof(TextNode))
            {
                ((TextNode)n).SelectAnswer(index - 1);
            }

            Timer = null;
        }
コード例 #2
0
        public void ShowText(string ID, TextData text, List <TextAnswerData> answers, TimerData timer, SettingsData settings)
        {
            // SET TIMER
            Timer = timer;

            text.Name = GetActorName(text.Name);

            if (text.Portrait == null && ActorEnabled)
            {
                text.Portrait = ActorPortrait;
            }

            string flow = EventNameofNode(ID);

            if (Conversation.EVENT_NAME == flow)
            {
                if (settings.CameraIndex == -1 && Conversation.CameraController.Enable)
                {
                    settings.CameraIndex = Conversation.CameraController.DefaultIndex;
                }

                if (settings.CameraIndex > -1)
                {
                    Conversation.CameraController.Set(settings.CameraIndex);
                }
                else
                {
                    Conversation.CameraController.Reset();
                }

                if (Conversation.OnTextChanged != null)
                {
                    Conversation.OnTextChanged(Conversation, text, answers, settings);
                }
            }
            else if (AmbientDialogue.EVENT_NAME == flow)
            {
                if (AmbientDialogue.OnTextChanged != null)
                {
                    AmbientDialogue.OnTextChanged(AmbientDialogue, text, answers, settings);
                }
            }
        }
コード例 #3
0
ファイル: TextNode.cs プロジェクト: KellyeAnnora/GGJ2020
        protected override void OnEnter()
        {
            TextData text = graph.translator.TranslateText(ID, new TextData()
            {
                Name           = ActorName,
                Portrait       = Portrait,
                Text           = Text,
                Audio          = Audio,
                AudioStartTime = AudioStartTime,
                AudioEndTime   = AudioEndTime,
                AudioDelay     = AudioDelay
            });

            text.Text = ReplaceText(text.Text);

            SettingsData settings = new SettingsData()
            {
                CameraIndex = CustomCameraEnable ? CameraIndex : -1,
                Skin        = CustomSkinEnable ? Skin : ""
            };
            TimerData timer = null;

            List <TextAnswerData> answers = new List <TextAnswerData>();

            foreach (var answer in Answers)
            {
                Variable show       = GetInput(answer.InputName);
                Variable answerText = Variables.GetByName(answer.VariableName);

                if (answer.Type == AnswerType.Time)
                {
                    Variable time = Variables.GetByName(answer.VariableName);

                    timer = new TimerData()
                    {
                        Seconds    = time.ConvertedValue <float>(),
                        OutputName = answer.OutputName
                    };
                    continue;
                }
                else if (show != null && !show.ConvertedValue <bool>())
                {
                    continue;
                }

                TextAnswerData answerData = new TextAnswerData();
                FetchCustomAnswerUI(answerText.ConvertedValue <string>(),
                                    out answerData.IsGlobal,
                                    out answerData.UIElementName,
                                    out answerData.VariableName,
                                    out answerData.Text);

                answerData.Text        = ReplaceText(answerData.Text);
                answerData.UseCustomUI = answerData.UIElementName != "";
                answerData.OutputName  = answer.OutputName;

                var a = graph.translator.TranslateAnswer(ID, answer.VariableName, answerData);
                answers.Add(a);
            }

            dialogueBehaviour.ShowText(ID, text, answers, timer, settings);
        }