当前位置: 首页>>代码示例>>Java>>正文


Java Dialog类代码示例

本文整理汇总了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;

}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:22,代码来源:ControllerMenuDialog.java

示例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);
		}
	};
}
 
开发者ID:CherokeeLanguage,项目名称:cll1-gdx,代码行数:25,代码来源:SelectSession.java

示例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;
}
 
开发者ID:CherokeeLanguage,项目名称:cll1-gdx,代码行数:27,代码来源:LearningSession.java

示例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;
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:22,代码来源:DialogWelcome.java

示例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;
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:21,代码来源:DialogWarnings.java

示例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());
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:19,代码来源:DialogFonts.java

示例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);
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:26,代码来源:DialogFactory.java

示例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());
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:22,代码来源:DialogFactory.java

示例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());
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:24,代码来源:DialogFactory.java

示例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());
}
 
开发者ID:raeleus,项目名称:skin-composer,代码行数:18,代码来源:DialogFactory.java

示例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);
	}
}
 
开发者ID:aphex-,项目名称:Opus-Prototype,代码行数:21,代码来源:Editor.java

示例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));
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:17,代码来源:OnResultLmlAttribute.java

示例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);
}
 
开发者ID:guillaume-alvarez,项目名称:ShapeOfThingsThatWere,代码行数:23,代码来源:FramedDialog.java

示例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();
    }
 
开发者ID:apotapov,项目名称:tafl,代码行数:18,代码来源:HudFactory.java

示例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;
    }
 
开发者ID:apotapov,项目名称:tafl,代码行数:27,代码来源:HudFactory.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Dialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。