Search in sources :

Example 11 with Archs

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();
}
Also used : Archs(com.watabou.pixeldungeon.ui.Archs) ScrollPane(com.watabou.pixeldungeon.ui.ScrollPane) NinePatch(com.watabou.noosa.NinePatch) Text(com.watabou.noosa.Text) RedButton(com.watabou.pixeldungeon.ui.RedButton) Component(com.watabou.noosa.ui.Component)

Example 12 with Archs

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();
}
Also used : Archs(com.watabou.pixeldungeon.ui.Archs) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) ScrollPane(com.watabou.pixeldungeon.ui.ScrollPane) NinePatch(com.watabou.noosa.NinePatch) BadgesList(com.watabou.pixeldungeon.ui.BadgesList) Text(com.watabou.noosa.Text)

Example 13 with Archs

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();
}
Also used : Archs(com.watabou.pixeldungeon.ui.Archs) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) BitmapText(com.watabou.noosa.BitmapText) Text(com.watabou.noosa.Text) RedButton(com.watabou.pixeldungeon.ui.RedButton)

Example 14 with Archs

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();
}
Also used : PremiumPrefsButton(com.watabou.pixeldungeon.ui.PremiumPrefsButton) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) Text(com.watabou.noosa.Text) Image(com.watabou.noosa.Image) StatisticsButton(com.watabou.pixeldungeon.ui.StatisticsButton) ChangelogButton(com.watabou.pixeldungeon.ui.ChangelogButton) ModsButton(com.watabou.pixeldungeon.ui.ModsButton) PlayGamesButton(com.watabou.pixeldungeon.ui.PlayGamesButton) Archs(com.watabou.pixeldungeon.ui.Archs) PremiumPrefsButton(com.watabou.pixeldungeon.ui.PremiumPrefsButton) PrefsButton(com.watabou.pixeldungeon.ui.PrefsButton) DonateButton(com.watabou.pixeldungeon.ui.DonateButton)

Aggregations

Archs (com.watabou.pixeldungeon.ui.Archs)14 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)10 Image (com.watabou.noosa.Image)8 Text (com.watabou.noosa.Text)6 BitmapText (com.watabou.noosa.BitmapText)5 RedButton (com.watabou.pixeldungeon.ui.RedButton)5 Touch (com.watabou.input.Touchscreen.Touch)3 Group (com.watabou.noosa.Group)3 NinePatch (com.watabou.noosa.NinePatch)3 TouchArea (com.watabou.noosa.TouchArea)3 ScrollPane (com.watabou.pixeldungeon.ui.ScrollPane)3 BitmapTextMultiline (com.watabou.noosa.BitmapTextMultiline)2 Camera (com.watabou.noosa.Camera)2 ColorBlock (com.watabou.noosa.ColorBlock)2 Component (com.watabou.noosa.ui.Component)2 HeroClass (com.watabou.pixeldungeon.actors.hero.HeroClass)2 Flare (com.watabou.pixeldungeon.effects.Flare)2 PrefsButton (com.watabou.pixeldungeon.ui.PrefsButton)2 WndOptions (com.watabou.pixeldungeon.windows.WndOptions)2 Callback (com.watabou.utils.Callback)2