Bugfix. Runnable again.
This commit is contained in:
parent
86581ffd8e
commit
327f9a6c66
6 changed files with 15 additions and 7 deletions
|
@ -34,6 +34,7 @@ public class GameController implements IModelChangedListener {
|
|||
private int selectedCol;
|
||||
private SharedPreferences settings;
|
||||
private int gameID = 0;
|
||||
private GameDifficulty difficulty;
|
||||
private CellConflictList errorList = new CellConflictList();
|
||||
private int selectedValue;
|
||||
private LinkedList<IGameSolvedListener> solvedListeners = new LinkedList<>();
|
||||
|
@ -51,9 +52,8 @@ public class GameController implements IModelChangedListener {
|
|||
|
||||
public GameController(GameType type, SharedPreferences pref) {
|
||||
setGameType(type);
|
||||
gameBoard = new GameBoard(type);
|
||||
gameBoard.registerOnModelChangeListener(this);
|
||||
setSettings(pref);
|
||||
gameBoard = new GameBoard(type);
|
||||
}
|
||||
|
||||
public int getGameID() {
|
||||
|
@ -112,6 +112,7 @@ public class GameController implements IModelChangedListener {
|
|||
int[] setValues = gic.getSetValues();
|
||||
boolean[][] setNotes = gic.getSetNotes();
|
||||
this.gameID = gic.getID();
|
||||
this.difficulty = gic.getDifficulty();
|
||||
|
||||
setGameType(gic.getGameType());
|
||||
this.gameBoard = new GameBoard(gic.getGameType());
|
||||
|
@ -142,6 +143,8 @@ public class GameController implements IModelChangedListener {
|
|||
}
|
||||
}
|
||||
|
||||
gameBoard.registerOnModelChangeListener(this);
|
||||
|
||||
// call the solve function to get the solution of this board
|
||||
solve();
|
||||
}
|
||||
|
@ -303,6 +306,10 @@ public class GameController implements IModelChangedListener {
|
|||
return c.getNotes().clone();
|
||||
}
|
||||
|
||||
public GameDifficulty getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public void deleteNote(int row, int col, int value) {
|
||||
GameCell c = gameBoard.getCell(row,col);
|
||||
c.deleteNote(value);
|
||||
|
|
|
@ -117,6 +117,10 @@ public class GameInfoContainer {
|
|||
return setNotes;
|
||||
}
|
||||
|
||||
public GameDifficulty getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return ID;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,6 @@ public class GameBoard implements Cloneable {
|
|||
public void registerOnModelChangeListener(final IModelChangedListener listener) {
|
||||
if(!modelChangedListeners.contains(listener)) {
|
||||
actionOnCells(new ICellAction<Boolean>() {
|
||||
|
||||
@Override
|
||||
public Boolean action(GameCell gc, Boolean existing) {
|
||||
gc.registerOnModelChangeListener(listener);
|
||||
|
|
|
@ -27,7 +27,7 @@ public enum GameType {
|
|||
this.size = size;
|
||||
this.sectionHeight = sectionHeight;
|
||||
this.sectionWidth = sectionWidth;
|
||||
this.resIDString = this.resIDString;
|
||||
this.resIDString = resIDString;
|
||||
}
|
||||
|
||||
public static List<GameType> getValidGameTypes() {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
}
|
||||
});
|
||||
int lastChosenDifficulty = settings.getInt("lastChosenDifficulty", 1);
|
||||
difficultyBar.setProgress(lastChosenDifficulty);
|
||||
difficultyBar.setRating(lastChosenDifficulty);
|
||||
|
||||
// on first create always check for loadable levels!
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
|
|
|
@ -52,8 +52,6 @@
|
|||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="8"
|
||||
android:divider="#000"
|
||||
|
|
Loading…
Reference in a new issue