Skip to content

Commit

Permalink
Add a parameter that indicates whether the page is a left or right side
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Apr 25, 2016
1 parent ffd38cf commit 5e537bd
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 20 deletions.
Expand Up @@ -12,6 +12,6 @@
public class ContentBlank extends PageContent {

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
}
}
Expand Up @@ -33,7 +33,7 @@ public class ContentBlockInteraction extends PageContent {
public TextData[] description;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMITHING.width / 2 - 10;
int y = TITLE_HEIGHT;

Expand Down
Expand Up @@ -36,7 +36,7 @@ public class ContentCrafting extends PageContent {
public TextData[] description;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int x = 0;
int y = 16;
int height = 100;
Expand Down
Expand Up @@ -12,7 +12,7 @@
public class ContentDummy extends PageContent {

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
//TODO load from JSON
}
}
Expand Up @@ -27,7 +27,7 @@ public ContentError(String errorStage, Exception e) {
}

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
addTitle(list, "Error");

TextData[] text = new TextData[1 + (exception != null ? 2 : 0)];
Expand Down
Expand Up @@ -18,7 +18,7 @@ public class ContentImage extends PageContent {
public ImageData image;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;

if(title == null || title.isEmpty()) {
Expand Down
Expand Up @@ -21,7 +21,7 @@ public class ContentImageText extends PageContent {
public TextData[] text;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;

if(title == null || title.isEmpty()) {
Expand Down
Expand Up @@ -16,7 +16,7 @@ public boolean addSection(SectionData data) {
}

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int width = (ElementSection.WIDTH + 5) * 3 - 5;
int height = (ElementSection.HEIGHT + 5) * 3 - 5;

Expand Down
Expand Up @@ -38,7 +38,7 @@ public class ContentSmelting extends PageContent {
public TextData[] description;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMELTING.width / 2;
int y = TITLE_HEIGHT;

Expand Down
Expand Up @@ -35,7 +35,7 @@ public class ContentSmithing extends PageContent {
public TextData[] description;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMITHING.width / 2;
int y = TITLE_HEIGHT;

Expand Down
Expand Up @@ -42,7 +42,7 @@ public void load() {
}

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;
if(title == null || title.isEmpty()) {
y = 0;
Expand Down
Expand Up @@ -21,7 +21,7 @@ public ContentTableOfContents(String title, TextData... contents) {
}

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = 0;

if(title != null && !title.trim().isEmpty()) {
Expand Down
Expand Up @@ -18,7 +18,7 @@ public class ContentText extends PageContent {
public TextData[] text;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;

if(title == null || title.isEmpty()) {
Expand Down
Expand Up @@ -21,7 +21,7 @@ public class ContentTextImage extends PageContent {
public ImageData image;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;

if(title == null || title.isEmpty()) {
Expand Down
Expand Up @@ -22,7 +22,7 @@ public class ContentTextLeftImage extends PageContent {
public TextData[] text2;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;

if(title == null || title.isEmpty()) {
Expand Down
Expand Up @@ -22,7 +22,7 @@ public class ContentTextRightImage extends PageContent {
public ImageData image;

@Override
public void build(BookData book, ArrayList<BookElement> list) {
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
int y = TITLE_HEIGHT;

if(title == null || title.isEmpty()) {
Expand Down
Expand Up @@ -24,7 +24,7 @@ public abstract class PageContent {
public void load() {
}

public abstract void build(BookData book, ArrayList<BookElement> list);
public abstract void build(BookData book, ArrayList<BookElement> list, boolean rightSide);

public void addTitle(ArrayList<BookElement> list, String title) {
TextData tdTitle = new TextData(title);
Expand Down
Expand Up @@ -341,17 +341,17 @@ private void buildPages() {
PageData page = book.findPage(0, statFile);

if(page != null) {
page.content.build(book, rightElements);
page.content.build(book, rightElements, false);
}
} else {
PageData leftPage = book.findPage((page - 1) * 2 + 1, statFile);
PageData rightPage = book.findPage((page - 1) * 2 + 2, statFile);

if(leftPage != null) {
leftPage.content.build(book, leftElements);
leftPage.content.build(book, leftElements, false);
}
if(rightPage != null) {
rightPage.content.build(book, rightElements);
rightPage.content.build(book, rightElements, true);
}
}

Expand Down

0 comments on commit 5e537bd

Please sign in to comment.