mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed tribe selection gui not scrolling to the correct position when opening
This commit is contained in:
parent
cdcbfea8dc
commit
db53f4906e
1 changed files with 5 additions and 7 deletions
|
@ -71,10 +71,7 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
|
|||
addOption(race, top);
|
||||
}
|
||||
|
||||
if (SELECTION == -1) {
|
||||
SELECTION = options.size() / 2;
|
||||
}
|
||||
scroll(SELECTION, false);
|
||||
scroll(SELECTION == -1 ? options.size() / 2 : SELECTION, false);
|
||||
}
|
||||
|
||||
private void addOption(Race race, int y) {
|
||||
|
@ -167,11 +164,12 @@ public class TribeSelectionScreen extends GameGui implements HidesHud {
|
|||
}
|
||||
|
||||
private void scroll(int target, boolean animate) {
|
||||
if (target == SELECTION) {
|
||||
SELECTION = target;
|
||||
target *= 4;
|
||||
if (targetScroll == target) {
|
||||
return;
|
||||
}
|
||||
SELECTION = target;
|
||||
targetScroll = SELECTION * 4;
|
||||
targetScroll = target;
|
||||
if (!animate) {
|
||||
scrollPosition = targetScroll;
|
||||
prevScrollPosition = scrollPosition;
|
||||
|
|
Loading…
Reference in a new issue