本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Dialog类的典型用法代码示例。如果您正苦于以下问题:Java Dialog类的具体用法?Java Dialog怎么用?Java Dialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dialog类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
@Override
public Dialog show(Stage stage, Action action) {
previousFocussedActor = null;
previousEscapeActor = null;
super.show(stage, action);
if (stage instanceof ControllerMenuStage) {
previousFocussedActor = ((ControllerMenuStage) stage).getFocussedActor();
previousEscapeActor = ((ControllerMenuStage) stage).getEscapeActor();
if (buttonsToAdd.size >= 1)
((ControllerMenuStage) stage).setFocussedActor(buttonsToAdd.get(0));
if (buttonsToAdd.size == 1)
((ControllerMenuStage) stage).setEscapeActor(buttonsToAdd.get(0));
}
return this;
}
示例2: deleteSessionConfirm
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
protected ClickListener deleteSessionConfirm(final int session, final Image btnTrashcan,
final TextButton btnSession) {
return new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Dialog confirmDelete = new Dialog("ᎯᎠᏍ ᏣᏚᎵᎭ?", skin) {
protected void result(Object object) {
if ("YES".equals(object)) {
SlotFolder.getSlotFolder(session).deleteDirectory();
btnSession.setText(EMPTY_SLOT+"\n"+nextSessionIndicationText(0l, 0));
btnTrashcan.setColor(Color.LIGHT_GRAY);
btnTrashcan.clearListeners();
}
};
};
confirmDelete.button("ᎥᎥ - YES", "YES");
confirmDelete.button("ᎥᏝ - NO", "NO");
confirmDelete.text("Are you sure you want\n" + "to delete this session?\n" + "This cannot be undone!");
confirmDelete.setModal(true);
confirmDelete.pack();
confirmDelete.show(stage);
}
};
}
示例3: onBack
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
@Override
protected boolean onBack() {
userPause();
pausedStage.getRoot().clearChildren();
Dialog cancelSession = new Dialog("[PAUSED] CANCEL SESSION?", skin) {
@Override
protected void result(Object object) {
if ("YES".equals(object)) {
game.previousScreen();
}
userResume();
}
};
cancelSession.setModal(true);
cancelSession.getTitleLabel().setAlignment(Align.center);
cancelSession.button("ᎥᎥ - YES", "YES");
cancelSession.button("ᎥᏝ - NO", "NO");
cancelSession.getContentTable().row();
cancelSession.text("Are you sure you want to cancel?");
cancelSession.getContentTable().row();
cancelSession.text("You will lose all of your");
cancelSession.getContentTable().row();
cancelSession.text("progress if you choose ᎥᎥ!");
cancelSession.show(pausedStage);
return true;
}
示例4: show
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
@Override
public Dialog show(Stage stage) {
Dialog dialog = super.show(stage);
if (getWidth() > Gdx.graphics.getWidth()) {
setWidth(Gdx.graphics.getWidth());
setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
setPosition((int) getX(), (int) getY());
}
if (getHeight() > Gdx.graphics.getHeight()) {
setHeight(Gdx.graphics.getHeight());
setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
setPosition((int) getX(), (int) getY());
}
resetWidth = getWidth();
resetHeight = getHeight();
main.getStage().setScrollFocus(scrollPane);
return dialog;
}
示例5: show
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
@Override
public Dialog show(Stage stage) {
Dialog dialog = super.show(stage);
if (getWidth() > Gdx.graphics.getWidth()) {
setWidth(Gdx.graphics.getWidth());
setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
setPosition((int) getX(), (int) getY());
}
if (getHeight() > Gdx.graphics.getHeight()) {
setHeight(Gdx.graphics.getHeight());
setPosition(getWidth() / 2.0f, getHeight() / 2.0f, Align.center);
setPosition((int) getX(), (int) getY());
}
resetWidth = getWidth();
resetHeight = getHeight();
main.getStage().setScrollFocus(scrollPane);
return dialog;
}
示例6: showAddFontSizeError
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
private void showAddFontSizeError(String name) {
Dialog dialog = new Dialog("", getSkin(), "bg");
dialog.getContentTable().defaults().pad(10.0f);
Label label = new Label("Error adding font...", getSkin(), "title");
dialog.getContentTable().add(label);
dialog.getContentTable().row();
dialog.text("Unable to add font \"" + name +
"\". Ensure image dimensions\nare less than max texture dimensions (" +
maxTextureWidth + "x" +
maxTextureHeight + ").\nSee project settings.");
dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
dialog.button("Ok");
dialog.key(Keys.ENTER, null).key(Keys.ESCAPE, null);
dialog.show(getStage());
}
示例7: showDeleteStyleDialog
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
public void showDeleteStyleDialog(Skin skin, Stage stage) {
StyleData styleData = main.getRootTable().getSelectedStyle();
Dialog dialog = new Dialog("Delete Style", skin, "bg") {
@Override
protected void result(Object object) {
if ((Boolean) object) {
main.getUndoableManager().addUndoable(new DeleteStyleUndoable(styleData, main), true);
}
}
};
dialog.getTitleLabel().setAlignment(Align.center);
dialog.getContentTable().defaults().padLeft(10.0f).padRight(10.0f);
dialog.text("Are you sure you want to delete style " + styleData.name + "?");
dialog.getContentTable().getCells().first().pad(10.0f);
dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
dialog.button("Yes, delete the style", true).button("No", false);
dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
dialog.key(Input.Keys.ENTER, true).key(Input.Keys.ESCAPE, false);
dialog.show(stage);
}
示例8: yesNoDialog
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
public void yesNoDialog(String title, String text,
ConfirmationListener listener) {
Dialog dialog = new Dialog(title, main.getSkin(), "bg") {
@Override
protected void result(Object object) {
listener.selected((int) object);
}
};
dialog.getTitleTable().getCells().first().padLeft(5.0f);
Label label = new Label(text, main.getSkin());
label.setAlignment(Align.center);
dialog.text(label);
dialog.getContentTable().getCells().first().pad(10.0f);
dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
dialog.button("Yes", 0);
dialog.button("No", 1);
dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
dialog.key(Input.Keys.ESCAPE, 1);
dialog.show(main.getStage());
}
示例9: yesNoCancelDialog
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
public void yesNoCancelDialog(String title, String text,
ConfirmationListener listener) {
Dialog dialog = new Dialog(title, main.getSkin(), "bg") {
@Override
protected void result(Object object) {
listener.selected((int) object);
}
};
dialog.getTitleTable().getCells().first().padLeft(5.0f);
Label label = new Label(text, main.getSkin());
label.setAlignment(Align.center);
dialog.text(label);
dialog.getContentTable().getCells().first().pad(10.0f);
dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
dialog.button("Yes", 0);
dialog.button("No", 1);
dialog.button("Cancel", 2);
dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
dialog.getButtonTable().getCells().get(2).getActor().addListener(main.getHandListener());
dialog.key(Input.Keys.ESCAPE, 2);
dialog.show(main.getStage());
}
示例10: showDialogError
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
public void showDialogError(String title, String message, Runnable runnable) {
Dialog dialog = new Dialog(title, main.getSkin(), "bg") {
@Override
public boolean remove() {
if (runnable != null) {
runnable.run();
}
return super.remove();
}
};
dialog.text(message);
dialog.button("OK");
dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
dialog.show(main.getStage());
}
示例11: setExitDialog
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
private void setExitDialog() {
if (settings.showExitDialog && !Config.DEBUG) {
Dialog exitDialog = new Dialog("Confirm Exit", Styles.UI_SKIN) {
@Override
protected void result(Object object)
{
if (object.equals(true))
{
((ExitDialogInterface) Gdx.app).exitConfirmed();
} else
{
((ExitDialogInterface) Gdx.app).exitCanceled();
}
}
};
exitDialog.button("Yes", true);
exitDialog.button("Cancel", false);
((ExitDialogInterface) Gdx.app).setExitDialog(exitDialog, STAGE);
}
}
示例12: process
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
final Dialog dialog = getDialogParent(tag);
if (dialog != null) {
dialog.setObject(actor, parser.parseAction(rawAttributeData, dialog));
} else {
final VisDialog visDialog = getVisDialogParent(tag);
if (visDialog == null) {
parser.throwErrorIfStrict(
"On result actions can be attached only to children of dialogs. Received on result action: "
+ rawAttributeData + " on a tag without dialog parent: " + tag.getTagName());
return;
}
visDialog.setObject(actor, parser.parseAction(rawAttributeData, dialog));
}
}
示例13: FramedDialog
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
public FramedDialog(Skin skin, String title, String message) {
this.skin = skin;
frame = new Image(skin.getPatch("frame"));
// TODO find why title is outside the box
dialog = new Dialog(title, skin) {
@Override
protected void result(Object object) {
fadeOut();
}
};
dialog.setBackground(skin.getTiledDrawable("menuTexture"));
dialog.getContentTable().defaults().expandX().fillX();
dialog.getButtonTable().defaults().expandX().fillX();
Label label = new Label(message, skin);
label.setAlignment(Align.center);
label.setWrap(true);
dialog.text(label);
}
示例14: addButton
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
private static void addButton(TaflGame game, Object text, Skin skin, LocaleService ls, ChangeListener listener, Dialog dialog) {
Sprite up = game.graphicsService.getSprite(Assets.GraphicFiles.ATLAS_PIECES, Assets.ButtonGraphics.BLANK);
Sprite down = game.graphicsService.getSprite(Assets.GraphicFiles.ATLAS_PIECES, Assets.ButtonGraphics.BLANK_PRESSED);
TextButtonStyle style = new TextButtonStyle();
style.fontColor = Constants.ScreenConstants.TEXT_COLOR;
style.font = game.graphicsService.getFont(game.deviceSettings.hudFont);
style.up = new TextureRegionDrawable(new TextureRegion(up));
style.down = new TextureRegionDrawable(new TextureRegion(down));
TextButton button = new TextButton(ls.get(text), style);
button.addListener(listener);
dialog.button(button);
dialog.getButtonTable().row();
}
示例15: createDialog
import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //导入依赖的package包/类
private static Dialog createDialog(TaflGame game, Object title, Skin skin, LocaleService ls, DeviceSettings deviceSettings) {
String localTitle = ls.get(title);
if (localTitle == null) {
localTitle = Constants.HudConstants.DEFAULT_DIALOG_TITLE;
}
Dialog dialog = new Dialog(localTitle, skin, Assets.Skin.SKIN_STYLE_DIALOG);
dialog.setMovable(false);
dialog.setModal(true);
dialog.padTop(50);
dialog.getCell(dialog.getButtonTable()).pad(deviceSettings.dialogSpacing);
dialog.getContentTable().defaults().padTop(deviceSettings.dialogSpacing);
dialog.getContentTable().defaults().padLeft(deviceSettings.dialogSpacing);
dialog.getContentTable().defaults().padRight(deviceSettings.dialogSpacing);
dialog.getButtonTable().defaults().spaceTop(deviceSettings.dialogSpacing);
dialog.getButtonTable().defaults().spaceBottom(deviceSettings.dialogSpacing);
dialog.getButtonTable().defaults().padLeft(deviceSettings.dialogSpacing);
dialog.getButtonTable().defaults().padRight(deviceSettings.dialogSpacing);
dialog.getButtonTable().defaults().size(deviceSettings.dialogButtonWidth,
deviceSettings.dialogButtonHeight);
return dialog;
}