public void load(int type, int stage, boolean advanced) { this.type = type; this.stage = stage; this.advanced = advanced; this.minSteps = PuzzleInfo.minStep(type, stage, advanced); originalColorIndexes = new int[61]; targetColorIndexes = new int[61]; PuzzleInfo.readColorIndexes(type, stage, advanced, originalColorIndexes, targetColorIndexes); }
@Override public void advance() { if (end) return; super.advance(); switch (animDirection) { case ShowHint: if (hintAnimCount < HINT_ANIM_MAX) ++hintAnimCount; break; case HideHint: if (hintAnimCount > 0) --hintAnimCount; else { resetMask.setVisible(false); resetMask.setEnabled(false); animDirection = Stay; } break; } int[] currentColorIndexes = Ball.ballsToInts(balls); boolean finished = true; for (int i = 0; i < currentColorIndexes.length; ++i) { if (currentColorIndexes[i] != record.targetColorIndexes[i]) { finished = false; break; } } if (finished) { end = true; PuzzleInfo.testMinSteps( record.type, record.stage, record.advanced, currentMoveItem.getNumber()); PuzzleNextStageWidget widget = new PuzzleNextStageWidget(record.type, record.stage, record.advanced); mainWidget.changeControl(widget, true); } }