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