public DialogueController(RootLine rootLine, GameObject[] speakerGOs, GameObject pcGO, string situation)
    {
        currentLine = rootLine;
        speakers = new DialogueAction[speakerGOs.Length];
        speakerMemories = new ArrayList();
        for (int i = 0; i < speakerGOs.Length; i++){
            GameObject speakerGO = speakerGOs[i];
            bool isPC = speakerGO == pcGO;
            if(!isPC) {
                speakerMemories.Add(speakerGOs[i].GetComponent("ImpressionMemory"));
            }
            GameObject otherSpeakerGO = speakerGOs[0];
            if (otherSpeakerGO == speakerGO){
                otherSpeakerGO = speakerGOs[1];
            }
            DialogueAction speaker = new DialogueAction(speakerGO, otherSpeakerGO.name, isPC);
            speakers[i] = speaker;
            ((ActionRunner)speakerGO.GetComponent("ActionRunner")).ResetRoutine(speaker, false);
            if (isPC){
                pc = speaker;
                goodbyeLine = GetGoodbyeLine(otherSpeakerGO);
            }
        }

        if(pc != null) {
            SendActionStarted();
        }

        this.situation = situation;
        //InitLookingDirections();
        currentSpeaker = null;
        started = false;
        firstLineSaid = false;
    }
Пример #2
0
    public Conversation(XmlElement element, LineCatalogue catalogue)
    {
        persistentConversation = new PersistentConversation();
        persistentConversation.name = element.GetAttribute("name");

        if(SaveLoad.SaveExits()) {
            PersistentConversation tmp = (PersistentConversation)SaveLoad.ReadSaveFile(PersistentConversation.GetSaveFileName(persistentConversation.name));
            if(tmp != null) {
                persistentConversation = tmp;
            }
            else {
                SaveLoad.ResetSave();
            }

        }

        //Debug.Log("Conversation.Conversation() name=" + persistentConversation.name );
        participants = new ArrayList();
        XmlNodeList participantNodeList = element.GetElementsByTagName("participant");
        foreach (XmlElement participantElement in participantNodeList){
            string participantName = participantElement.GetAttribute("name");
            participants.Add(CharacterManager.GetCharacter(participantName));
        }

        XmlElement rootLineElement = (XmlElement)element.GetElementsByTagName("root_line").Item(0);
        rootLine = new RootLine(rootLineElement, catalogue, this);
        rootLine.ConnectLinks(catalogue);
        currentController = null;
    }
Пример #3
0
        private void AddRoots(RootLine entry, MorphemeSurfaceDictionary<Root> roots)
        {
            string item = entry.Root;
            string[] surfaces = entry.Surfaces.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
            string lex = entry.Lex;
            string[] flags = entry.Flags.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
            string type = entry.Id;
            string[] rules = entry.Rules.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);

            if (string.IsNullOrEmpty(entry.Lex))
            {
                lex = item;
            }

            Root root;
            if (type == "KISALTMA" || type == "ALINTI" || type == "KISALTMA_NOKTALI" || type == "HARF")
            {
                root = new Root(type, lex, LabelSet.ConvertLabelNamesToIndexes(flags), _orthography.GetRules(rules),
                    item);
            }
            else
            {
                root = new Root(type, lex, LabelSet.ConvertLabelNamesToIndexes(flags), _orthography.GetRules(rules));
            }

            roots.Add(item, root); // kelimeyi asıl yüzeyi ile ekliyoruz

            //eğer fazladan yüzeyi var ise onunla da ekliyoruz.
            foreach (string lexicalForm in surfaces)
            {
                roots.Add(lexicalForm, root);
            }
        }
Пример #4
0
        private void AddRoots(RootLine entry, Dictionary <string, Root> rootsById,
                              MorphemeSurfaceDictionary <Root> rootsBySurface)
        {
            var mainSurface = entry.Root;
            var surfaces    = new List <string> {
                mainSurface
            };

            surfaces.AddRange(entry.Surfaces.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries));

            var lex    = entry.Lex;
            var labels = entry.Labels.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var pos    = entry.Pos;
            var rules  = entry.Rules.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            if (Regex.IsMatch(lex, @"\p{L}[2-9]"))
            {
                rules.Add("DROP_ID_DIGIT");
            }

            if (string.IsNullOrEmpty(entry.Lex))
            {
                lex = mainSurface;
            }

            var root = new Root(pos, lex,
                                new ImmutableSortedSet <string>(surfaces),
                                new ImmutableHashSet <string>(labels),
                                _orthography.GetRules(rules));

            var id = lex + "/" + pos;

            if (!rootsById.ContainsKey(id))
            {
                rootsById.Add(id, root);
            }
            else
            {
                Trace.TraceEvent(TraceEventType.Warning, 0, $"Duplicate root: {id}");
            }

            foreach (var lexicalForm in surfaces)
            {
                rootsBySurface.Add(lexicalForm, root);
            }
        }
Пример #5
0
        private void AddRoots(RootLine entry, Dictionary<string, Root> rootsById,
            MorphemeSurfaceDictionary<Root> rootsBySurface)
        {
            var mainSurface = entry.Root;
            var surfaces = new List<string> {mainSurface};
            surfaces.AddRange(entry.Surfaces.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries));

            var lex = entry.Lex;
            var labels = entry.Labels.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
            var pos = entry.Pos;
            var rules = entry.Rules.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries).ToList();

            if (Regex.IsMatch(lex, @"\p{L}[2-9]"))
            {
                rules.Add("DROP_ID_DIGIT");
            }

            if (string.IsNullOrEmpty(entry.Lex))
            {
                lex = mainSurface;
            }

            var root = new Root(pos, lex,
                new ImmutableSortedSet<string>(surfaces),
                new ImmutableHashSet<string>(labels),
                _orthography.GetRules(rules));

            var id = lex + "/" + pos;

            if (!rootsById.ContainsKey(id))
            {
                rootsById.Add(id, root);
            }
            else
            {
                Trace.TraceEvent(TraceEventType.Warning, 0, $"Duplicate root: {id}");
            }

            foreach (var lexicalForm in surfaces)
            {
                rootsBySurface.Add(lexicalForm, root);
            }
        }
Пример #6
0
        private void AddRoots(RootLine entry, MorphemeSurfaceDictionary <Root> roots)
        {
            string item = entry.Root;

            string[] surfaces = entry.Surfaces.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string   lex      = entry.Lex;

            string[] flags = entry.Flags.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string   type  = entry.Id;

            string[] rules = entry.Rules.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);


            if (string.IsNullOrEmpty(entry.Lex))
            {
                lex = item;
            }

            Root root;

            if (type == "KISALTMA" || type == "ALINTI" || type == "KISALTMA_NOKTALI" || type == "HARF")
            {
                root = new Root(type, lex, LabelSet.ConvertLabelNamesToIndexes(flags), _orthography.GetRules(rules),
                                item);
            }
            else
            {
                root = new Root(type, lex, LabelSet.ConvertLabelNamesToIndexes(flags), _orthography.GetRules(rules));
            }

            roots.Add(item, root); // kelimeyi asıl yüzeyi ile ekliyoruz

            //eğer fazladan yüzeyi var ise onunla da ekliyoruz.
            foreach (string lexicalForm in surfaces)
            {
                roots.Add(lexicalForm, root);
            }
        }