本文整理汇总了Java中com.badlogic.gdx.utils.OrderedMap类的典型用法代码示例。如果您正苦于以下问题:Java OrderedMap类的具体用法?Java OrderedMap怎么用?Java OrderedMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OrderedMap类属于com.badlogic.gdx.utils包,在下文中一共展示了OrderedMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@Override
public void read(Json json, JsonValue jsonData) {
try {
colors = json.readValue("colors", Array.class, jsonData);
fonts = json.readValue("fonts", Array.class, jsonData);
classStyleMap = new OrderedMap<>();
for (JsonValue data : jsonData.get("classStyleMap").iterator()) {
classStyleMap.put(ClassReflection.forName(data.name), json.readValue(Array.class, data));
}
for (Array<StyleData> styleDatas : classStyleMap.values()) {
for (StyleData styleData : styleDatas) {
styleData.jsonData = this;
}
}
customClasses = json.readValue("customClasses", Array.class, CustomClass.class, new Array<>(), jsonData);
for (CustomClass customClass : customClasses) {
customClass.setMain(main);
}
} catch (ReflectionException e) {
Gdx.app.log(getClass().getName(), "Error parsing json data during file read", e);
main.getDialogFactory().showDialogError("Error while reading file...", "Error while attempting to read save file.\nPlease ensure that file is not corrupted.\n\nOpen error log?");
}
}
示例2: createNewInstance
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@Override
public InventoryItem createNewInstance() {
UsableItem returnValue = (UsableItem) super.createNewInstance();
returnValue.usesLeft = s_maxUses;
returnValue.useCondition = useCondition;
returnValue.targetType = targetType;
returnValue.targetScript = targetScript;
returnValue.effects = new OrderedMap<Effect, Array<EffectParameter>>();
for (Effect key : effects.keys()) {
Array<EffectParameter> originalParams = effects.get(key);
Array<EffectParameter> newCopyParam = new Array<EffectParameter>();
for (EffectParameter param : originalParams) {
newCopyParam.add(param);
}
returnValue.effects.put(key, newCopyParam);
}
return returnValue;
}
示例3: readJsonObject
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void readJsonObject(JsonObject element, OrderedMap<String, Object> jsonData) {
Entries<String, Object> entries = jsonData.entries();
for (Entry<String, Object> entry : entries) {
if (entry.value instanceof OrderedMap) {
JsonObject obj = new JsonObject();
element.elements.put(entry.key, obj);
// unchecked, but safe:
readJsonObject(obj, (OrderedMap<String, Object>) entry.value);
} else if (entry.value instanceof Array) {
JsonArray arr = new JsonArray();
element.elements.put(entry.key, arr);
// unchecked, but safe:
readJsonArray(arr, (Array<OrderedMap<String, Object>>) entry.value);
} else {
element.values.put(entry.key, entry.value.toString());
}
}
}
示例4: read
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
/***
* Implement Json Serializable
*/
@SuppressWarnings("unchecked")
@Override
public void read(Json json, OrderedMap<String, Object> jsonData)
{
// read basic properties
currentLevelId = json.readValue("currentLevelId", Integer.class, jsonData);
credits = json.readValue("credits", Integer.class, jsonData);
// change Json Hashmap default formatted strings to integers (levelId)
Map<String, Integer> highScores = json.readValue("highScores", HashMap.class, Integer.class, jsonData);
for (String levelIdAsString : highScores.keySet())
{
int levelId = Integer.valueOf(levelIdAsString);
Integer highScore = highScores.get(levelIdAsString);
this.highScores.put(levelId, highScore);
}
// read the playerCharacter
playerCharacter = json.readValue("playerCharacter", PlayerCharacter.class, jsonData);
}
示例5: map
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
private static OrderedMap<String, GenPref> map(GenPref...objects){
OrderedMap<String, GenPref> prefs = new OrderedMap<>();
for(int i = 0; i < objects.length; i ++){
GenPref pref = (GenPref)objects[i];
prefs.put(pref.name, pref);
}
return prefs;
}
示例6: Tilemap
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
Tilemap() {
this.objects = new ObjectMap<>();
this.entrypoints = new ObjectMap<>();
this.tileLayers = new Array<>(true, 16);
this.imageLayers = new Array<>(true, 16);
this.tilesets = new OrderedMap<>();
}
示例7: UIController
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
public UIController(Environment parent, MultiRenderer renderer) {
this.destroyed = false;
this.renderer = renderer;
this.environment = parent;
this.removed = new ObjectSet<>();
this.events = new EventHelper(this);
this.camera = new OrthographicCamera(OverworldController.RENDER_WIDTH,
OverworldController.RENDER_HEIGHT);
this.camera.position.x += OverworldController.RENDER_WIDTH / 2F;
this.camera.position.y += OverworldController.RENDER_HEIGHT / 2F;
this.camera.update();
this.aObj = new OrderedMap<>();
this.bObj = new OrderedMap<>();
}
示例8: Text
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
private Text() {
this.components = new OrderedMap<>();
this.instantiationTime = TimeUtils.millis();
this.stringBounds = new Pair<>(0, 0);
this.spaceTaken = new Pair<>(-1F, -1F);
this.transform = new Transform();
this.m_valuePair = new Pair<>();
this.m_drawnTransform = new Transform();
}
示例9: StyleData
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
public StyleData(StyleData styleData, String styleName, Main main) {
name = styleName;
this.main = main;
clazz = styleData.clazz;
properties = new OrderedMap<>();
for (Entry<String, StyleProperty> entry : styleData.properties.entries()) {
properties.put(entry.key, new StyleProperty(entry.value));
}
deletable = true;
}
示例10: read
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@Override
public void read(Json json, JsonValue jsonData) {
name = jsonData.getString("name");
properties = json.readValue("properties", OrderedMap.class, jsonData);
deletable = jsonData.getBoolean("deletable");
try {
clazz = ClassReflection.forName(jsonData.getString("clazz"));
} catch (ReflectionException ex) {
Gdx.app.error(getClass().toString(), "Error reading from serialized object" , ex);
main.getDialogFactory().showDialogError("Read Error...","Error reading from serialized object.\n\nOpen log?");
}
}
示例11: addAsset
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@Override
protected <T> void addAsset(String fileName, Class<T> type, T asset) {
super.addAsset(fileName, type, asset);
// this is VERY ugly, but a bit more future proof in case of changes in the parent
// than just copying the parent method
ObjectMap<String, RefCountedContainer> typeToAssets = assets.get(type);
if (!(typeToAssets instanceof OrderedMap)) {
RefCountedContainer value = typeToAssets.get(fileName);
typeToAssets = new OrderedMap<String, RefCountedContainer>();
typeToAssets.put(fileName, value);
assets.put(type, typeToAssets);
}
}
示例12: TrapType
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
public TrapType(FileHandle file) throws IOException {
s_id = file.nameWithoutExtension().toLowerCase(Locale.ENGLISH);
s_effects = new OrderedMap<Effect, Array<EffectParameter>>();
s_projectile = null;
s_automaticOnHitAnimation = true;
loadFromXML(file);
}
示例13: loadFromXML
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@Override
public void loadFromXML(FileHandle file) throws IOException {
effects = new OrderedMap<Effect, Array<EffectParameter>>();
super.loadFromXML(file);
if (s_weaponDamageMax < s_weaponDamageMin) {
throw new GdxRuntimeException("Max damage cannot be less than min damage for "+getId());
}
}
示例14: createNewInstance
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
@Override
public InventoryItem createNewInstance() {
Weapon newInstance = (Weapon) super.createNewInstance();
newInstance.effects = new OrderedMap<Effect, Array<EffectParameter>>();
for (Entry<Effect, Array<EffectParameter>> entry : this.effects.entries()) {
newInstance.effects.put(entry.key, entry.value);
}
return newInstance;
}
示例15: Perk
import com.badlogic.gdx.utils.OrderedMap; //导入依赖的package包/类
public Perk(FileHandle file) throws IOException {
s_id = file.nameWithoutExtension().toLowerCase(Locale.ENGLISH);
s_modifiers = new Array<Modifier>();
s_effects = new OrderedMap<Effect, Array<EffectParameter>>();
s_isAttack = false;
s_isActivated = false;
s_automaticOnHitAnimation = true;
projectile = null;
loadFromXML(file);
}