Search in sources :

Example 6 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class AboutScene method createTouchLink.

private Text createTouchLink(final String address, Text visit) {
    Text text = createText(address, visit);
    text.hardlight(Window.TITLE_COLOR);
    TouchArea area = new TouchArea(text) {

        @Override
        protected void onClick(Touch touch) {
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(address));
            Game.instance().startActivity(Intent.createChooser(intent, OUR_SITE));
        }
    };
    add(area);
    return text;
}
Also used : TouchArea(com.watabou.noosa.TouchArea) Text(com.watabou.noosa.Text) Intent(android.content.Intent) Touch(com.watabou.input.Touchscreen.Touch)

Example 7 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class AboutScene method createText.

private Text createText(String text, Text upper) {
    Text multiline = createMultiline(text, GuiProperties.regularFontSize());
    multiline.maxWidth(Camera.main.width * 5 / 6);
    multiline.measure();
    add(multiline);
    if (upper != null) {
        placeBellow(multiline, upper);
    }
    return multiline;
}
Also used : Text(com.watabou.noosa.Text)

Example 8 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class AboutScene method createTouchEmail.

private Text createTouchEmail(final String address, Text text2) {
    Text text = createText(address, text2);
    text.hardlight(Window.TITLE_COLOR);
    TouchArea area = new TouchArea(text) {

        @Override
        protected void onClick(Touch touch) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("message/rfc822");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address });
            intent.putExtra(Intent.EXTRA_SUBJECT, Game.getVar(R.string.app_name));
            Game.instance().startActivity(Intent.createChooser(intent, SND));
        }
    };
    add(area);
    return text;
}
Also used : TouchArea(com.watabou.noosa.TouchArea) Text(com.watabou.noosa.Text) Intent(android.content.Intent) Touch(com.watabou.input.Touchscreen.Touch)

Example 9 with Text

use of com.watabou.noosa.Text in project pixel-dungeon-remix by NYRDS.

the class AboutScene method create.

@Override
public void create() {
    super.create();
    Text text = createText(getTXT(), null);
    text.camera = uiCamera;
    text.x = align((Camera.main.width - text.width()) / 2);
    text.y = align((Camera.main.height - text.height()) / 3);
    Text email = createTouchEmail(Game.getVar(R.string.AboutScene_Mail), text);
    Text visit = createText(Game.getVar(R.string.AboutScene_OurSite), email);
    Text site = createTouchLink(LNK, visit);
    createText("\n" + getTRN(), site);
    Image nyrdie = Icons.NYRDIE.get();
    nyrdie.x = align(text.x + (text.width() - nyrdie.width) / 2);
    nyrdie.y = text.y - nyrdie.height - 8;
    add(nyrdie);
    new Flare(7, 64).color(0x332211, true).show(nyrdie, 0).angularSpeed = -20;
    Archs archs = new Archs();
    archs.setSize(Camera.main.width, Camera.main.height);
    addToBack(archs);
    ExitButton btnExit = new ExitButton();
    btnExit.setPos(Camera.main.width - btnExit.width(), 0);
    add(btnExit);
    fadeIn();
}
Also used : Flare(com.watabou.pixeldungeon.effects.Flare) Archs(com.watabou.pixeldungeon.ui.Archs) ExitButton(com.watabou.pixeldungeon.ui.ExitButton) Text(com.watabou.noosa.Text) Image(com.watabou.noosa.Image)

Example 10 with Text

use of com.watabou.noosa.Text 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)

Aggregations

Text (com.watabou.noosa.Text)18 Archs (com.watabou.pixeldungeon.ui.Archs)6 RedButton (com.watabou.pixeldungeon.ui.RedButton)5 Image (com.watabou.noosa.Image)4 ExitButton (com.watabou.pixeldungeon.ui.ExitButton)4 ScrollPane (com.watabou.pixeldungeon.ui.ScrollPane)4 NinePatch (com.watabou.noosa.NinePatch)3 Component (com.watabou.noosa.ui.Component)3 Intent (android.content.Intent)2 Touch (com.watabou.input.Touchscreen.Touch)2 SystemText (com.watabou.noosa.SystemText)2 TouchArea (com.watabou.noosa.TouchArea)2 Flare (com.watabou.pixeldungeon.effects.Flare)2 ItemSprite (com.watabou.pixeldungeon.sprites.ItemSprite)2 Spell (com.nyrds.pixeldungeon.mechanics.spells.Spell)1 BitmapText (com.watabou.noosa.BitmapText)1 Visual (com.watabou.noosa.Visual)1 BadgesList (com.watabou.pixeldungeon.ui.BadgesList)1 ChangelogButton (com.watabou.pixeldungeon.ui.ChangelogButton)1 DonateButton (com.watabou.pixeldungeon.ui.DonateButton)1