use of com.watabou.pixeldungeon.ui.ModsButton 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