本文整理汇总了Java中com.badlogic.gdx.utils.Timer.Task类的典型用法代码示例。如果您正苦于以下问题:Java Task类的具体用法?Java Task怎么用?Java Task使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Task类属于com.badlogic.gdx.utils.Timer包,在下文中一共展示了Task类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public void create()
{
enemyStack = new Stack<Enemy>();
Timer.schedule(new Task()
{
@Override
public void run()
{
int choiceToMove = MathUtils.random(3);
for(int i = 0; i < 5; i++)
{
enemyStack.add(new WeakEnemy(choiceToMove, xOffset * i, yOffset * i));
}
//Timer.instance().clear();
}
}, 0.5f, intervalBetweenSpawn);
}
示例2: loadComplete
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public void loadComplete() {
// System.out.print("[");
// for (Block b : blocks) {
// System.out.print("[\"" + b.body.getPosition().x + "\"d \"" + b.body.getPosition().y + "\"d]");
// }
// System.out.println("]");
//// System.out.print("[");
//// for (Entity b : entities) {
//// System.out.print("[\"" + b.body.getPosition().x + "\"d \"" + b.body.getPosition().y + "\"d]");
//// }
//// System.out.println("]");
Timer.schedule(new Task() {
public void run() {
loaded = true;
}
}, 1);
}
示例3: beginContact
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
@Override
public void beginContact(Contact contact) {
Entity entity = getEntity(contact, PlayerComponent.class);
spawnSmoke(entity);
laserHit.play();
engine.removeEntity(entity);
Timer.instance().scheduleTask(
new Task() {
@Override
public void run() {
EventManager.fireEvent(
SceneManager.getCurrentScene(),
new Event(EventType.YOU_HAVE_BEEN_KILLED, false, false)
);
}
},
2.0f
);
}
示例4: addMemoryItemButtonListener
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
private void addMemoryItemButtonListener(final MemorySingle button) {
button.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y){
button.setText(Integer.toString(button.numb));
addBouncyAction(button);
stage.addActor(new Bubbles(Gdx.input.getX() - 100, game.getHeight() - Gdx.input.getY(),10));
if(!checkedButtons.contains(button))
checkedButtons.add(button);
if(checkedButtons.size() == 2){
disableAllButtons();
Timer.schedule(new Task(){
@Override
public void run() {
checkIfMatch();
enableAllButtons();
}
}, 1f);
}
}
});
}
示例5: RespawnEnemy
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public void RespawnEnemy() {
Timer.schedule(new Task(){
@Override
public void run() {
tics++;
if(tics > 25){
tics = 1;
}
if (tics == 1) {enemigoSpamea = true;}
if (tics == 2) {enemigoSpamea = true;}
if (tics == 3) {enemigoSpamea = true;}
if (tics == 5) {enemigoSpamea = false;}
if(tics % 2 == 0) {go=1;} else {go=0;}
}
}
,0,30/30.0f);
}
示例6: animacionGameOver
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public void animacionGameOver() {
Timer.schedule(new Task(){
@Override
public void run() {
tics++;
if(tics > 60){
tics = 0;
}
if(tics%10==0){if(timer>0 && Juego.gameOver==0 && Juego.titleScreen==0){timer--;}}
if(tics==20 && Juego.gameOver==1){Juego.titleScreen=1;}
if(tics==20){Juego.gameOver=0;}
}
}
,0,30/35.0f);
}
示例7: setName
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public void setName(final Actor actor){
com.badlogic.gdx.utils.Timer.schedule(new Task(){
@Override
public void run() {
String name = actor.getClass().getSimpleName()+getNameCount(actor);
if(Scene.getCurrentScene().findActor(name) == null)
actor.setName(name);
else
actor.setName(name+"_1");
actor.setX(Scene.mouse.x-actor.getWidth()/2);
actor.setY(Scene.mouse.y-actor.getHeight()/2);
Scene.getCurrentScene().addActor(actor);
Frame.actorPanel.addActor(actor.getName());
Scene.isDirty = true;
Effect.createEffect(actor, EffectType.ScaleInOut, 1.5f, 0.5f, InterpolationType.Linear);
}
}, 0.1f);
}
示例8: SceneEditor
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public SceneEditor(){
super();
if(reloadAssets){
Asset.loadBlocking(); // this is the first time this Scene is created by the Stage
Content.assetPanel.updateAsset();
com.badlogic.gdx.utils.Timer.schedule(new Task(){
@Override
public void run() {
Frame.scenePanel.showStudio();
Scene.scenesMap.removeKey("gdxstudio.SceneEditor");
Frame.scenePanel.update();
}
}, 1f);
reloadAssets = false;
addField = new AddField();
}
else{
Frame.scenePanel.showStudio();
Scene.scenesMap.removeKey("gdxstudio.SceneEditor");
}
Content.studioPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
示例9: beingHit
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public void beingHit() {
if (!this.invincible) {
Assets.playSound("playerHurt");
this.invincible = true;
this.state = Player.State.BeingHit;
this.stateTime = 0;
this.velocity.y = 150;
this.noControl = true;
int lifes = this.counter.lostLife();
if (lifes <= 0) {
this.die();
}
Timer.schedule(new Task() {
@Override
public void run() {
Player.this.invincible = false;
Player.this.state = Player.State.Standing;
}
}, 1.8f);
}
}
示例10: ok
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
@Override
protected void ok() {
try {
Ctx.project.getEditorConfig().setProperty(ANDROID_SDK_PROP, androidSdk.getText());
Ctx.project.saveProject();
} catch (Exception ex) {
String msg = ex.getClass().getSimpleName()
+ " - " + ex.getMessage();
Message.showMsgDialog(getStage(), "Error saving project", msg);
}
final Stage stage = getStage();
Message.showMsg(getStage(), "Creating project...", true);
Timer.schedule(new Task() {
@Override
public void run() {
createProject(stage);
}
},1);
}
示例11: ok
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
@Override
protected void ok() {
Message.showMsg(getStage(), "Creating resolution...", true);
Timer.schedule(new Task() {
@Override
public void run() {
createResolution();
String msg = scaleImages();
if(listener != null)
listener.changed(new ChangeEvent(), CreateResolutionDialog.this);
Message.hideMsg();
if(msg != null)
Message.showMsgDialog(getStage(), "Error creating resolution", msg);
}
},1);
}
示例12: showMsg
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public static void showMsg(final Stage stage, final String text, final boolean modal) {
Timer.post(new Task() {
@Override
public void run() {
isModal = modal;
if (text == null) {
hideMsg();
return;
}
add(stage, text);
if (FADE_DURATION > 0) {
msg.getColor().a = 0;
msg.addAction(Actions.fadeIn(FADE_DURATION, Interpolation.fade));
}
}
});
}
示例13: initForWorkplace
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
public static void initForWorkplace(final Human human) {
Vector3 pathStart = human.getVoxelBelow();
boolean queue = StateTools.equipTool(human, human.getWorkPlace().getWorkerTool(), false, pathStart);
Structure workPlace = human.getWorkPlace();
EnterStructureJob esj = new EnterStructureJob(human, workPlace, false);
esj.setEndEvent(new Callback() {
@Override
public void trigger() {
Timer.schedule(new Task() {
@Override
public void run() {
human.changeState(human.getWorkPlace().getWorkerState());
}
}, 1);
}
});
if (queue) {
Path p = AStar.findPath(pathStart, workPlace.getStructureNode(pathStart, NodeType.entry).pos.cpy().add(workPlace.getVoxelPos()), human, NodeType.entry.useGhostTarget);
human.queueJob(p, esj);
} else human.setJob(null, esj);
}
示例14: fileChanged
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
@Override
public void fileChanged (FileHandle file) {
if (ProjectPathUtils.isTexture(file)) {
cacheWaitTimer.clear();
cacheWaitTimer.scheduleTask(new Task() {
@Override
public void run () {
updateCache();
}
}, 0.5f);
}
if (ProjectPathUtils.isTextureAtlas(file) || ProjectPathUtils.isTextureAtlasImage(file)) {
atlasWaitTimer.clear();
atlasWaitTimer.scheduleTask(new Task() {
@Override
public void run () {
updateAtlas(file);
}
}, 0.5f);
}
}
示例15: buildUI
import com.badlogic.gdx.utils.Timer.Task; //导入依赖的package包/类
@Override
protected Actor buildUI(Skin skin, I18N i18n) {
gallery = new Gallery(2.5f, 3, skin);
for (int i = 0; i < 3; i++) {
addItem();
}
Timer.schedule(new Task() {
@Override
public void run() {
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
addItem();
}
});
}
}, 1, 1, 50);
return gallery;
}