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 )); }
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()); }
private bool isSelectedPhanLoaiThuByHocSinh() { string selectedPhanLoaiThuId = string.Format("{0}", cmbPhanLoaiThu.EditValue); string[] phanLoaiThuByHocSinhs = StringUtil.Split(Settings.Default.PhanLoaiThuByHocSinh, ","); return(ArrayUtil.Contains(phanLoaiThuByHocSinhs, selectedPhanLoaiThuId)); }
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]; } } }
public virtual bool IsValidStimuli2Category2(string stimuli) { return(ArrayUtil.Contains(secondStimuliCategory2Options, stimuli)); }
public virtual bool IsValidStimuli1Category1(string stimuli) { return(ArrayUtil.Contains(firstStimuliCategory1Options, stimuli)); }
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)); }
public bool RunsOnSwipe(Direction swipeDirection) { return(triggerOnSwipe && ArrayUtil.Contains(validSwipeDirections, swipeDirection)); }