private void ShowTopic(TopicEntry topic, bool isRoot)
        {
            if (topic == null)
            {
                AddText(BaseLocale.GetStr(RS.rs_NothingToSay));
            }
            else
            {
                if (isRoot)
                {
                    string qst = topic.Phrase;
                    if (!string.IsNullOrEmpty(qst))
                    {
                        AddText(qst);
                    }
                }

                if (CheckScript(topic.Action) && !string.IsNullOrEmpty(topic.Answer))
                {
                    AddText(topic.Answer);

                    for (int i = 0; i < topic.TopicsCount; i++)
                    {
                        TopicEntry subTopic = topic.GetTopic(i);

                        if (CheckScript(subTopic.Condition))
                        {
                            AddText("@" + subTopic.Phrase + "@ ");
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public TopicEntry GetTopic(CreatureEntity collocutor, int conversationIndex, TopicEntry parentTopic, string phrase)
        {
            TopicEntry result = null;

            DialogEntry       dlg        = Dialog;
            ConversationEntry curConvers = dlg.GetConversation(conversationIndex);

            if (parentTopic == null)
            {
                result = curConvers.GetTopic(0);
            }
            else
            {
                for (int i = 0; i < parentTopic.TopicsCount; i++)
                {
                    TopicEntry subTopic = parentTopic.GetTopic(i);
                    if ((subTopic.Phrase == phrase))
                    {
                        result = subTopic;
                        break;
                    }
                }
            }

            return(result);
        }