本文整理汇总了Java中com.badlogic.gdx.utils.ObjectMap.keys方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectMap.keys方法的具体用法?Java ObjectMap.keys怎么用?Java ObjectMap.keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.ObjectMap
的用法示例。
在下文中一共展示了ObjectMap.keys方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHorizontalGroup
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addHorizontalGroup(Table table, Element element) {
Table horizontalGroup = new Table();
ScrollPane scrollPane = new ScrollPane(horizontalGroup, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null) {
atrributes = new ObjectMap<String, String>();
}
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
horizontalGroup.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
addChildrens(element, horizontalGroup);
actorsMap.put(horizontalGroup.getName(), horizontalGroup);
}
示例2: addVerticalGroup
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addVerticalGroup(Table table, Element element) {
VerticalGroup verticalGroup = new VerticalGroup();
ScrollPane scrollPane = new ScrollPane(verticalGroup, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null) {
atrributes = new ObjectMap<String, String>();
}
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
verticalGroup.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
// addChildrens(element, horizontalGroup);
actorsMap.put(verticalGroup.getName(), verticalGroup);
}
示例3: addScrollPanel
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addScrollPanel(Table table, Element element) {
Table tableScroll = new Table(skin);
ScrollPane scrollPane = new ScrollPane(tableScroll, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null) {
atrributes = new ObjectMap<String, String>();
}
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
tableScroll.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
addChildrens(element, tableScroll);
actorsMap.put(tableScroll.getName(), tableScroll);
}
示例4: addTable
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addTable(Table table, Element element) {
Table newTable = new Table(skin);
parseTable(element, newTable);
Cell<Table> cell = table.add(newTable);
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null) {
atrributes = new ObjectMap<String, String>();
}
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
newTable.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
addChildrens(element, newTable);
actorsMap.put(newTable.getName(), newTable);
}
示例5: addList
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addList(Table table, Element element) {
Gdx.app.log("JXmlUi", "addList");
ObjectMap<String, String> atrributes = element.getAttributes();
if (atrributes == null)
atrributes = new ObjectMap<String, String>();
List<String> list = new List<String>(skin);
list.getSelection().setMultiple(false);
ScrollPane scrollPane = new ScrollPane(list, skin);
Cell<ScrollPane> cell = table.add(scrollPane);
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
list.setName(atrributes.get(key));
scrollPane.setName(atrributes.get(key) + "-scroll-panel");
}
}
cellPrepare(cell, atrributes);
actorsMap.put(list.getName(), list);
actorsMap.put(scrollPane.getName(), scrollPane);
addElementsInList(element, list);
}
示例6: addButton
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addButton(Table table, Element element) {
TextButton button = new TextButton("", skin);
Cell<TextButton> cell = table.add(button);
ObjectMap<String, String> atrributes = element.getAttributes();
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("text")) {
button.setText(atrributes.get(key));
} else if (key.equalsIgnoreCase("checked")) {
button.setChecked(Boolean.parseBoolean(atrributes.get(key)));
} else if (key.equalsIgnoreCase("visible")) {
button.setVisible(Boolean.parseBoolean(atrributes.get(key)));
} else if (key.equalsIgnoreCase("enable")) {
button.setDisabled(!Boolean.parseBoolean(atrributes.get(key)));
} else if (key.equalsIgnoreCase("name")) {
button.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
// System.out.println("Dodaje button: " + button.getName());
actorsMap.put(button.getName(), button);
}
示例7: loadSpriteSheets
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
* Loads spritesheets found within the given root
* directory and its subfolders into this
* {@link SpriteSheetManager}.
*
* @param rootDirectory the root directory to search in
*/
public void loadSpriteSheets(File rootDirectory) {
log.info("Loading spritesheet assets from directory " + rootDirectory.getAbsolutePath());
ObjectMap<String, File> files = FileUtil.loadWithIdentifiers(rootDirectory, file -> {
return file.getName().endsWith(".spritesheet");
});
for (String key : files.keys()) {
File targetFile = files.get(key);
try {
this.sheets.put(key,
new PackagedSpriteSheetFactory(key, renderer, new ZipFile(targetFile)));
log.info(
"Loaded packaged spritesheet " + targetFile.getName() + " under key " + key);
} catch (Exception e) {
String message = "Could not load spritesheet at spritesheet file "
+ targetFile.getAbsolutePath();
if (e instanceof ZipException)
message += " (bad spritesheet file/format)";
log.error(message, e);
}
}
log.info(this.sheets.size + " spritesheet(s) loaded.");
}
示例8: getEffectsAsString
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
* Gets the effects of this Perk as a human
* readable string.
*
* This does not include any modifiers
* associated with this Perk.
*
* @return null if there are no associated effects, the string otherwise
*/
public static String getEffectsAsString(EffectContainer ec, Object user) {
ObjectMap<Effect, Array<EffectParameter>> effects = ec.getEffects();
if (effects.size == 0) {
return null;
}
StringBuilder fsb = StringUtil.getFSB();
int i = 0;
for (Effect effect : effects.keys()) {
String desc = effect.getDescription(user, effects.get(effect));
if (desc == null) {
continue;
}
if (i > 0) {
fsb.append("\n");
}
fsb.append(desc);
++i;
}
String returnValue = fsb.toString();
StringUtil.freeFSB(fsb);
return returnValue;
}
示例9: addImage
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addImage(Table table, Element element) {
Image image = new Image(new Texture(element.get("path")));
Cell<Image> cell = table.add(image);
ObjectMap<String, String> atrributes = element.getAttributes();
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
image.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
actorsMap.put(image.getName(), image);
}
示例10: addLabel
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addLabel(Table table, Element element) {
ObjectMap<String, String> atrributes = element.getAttributes();
Label label = new Label(element.get("text", ""), skin);
Cell<Label> cell = table.add(label);
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
label.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
actorsMap.put(label.getName(), label);
}
示例11: addTextArea
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addTextArea(Table table, Element element) {
ObjectMap<String, String> atrributes = element.getAttributes();
TextArea textArea = new TextArea(element.get("text", ""), skin);
Cell<TextArea> cell = table.add(textArea);
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
textArea.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
actorsMap.put(textArea.getName(), textArea);
}
示例12: addTextField
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
private void addTextField(Table table, Element element) {
ObjectMap<String, String> atrributes = element.getAttributes();
TextField textField = new TextField(element.get("text", ""), skin);
Cell<TextField> cell = table.add(textField);
for (String key : atrributes.keys()) {
if (key.equalsIgnoreCase("name")) {
textField.setName(atrributes.get(key));
}
}
cellPrepare(cell, atrributes);
actorsMap.put(textField.getName(), textField);
}
示例13: loadFonts
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
/**
* Loads fonts found within the given root directory and
* its subfolders into this {@link FontManager}.
*
* @param rootDirectory the root directory to search in
*/
public void loadFonts(File rootDirectory) {
log.info("Loading fonts from directory " + rootDirectory.getAbsolutePath());
ObjectMap<String, File> files = FileUtil.loadWithIdentifiers(rootDirectory, file -> {
return file.getName().endsWith(".font");
});
for (String key : files.keys()) {
File fontFile = files.get(key);
if (key.startsWith("styles.")) {
continue;
}
try {
Font font = new Font(key, this.renderer, new ZipFile(fontFile));
this.fonts.put(key, font);
log.info("Loaded font " + fontFile.getName() + " under key " + key);
} catch (Exception e) {
String message = "Could not load font at font file " + fontFile.getAbsolutePath();
if (e instanceof IOException)
message += " (load error)";
if (e instanceof BadAssetException)
message += " (bad asset: " + e.getMessage() + ")";
if (e instanceof ZipException)
message += " (bad file)";
log.error(message, e);
}
}
log.info(fonts.size + " font(s) loaded.");
}
示例14: executeTargetScript
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public void executeTargetScript(Object user, ObjectMap<String, Object> parameters) {
if (targetScript == null) {
return;
}
Binding context = new Binding();
context.setVariable(Effect.USER, user);
if (parameters != null) {
for (String paramName : parameters.keys()) {
context.setVariable(paramName, parameters.get(paramName));
}
}
targetScript.setBinding(context);
setScriptResult(targetScript.run());
}
示例15: loadFromXML
import com.badlogic.gdx.utils.ObjectMap; //导入方法依赖的package包/类
public void loadFromXML(Element root) {
ObjectMap<String, String> attributes = root.getAttributes();
if (attributes != null) {
for (String statName : attributes.keys()) {
ModifiableStat stat = ModifiableStat.valueOf(statName.toUpperCase(Locale.ENGLISH));
setMod(stat, Float.parseFloat(attributes.get(statName)));
}
}
XMLUtil.readPrimitiveMembers(this, root.getChildByName(XMLUtil.XML_PROPERTIES));
}