Index: src/activities/gnumch-equality/Gnumch.qml =================================================================== --- src/activities/gnumch-equality/Gnumch.qml +++ src/activities/gnumch-equality/Gnumch.qml @@ -59,24 +59,26 @@ } function nextLevel() { - Activity.nextLevel() - if (Activity._currentLevel == 7) { - operator = " - " - Activity._operator = operator - } + Activity.nextLevel(); + initLevel(); + } - if (Activity._currentLevel == 0) { - operator = " + " - } - topPanel.goal = Activity.getGoal() - monsters.destroyAll() - Activity.fillAllGrid() - topPanel.life.opacity = 1 - spawningMonsters.stop() - timerActivateWarn.stop() - if (Activity._currentLevel != 7) { - spawningMonsters.start() - timerActivateWarn.start() + function previousLevel() { + Activity.previousLevel(); + initLevel(); + } + + function initLevel() { + topPanel.life.opacity = 1; + forceActiveFocus(); + Activity.initLevel(); + operator = Activity._operator; + topPanel.goal = Activity.getGoal(); + monsters.destroyAll(); + spawningMonsters.stop(); + timerActivateWarn.stop(); + if (Activity._currentLevel % 6 !== 0) { + spawningMonsters.restart(); } } @@ -91,19 +93,8 @@ } onStart: { - Activity.start(modelCells, topPanel.bar, bonus, type, operator) - topPanel.life.opacity = 1 - forceActiveFocus() - operator = " + " - Activity._operator = operator - Activity.fillAllGrid() - topPanel.goal = Activity.getGoal() - if (Activity._currentLevel % 6 == 1) { - spawningMonsters.restart() - } else { - spawningMonsters.stop() - timerActivateWarn.stop() - } + Activity.start(modelCells, topPanel.bar, bonus, type, operator); + initLevel(); } onStop: { monsters.destroyAll() Index: src/activities/gnumch-equality/TopPanel.qml =================================================================== --- src/activities/gnumch-equality/TopPanel.qml +++ src/activities/gnumch-equality/TopPanel.qml @@ -99,11 +99,11 @@ id: bar content: BarEnumContent { - value: help | home + value: help | home | level } onHelpClicked: displayDialog(dialogHelp) - onPreviousLevelClicked: Activity.previousLevel() - onNextLevelClicked: Activity.nextLevel() + onPreviousLevelClicked: background.previousLevel() + onNextLevelClicked: background.nextLevel() onHomeClicked: activity.home() } } Index: src/activities/gnumch-equality/gnumch-equality.js =================================================================== --- src/activities/gnumch-equality/gnumch-equality.js +++ src/activities/gnumch-equality/gnumch-equality.js @@ -46,6 +46,12 @@ function stop() { } +function initLevel() { + _operator = _currentLevel < 7 ? " + " : " - "; + fillAllGrid(); + _bar.level = _currentLevel + 1; +} + function nextLevel() { if(_numberOfLevel <= ++_currentLevel ) { _currentLevel = 0