private bool searchForIdentityCard(int i_Key, string i_CardIndex, ref string o_IdentitiyCardIndex) { bool res = false; if (m_Memory.ContainsKey(i_Key)) { MemoryCell cellToCheck = m_Memory[i_Key]; if (cellToCheck.FirstCardIndex == i_CardIndex && cellToCheck.SecondCardIndex != null) { o_IdentitiyCardIndex = cellToCheck.SecondCardIndex; res = true; } else if (cellToCheck.SecondCardIndex == i_CardIndex && cellToCheck.FirstCardIndex != null) { o_IdentitiyCardIndex = cellToCheck.FirstCardIndex; res = true; } else { o_IdentitiyCardIndex = null; } } return(res); }
public void AddIndexToMemory(int i_Key, string i_IndexOfCardInBoard) { if (!m_Memory.ContainsKey(i_Key)) { if (m_Memory.Count == r_MaxKeyToRemember) { m_Memory.Remove(m_Memory.Keys.First()); } MemoryCell newCell = new MemoryCell(i_Key); newCell.FirstCardIndex = i_IndexOfCardInBoard; m_Memory.Add(i_Key, newCell); } else if (m_Memory[i_Key].FirstCardIndex != i_IndexOfCardInBoard) { MemoryCell updateCell = m_Memory[i_Key]; updateCell.SecondCardIndex = i_IndexOfCardInBoard; m_Memory[i_Key] = updateCell; } }