use of com.watabou.pixeldungeon.ui.Archs in project pixel-dungeon-remix by NYRDS.
the class AllowStatisticsCollectionScene method create.
@Override
public void create() {
super.create();
Text title = createMultiline(TTL_Welcome, GuiProperties.bigTitleFontSize());
int w = Camera.main.width;
int h = Camera.main.height;
int pw = w - 10;
title.maxWidth(pw);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align(8);
add(title);
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.x = (w - pw) / 2;
panel.y = title.y + title.height() + GAP * 2;
int ph = (int) (h - panel.y - 22);
panel.size(pw, ph);
add(panel);
ScrollPane list = new ScrollPane(new Component());
add(list);
list.setRect(panel.x + panel.marginLeft(), panel.y + panel.marginTop(), panel.innerWidth(), panel.innerHeight());
list.scrollTo(0, 0);
Component content = list.content();
content.clear();
float yPos = 0;
Text text = createMultiline(Game.getVar(R.string.AllowStatisticsCollectionScene_Request), GuiProperties.regularFontSize());
text.maxWidth((int) panel.innerWidth());
text.measure();
content.add(text);
yPos += text.height() + GAP;
content.setSize(panel.innerWidth(), yPos);
RedButton allow = new RedButton(Game.getVar(R.string.AllowStatisticsCollectionScene_Allow)) {
@Override
protected void onClick() {
Preferences.INSTANCE.put(Preferences.KEY_COLLECT_STATS, 100);
Game.instance().initEventCollector();
Game.switchScene(TitleScene.class);
}
};
RedButton deny = new RedButton(Game.getVar(R.string.AllowStatisticsCollectionScene_Deny)) {
@Override
protected void onClick() {
Preferences.INSTANCE.put(Preferences.KEY_COLLECT_STATS, -100);
Game.instance().initEventCollector();
Game.switchScene(TitleScene.class);
}
};
allow.setRect((w - pw) / 2, h - 22, pw / 2 - GAP, 18);
deny.setRect((w - pw) / 2 + pw / 2, h - 22, pw / 2 - GAP, 18);
add(allow);
add(deny);
Archs archs = new Archs();
archs.setSize(Camera.main.width, Camera.main.height);
addToBack(archs);
fadeIn();
}
use of com.watabou.pixeldungeon.ui.Archs in project pixel-dungeon-remix by NYRDS.
the class BadgesScene method create.
@Override
public void create() {
super.create();
Music.INSTANCE.play(Assets.THEME, true);
Music.INSTANCE.volume(1f);
uiCamera.setVisible(false);
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize(w, h);
add(archs);
int pw = Math.min(160, w - 6);
int ph = h - 30;
NinePatch panel = Chrome.get(Chrome.Type.WINDOW);
panel.size(pw, ph);
panel.x = (w - pw) / 2;
panel.y = (h - ph) / 2;
add(panel);
Text title = PixelScene.createText(TXT_TITLE, GuiProperties.titleFontSize());
title.hardlight(Window.TITLE_COLOR);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align((panel.y - title.baseLine()) / 2);
add(title);
Badges.loadGlobal();
ScrollPane list = new BadgesList(true);
add(list);
list.setRect(panel.x + panel.marginLeft(), panel.y + panel.marginTop(), panel.innerWidth(), panel.innerHeight());
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
fadeIn();
}
use of com.watabou.pixeldungeon.ui.Archs in project pixel-dungeon-remix by NYRDS.
the class RankingsScene method create.
@Override
public void create() {
super.create();
Music.INSTANCE.play(Assets.THEME, true);
Music.INSTANCE.volume(1f);
uiCamera.setVisible(false);
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize(w, h);
add(archs);
Rankings.INSTANCE.load();
if (Rankings.INSTANCE.records.size() > 0) {
float rowHeight = PixelDungeon.landscape() ? ROW_HEIGHT_L : ROW_HEIGHT_P;
float top = align(rowHeight / 2);
Text title = PixelScene.createText(TXT_TITLE, GuiProperties.titleFontSize());
title.hardlight(Window.TITLE_COLOR);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align(top - title.height() - GAP);
add(title);
float btnHeight = rowHeight / 2;
RedButton btnNext = new RedButton(">") {
@Override
protected void onClick() {
super.onClick();
startFrom += recodrsPerPage;
if (startFrom > Rankings.TABLE_SIZE - recodrsPerPage) {
startFrom = Rankings.TABLE_SIZE - recodrsPerPage;
}
if (startFrom > Rankings.INSTANCE.records.size()) {
startFrom -= recodrsPerPage;
}
switch(PixelDungeon.donated()) {
case 0:
if (startFrom > 10) {
startFrom = 10;
}
break;
case 1:
if (startFrom > 25) {
startFrom = 25;
}
break;
case 2:
if (startFrom > 50) {
startFrom = 50;
}
break;
}
createRecords();
}
};
btnNext.setRect(w / 2 + GAP, h - btnHeight, w / 2 - GAP, btnHeight);
add(btnNext);
RedButton btnPrev = new RedButton("<") {
@Override
protected void onClick() {
super.onClick();
startFrom -= recodrsPerPage;
if (startFrom < 0) {
startFrom = 0;
}
createRecords();
}
};
btnPrev.setRect(0, h - btnHeight, w / 2 - GAP, btnHeight);
add(btnPrev);
createRecords();
Text label = PixelScene.createText(TXT_TOTAL, GuiProperties.titleFontSize());
label.hardlight(DEFAULT_COLOR);
label.measure();
add(label);
Text happy = PixelScene.createText(Integer.toString(Rankings.INSTANCE.happyWonNumber), GuiProperties.titleFontSize());
happy.hardlight(HAPPY_COLOR);
happy.measure();
add(happy);
Text won = PixelScene.createText("/" + Integer.toString(Rankings.INSTANCE.wonNumber), GuiProperties.titleFontSize());
won.hardlight(Window.TITLE_COLOR);
won.measure();
add(won);
Text total = PixelScene.createText("/" + Rankings.INSTANCE.totalNumber, GuiProperties.titleFontSize());
total.hardlight(DEFAULT_COLOR);
total.measure();
total.x = align((w - total.width()) / 2);
total.y = align(top + recodrsPerPage * rowHeight + GAP);
add(total);
float tw = label.width() + won.width() + happy.width() + total.width();
label.x = align((w - tw) / 2);
happy.x = label.x + label.width();
won.x = happy.x + happy.width();
total.x = won.x + won.width();
label.y = happy.y = won.y = total.y = align(top + recodrsPerPage * rowHeight + GAP);
} else {
Text title = PixelScene.createText(TXT_NO_GAMES, GuiProperties.titleFontSize());
title.hardlight(DEFAULT_COLOR);
title.measure();
title.x = align((w - title.width()) / 2);
title.y = align((h - title.height()) / 2);
add(title);
}
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
fadeIn();
}
use of com.watabou.pixeldungeon.ui.Archs in project pixel-dungeon-remix by NYRDS.
the class TitleScene method create.
@Override
public void create() {
super.create();
Music.INSTANCE.play(Assets.THEME, true);
Music.INSTANCE.volume(1f);
uiCamera.setVisible(false);
int w = Camera.main.width;
int h = Camera.main.height;
float height = 180;
Image title = new Image(REMIXED_TITLE);
add(title);
title.x = (w - title.width()) / 2;
title.y = (title.height() * 0.10f) / 2;
if (PixelDungeon.landscape()) {
title.y = -(title.height() * 0.05f);
}
placeTorch(title.x + title.width / 2 + 3, title.y + title.height / 2 - 3);
placeTorch(title.x + title.width / 2 - 5, title.y + title.height / 2 + 5);
placeTorch(title.x + title.width / 2 - 14, title.y + title.height / 2 + 14);
DashboardItem btnBadges = new DashboardItem(TXT_BADGES, 3) {
@Override
protected void onClick() {
PixelDungeon.switchNoFade(BadgesScene.class);
}
};
btnBadges.setPos(w / 2 - btnBadges.width(), (h + height) / 2 - DashboardItem.SIZE);
add(btnBadges);
DashboardItem btnAbout = new DashboardItem(TXT_ABOUT, 1) {
@Override
protected void onClick() {
PixelDungeon.switchNoFade(AboutScene.class);
}
};
btnAbout.setPos(w / 2, (h + height) / 2 - DashboardItem.SIZE);
add(btnAbout);
DashboardItem btnPlay = new DashboardItem(TXT_PLAY, 0) {
@Override
protected void onClick() {
PixelDungeon.switchNoFade(StartScene.class);
}
};
btnPlay.setPos(w / 2 - btnPlay.width(), btnAbout.top() - DashboardItem.SIZE);
add(btnPlay);
DashboardItem btnHighscores = new DashboardItem(TXT_HIGHSCORES, 2) {
@Override
protected void onClick() {
PixelDungeon.switchNoFade(RankingsScene.class);
}
};
btnHighscores.setPos(w / 2, btnPlay.top());
add(btnHighscores);
btnDonate = new DonateButton();
pleaseSupport = PixelScene.createText(GuiProperties.titleFontSize());
pleaseSupport.text(btnDonate.getText());
pleaseSupport.measure();
pleaseSupport.setPos((w - pleaseSupport.width()) / 2, h - pleaseSupport.height() * 2);
btnDonate.setPos((w - btnDonate.width()) / 2, pleaseSupport.y - btnDonate.height());
float dashBaseline = btnDonate.top() - DashboardItem.SIZE;
if (PixelDungeon.landscape()) {
btnPlay.setPos(w / 2 - btnPlay.width() * 2, dashBaseline);
btnHighscores.setPos(w / 2 - btnHighscores.width(), dashBaseline + btnHighscores.height() / 3);
btnBadges.setPos(w / 2, dashBaseline + btnBadges.height() / 3);
btnAbout.setPos(btnBadges.right(), dashBaseline);
} else {
btnPlay.setPos(w / 2 - btnPlay.width(), btnAbout.top() - DashboardItem.SIZE + 5);
btnHighscores.setPos(w / 2, btnPlay.top());
btnBadges.setPos(w / 2 - btnBadges.width(), dashBaseline + 5);
btnAbout.setPos(w / 2, dashBaseline + 5);
}
Archs archs = new Archs();
archs.setSize(w, h);
addToBack(archs);
Text version = Text.createBasicText("v " + Game.version, font1x);
version.measure();
version.hardlight(0x888888);
version.setPos(w - version.width(), h - version.height());
add(version);
float freeInternalStorage = Game.getAvailableInternalMemorySize();
if (freeInternalStorage < 2) {
Text lowInteralStorageWarning = PixelScene.createMultiline(GuiProperties.regularFontSize());
lowInteralStorageWarning.text(Game.getVar(R.string.TitleScene_InternalStorageLow));
lowInteralStorageWarning.measure();
lowInteralStorageWarning.setPos(0, h - lowInteralStorageWarning.height());
lowInteralStorageWarning.hardlight(0.95f, 0.1f, 0.1f);
add(lowInteralStorageWarning);
}
PrefsButton btnPrefs = new PrefsButton();
btnPrefs.setPos(0, 0);
add(btnPrefs);
PlayGamesButton btnPlayGames = new PlayGamesButton();
btnPlayGames.setPos(btnPrefs.right() + 2, 0);
add(btnPlayGames);
ModsButton btnMods = new ModsButton();
btnMods.setPos(0, btnPrefs.bottom() + 2);
add(btnMods);
if (PixelDungeon.donated() > 0) {
PremiumPrefsButton btnPPrefs = new PremiumPrefsButton();
btnPPrefs.setPos(btnPrefs.right() + 2, 0);
add(btnPPrefs);
btnPlayGames.setPos(btnPPrefs.right() + 2, 0);
}
ExitButton btnExit = new ExitButton();
btnExit.setPos(w - btnExit.width(), 0);
add(btnExit);
ChangelogButton btnChangelog = new ChangelogButton();
btnChangelog.setPos(w - btnChangelog.width(), btnExit.bottom() + 2);
add(btnChangelog);
StatisticsButton btnStats = new StatisticsButton();
btnStats.setPos(w - btnStats.width(), btnChangelog.bottom() + 2);
add(btnStats);
fadeIn();
}
Aggregations