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


Java Telegram类代码示例

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


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

示例1: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
/** Handles received telegrams. The telegram is first routed to the current state. If the current state does not deal with the
 * message, it's routed to the global state's message handler.
 * 
 * @param telegram the received telegram
 * @return true if telegram has been successfully handled; false otherwise. */
@Override
public boolean handleMessage (Telegram telegram) {

	// First see if the current state is valid and that it can handle the message
	if (currentState != null && currentState.onMessage(owner, telegram)) {
		return true;
	}

	// If not, and if a global state has been implemented, send
	// the message to the global state
	if (globalState != null && globalState.onMessage(owner, telegram)) {
		return true;
	}

	return false;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:22,代码来源:DefaultStateMachine.java

示例2: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(Telegram telegram) {
	switch (telegram.message) {
		case Constants.MSG_GUI_SET_DOG_BUTTON_TO_WHISTLE:
			setDogButton(whistleButton, (HumanCharacter) telegram.extraInfo);
			return true;
		case Constants.MSG_GUI_SET_DOG_BUTTON_TO_THROW:
			setDogButton(throwButton, (HumanCharacter) telegram.extraInfo);
			return true;
		case Constants.MSG_GUI_CLEAR_DOG_BUTTON:
			clearDogButton((HumanCharacter) telegram.extraInfo);
			return true;
		case Constants.MSG_GUI_UPDATE_DOG_BUTTON:
			updateDogButton((HumanCharacter) telegram.extraInfo);
			return true;
	}
	return false;
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:19,代码来源:GameStage.java

示例3: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage (Telegram msg) {
	TelegramMessage telegramMsg = TelegramMessage.values()[msg.message];
	switch (telegramMsg) {
	
	case SQUAD_INPUT_SELECTED:
		int index = (Integer)msg.extraInfo;
		setSelected(index, true);
		return true;
		
	case GUI_INSUFFICIENT_RESOURCES:
		if(resourceAlertTask.isScheduled())
			resourceAlertTask.cancel();
		Timer.schedule(resourceAlertTask, 0.0f, 0.15f, 5);
		return true;

	default:
		return false;
	}
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:21,代码来源:GUISystem.java

示例4: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean handleMessage(Telegram msg) {
	if (msg.message == MessageType.YOU_ARE_DISMANTLED.ordinal()) {
		kill();
		Vector3 p = Game.instance.activeIsland.pos;
		ItemDrop i = new ItemDrop(Island.SIZE / 2 - 5, Island.SIZE / 4 * 3 + p.y + 1, Island.SIZE / 2, Item.get("YELLOW_CRYSTAL"), 1);
		island.addEntity(i, false, false);
		return true;
	}
	
	if (msg.message == MessageType.STRUCTURE_BROADCAST_HANDLED.ordinal()) {
		requestedHumanStates.removeValue((State<Human>) msg.extraInfo, true);
	}
	
	return false;
}
 
开发者ID:Dakror,项目名称:Vloxlands,代码行数:18,代码来源:Structure.java

示例5: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage (Telegram telegram) {
	switch (telegram.message) {
	case PF_RESPONSE: // PathFinderQueue will call us directly, no need to register for this message
		MyPathFinderRequest pfr = (MyPathFinderRequest)telegram.extraInfo;
		if (PathFinderRequestControl.DEBUG) {
			@SuppressWarnings("unchecked")
			PathFinderQueue<FlatTiledNode> pfQueue = (PathFinderQueue<FlatTiledNode>)telegram.sender;
			System.out.println("pfQueue.size = " + pfQueue.size() + " executionFrames = " + pfr.executionFrames);
		}

		// Swap double buffer
		workPath = activePath;
		activePath = (TiledSmoothableGraphPath<FlatTiledNode>)pfr.resultPath;

		isActivePathSmoothed = pfr.smoothEnabled;

		// Release the request
		requestPool.free(pfr);
		break;
	}
	return true;
}
 
开发者ID:libgdx,项目名称:gdx-ai,代码行数:24,代码来源:InterruptibleFlatTiledAStarTest.java

示例6: AssetStateIdle

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
public AssetStateIdle() {
    MessageManager.getInstance().addListener(new Telegraph() {
        @Override
        public boolean handleMessage(Telegram msg) {
            startGcTask();
            return true;
        }
    }, AssetsStates.ASSETS_GC);
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:10,代码来源:AssetStateIdle.java

示例7: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage (Telegram telegram) {
	@SuppressWarnings("unchecked")
	PathFinderRequest<N> pfr = (PathFinderRequest<N>)telegram.extraInfo;
	pfr.client = telegram.sender; // set the client to be notified once the request has completed
	pfr.status = PathFinderRequest.SEARCH_NEW; // Reset status
	pfr.statusChanged = true; // Status has just changed
	pfr.executionFrames = 0; // Reset execution frames counter
	requestQueue.store(pfr);
	return true;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:12,代码来源:PathFinderQueue.java

示例8: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(Telegram telegram) {
	switch (telegram.message) {
		case Constants.MSG_DOG_LETS_PLAY:
			humanWantToPlay = true;
			stickThrown = false;
			break;
		case Constants.MSG_DOG_LETS_STOP_PLAYING:
			humanWantToPlay = false;
			break;
		case Constants.MSG_DOG_HUMAN_IS_DEAD:
			humanIsDead = true;
			humanWantToPlay = false;
			alreadyCriedForHumanDeath = false;
			break;
		case Constants.MSG_DOG_HUMAN_IS_RESURRECTED:
			humanIsDead = false;
			alreadyCriedForHumanDeath = false;
			break;
		case Constants.MSG_DOG_STICK_THROWN:
			stickThrown = true;
			break;
	}
	// Update GUI buttons if the dog's owner is selected
	if (this.human != null && this.human.selected) {
		MessageManager.getInstance().dispatchMessage(Constants.MSG_GUI_UPDATE_DOG_BUTTON, this.human);
	}
	return true;
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:30,代码来源:DogCharacter.java

示例9: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage (Telegram msg) {
	TelegramMessage telegramMsg = TelegramMessage.values()[msg.message];
	switch (telegramMsg) {

	case CONSTRUCT_UNIT_REQUEST:
		Entity squad = (Entity)msg.extraInfo;
		constructUnit(squad);
		return true;

	default:
		return false;
	}

}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:16,代码来源:ConstructionSystem.java

示例10: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(final Telegram msg) {
	Entity character = (Entity) msg.extraInfo;
	character.getBody().setTransform(RESPAWN_POSITION, character.getBody().getAngle());
	character.changeState(NinjaRabbitState.IDLE);
	character.setDirection(Direction.RIGHT);
	return true;
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:9,代码来源:NinjaRabbitGraphicsProcessor.java

示例11: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(final Telegram msg) {
	getStatus().setLevel((byte) (getStatus().getLevel() + 1));
	getStatus().setTime(PlayerStatus.DEFAULT_TIME);
	MessageManager.getInstance().dispatchMessage(this, MessageType.BEGIN_LEVEL.code());
	return true;
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:8,代码来源:LevelPlayerStatusProcessor.java

示例12: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(final Telegram msg) {
	if (msg.message == MessageType.COLLECTED.code()) {
		getStatus().setCollectibles((short) (getStatus().getCollectibles() + 1));
		getStatus().setScore(getStatus().getScore() + COLLECTIBLE_POINTS);
	} else if (msg.message == MessageType.DEAD.code()) {
		if (getStatus().getLives() > 0) {
			getStatus().setLives((short) (getStatus().getLives() - 1));
		}
		System.out.println("Dead received!");
	}
	return true;
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:14,代码来源:NinjaRabbitPlayerStatusProcessor.java

示例13: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(final Telegram msg) {
	if (msg.message == MessageType.RESET.code()) {
		reset();
	} else if (msg.message == MessageType.DEAD.code()) {
		restartCurrentLevel();
	} else if (msg.message == MessageType.BEGIN_LEVEL.code()) {
		beginNextLevel();
	}
	return false;
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:12,代码来源:NinjaRabbitGame.java

示例14: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage(final Telegram msg) {
	if (msg.message == MessageType.GAME_OVER.code()) {
		theme.stop();
		gameOverMusic.play();
	} else if (msg.message == MessageType.EXIT.code()) {
		theme.stop();
		exitMusic.play();
	}
	return true;
}
 
开发者ID:nfantone,项目名称:ninja-rabbit,代码行数:12,代码来源:LevelAudioProcessor.java

示例15: handleMessage

import com.badlogic.gdx.ai.msg.Telegram; //导入依赖的package包/类
@Override
public boolean handleMessage (Telegram msg) {
	// build a new house
	if (houses.size <= 10) {
		houses.add(new House(this));
	}
	return false;
}
 
开发者ID:libgdx,项目名称:gdx-ai,代码行数:9,代码来源:TelegramProviderTest.java


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