public DTSudokuFrame(DTSudokuDifficultyValue initialDifficulty) { this.random = new SudokuRandom(); this.sudokuBoardFrameSection = null; this.sudokuDifficultySelectionFrameSection = new DTSudokuDifficultySelectionFrameSection(initialDifficulty); this.sudokuNewGameButtonFrameSection = new DTSudokuNewGameButtonFrameSection(); this.sudokuLoadingBoardFrameSection = new DTSudokuLoadingBoardFrameSection(initialDifficulty, this.random); }
public IFrame <IDTSudokuAssets> GetNextFrame(IKeyboard keyboardInput, IMouse mouseInput, IKeyboard previousKeyboardInput, IMouse previousMouseInput) { if (this.sudokuLoadingBoardFrameSection == null) { IMouse translatedMouseInput = new TranslatedMouse(mouseInput, -25, -25); IMouse translatedPreviousMouseInput = new TranslatedMouse(previousMouseInput, -25, -25); this.sudokuBoardFrameSection.ProcessInputs(keyboardInput, translatedMouseInput, previousKeyboardInput, translatedPreviousMouseInput); IMouse translatedMouseInput2 = new TranslatedMouse(mouseInput, -25, -555); IMouse translatedPreviousMouseInput2 = new TranslatedMouse(previousMouseInput, -25, -555); this.sudokuDifficultySelectionFrameSection.ProcessInputs(keyboardInput, translatedMouseInput2, previousKeyboardInput, translatedPreviousMouseInput2); IMouse translatedMouseInput3 = new TranslatedMouse(mouseInput, -125, -620); IMouse translatedPreviousMouseInput3 = new TranslatedMouse(previousMouseInput, -125, -620); this.sudokuNewGameButtonFrameSection.ProcessInputs(keyboardInput, translatedMouseInput3, previousKeyboardInput, translatedPreviousMouseInput3); if (this.sudokuNewGameButtonFrameSection.HasStartedNewGame()) { DTSudokuDifficultyValue difficulty = this.sudokuDifficultySelectionFrameSection.GetSelectedDifficulty(); this.sudokuLoadingBoardFrameSection = new DTSudokuLoadingBoardFrameSection(difficulty, this.random); } } else { if (this.sudokuLoadingBoardFrameSection.IsDoneGeneratingSudokuPuzzle()) { int[,] newBoard = this.sudokuLoadingBoardFrameSection.GetGeneratedSudokuPuzzle(); this.sudokuBoardFrameSection = new DTSudokuBoardFrameSection(newBoard); this.sudokuLoadingBoardFrameSection = null; } else { this.sudokuLoadingBoardFrameSection.KeepGeneratingSudokuPuzzle(); } } return(this); }