Exemple #1
0
        // 格式化输入的对话语言
        public string FormatTaskText(string taskText)
        {
            //Debug.Log("FormatTaskText()");

            string text = taskText;
            Regex  re   = new Regex(@"\{\d+\}");

            foreach (Match matchData in re.Matches(text))
            {
                string value = matchData.Value;
                int    flag  = int.Parse(value.Replace("{", "").Replace("}", ""));

                switch (flag)
                {
                case 0:
                    text = text.Replace(value, theOwner.name);
                    continue;

                case 1:
                    text = text.Replace(value, theOwner.GetSexString(DialogueRelationship.You));
                    continue;

                case 2:
                    text = text.Replace(value, theOwner.GetSexString(DialogueRelationship.OlderToYounger));
                    continue;

                case 3:
                    text = text.Replace(value, theOwner.GetSexString(DialogueRelationship.YoungerToOlder));
                    continue;

                default:
                    text = text.Replace(value, LanguageData.GetContent(flag));
                    continue;
                }
            }

            return(text);
        }