本文整理匯總了Java中com.badlogic.gdx.maps.tiled.TiledMapTileLayer.getProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java TiledMapTileLayer.getProperties方法的具體用法?Java TiledMapTileLayer.getProperties怎麽用?Java TiledMapTileLayer.getProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.maps.tiled.TiledMapTileLayer
的用法示例。
在下文中一共展示了TiledMapTileLayer.getProperties方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TmxMap
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; //導入方法依賴的package包/類
public TmxMap(String levelName) {
map = new TmxMapLoader().load(levelName);
tileLayer = (TiledMapTileLayer) map.getLayers().get(0);
objectsLayer = map.getLayers().get(1);
MapProperties properties = tileLayer.getProperties();
worldType = WorldTypeEnum.valueOf(((String)properties.get(TilemapPropertiesConstants.WORLD)).toUpperCase());
musicTheme = ((String)properties.get("music")).toUpperCase();
String sScrollableTo = (String)properties.get("scrollableTo");
scrollMaxValue = sScrollableTo!=null && !sScrollableTo.equals("") ? Float.parseFloat(sScrollableTo) : 1000;
String sCastle = (String)properties.get("castle");
endLevelCastleType = worldType !=WorldTypeEnum.CASTLE ? sCastle!=null && !sCastle.equals("") ? CastleTypeEnum.valueOf(sCastle.toUpperCase()) : CastleTypeEnum.SMALL : null;
initBlocks(worldType);
initMapObjects();
initBackgrounds(properties);
}
示例2: populateStateMap
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; //導入方法依賴的package包/類
private void populateStateMap(int x, int y, State state, int layerIndex, TiledMapTileLayer layer,
TiledMapConfig config) {
Cell cell = layer.getCell(x, y);
MapProperties layerProperties = layer.getProperties();
boolean collisionLayer = Boolean
.valueOf(layerProperties.get(config.get(Constants.COLLISION), "false", String.class));
CellState cellState = state.getState(x, y, layerIndex);
// Inherit the collision from the previous layer, if and only if
// the current layer is non-collision by default
if (layerIndex > 0 && !collisionLayer && state.getState(x, y, layerIndex - 1).isCollision()) {
cellState.setCollision(true);
} else if (cell != null) {
TiledMapTile tile = cell.getTile();
if (tile != null) {
MapProperties properties = tile.getProperties();
cellState.setProperties(properties);
if (properties.containsKey(Constants.COLLISION)) {
boolean collision = Boolean.valueOf(properties.get(Constants.COLLISION, String.class));
cellState.setCollision(collision);
} else {
cellState.setCollision(DEFAULT_COLLISION);
}
} else {
cellState.setCollision(DEFAULT_COLLISION);
}
} else {
cellState.setCollision(DEFAULT_COLLISION);
}
}
示例3: copyLayerProperties
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; //導入方法依賴的package包/類
public static void copyLayerProperties(TiledMapTileLayer from, TiledMapTileLayer to) {
MapProperties fromP = from.getProperties();
MapProperties toP = to.getProperties();
Iterator<String> it = fromP.getKeys();
while (it.hasNext()) {
String key = it.next();
toP.put(key, fromP.get(key));
}
}
示例4: isInteractableLayer
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; //導入方法依賴的package包/類
/**
* <p>
* Returns true if the layer has a property as listed in
* {@link WorldConstants#interactableLayersProperties}.
* </p>
*
* @param layer
* The layer whose properties are to be checked.
* @return true if the layer validates as an interactable layer, false for
* all other layers.
*/
public static boolean isInteractableLayer(TiledMapTileLayer layer) {
MapProperties props = layer.getProperties();
if (props != null) {
for (String key : WorldConstants.interactableLayersProperties) {
if (props.get(key) != null) {
return true;
}
}
}
return false;
}
示例5: getInteractableLayerType
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; //導入方法依賴的package包/類
public static InteractableLayerTypes getInteractableLayerType(TiledMapTileLayer layer) {
MapProperties props = layer.getProperties();
for (String s : WorldConstants.interactableLayersProperties) {
if (props.get(s) != null) {
return InteractableLayerTypes.fromProperty(s);
}
}
return null;
}
示例6: generateInteractablePlatformEntity
import com.badlogic.gdx.maps.tiled.TiledMapTileLayer; //導入方法依賴的package包/類
protected Entity generateInteractablePlatformEntity(TiledMapTileLayer layer, boolean mirrored, float xOffset,
float yOffset) {
Entity e = world.createEntity();
MapProperties properties = layer.getProperties();
Rectangle platformRect = calculatePlatformRect(layer);
if (platformRect == null) {
Gdx.app.debug("LOAD_LEVEL", "Couldn't create platform rect for layer " + layer);
return null;
}
Texture texture = null;
int platSize = 0;
PlatformSpriteOrientation orientation = PlatformSpriteOrientation.NONE;
if (platformRect.height == 1.0f) { // if height is 1 tile
texture = generateHorizontalPlatformTexture((int) platformRect.width);
platSize = (int) platformRect.width;
orientation = PlatformSpriteOrientation.HORIZONTAL;
} else if (platformRect.width == 1.0f) {
texture = generateVerticalPlatformTexture((int) platformRect.height);
platSize = (int) platformRect.height;
orientation = PlatformSpriteOrientation.VERTICAL;
}
Position position = world.createComponent(Position.class);
position.position.x = platformRect.x + xOffset;
position.position.y = platformRect.y + yOffset;
PlatformSprite platformSprite = world.createComponent(PlatformSprite.class);
platformSprite.setTexture(texture);
platformSprite.mirrored = mirrored;
platformSprite.spriteWidth = texture.getWidth();
platformSprite.spriteHeight = texture.getHeight();
platformSprite.size = platSize;
platformSprite.orientation = orientation;
platformSprite.rectangle = new Rectangle(platformRect);
platformSprite.rectangle.width *= PLATFORM_TILE_WIDTH;
platformSprite.rectangle.height *= PLATFORM_TILE_HEIGHT;
e.addComponent(position);
e.addComponent(platformSprite);
e.addComponent(world.createComponent(PlatformInputListener.class));
if (properties.get("dx") != null) {
DxLayer dxLayer = world.createComponent(DxLayer.class);
dxLayer.fromTiledProperties(properties);
dxLayer.layer = layer;
e.addComponent(dxLayer);
} else if (properties.get("dy") != null) {
DyLayer dyLayer = world.createComponent(DyLayer.class);
dyLayer.fromTiledProperties(properties);
dyLayer.layer = layer;
e.addComponent(dyLayer);
} else if (properties.get("minOpacity") != null) {
Opacity opacity = world.createComponent(Opacity.class);
opacity.opacity = layer.getOpacity();
FadableLayer fadableLayer = world.createComponent(FadableLayer.class);
fadableLayer.layer = layer;
fadableLayer.setupOpacity(opacity, layer.getOpacity(), properties);
e.addComponent(opacity);
e.addComponent(fadableLayer);
}
Solid solid = world.createComponent(Solid.class);
solid.boundingBox = platformSprite.rectangle;
solid.invertedGravity = false;
solid.weight = 100.0f;
e.addToWorld();
e.disable();
return e;
}