allow changing state while the current transition didn't finish completely yet
This commit is contained in:
parent
6dd343da83
commit
d944ff8620
|
@ -476,17 +476,28 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void switchState(OpsuState newstate, int outtime, int intime) {
|
public void switchState(OpsuState newstate, int outtime, int intime) {
|
||||||
if (tProgress != -1) {
|
if (tProgress != -1 && tProgress <= tOut) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outtime == 0) {
|
if (outtime == 0) {
|
||||||
switchStateInstantly(newstate);
|
switchStateInstantly(newstate);
|
||||||
newstate = null;
|
newstate = null;
|
||||||
|
} else {
|
||||||
|
input.removeListener(this.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tProgress == -1) {
|
||||||
|
tProgress = 0;
|
||||||
|
} else {
|
||||||
|
// we were in a transition (out state), so start from the time
|
||||||
|
// that was already spent transitioning in
|
||||||
|
tProgress = (int) (((1f - (tProgress - tOut) / (float) tIn)) * outtime);
|
||||||
|
}
|
||||||
|
|
||||||
tNextState = newstate;
|
tNextState = newstate;
|
||||||
tIn = intime;
|
tIn = intime;
|
||||||
tOut = outtime;
|
tOut = outtime;
|
||||||
tProgress = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void switchStateInstantly(OpsuState state) {
|
public void switchStateInstantly(OpsuState state) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user