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


Java Task类代码示例

本文整理汇总了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);
}
 
开发者ID:UdealInferno,项目名称:Parasites-of-HellSpace,代码行数:20,代码来源:SpawningEnemy.java

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

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

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

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

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

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

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

示例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);
    }

}
 
开发者ID:jjhaggar,项目名称:ludum30_a_hole_new_world,代码行数:25,代码来源:Player.java

示例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);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:22,代码来源:CreateProjectDialog.java

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

示例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));
				}

			}
		});
	}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:24,代码来源:Message.java

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

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

示例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;
}
 
开发者ID:e-ucm,项目名称:ead,代码行数:22,代码来源:GalleryTest.java


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