Fix so first player's avatar has focus when Forge first opened

This commit is contained in:
drdev
2014-01-30 01:58:49 +00:00
parent 3bbfe87868
commit 059e7f7920

View File

@@ -197,6 +197,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
}
playerPanelWithFocus = playerPanels.get(0);
playerPanelWithFocus.setFocused(true);
playersFrame.setOpaque(false);
playersFrame.add(playersScroll, "w 100%, h 100%-35px");
@@ -396,7 +397,7 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
fdc.getDecksComboBox().addListener(new IDecksComboBoxListener() {
@Override
public void deckTypeSelected(DecksComboBoxEvent ev) {
playerPanels.get(playerWithFocus).focusOnAvatar();
playerPanelWithFocus.focusOnAvatar();
}
});
}
@@ -832,24 +833,17 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
}
private void changePlayerFocus(int newFocusOwner, GameType gType) {
playerPanelWithFocus.setFocused(false);
playerWithFocus = newFocusOwner;
playerPanelWithFocus = playerPanels.get(playerWithFocus);
playerPanelWithFocus.setFocused(true);
changeAvatarFocus();
playersScroll.getViewport().scrollRectToVisible(playerPanelWithFocus.getBounds());
populateDeckPanel(gType);
refreshPanels(true, true);
}
/** Changes avatar appearance dependant on focus player. */
private void changeAvatarFocus() {
for (int i = 0; i < playerPanels.size(); i++) {
PlayerPanel pp = playerPanels.get(i);
pp.setFocused(i == playerWithFocus);
}
}
/** Saves avatar prefs for players one and two. */
private void updateAvatarPrefs() {
int pOneIndex = playerPanels.get(0).getAvatarIndex();