Changed overall style

Now one can change directly between Screens from TopBar
Fixed bugs
This commit is contained in:
=
2018-01-21 17:40:25 +01:00
parent 2c19e3dcb5
commit 5302ac0d00
19 changed files with 181 additions and 154 deletions

View File

@ -21,6 +21,7 @@ public class TopBar implements View.OnClickListener {
private GameActivity gameActivity;
private View layout;
private Screen.ScreenType parent;
private Screen.ScreenType customCallerForScreenSwitch = Screen.ScreenType.NONE;
private Animation starDecreaseAnimation;
private Animation energyDecreaseAnimation;
@ -59,11 +60,12 @@ public class TopBar implements View.OnClickListener {
toolshopButton.setOnClickListener(this);
shapeshopButton = (Button) layout.findViewById(R.id.topbar_shapeshop);
shapeshopButton.setOnClickListener(this);
if (parent == Screen.ScreenType.TOOL_SHOP || parent == Screen.ScreenType.SHAPE_SHOP || parent == Screen.ScreenType.SETTINGS) {
toolshopButton.setEnabled(false);
shapeshopButton.setEnabled(false);
if(parent == Screen.ScreenType.SETTINGS)
settingsButton.setEnabled(false);
}
if(parent == Screen.ScreenType.TOOL_SHOP)
toolshopButton.setEnabled(false);
if(parent == Screen.ScreenType.SHAPE_SHOP)
shapeshopButton.setEnabled(false);
if (parent == Screen.ScreenType.GAME) {
toolshopButton.setEnabled(false);
shapeshopButton.setEnabled(false);
@ -96,7 +98,7 @@ public class TopBar implements View.OnClickListener {
gameActivity.getTutorialManager().onTopBarUpdate(this);
}
public void startToolShopButtonPulse(){
public void startToolShopButtonPulse() {
toolshopButton.startAnimation(toolShopPulse);
}
@ -110,22 +112,32 @@ public class TopBar implements View.OnClickListener {
energyCountDecrease.startAnimation(energyDecreaseAnimation);
}
public void setCustomCallerForScreenSwitch(Screen.ScreenType customCallerForScreenSwitch) {
this.customCallerForScreenSwitch = customCallerForScreenSwitch;
}
@Override
public void onClick(View v) {
if (v.equals(toolshopButton)) {
gameActivity.flipToScreen(Screen.ScreenType.TOOL_SHOP);
flipToScreen(Screen.ScreenType.TOOL_SHOP);
} else if (v.equals(shapeshopButton)) {
gameActivity.flipToScreen(Screen.ScreenType.SHAPE_SHOP);
flipToScreen(Screen.ScreenType.SHAPE_SHOP);
} else if (v.equals(settingsButton)) {
gameActivity.flipToScreen(Screen.ScreenType.SETTINGS);
flipToScreen(Screen.ScreenType.SETTINGS);
}
}
private void flipToScreen(Screen.ScreenType screenType) {
if (customCallerForScreenSwitch != Screen.ScreenType.NONE)
gameActivity.flipToScreen(screenType, customCallerForScreenSwitch);
gameActivity.flipToScreen(screenType);
}
public Screen.ScreenType getParent() {
return parent;
}
public boolean isToolShopButtonEnabled(){
public boolean isToolShopButtonEnabled() {
return toolshopButton.isEnabled();
}
}

View File

@ -150,4 +150,8 @@ public class ViewManager implements View.OnClickListener {
return ((int) (value * 20)) / 10f;
}
public boolean isShortMenuVisible(){
return shortMenu.isVisible();
}
}