allow changing state while the current transition didn't finish completely yet

This commit is contained in:
yugecin 2018-06-25 22:58:34 +02:00
parent 6dd343da83
commit d944ff8620
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44

View File

@ -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) {