public void RegenerateNewLocks(PuzzleDifficulty difficulty) { NumbersOrder = NumbersOrder.OrderBy(x => RandomValuesGenerator.GetRandomInt()).ToList(); Locks.Clear(); for (int i = 0; i < 10; i++) { switch (difficulty) { case PuzzleDifficulty.Easy: Locks.Add( new EasyPuzzleLockPreset( number: NumbersOrder[i], color: (PuzzleColors)Enum.GetValues(typeof(PuzzleColors)).GetValue(RandomValuesGenerator.GetInt(0, 4)), lowerRange: 0, upperRange: 9) { NumberCypherType = PuzzleNumberCypherType.ReverseInRange, ColorCypherType = PuzzleColorCypherType.TextShuffle }); break; case PuzzleDifficulty.Normal: Locks.Add( new NormalPuzzleLockPreset( lockNumber: NumbersOrder[i], color: (PuzzleColors)Enum.GetValues(typeof(PuzzleColors)).GetValue(RandomValuesGenerator.GetInt(0, 4)), caesarShift: RandomValuesGenerator.GetInt(1, 100)) { NumberCypherType = PuzzleNumberCypherType.Caesar, ColorCypherType = PuzzleColorCypherType.RGB }); break; case PuzzleDifficulty.Hard: Locks.Add( new HardPuzzleLockPreset( lockNumber: NumbersOrder[i], color: (PuzzleColors)Enum.GetValues(typeof(PuzzleColors)).GetValue(RandomValuesGenerator.GetInt(0, 4))) { NumberCypherType = PuzzleNumberCypherType.Binary, ColorCypherType = PuzzleColorCypherType.Hex }); break; } } PreviousLockNumber = null; CurrentLockNumber = null; NextLockNumber = null; CurrentOrderIndex = 0; CurrentLockNumber = NumbersOrder[CurrentOrderIndex]; NextLockNumber = NumbersOrder[CurrentOrderIndex + 1]; }
/// <inheritdoc /> public virtual TQuery ClearLocks() { Locks.Clear(); return(Query); }