Пример #1
0
        public TextAnswerData TranslateAnswer(string textId, string answerID, TextAnswerData answer)
        {
            if (current == null)
            {
                return(answer);
            }

            var tText = current[textId];

            if (tText == null)
            {
                return(answer);
            }

            var tAnswer = tText.GetAnswer(answerID);

            if (tAnswer == null)
            {
                return(answer);
            }

            answer.Text = tAnswer.TranslatedText;

            return(answer);
        }
Пример #2
0
        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);
        }