Add boolean 'isCustom' variable to GameInfoContainer and GameController
This commit is contained in:
parent
b12d085f27
commit
1c6be6e5c4
2 changed files with 11 additions and 0 deletions
|
@ -64,6 +64,7 @@ public class GameController implements IModelChangedListener, Parcelable {
|
||||||
private GameType gameType;
|
private GameType gameType;
|
||||||
private GameDifficulty difficulty;
|
private GameDifficulty difficulty;
|
||||||
private CellConflictList errorList = new CellConflictList();
|
private CellConflictList errorList = new CellConflictList();
|
||||||
|
private boolean gameIsCustom;
|
||||||
|
|
||||||
// Undo Redo
|
// Undo Redo
|
||||||
private UndoRedoManager undoRedoManager;
|
private UndoRedoManager undoRedoManager;
|
||||||
|
@ -91,6 +92,7 @@ public class GameController implements IModelChangedListener, Parcelable {
|
||||||
public GameController(GameType type, SharedPreferences pref, Context context) {
|
public GameController(GameType type, SharedPreferences pref, Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.gameBoard = new GameBoard(type);
|
this.gameBoard = new GameBoard(type);
|
||||||
|
this.gameIsCustom = false;
|
||||||
|
|
||||||
setGameType(type);
|
setGameType(type);
|
||||||
setSettings(pref);
|
setSettings(pref);
|
||||||
|
@ -102,6 +104,8 @@ public class GameController implements IModelChangedListener, Parcelable {
|
||||||
return gameID;
|
return gameID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean gameIsCustom() { return gameIsCustom; }
|
||||||
|
|
||||||
public void loadNewLevel(GameType type, GameDifficulty difficulty) {
|
public void loadNewLevel(GameType type, GameDifficulty difficulty) {
|
||||||
NewLevelManager newLevelManager = NewLevelManager.getInstance(context, settings);
|
NewLevelManager newLevelManager = NewLevelManager.getInstance(context, settings);
|
||||||
|
|
||||||
|
@ -141,6 +145,7 @@ public class GameController implements IModelChangedListener, Parcelable {
|
||||||
this.difficulty = gic.getDifficulty();
|
this.difficulty = gic.getDifficulty();
|
||||||
this.time = gic.getTimePlayed();
|
this.time = gic.getTimePlayed();
|
||||||
this.usedHints = gic.getHintsUsed();
|
this.usedHints = gic.getHintsUsed();
|
||||||
|
this.gameIsCustom = gic.isCustom();
|
||||||
|
|
||||||
setGameType(gic.getGameType());
|
setGameType(gic.getGameType());
|
||||||
this.gameBoard = new GameBoard(gic.getGameType());
|
this.gameBoard = new GameBoard(gic.getGameType());
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class GameInfoContainer {
|
||||||
int[] setValues;
|
int[] setValues;
|
||||||
boolean[][] setNotes;
|
boolean[][] setNotes;
|
||||||
int hintsUsed;
|
int hintsUsed;
|
||||||
|
boolean isCustom;
|
||||||
|
|
||||||
public GameInfoContainer() {}
|
public GameInfoContainer() {}
|
||||||
public GameInfoContainer(int ID, GameDifficulty difficulty, GameType gameType, int[] fixedValues, int[] setValues, boolean[][] setNotes) {
|
public GameInfoContainer(int ID, GameDifficulty difficulty, GameType gameType, int[] fixedValues, int[] setValues, boolean[][] setNotes) {
|
||||||
|
@ -40,12 +41,17 @@ public class GameInfoContainer {
|
||||||
this.setValues = setValues;
|
this.setValues = setValues;
|
||||||
this.setNotes = setNotes;
|
this.setNotes = setNotes;
|
||||||
this.hintsUsed = hintsUsed;
|
this.hintsUsed = hintsUsed;
|
||||||
|
isCustom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setID(int ID) {
|
public void setID(int ID) {
|
||||||
this.ID = ID;
|
this.ID = ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCustom (boolean isCustom) { this.isCustom = isCustom; }
|
||||||
|
|
||||||
|
public boolean isCustom () { return isCustom; }
|
||||||
|
|
||||||
public void parseGameType(String s) {
|
public void parseGameType(String s) {
|
||||||
gameType = Enum.valueOf(GameType.class, s);
|
gameType = Enum.valueOf(GameType.class, s);
|
||||||
if(gameType == null) {
|
if(gameType == null) {
|
||||||
|
|
Loading…
Reference in a new issue