public void SetInputStringComputed() { m_IsInputStringComputed = true; m_IsInputStringProcessing = false; m_ComputedGameInputList = new List <GameInputList>(); // Parse all the computed input list foreach (string inputs in m_ComputedInputStringList) { GameInputList gameInputList = new GameInputList(); string inputToCheck = string.Empty; // Parse all single character foreach (char c in inputs) { inputToCheck += c; // For each inputToCheck, try to find the matching EInputKey foreach (EInputKey inputKey in Enum.GetValues(typeof(EInputKey))) { string inputKeyToString = GameInput.ConvertInputKeyToString(inputKey); if (inputToCheck.Equals(inputKeyToString)) { gameInputList.Add(new GameInput(inputKey)); inputToCheck = string.Empty; break; } } } m_ComputedGameInputList.Add(gameInputList); } if (m_NeededStanceList.Count == 0) { KakutoDebug.LogError("Needed stance list is empty for attack " + m_Name); } else { for (int i = 0; i < m_NeededStanceList.Count; i++) { for (int j = i + 1; j < m_NeededStanceList.Count; j++) { if (m_NeededStanceList[i] == m_NeededStanceList[j]) { KakutoDebug.LogError("Needed stance list contains the stance " + m_NeededStanceList[i] + " twice for attack " + m_Name); } } } } }
public static bool FindSubList <T>(this IList <T> list, GameInputList sublist) { for (int listIndex = 0; listIndex <= list.Count - sublist.Count; listIndex++) { int count = 0; while (count < sublist.Count && sublist[count].Equals(list[listIndex + count])) { count++; } if (count == sublist.Count) { return(true); } } return(false); }