本文整理汇总了Java中org.andengine.util.debug.Debug类的典型用法代码示例。如果您正苦于以下问题:Java Debug类的具体用法?Java Debug怎么用?Java Debug使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Debug类属于org.andengine.util.debug包,在下文中一共展示了Debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scan
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Identify available locales
* @param locales_directory
* @return
*/
public Map<String, String> scan(String locales_directory) throws IOException {
final Map<String, String> locale_map = new HashMap<String, String>();
String[] files = PhoeniciaContext.assetManager.list(locales_directory);
for (String locale_dir: files) {
if (locale_dir.equals("common")) continue;
String locale_path = locales_directory+"/"+locale_dir+"/manifest.xml";
LocaleHeaderScanner scanner = new LocaleHeaderScanner(locale_path, locale_map);
try {
InputStream locale_manifest_in = PhoeniciaContext.assetManager.open(locale_path);
final SAXParserFactory spf = SAXParserFactory.newInstance();
final SAXParser sp = spf.newSAXParser();
final XMLReader xr = sp.getXMLReader();
xr.setContentHandler(scanner);
xr.parse(new InputSource(new BufferedInputStream(locale_manifest_in)));
} catch (Exception e) {
Debug.e(e);
}
}
return locale_map;
}
示例2: setManagedHUD
import org.andengine.util.debug.Debug; //导入依赖的package包/类
public void setManagedHUD(PhoeniciaHUD hud, IOnSceneTouchListener touchListener) {
if (hud == null) {
this.clearManagedHUD();
return;
}
if (this.managedHUD != null) {
this.detachChild(this.managedHUD);
}
this.managedHUD = hud;
Debug.d("Attaching HUD to tour overlay: " + hud);
this.game.hudManager.setHudLayerVisible(false);
this.attachChild(this.managedHUD);
this.managedHUD.setZIndex(this.messageBox.getZIndex() - 1);
this.sortChildren();
if (touchListener != null) {
this.managedHUD.setOnSceneTouchListener(touchListener);
}
}
示例3: pass
import org.andengine.util.debug.Debug; //导入依赖的package包/类
private void pass(Word word) {
//TODO: count success
Debug.d("wordmatch: pass!");
GameSounds.play(GameSounds.COMPLETE);
this.winnings.add(word);
ITiledTextureRegion sprite_region = this.game.wordSprites.get(word);
Sprite winning_sprite = new Sprite(this.cardPane.getWidth()/2, this.cardPane.getHeight() - 300, sprite_region.getTextureRegion(1), PhoeniciaContext.vboManager);
winning_sprite.setZIndex(foreground_sprite.getZIndex()+1);
this.resultsPane.attachChild(winning_sprite);
winning_sprite.registerEntityModifier(new ParallelEntityModifier(
new ScaleModifier(0.5f, 2.0f, 1.0f),
new MoveYModifier(0.5f, 300, 80),
new MoveXModifier(0.5f, this.resultsPane.getWidth()/2, 40+(this.result_number*80))
));
this.result_number++;
}
示例4: parseTourStop
import org.andengine.util.debug.Debug; //导入依赖的package包/类
private void parseTourStop(Attributes attributes) throws SAXException {
Debug.v("Parsing locale tour stop");
String stopId = attributes.getValue("id");
if (stopId.equals("welcome")) {
this.currentTourStop = locale.tour.welcome;
} else if (stopId.equals("words")) {
this.currentTourStop = locale.tour.words;
} else if (stopId.equals("inventory")) {
this.currentTourStop = locale.tour.inventory;
} else if (stopId.equals("market")) {
this.currentTourStop = locale.tour.market;
} else if (stopId.equals("workshop")) {
this.currentTourStop = locale.tour.workshop;
} else if (stopId.equals("gifts")) {
this.currentTourStop = locale.tour.gifts;
}
}
示例5: setEmblem
import org.andengine.util.debug.Debug; //导入依赖的package包/类
public void setEmblem(Sprite emblem) {
Debug.d("Setting emblem to "+emblem);
this.emblem = emblem;
this.emblem.setPosition(this.getWidth()*0.66f, this.getHeight()*0.66f);
this.emblem.setZIndex(this.getZIndex() + 1);
this.emblem.setScale(0.33f);
this.emblem.registerEntityModifier(
new LoopEntityModifier(
new SequenceEntityModifier(
new MoveYModifier(1f, this.emblem.getY(), this.emblem.getY() + 5),
new MoveYModifier(1f, this.emblem.getY()+5, this.emblem.getY())
)
)
);
this.attachChild(emblem);
}
示例6: reset
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Restart the build progress for this tile
* @param context ApplicationContext ApplicationContext for use in database calls
*/
public void reset(Context context) {
if (this.sprite != null) {
this.sprite.setProgress(0, letter.time);
}
LetterBuilder builder = this.getBuilder(context);
if (builder != null) {
//Debug.d("Resetting LetterTile builder");
builder.progress.set(0);
builder.start();
builder.save(context);
this.phoeniciaGame.addBuilder(builder);
} else {
Debug.e("Could not reset LetterTile builder, because it was missing");
}
}
示例7: checkPlacement
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Checks that the target location is compatible with the placed block's restrictions
* @param mapTile Map tile of the target location
*/
private void checkPlacement(TMXTile mapTile) {
this.sprite.setCurrentTileIndex(0);
this.confirmBlock.setVisible(true);
for (int c = 0; c < spriteColumns; c++) {
for (int r = 0; r < spriteRows; r++) {
final String tileRestriction = this.game.mapRestrictions[mapTile.getTileRow()-r][mapTile.getTileColumn()-c];
Debug.d("Map tile at "+(mapTile.getTileRow()-r)+"x"+(mapTile.getTileColumn()-c)+" has restriction class: " + tileRestriction);
if (this.game.placedSprites[mapTile.getTileColumn()-c][mapTile.getTileRow()-r] != null &&
this.game.placedSprites[mapTile.getTileColumn()-c][mapTile.getTileRow()-r] != this.sprite) {
this.sprite.setCurrentTileIndex(1);
this.confirmBlock.setVisible(false);
} else if (tileRestriction != null && (this.restriction == null || !this.restriction.equals(tileRestriction))) {
this.sprite.setCurrentTileIndex(1);
this.confirmBlock.setVisible(false);
} else if (tileRestriction == null && (this.restriction != null)) {
this.sprite.setCurrentTileIndex(1);
this.confirmBlock.setVisible(false);
}
}
}
}
示例8: restart
import org.andengine.util.debug.Debug; //导入依赖的package包/类
public void restart(Context context) {
Debug.d("Loading word builder queue");
Filter queueBuilders = new Filter();
queueBuilders.is("tile", this);
this.buildQueue = WordBuilder.objects(PhoeniciaContext.context).filter(queueBuilders).toList();
Debug.d("Restarting active word builder for tile: "+this.word.name);
WordBuilder activeBuilder = this.getActiveBuilder(context);
if (activeBuilder != null) {
Debug.d("Restarting active word builder: " + activeBuilder.getId());
this.setActiveBuilder(activeBuilder);
} else {
Debug.d("No active builder found, moving on to the next one");
this.isActive = false;
this.next();
}
this.checkAttention();
}
示例9: reset
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Restart the build progress for this tile
* @param context ApplicationContext ApplicationContext for use in database calls
*/
public void reset(Context context) {
if (this.sprite != null) {
this.sprite.setProgress(0, word.construct);
}
WordTileBuilder builder = this.getBuilder(context);
if (builder != null) {
Debug.d("Resetting WordTile builder");
builder.progress.set(0);
builder.start();
builder.save(context);
this.phoeniciaGame.addBuilder(builder);
} else {
Debug.e("Could not reset WordTile builder, because it was missing");
}
}
示例10: newForRequest
import org.andengine.util.debug.Debug; //导入依赖的package包/类
public static Gift newForRequest(final GameSession game, final int requestCode) {
Debug.d("Generating Gift from request code: " + requestCode);
Gift newGift = new Gift();
newGift.game.set(game);
newGift.requestCode.set(requestCode);
GiftRequest request = GiftRequest.fromRequestCode(requestCode);
newGift.requestType.set(request.itemType.get());
newGift.requestItem.set(request.itemIndex.get());
int requestKey = request.checkKey.get();
int responseKey = (int)Math.round(Math.random() * 99);
Debug.d("Generating Gift with response key: "+responseKey);
int code = requestCode % 10000;// **0000 - **9999
code = GiftRequest.encode(responseKey, code);
code += responseKey * 10000;// 00**** - 99****
newGift.responseCode.set(code);
Debug.d("Generating Gift with response code: "+code);
Date now = new Date();
newGift.sent.set((double) now.getTime());
return newGift;
}
示例11: fulfillRequest
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Mark a given request as having been fulfilled, and at the same time subtract the requested
* items from the player's inventory, and credit the player for the coins and experience points
* offered in the request
* @param request
*/
public void fulfillRequest(MarketRequest request) {
Debug.d("Completing sale to " + request.person_name.get());
for (RequestItem item : request.getItems(PhoeniciaContext.context)) {
try {
Inventory.getInstance().subtract(item.item_name.get(), item.quantity.get());
} catch (Exception e) {
Debug.e("Failed to subtract inventory item "+item.item_name.get()+" while completing sale");
return;
}
}
Bank.getInstance().credit(request.coins.get());
this.game.session.addExperience(request.points.get());
request.status.set(MarketRequest.FULFILLED);
request.save(PhoeniciaContext.context);
this.requestFulfilled(request);
}
示例12: onClick
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Called when the Sprite for the tile has been clicked by the player
* @param buttonSprite
* @param v
* @param v2
*/
public void onClick(MapBlockSprite buttonSprite, float v, float v2) {
if (this.item_type.get().equals("inventory")) {
if (phoeniciaGame.locale.isLevelReached(phoeniciaGame.locale.inventoryBlock.level, phoeniciaGame.getCurrentLevel())) {
phoeniciaGame.hudManager.showInventory();
} else {
this.showLevelLock(phoeniciaGame.locale.inventoryBlock.level);
}
} else if (this.item_type.get().equals("market")) {
if (phoeniciaGame.locale.isLevelReached(phoeniciaGame.locale.marketBlock.level, phoeniciaGame.getCurrentLevel())) {
phoeniciaGame.hudManager.showMarket();
} else {
this.showLevelLock(phoeniciaGame.locale.marketBlock.level);
}
} else if (this.item_type.get().equals("workshop")) {
if (phoeniciaGame.locale.isLevelReached(phoeniciaGame.locale.workshopBlock.level, phoeniciaGame.getCurrentLevel())) {
phoeniciaGame.hudManager.showWorkshop(this);
} else {
this.showLevelLock(phoeniciaGame.locale.workshopBlock.level);
}
} else {
Debug.e("Unknown default block: "+this.item_type.get());
}
}
示例13: loadLocaleGames
import org.andengine.util.debug.Debug; //导入依赖的package包/类
private void loadLocaleGames() throws IOException {
List<Game> blockGames = locale.games;
try {
// Load game assets
for (int i = 0; i < blockGames.size(); i++) {
Game game = blockGames.get(i);
Debug.d("Loading game sprite texture from " + game.sprite_texture);
final AssetBitmapTexture gameSpriteTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, game.sprite_texture);
gameSpriteTexture.load();
this.gameTextures.put(game, gameSpriteTexture);
this.gameSprites.put(game, TextureRegionFactory.extractTiledFromTexture(gameSpriteTexture, 0, 0, GAME_SPRITE_WIDTH * GAME_SPRITE_COLS, GAME_SPRITE_HEIGHT * GAME_SPRITE_ROWS, GAME_SPRITE_COLS, GAME_SPRITE_ROWS));
Debug.d("Loading game block texture from " + game.block_texture);
final AssetBitmapTexture gameTexture = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, game.block_texture);
gameTexture.load();
int[] gameTileSize = GameTextures.calculateTileSize(game.columns, game.rows, game.height);
Debug.d("Word "+game.name+" has size "+game.columns+"x"+game.rows+" and sprite size "+gameTileSize[0]+"x"+gameTileSize[1]);
this.gameBlocks.put(game, TextureRegionFactory.extractTiledFromTexture(gameTexture, 0, 0, gameTileSize[0] * GAME_TEXTURE_COLS, gameTileSize[1] * GAME_TEXTURE_ROWS, GAME_TEXTURE_COLS, GAME_TEXTURE_ROWS));
}
} catch (final IOException e)
{
e.printStackTrace();
throw e;
}
}
示例14: subtract
import org.andengine.util.debug.Debug; //导入依赖的package包/类
/**
* Decrement the quantity of an InventoryItem.
*
* Throws an exception if there are no items matching this name in the player's inventory
* /TODO: Properly handle cases when subtracting an item isn't allowed
* @param inventory_id name of the InventoryItem
* @return the new quantity of this item
*/
public int subtract(final String inventory_id, final int quantity) throws Exception {
Debug.d("Subtracting item: " + inventory_id);
final Filter filter = new Filter();
filter.is("item_name", inventory_id);
try {
InventoryItem item = InventoryItem.objects(PhoeniciaContext.context).filter(this.session.filter).filter(filter).toList().get(0);
if (item != null) {
final int count = item.quantity.get() - quantity;
item.quantity.set(count);
item.save(PhoeniciaContext.context);
this.inventoryUpdated(item);
return count;
}
} catch (IndexOutOfBoundsException e) {
throw new Exception("Can not subtract item "+inventory_id+" from inventory because it has none");
}
return 0;
}
示例15: showDeleteConfirm
import org.andengine.util.debug.Debug; //导入依赖的package包/类
public void showDeleteConfirm(final SessionSprite sessionSprite) {
final Scene scene = this;
Dialog confirmDelete = new Dialog(400, 200, Dialog.Buttons.YES_NO, PhoeniciaContext.vboManager, new Dialog.DialogListener() {
@Override
public void onDialogButtonClicked(Dialog dialog, Dialog.DialogButton dialogButton) {
if (dialogButton == Dialog.DialogButton.YES) {
Debug.d("Delete session");
deleteSession(sessionSprite);
} else {
Debug.d("Don't delete session");
}
dialog.close();
scene.unregisterTouchArea(dialog);
}
});
confirmDelete.attachChild(new Text(200, 150, GameFonts.dialogText(), "Delete saved game?", 18, new TextOptions(HorizontalAlign.CENTER), PhoeniciaContext.vboManager));
scene.registerTouchArea(confirmDelete);
confirmDelete.open(scene);
}