protected override void Execute()
    {
        Description descriptionPanel = Description.GetInstance();

        descriptionPanel.ClearDescription();
        if (bundleInstance == null || (actualConv == null || actualConv != npc.ActiveConversation))
        {
            if (actualConv != null)
            {
                actualConv.OnActivationChange -= parentBundle.RefreshOnEvent;
            }
            actualConv     = npc.ActiveConversation;
            bundleInstance = MenuItemBundleFactroy.CreateConversationLineBundle(LabelUtility.Instance.GetLabel(LabelNames.CONVERSATIONWITH) + npc.NameText.GetText(), parentBundle, actualConv.FirstLine, npc.NameText.GetText());

            actualConv.OnActivationChange += parentBundle.RefreshOnEvent;
        }
        bundleInstance.ExecuteSideEffects();
        menuController.CurrentBundle = bundleInstance;
    }
    private SortedList <string, GENpc.GEConversation> ProcessConversations(List <NPCsTypeNPCConversation> conversations, GENpc npc)
    {
        SortedList <string, GENpc.GEConversation> processedConvs = new SortedList <string, GENpc.GEConversation>();

        if (conversations == null || conversations.Count == 0)
        {
            return(processedConvs);
        }

        foreach (NPCsTypeNPCConversation conv in conversations)
        {
            GENpc.GEConversation newConv            = new GENpc.GEConversation(conv.id, conv.activeAtStart, npc);
            SortedList <string, GENpc.GELine> lines = ProcessLines(conv.Line, newConv);
            SortedList <string, GEText>       texts = ProcessTexts(conv.Texts);
            newConv.FirstLine = lines[conv.firstLineId];
            newConv.Lines     = lines;
            newConv.Texts     = texts;
            processedConvs.Add(conv.id, newConv);
            elementManager.AddNpcConv(newConv);
        }

        return(processedConvs);
    }
Example #3
0
 public void AddNpcConv(GENpc.GEConversation conv)
 {
     AddToDic(npcConvs, conv);
 }
    private SortedList <string, GENpc.GELine> ProcessLines(List <NPCsTypeNPCConversationLine> lines, GENpc.GEConversation conv)
    {
        SortedList <string, GENpc.GELine> processedLines = new SortedList <string, GENpc.GELine>();

        if (lines == null || lines.Count == 0)
        {
            return(processedLines);
        }

        foreach (NPCsTypeNPCConversationLine line in lines)
        {
            GENpc.GELine          newLine = new GENpc.GELine(line.id, conv, line.isLastLine);
            List <GENpc.GEAnswer> answers = ProcessAnswers(line.Answer, newLine);
            newLine.Answers        = answers;
            OnReferenceProcessing += delegate(object o, EventArgs e)
            {
                newLine.LineText = elementManager.GetTextElement(line.lineTextId);
            };
            processedLines.Add(line.id, newLine);
            elementManager.AddNpcConvLine(newLine);
        }

        return(processedLines);
    }