當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。