Skip to content
Snippets Groups Projects
Commit 838ffbd5 authored by Drahomír Karchňák's avatar Drahomír Karchňák
Browse files

#58 Fixed a bug, which caused the intro music to stop playing everytime you scrolled.

parent 10613e5c
No related merge requests found
......@@ -9,6 +9,8 @@ import cz.nic.tablexia.screen.gamemenu.GameMenuAssets;
import cz.nic.tablexia.screen.gamemenu.GameMenuScreen;
/**
* This class represents the page between the office and game menu pages
* It works as a separator and PagedScrollPane can't snap to this page
* Created by Drahomir Karchnak on 02/12/15.
*/
public class WallPage extends MenuPage{
......@@ -21,8 +23,10 @@ public class WallPage extends MenuPage{
public WallPage(AbstractTablexiaScreen<int[][]> screen) {
super(screen);
//offset of the pagedScrollPane
pagedScrollPaneOffsetY = ((GameMenuScreen) screen).getPagedScrollPane().getY();
//Sets size and position of WallPage
setSize(mid.getRegionWidth(), getScreen().getSceneOuterHeight());
setPosition(getScreen().getSceneWidth(), getScreen().getSceneOuterBottomY() - getScreen().getSceneOuterBottomY());
}
......@@ -31,6 +35,7 @@ public class WallPage extends MenuPage{
public void draw(Batch batch, float parentAlpha) {
batch.setColor(batch.getColor().r, batch.getColor().g, batch.getColor().b, parentAlpha);
//Disables Blending, no need when drawing the background
batch.disableBlending();
//Just adjusting sourceX coordinate to get animated background/sky
......@@ -48,6 +53,7 @@ public class WallPage extends MenuPage{
false);
//Enables Blending for foreground layer
batch.enableBlending();
batch.draw( mid,
......@@ -62,6 +68,7 @@ public class WallPage extends MenuPage{
@Override
public boolean isSnapToAllowed() {
//PagedScrollPane can't snap to this page
return false;
}
......
......@@ -181,8 +181,11 @@ public class PagedScrollPane extends ScrollPane {
setSmoothScrolling(smooth);
setScrollX(page.getX());
MenuPage leavePage = (MenuPage) contentTable.getChildren().get(indexCurrentPage);
leavePage.onScrollPageExit();
//Is changing page ?
if(indexCurrentPage != i) {
MenuPage leavePage = (MenuPage) contentTable.getChildren().get(indexCurrentPage);
leavePage.onScrollPageExit();
}
//in case smooth scrolling is set to false, we need to update visual scroll
if (!smooth) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment