當前位置: 首頁>>代碼示例>>Java>>正文


Java Dialog.button方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Dialog.button方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.button方法的具體用法?Java Dialog.button怎麽用?Java Dialog.button使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.Dialog的用法示例。


在下文中一共展示了Dialog.button方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: inviteSelected

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
public void inviteSelected(String[] availableMods, Stage stage, final CardshifterClient client) {
    if (selected == null) {
        return;
    }

    Dialog dialog = new Dialog("Invite " + selected.getName(), skin) {
        @Override
        protected void result(Object object) {
        	if (object != null) {
                client.send(new StartGameRequest(selected.getId(), (String) object));
                callback.callback((String) object);
        	}
        }
    };
    dialog.text("Which mod do you want to play?");
    for (String mod : availableMods) {
        dialog.button(mod, mod);
    }
    dialog.button("Cancel");
    dialog.show(stage);
}
 
開發者ID:Cardshifter,項目名稱:Cardshifter,代碼行數:22,代碼來源:UsersList.java

示例10: onClientConnected

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
@Override
public void onClientConnected(IOException e) {
	connectingDialog.setVisible(false);
	if (e == null) {
		game.pushScreen("lobby");
	} else {
		game.setCurrentSession(null);

		Dialog dialog = new Dialog("Fehler", skin);
		dialog.text(e.getMessage());
		dialog.button("Ok", true);
		dialog.key(Keys.ENTER, true);
		dialog.show(stage);
	}
}
 
開發者ID:eskalon,項目名稱:ProjektGG,代碼行數:16,代碼來源:ServerBrowserScreen.java

示例11: onHostStarted

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
@Override
public void onHostStarted(IOException e) {
	connectingDialog.setVisible(false);
	if (e == null) {
		game.pushScreen("lobby");
	} else {
		game.setCurrentSession(null);
		Dialog dialog = new Dialog("Fehler", skin);
		dialog.text(e.getMessage());
		dialog.button("Ok", true);
		dialog.key(Keys.ENTER, true);
		dialog.show(stage);
	}
}
 
開發者ID:eskalon,項目名稱:ProjektGG,代碼行數:15,代碼來源:LobbyCreationScreen.java

示例12: firstTime

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
protected void firstTime() {
	log("SHOWING FIRST TIME DIALOG");
	userPause();
	pausedStage.getRoot().clearChildren();
	Dialog firstTimeNotice = new Dialog("HOW THIS WORKS", skin) {
		@Override
		protected void result(Object object) {
			userResume();
			stage.addAction(actionLoadNextChallengeQuick());
		}
	};
	firstTimeNotice.setModal(true);
	firstTimeNotice.setFillParent(true);
	firstTimeNotice.getTitleLabel().setAlignment(Align.center);
	firstTimeNotice.button("ᎰᏩ");

	Table contentTable = firstTimeNotice.getContentTable();
	contentTable.row();
	Table noticeTable = new Table(skin);
	noticeTable.defaults().expand().fill();
	contentTable.add(noticeTable).expand().fill();
	String txt = Gdx.files.internal("text/how-this-works.txt").readString(UTF_8.name());
	Label message = new Label(txt, skin);
	message.setFontScale(.8f);
	message.setWrap(true);
	noticeTable.add(message);
	firstTimeNotice.show(pausedStage);
}
 
開發者ID:CherokeeLanguage,項目名稱:cll1-gdx,代碼行數:29,代碼來源:LearningSession.java

示例13: showConfirmDeleteDialog

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
/**
 * Shows a dialog to confirm deletion of all TintedDrawables based on the
 * provided drawable data. This is called when the delete button is pressed
 * on a drawable in the drawable list.
 * @param drawable 
 */
private void showConfirmDeleteDialog(DrawableData drawable) {
    Dialog dialog = new Dialog("Delete duplicates?", getSkin(), "bg"){
        @Override
        protected void result(Object object) {
            if ((boolean) object) {
                main.getProjectData().setChangesSaved(false);
                removeDuplicateDrawables(drawable.file);
                gatherDrawables();
                sortBySelectedMode();
            }
        }
    };
    
    dialog.getTitleTable().padLeft(5.0f);
    dialog.getContentTable().padLeft(10.0f).padRight(10.0f).padTop(5.0f);
    dialog.getButtonTable().padBottom(15.0f);
    
    dialog.text("Deleting this drawable will also delete one or more tinted drawables.\n"
            + "Delete duplicates?");
    dialog.button("OK", true);
    dialog.button("Cancel", false);
    dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
    dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
    dialog.key(Input.Keys.ENTER, true);
    dialog.key(Input.Keys.ESCAPE, false);
    dialog.show(getStage());
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:34,代碼來源:DialogDrawables.java

示例14: showDrawableError

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
/**
 * Show an setStatusBarError indicating a drawable that exceeds project specifications
 */
private void showDrawableError() {
    Dialog dialog = new Dialog("Error...", getSkin(), "bg");
    
    dialog.getTitleTable().padLeft(5.0f);
    dialog.getContentTable().padLeft(10.0f).padRight(10.0f).padTop(5.0f);
    dialog.getButtonTable().padBottom(15.0f);
    
    Label label = new Label("Error while adding new drawables.\nEnsure that image dimensions are\nless than maximums specified in project.\nRolling back changes...", getSkin());
    label.setAlignment(Align.center);
    dialog.text(label);
    dialog.button("OK");
    dialog.show(getStage());
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:17,代碼來源:DialogDrawables.java

示例15: showRemoveDuplicatesDialog

import com.badlogic.gdx.scenes.scene2d.ui.Dialog; //導入方法依賴的package包/類
/**
 * Shows a dialog to confirm removal of duplicate drawables that have the
 * same name without extension. This is called after selecting new drawables.
 * @param unhandledFiles
 * @param backup
 * @param filesToProcess 
 */
private void showRemoveDuplicatesDialog(Array<FileHandle> unhandledFiles, Array<DrawableData> backup, Array<FileHandle> filesToProcess) {
    Dialog dialog = new Dialog("Delete duplicates?", getSkin(), "bg"){
        @Override
        protected void result(Object object) {
            if ((boolean) object) {
                for (FileHandle fileHandle : unhandledFiles) {
                    removeDuplicateDrawables(fileHandle);
                    filesToProcess.add(fileHandle);
                }
            }
            finalizeDrawables(backup, filesToProcess);
        }
    };
    
    dialog.getTitleTable().padLeft(5.0f);
    dialog.getContentTable().padLeft(10.0f).padRight(10.0f).padTop(5.0f);
    dialog.getButtonTable().padBottom(15.0f);
    
    dialog.text("Adding this drawable will overwrite one or more drawables\n"
            + "Delete duplicates?");
    dialog.button("OK", true);
    dialog.button("Cancel", false);
    dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
    dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
    dialog.key(Input.Keys.ENTER, true);
    dialog.key(Input.Keys.ESCAPE, false);
    dialog.show(getStage());
}
 
開發者ID:raeleus,項目名稱:skin-composer,代碼行數:36,代碼來源:DialogDrawables.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Dialog.button方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。