Fixed a small bug with hovering over song buttons.

The left/right arrow keys no longer reset hover data if the start node hasn't changed.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-01-13 23:00:09 -05:00
parent 71f614c90a
commit 62b7ecd648
2 changed files with 15 additions and 1 deletions

View File

@ -77,7 +77,7 @@
<argument>-Dmain="itdelatrisu.opsu.Opsu"</argument> <argument>-Dmain="itdelatrisu.opsu.Opsu"</argument>
<argument>-Doutput="opsu-${project.version}-runnable.jar"</argument> <argument>-Doutput="opsu-${project.version}-runnable.jar"</argument>
<argument>${basedir}/tools/JarSplicePlus.jar</argument> <argument>${basedir}/tools/JarSplicePlus.jar</argument>
</arguments> </arguments>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@ -506,7 +506,14 @@ public class SongMenu extends BasicGameState {
OsuGroupNode next = focusNode.next; OsuGroupNode next = focusNode.next;
if (next != null) { if (next != null) {
SoundController.playSound(SoundEffect.MENUCLICK); SoundController.playSound(SoundEffect.MENUCLICK);
OsuGroupNode oldStartNode = startNode;
float oldHoverOffset = hoverOffset;
int oldHoverIndex = hoverIndex;
setFocus(next, 0, false); setFocus(next, 0, false);
if (startNode == oldStartNode) {
hoverOffset = oldHoverOffset;
hoverIndex = oldHoverIndex;
}
} }
break; break;
case Input.KEY_LEFT: case Input.KEY_LEFT:
@ -515,7 +522,14 @@ public class SongMenu extends BasicGameState {
OsuGroupNode prev = focusNode.prev; OsuGroupNode prev = focusNode.prev;
if (prev != null) { if (prev != null) {
SoundController.playSound(SoundEffect.MENUCLICK); SoundController.playSound(SoundEffect.MENUCLICK);
OsuGroupNode oldStartNode = startNode;
float oldHoverOffset = hoverOffset;
int oldHoverIndex = hoverIndex;
setFocus(prev, (prev.index == focusNode.index) ? 0 : prev.osuFiles.size() - 1, false); setFocus(prev, (prev.index == focusNode.index) ? 0 : prev.osuFiles.size() - 1, false);
if (startNode == oldStartNode) {
hoverOffset = oldHoverOffset;
hoverIndex = oldHoverIndex;
}
} }
break; break;
case Input.KEY_NEXT: case Input.KEY_NEXT: