Commit 74652126 authored by Timothée Giet's avatar Timothée Giet

core, always halt the bonus when changing level manually

parent 13990793
......@@ -423,7 +423,11 @@ Item {
BarButton {
source: "qrc:/gcompris/src/core/resource/bar_previous.svg";
sourceSize.width: halfButtonScaled
onClicked: bar.previousLevelClicked()
onClicked: {
if(bonus)
bonus.haltBonus();
bar.previousLevelClicked();
}
}
}
Component {
......@@ -449,7 +453,11 @@ Item {
BarButton {
source: "qrc:/gcompris/src/core/resource/bar_next.svg";
sourceSize.width: halfButtonScaled
onClicked: bar.nextLevelClicked()
onClicked: {
if(bonus)
bonus.haltBonus();
bar.nextLevelClicked();
}
}
}
Component {
......
......@@ -119,6 +119,23 @@ Image {
z: 1000
sourceSize.width: parent.width * 0.5
/**
* type:bool
* used in animation onStopped to check if we need to trigger win-loose signals
*/
property bool bonusStopped: false
/**
* Use this when stopping manually the bonus, like when changing level manually
*/
function haltBonus() {
bonusStopped = true;
timer.stop();
animation.stop();
bonus.opacity = 0;
bonusStopped = false;
}
/**
* Triggers win feedback.
*
......@@ -131,7 +148,7 @@ Image {
function good(name) {
source = url + "bonus/" + name + "_good.svg"
isWin = true
timer.start()
timer.restart()
}
/**
......@@ -146,7 +163,7 @@ Image {
function bad(name, audioIndex) {
source = url + "bonus/" + name + "_bad.svg"
isWin = false;
timer.start()
timer.restart()
if(audioIndex) {
nextAudioIndex = audioIndex
}
......@@ -204,8 +221,9 @@ Image {
easing.type: Easing.InOutQuad
}
onStopped: {
bonus.stop()
isWin ? win() : loose()
bonus.stop();
if(!bonusStopped)
isWin ? win() : loose();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment