本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Cell类的典型用法代码示例。如果您正苦于以下问题:Java Cell类的具体用法?Java Cell怎么用?Java Cell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Cell类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addHorizontalGroup
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的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.scenes.scene2d.ui.Cell; //导入依赖的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.scenes.scene2d.ui.Cell; //导入依赖的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.scenes.scene2d.ui.Cell; //导入依赖的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.scenes.scene2d.ui.Cell; //导入依赖的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.scenes.scene2d.ui.Cell; //导入依赖的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: initialize
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
@Override protected void initialize() {
Table table = new Table(Config.skin);
table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background"));
label = new LocLabel("", DieMessageWindow.ACTIVE);
label.setWrap(true);
label.setAlignment(Align.center);
table.setTouchable(Touchable.disabled);
Label tapToContinue = new LocLabel("tap-to-continue", DieMessageWindow.INACTIVE);
tapToContinue.setWrap(true);
tapToContinue.setAlignment(Align.center);
if (image != null) {
image.setTouchable(Touchable.disabled);
table.add(image).padTop(-15 - dy).row();
}
final Cell<LocLabel> cell = table.add(label).width(100);
if (forceLabelHeight) cell.height(labelHeight);
cell.row();
table.add(new Image(Config.skin, "ui-tutorial-window-line")).padTop(4).row();
table.add(tapToContinue).width(80).row();
this.table.add(table);
}
示例8: getInventory
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
public static Array<InventoryItemLocation> getInventory(Table targetTable){
Array<Cell> cells = targetTable.getCells();
Array<InventoryItemLocation> items = new Array<InventoryItemLocation>();
for(int i = 0; i < cells.size; i++){
InventorySlot inventorySlot = ((InventorySlot)cells.get(i).getActor());
if( inventorySlot == null ) continue;
int numItems = inventorySlot.getNumItems();
if( numItems > 0 ){
items.add(new InventoryItemLocation(
i,
inventorySlot.getTopInventoryItem().getItemTypeID().toString(),
numItems,
inventorySlot.getTopInventoryItem().getName()));
}
}
return items;
}
示例9: getInventoryFiltered
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
public static Array<InventoryItemLocation> getInventoryFiltered(Table targetTable, String filterOutName){
Array<Cell> cells = targetTable.getCells();
Array<InventoryItemLocation> items = new Array<InventoryItemLocation>();
for(int i = 0; i < cells.size; i++){
InventorySlot inventorySlot = ((InventorySlot)cells.get(i).getActor());
if( inventorySlot == null ) continue;
int numItems = inventorySlot.getNumItems();
if( numItems > 0 ){
String topItemName = inventorySlot.getTopInventoryItem().getName();
if( topItemName.equalsIgnoreCase(filterOutName)) continue;
//System.out.println("[i] " + i + " itemtype: " + inventorySlot.getTopInventoryItem().getItemTypeID().toString() + " numItems " + numItems);
items.add(new InventoryItemLocation(
i,
inventorySlot.getTopInventoryItem().getItemTypeID().toString(),
numItems,
inventorySlot.getTopInventoryItem().getName()));
}
}
return items;
}
示例10: doesInventoryHaveSpace
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
public boolean doesInventoryHaveSpace(){
Array<Cell> sourceCells = inventorySlotTable.getCells();
int index = 0;
for (; index < sourceCells.size; index++) {
InventorySlot inventorySlot = ((InventorySlot) sourceCells.get(index).getActor());
if (inventorySlot == null) continue;
int numItems = inventorySlot.getNumItems();
if (numItems == 0) {
return true;
}else{
index++;
}
}
return false;
}
示例11: addEntityToInventory
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
public void addEntityToInventory(Role entity, String itemName){
Array<Cell> sourceCells = inventorySlotTable.getCells();
int index = 0;
for (; index < sourceCells.size; index++) {
InventorySlot inventorySlot = ((InventorySlot) sourceCells.get(index).getActor());
if (inventorySlot == null) continue;
int numItems = inventorySlot.getNumItems();
if (numItems == 0) {
InventoryItem inventoryItem = InventoryItemFactory.getInstance().getInventoryItem(InventoryItem.ItemTypeID.valueOf(entity.getItemTypeID()));
inventoryItem.setName(itemName);
inventorySlot.add(inventoryItem);
dragAndDrop.addSource(new InventorySlotSource(inventorySlot, dragAndDrop));
break;
}
}
}
示例12: addLine
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
/**
* Adds a new line of text to the tooltip.
*
* This will create a new label, add it as new row
* to the tooltip and then return it.
*
* The created label will use the supplied style.
*
* If the supplied text is empty or null, this will return null;
*
* @param newText
* @return
*/
public Label addLine(CharSequence newText, LabelStyle style) {
if (newText == null || newText.length() < 1) {
return null;
}
Label label = newLabel(newText, style);
Cell<?> cell = add(label).prefWidth(this.style.width).fill().align(Align.left).padLeft(this.style.padLeft).padRight(this.style.padRight).padTop(getRows() == 0 ? this.style.padTop : 0).padBottom(this.style.padBottom);
row();
if (getRows() > 1) {
getCells().get(getRows()-2).padBottom(0);
}
pack();
cell.width(label.getGlyphLayout().width);
invalidateHierarchy();
this.pack();
return label;
}
示例13: logMessage
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
/**
* Adds a new line of text to the log panel.
*
* This will create a new label and add it as new row
* to the log panel.
*
* The created label will use the supplied color.
*
* @param newText
* @return
*/
public void logMessage(String text, Color color, boolean logTime) {
Label label = newLabel(text, "logLabel");
if (!logTime) {
messages.add(label).fillX().expandX().align(Align.left).padLeft(10).top();
} else {
Table table = new Table();
table.add(new Label(GameState.getCurrentGameDate().toString(false), style.textStyle)).top();
table.add(label).padLeft(10).fillX().expandX().top();
messages.add(table).fillX().expandX().align(Align.left).padLeft(10).top();
}
messages.row();
label.setColor(color);
srollPane.layout();
srollPane.setScrollY(srollPane.getMaxY());
if (messages.getCells().size > Configuration.getMaxMessagesInLog()) {
@SuppressWarnings("rawtypes")
Cell cell = messages.getCells().removeIndex(0);
if (cell.getActor() != null) {
messages.removeActor((Actor) cell.getActor());
}
cell.clearActor();
}
}
示例14: populateCraftableItems
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
private void populateCraftableItems(ItemCategory category) {
craftingTable.clear();
currentCategory = category;
itemNameLabel.setText("");
itemInfoLabel.setText("");
Array<CraftingRecipe> recipes = CraftingRecipes.getInstance().getCraftableItems(category);
int y = 0;
for (int i = 0; i < recipes.size; i++) {
ItemStack stack = recipes.get(i).getCraftedItemStack();
ItemBox box = new ItemBox(stack, String.valueOf(i));
Cell<Table> cell = craftingTable.add((Table) box).width(60).height(60).padRight(10).padBottom(10);
if (i % MAX_TABLE_WIDTH == 0) {
cell.padLeft(10);
}
if (y == 0) {
cell.padTop(10);
}
if ((i + 1) % MAX_TABLE_WIDTH == 0) {
craftingTable.row();
y++;
}
}
}
示例15: process
import com.badlogic.gdx.scenes.scene2d.ui.Cell; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
VisLabel lblText = new VisLabel(parser.parseString(rawAttributeData, actor));
lblText.setAlignment(Align.center);
boolean needLineWrap = lblText.getPrefWidth() > LINE_WRAP_THRESHOLD;
if (needLineWrap) {
lblText.setWrap(true);
}
final Tooltip tooltip = new Tooltip();
tooltip.clearChildren(); // Removing empty cell with predefined paddings.
Cell<VisLabel> tooltipCell = tooltip.add(lblText).center().pad(0f, 4f, 2f, 4f);
if (needLineWrap) { tooltipCell.width(LINE_WRAP_THRESHOLD); }
tooltip.pack();
tooltip.setTarget(actor);
}