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


Java TextInputListener类代码示例

本文整理汇总了Java中com.badlogic.gdx.Input.TextInputListener的典型用法代码示例。如果您正苦于以下问题:Java TextInputListener类的具体用法?Java TextInputListener怎么用?Java TextInputListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextInputListener类属于com.badlogic.gdx.Input包,在下文中一共展示了TextInputListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showEnigma

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
private void showEnigma() {
    Gdx.input.getTextInput(new TextInputListener() {
        @Override
        public void input(String text){
            message = text;
            if(message.equals("aspirateur") /*== "aspirateur"*/){
            	Gdx.input.vibrate(1000); 
            	enigma = true;
            	tryAgain = false;
            	System.out.println("true");
            }
            else{
            	tryAgain = true;
            }
        }

        @Override
        public void canceled(){
            message = "no";
        }
    }, "Je ne respire jamais, mais j'ai beaucoup de soufle. Qui suis-je ?", "", "");
}
 
开发者ID:h-victor,项目名称:elin-game,代码行数:23,代码来源:DialogStageScript.java

示例2: render

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
public void render () {
	Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	batch.begin();
	font.draw(batch, message, 10, 40);
	batch.end();

	if (Gdx.input.justTouched()) {
		Gdx.input.getTextInput(new TextInputListener() {
			@Override
			public void input (String text) {
				message = "message: " + text + ", touch screen for new dialog";
			}

			@Override
			public void canceled () {
				message = "cancled by user";
			}
		}, "enter something funny", "funny", "something funny");
	}
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:21,代码来源:TextInputDialogTest.java

示例3: askForFile

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void askForFile(Controller controller,
		final FileChooserListener listener) {
	Gdx.input.getTextInput(new TextInputListener() {

		@Override
		public void input(final String text) {
			Gdx.app.postRunnable(new Runnable() {
				@Override
				public void run() {
					listener.fileChosen(text,
							FileChooserListener.Result.SUCCESS);

				}
			});
		}

		@Override
		public void canceled() {
		}

	}, "File path!", "", "");
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:24,代码来源:MokapDesktopPlatform.java

示例4: askForAudio

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void askForAudio(Controller controller,
		final FileChooserListener listener) {
	Gdx.input.getTextInput(new TextInputListener() {

		@Override
		public void input(final String text) {
			Gdx.app.postRunnable(new Runnable() {

				@Override
				public void run() {
					listener.fileChosen(text,
							FileChooserListener.Result.SUCCESS);
				}
			});
		}

		@Override
		public void canceled() {
		}

	}, "File path!", "", "");
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:24,代码来源:MokapDesktopPlatform.java

示例5: show

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void show() {
    font = game.getFont(170);
    batch = new SpriteBatch();
    camera = new OrthographicCamera();
    viewport = new FitViewport(1280, 720, camera);
    camera.setToOrtho(false, 1280, 720);
    buttons = new ArrayList<MyButton>();
    addAllButtons();
    final Preferences prefs = Gdx.app.getPreferences("profile");
    String name = prefs.getString("name");
    name = name.trim();
    if (name.length() == 0) {
        Gdx.input.getTextInput(new TextInputListener() {
            
            @Override
            public void input(String text) {
                prefs.putString("name", text);
                prefs.flush();
            }
            
            @Override
            public void canceled() {
            }
        }, "Enter name", "");
    }
}
 
开发者ID:ganeshkamathp,项目名称:killingspree,代码行数:28,代码来源:MainMenuScreen.java

示例6: processButton

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
private void processButton() {
    if (currentButton == backButton) {
        game.setScreen(new MainMenuScreen(game));
    } else if (currentButton == refreshButton) {
        addIpButtons();
    } else if (currentButton == manualIpButton) {
        if (pressedButton) {
            return;
        }
        pressedButton = true;
        
        Gdx.input.getTextInput(new TextInputListener() {
            
            @Override
            public void input(String text) {
                joinGame(text);
            }
            
            @Override
            public void canceled() {
                pressedButton = false;
            }
        }, "Enter IP", "");
        
    } else {
        if (!pressedButton) {
            pressedButton = true;
            joinGame(currentButton.getText());
        }
    }
}
 
开发者ID:ganeshkamathp,项目名称:killingspree,代码行数:32,代码来源:ClientDiscoveryScreen.java

示例7: perform

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void perform(Object... args) {
	resultListener = (TextInputListener) args[0];
	ModelEntity game = (ModelEntity) controller.getModel()
			.getResource(ModelStructure.GAME_FILE).getObject();
	variables = Q.getComponent(game, Variables.class);
	names.clear();
	for (VariableDef def : variables.getVariablesDefinitions()) {
		names.add(def.getName());
	}

	Gdx.input.getTextInput(this, i18N.m("new.variable"), newVariableName(),
			"");
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:15,代码来源:CreateVariable.java

示例8: nextStage

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
public void nextStage() {
	this.stageid++;
	if (stageid >= getStageGroupbyId(this.diffcultid).getStage_group()
			.size()) {
		// TODO 游戏通关
		Gdx.input.getTextInput(new TextInputListener() {
			
			@Override
			public void input(String text) {
				Preferences pref = Gdx.app.getPreferences("highscore");
				pref.putInteger(text, GameModel.this.getScore());
				pref.flush();
			}
			
			@Override
			public void canceled() {
				
			}
		}, "恭喜通关!请留下您的大名:", "玩家");
		BulletGame.setCurrentScreen(BulletGame.homeScreen);
		objList.clear();
	} else {
		// TODO 开始下一关
		this.currentStage = getStageGroupbyId(diffcultid).getStagebyId(stageid);
		currentStage.getTask().reset();
		objList.clear();
		getObjList().add(player.getGrazer());
		getObjList().add(player);
	}
}
 
开发者ID:tjumyk,项目名称:touhou-java,代码行数:31,代码来源:GameModel.java

示例9: getTextInput

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void getTextInput (TextInputListener listener, String title, String text, String hint) {
	Gdx.app.getInput().getTextInput(listener, title, text, hint);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:RemoteInput.java

示例10: getTextInput

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void getTextInput (TextInputListener listener, String title, String text, String hint) {
	input.getTextInput(listener, title, text, hint);
}
 
开发者ID:basherone,项目名称:libgdxcn,代码行数:5,代码来源:GwtTestWrapper.java

示例11: update

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
private void update() {
	if (Gdx.input.isKeyPressed(Keys.BACK) || Gdx.input.isKeyPressed(Keys.ESCAPE)){
		Chainball.setScreen(Assets.mainMenu);
	}
	if (Gdx.input.justTouched()){
		if (nickname.contains(Chainball.getX(), Chainball.getY())){
			name = "";
			Gdx.input.getTextInput(new TextInputListener() {

				@Override
				public void input(String text) {
					System.out.println("Text length: " + text.length());
					if (text.length() > Constants.MAX_NAME_LENGTH){
						text = text.substring(0, Constants.MAX_NAME_LENGTH);
						Prefs.setName(text);
					} else if (text.length() < 1){
						text = Constants.DEFAULT_TEXT; 
					} else {
						Prefs.setName(text);
					}
					name = text;
				}

				@Override
				public void canceled() {
					name = "Enter a name";
				}
			}, title, textInitial);
		} else if (sound.contains(Chainball.getX(), Chainball.getY())){
			if (Prefs.soundEffects()){
				Prefs.setSoundEffects(false);
			} else {
				Assets.green.play(Constants.VOLUME);
				Prefs.setSoundEffects(true);
			}
		} else if (music.contains(Chainball.getX(), Chainball.getY())){
			if (Prefs.music()){
				Assets.stopCurrentSong();
				Prefs.setMusic(false);
			} else {
				Assets.green.play(Constants.VOLUME);
				Prefs.setMusic(true);
				Assets.play(Assets.mainMenuSong);
			}
		} else if (save.contains(Chainball.getX(), Chainball.getY())){
			Chainball.setScreen(Assets.mainMenu);
		}
	}
}
 
开发者ID:AlanMorel,项目名称:chainball,代码行数:50,代码来源:Settings.java

示例12: getMultilineTextInput

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void getMultilineTextInput(final TextInputListener listener,
		final String title, final String text, final I18N i18n) {
	final EditorActivity activity = (EditorActivity) Gdx.app;
	activity.post(new Runnable() {
		public void run() {
			AlertDialog.Builder alert = new AlertDialog.Builder(activity);
			alert.setTitle(title);
			final EditText input = new EditText(activity);
			input.setText(text);
			input.setSingleLine(false);
			input.setHorizontalScrollBarEnabled(false);
			input.setVerticalScrollBarEnabled(true);
			input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
					| InputType.TYPE_TEXT_FLAG_MULTI_LINE
					| InputType.TYPE_CLASS_TEXT);
			alert.setView(input);
			alert.setPositiveButton(i18n.m("accept"),
					new DialogInterface.OnClickListener() {
						public void onClick(DialogInterface dialog,
								int whichButton) {
							Gdx.app.postRunnable(new Runnable() {
								@Override
								public void run() {
									listener.input(input.getText()
											.toString());
								}
							});
						}
					});
			alert.setOnCancelListener(new OnCancelListener() {
				@Override
				public void onCancel(DialogInterface arg0) {
					Gdx.app.postRunnable(new Runnable() {
						@Override
						public void run() {
							listener.canceled();
						}
					});
				}
			});
			alert.show();
		}
	});

}
 
开发者ID:e-ucm,项目名称:ead,代码行数:47,代码来源:AndroidPlatform.java

示例13: CreateVariable

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
public CreateVariable() {
	super(true, false, TextInputListener.class);
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:4,代码来源:CreateVariable.java

示例14: getMultilineTextInput

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
@Override
public void getMultilineTextInput(TextInputListener listener, String title,
		String text, I18N i18n) {
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:5,代码来源:DesktopPlatform.java

示例15: getMultilineTextInput

import com.badlogic.gdx.Input.TextInputListener; //导入依赖的package包/类
public void getMultilineTextInput(TextInputListener listener,
final String title, final String text, I18N i18n);
 
开发者ID:e-ucm,项目名称:ead,代码行数:3,代码来源:Platform.java


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