当前位置: 首页>>代码示例>>Java>>正文


Java Cell类代码示例

本文整理汇总了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);
	
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:22,代码来源:JXmlUi.java

示例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);		
	}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:21,代码来源:JXmlUi.java

示例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);
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:21,代码来源:JXmlUi.java

示例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);
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:20,代码来源:JXmlUi.java

示例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);
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:26,代码来源:JXmlUi.java

示例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);
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:24,代码来源:JXmlUi.java

示例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);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:27,代码来源:TutorialMessageWindow.java

示例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;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:18,代码来源:InventoryUI.java

示例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;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:21,代码来源:InventoryUI.java

示例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;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:17,代码来源:InventoryUI.java

示例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;
            }
        }
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:18,代码来源:InventoryUI.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:30,代码来源:CompositeTooltip.java

示例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();
		
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:37,代码来源:LogPanel.java

示例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++;
		}
	}
}
 
开发者ID:jmrapp1,项目名称:TerraLegion,代码行数:26,代码来源:CraftingScreen.java

示例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);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:17,代码来源:TooltipLmlAttribute.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Cell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。