Esempio n. 1
0
    public void CreateConversationGraph()
    {
        List <LText> allTexts = new List <LText>(this.Elements);
        Dictionary <LText, LText[]> responses = new Dictionary <LText, LText[]>();

        foreach (LText text in allTexts)
        {
            string[]     responseIds       = text.Responses;
            List <LText> matchingResponses = allTexts.FindAll(response => ArrayUtil.Contains <string>(responseIds, response.ID));
            responses.Add(text, matchingResponses.ToArray());
        }
        Dictionary <LText, LGraphNode <LText> > textNodes = new Dictionary <LText, LGraphNode <LText> >();

        foreach (LText text in responses.Keys)
        {
            textNodes.Add(text, new LGraphNode <LText>(text));
        }
        foreach (LText text in responses.Keys)
        {
            foreach (LText response in responses.Keys)
            {
                if (text.Responses.Contains(response.ID))
                {
                    textNodes[text].AddNeighbour(textNodes[response]);
                }
            }
        }
        Conversation = new LConversationGraph(textNodes.Values.ToArray());
    }
 public bool HasEndEvent(string eventName)
 {
     return(ArrayUtil.Contains(
                StopEvents,
                eventName
                ));
 }
Esempio n. 3
0
    public void CreateConversationGraph()
    {
        List <DialogueLine> allLines = new List <DialogueLine>(this.Elements);
        Dictionary <DialogueLine, DialogueLine[]> responses = new Dictionary <DialogueLine, DialogueLine[]>();

        foreach (DialogueLine line in allLines)
        {
            string[]            responseIds       = line.Responses;
            List <DialogueLine> matchingResponses = allLines.FindAll(response => ArrayUtil.Contains <string>(responseIds, response.ID));
            responses.Add(line, matchingResponses.ToArray());
        }
        Dictionary <DialogueLine, GraphNode <DialogueLine> > dialogueNodes = new Dictionary <DialogueLine, GraphNode <DialogueLine> >();

        foreach (DialogueLine line in responses.Keys)
        {
            dialogueNodes.Add(line, new GraphNode <DialogueLine>(line));
        }
        foreach (DialogueLine text in responses.Keys)
        {
            foreach (DialogueLine response in responses.Keys)
            {
                if (text.Responses.Contains(response.ID))
                {
                    dialogueNodes[text].AddNeighbour(dialogueNodes[response]);
                }
            }
        }
        Conversation = new ConversationGraph(dialogueNodes.Values.ToArray());
    }
Esempio n. 4
0
        private bool isSelectedPhanLoaiThuByHocSinh()
        {
            string selectedPhanLoaiThuId = string.Format("{0}", cmbPhanLoaiThu.EditValue);

            string[] phanLoaiThuByHocSinhs = StringUtil.Split(Settings.Default.PhanLoaiThuByHocSinh, ",");

            return(ArrayUtil.Contains(phanLoaiThuByHocSinhs, selectedPhanLoaiThuId));
        }
Esempio n. 5
0
 public void PopulateGroups()
 {
     foreach (AudioFile file in files)
     {
         foreach (AudioGroup group in groups)
         {
             if (ArrayUtil.Contains(file.Groups, group.Name))
             {
                 group.AddFile(file);
             }
         }
     }
 }
 public void Remove(params KeyCode[] keys)
 {
     for (int i = 0; i < keys.Length; i++)
     {
         if (ArrayUtil.Contains(m_modifiers, keys[i]))
         {
             int index = ArrayUtil.FindFirstIndex(m_modifiers, keys[i]);
             if (m_referenceCount[index] > 1)
             {
                 --m_referenceCount[index];
             }
             else
             {
                 m_modifiers      = ArrayUtil.RemoveAt(m_modifiers, index);
                 m_referenceCount = ArrayUtil.RemoveAt(m_referenceCount, index);
                 m_pressed        = ArrayUtil.RemoveAt(m_pressed, index);
             }
             continue;
         }
         Debug.Log("Tried removing non existant Modifier Key: " + keys.ToString());
     }
 }
        public void Add(params KeyCode[] keys)
        {
            if (m_modifiers == null)
            {
                m_modifiers      = new KeyCode[0];
                m_referenceCount = new int[0];
                m_pressed        = new bool[0];
            }

            for (int i = 0; i < keys.Length; i++)
            {
                if (!ArrayUtil.Contains(m_modifiers, keys[i]))
                {
                    m_modifiers      = ArrayUtil.AddToArray(m_modifiers, keys[i]);
                    m_referenceCount = ArrayUtil.AddToArray(m_referenceCount, 1);
                    m_pressed        = ArrayUtil.AddToArray(m_pressed, false);
                }
                else
                {
                    int index = ArrayUtil.FindFirstIndex(m_modifiers, keys[i]);
                    ++m_referenceCount[index];
                }
            }
        }
Esempio n. 8
0
 public virtual bool IsValidStimuli2Category2(string stimuli)
 {
     return(ArrayUtil.Contains(secondStimuliCategory2Options, stimuli));
 }
Esempio n. 9
0
 public virtual bool IsValidStimuli1Category1(string stimuli)
 {
     return(ArrayUtil.Contains(firstStimuliCategory1Options, stimuli));
 }
Esempio n. 10
0
 private bool CheckValid()
 {
     return(ArrayUtil.Contains(m_keysPressed, true) &&
            m_modifierRegister.Check(m_modifierChecklist));
 }
 public bool IsValidStimuli2Category2(Sprite stimuli)
 {
     return(ArrayUtil.Contains(sprites[1][1], stimuli, sameSprite));
 }
 public bool IsValidStimuli1Category1(Sprite stimuli)
 {
     return(ArrayUtil.Contains(sprites[0][0], stimuli, sameSprite));
 }
 public bool IsValidModifier(KeyCode key)
 {
     return(ArrayUtil.Contains(m_modifiers, key));
 }
 public bool CanTransition(ObjectState toState)
 {
     return(ArrayUtil.Contains(ValidTransitionStates, toState.ID));
 }
Esempio n. 15
0
 public bool RunsOnSwipe(Direction swipeDirection)
 {
     return(triggerOnSwipe && ArrayUtil.Contains(validSwipeDirections, swipeDirection));
 }