本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Container类的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Container类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CampPanel
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
public CampPanel(GameState gameState, CampPanelStyle style) {
super(Strings.getString(UIManager.STRING_TABLE, "campHeading"), style);
this.gameState = gameState;
this.style = style;
tooltip = new SimpleTooltip(style.tooltipStyle);
addListener(this);
hunterSelect = new ModalEnabledSelectBox<GameCharacter>(style.hunterSelectStyle);
hunterSelect.setName(HUNTER_SELECT);
waterSelect = new ModalEnabledSelectBox<GameCharacter>(style.waterSelectStyle);
waterSelect.setName(WATER_SELECT);
food = new Label("", style.textStyle);
food.setAlignment(Align.center);
water = new Label("", style.textStyle);
water.setAlignment(Align.center);
pcSelects = new Container<Table>();
pcSelects.setBackground(style.buttonBackground);
}
示例2: processForActor
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value verticalValue = LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padTop(verticalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padTop(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padTop(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padTop(LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
示例3: processForActor
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value horizontalValue = LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padLeft(horizontalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padLeft(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padLeft(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padLeft(LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
示例4: processForActor
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value horizontalValue = LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padRight(horizontalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padRight(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padRight(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padRight(LmlUtilities.parseHorizontalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
示例5: processForActor
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
@Override
protected void processForActor(final LmlParser parser, final LmlTag tag, final Actor actor,
final String rawAttributeData) {
// Parsed if actor is not in a cell:
if (actor instanceof Table) {
final Value verticalValue = LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor,
rawAttributeData);
((Table) actor).padBottom(verticalValue);
} else if (actor instanceof VerticalGroup) {
((VerticalGroup) actor).padBottom(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof HorizontalGroup) {
((HorizontalGroup) actor).padBottom(parser.parseFloat(rawAttributeData, actor));
} else if (actor instanceof Container<?>) {
((Container<?>) actor)
.padBottom(LmlUtilities.parseVerticalValue(parser, tag.getParent(), actor, rawAttributeData));
} else {
// Exception:
super.processForActor(parser, tag, actor, rawAttributeData);
}
}
示例6: TabPanel
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
public TabPanel(Skin skin) {
super(skin);
this.skin = skin;
buttonGroup = new ButtonGroup<Button>();
header = new HorizontalGroup();
body = new Container<Actor>();
tabs = new ArrayList<Tab>();
buttonGroup.setMaxCheckCount(1);
buttonGroup.setMinCheckCount(1);
buttonGroup.setUncheckLast(true);
header.wrap(true);
header.rowAlign(Align.left);
add(header).expandX().fillX().left();
row();
add(body).expand().fill();
body.fill();
}
示例7: addTab
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
/**
* Registers a new tab with the given icon and the target actor
*
* @param id
* tab id
* @param icon
* tab icon to show
* @param actor
* Content actor
*/
public void addTab(String id, String iconId, Actor content) {
if (!id.isEmpty() && !tabs.containsKey(id)) {
final Tab tab = new Tab(id, content, generateTabStyle(iconId, false), generateTabStyle(iconId, true));
tabs.put(id, tab);
tabGroup.addActor(tab);
Container<?> padding = new Container<Actor>();
padding.height(15f);
tabGroup.addActor(padding);
setTab(id);
tab.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
if (activeTabId != tab.getId()) {
SoundUtils.play(Assets.SND_TAB, 0.7f, 0.9f);
}
setTab(tab.getId());
}
});
}
}
示例8: addCategoryLabel
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
private void addCategoryLabel() {
int toFill = columns - gallery.getGrid().getChildren().size % columns;
for (int i = 0; i < toFill; i++) {
gallery.addSpace();
}
CategoryButton aux = categories.get(count);
Label cat = new Label(aux.getButtonText(), skin,
SkinConstants.STYLE_BIG);
gallery.addOriginal(cat);
gallery.addSpace();
Container<TextButton> more = new Container<TextButton>();
TextButton button = new TextButton(i18N.m("more").toUpperCase(), skin,
SkinConstants.STYLE_CATEGORY);
Color color = aux.getColor();
color.a = 1;
button.setColor(color);
more.setActor(button);
for (EventListener listener : aux.getListeners()) {
button.addListener(listener);
}
more.right();
gallery.addOriginal(more);
}
示例9: GroupEditor
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
public GroupEditor(GroupEditorStyle style) {
this.style = style;
layersTouched = new Array<Actor>();
layerSelector = new LayerSelector(this, style);
selectionGroup = new SelectionGroup(this, style);
addActor(sceneContainer = new AbstractWidget());
sceneBackground = new Container();
sceneBackground.setBackground(style.groupBackground);
sceneContainer.addActor(sceneBackground);
sceneContainer.addActor(selectionGroup);
TouchRepresentation touchRepresentation = new TouchRepresentation(
style.touch);
addActor(touchRepresentation);
addListener(touchRepresentation);
}
示例10: initLabel
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
private void initLabel(){
text = new Label(LevelMap.getLevel().getEnergyNumber() + "/" + LevelMap.getLevel().getMaxEnergy(),
FontLoader.generateStyle(26, Color.BLACK));
Container l = new Container(text);
l.setPosition(energyBar.getX() + energyBar.getWidth()/2,
energyBar.getY() + energyBar.getHeight()/2);
l.setTransform(true);
l.addAction(Actions.rotateTo(90));
addActor(l);
}
示例11: init
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
public void init (ProgressDialogSettings settings, final ProgressDialogCallback callback) {
clearChildren();
ProgressDialogStyle style = (ProgressDialogStyle) getStyle();
setTitle(settings.header);
current.setText(Float.toString(settings.start));
progressBar.setRange(settings.start, settings.end);
progressBar.setValue(settings.start);
add(new Label(Float.toString(settings.start), style.textStyle));
add(progressBar).fill().prefWidth(style.barWidth).prefHeight(style.barHeight);
add(new Label(Float.toString(settings.end), style.textStyle));
row();
add(current).colspan(3).center();
row();
if (settings.text != null) {
textLabel.setText(settings.text);
add(textLabel).colspan(3).center();
row();
}
if (settings.canCancel) {
Container<TextButtonWithSound> buttonsContainer = new Container<TextButtonWithSound>();
TextButtonWithSound button = new TextButtonWithSound(Strings.getString(UIManager.STRING_TABLE, "cancel"), style.cancelButtonStyle);
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
callback.onCancelled((int)progressBar.getValue());
UIManager.hideProgressDialog();
}
});
buttonsContainer.setActor(button);
buttonsContainer.fill().width(style.cancelButtonWidth).height(style.cancelButtonHeight);
add(buttonsContainer).center().colspan(3);
}
pack();
}
示例12: buildButtons
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
private Actor buildButtons() {
Table buttonTable = new Table();
addButton(buttonTable, Strings.getString(UIManager.STRING_TABLE, "campGatherButton"), style.gatherButtonStyle, GATHER);
addButton(buttonTable, Strings.getString(UIManager.STRING_TABLE, "campSleepButton"), style.sleepButtonStyle, SLEEP);
addButton(buttonTable, Strings.getString(UIManager.STRING_TABLE, "campPackupButton"), style.packUpButtonStyle, PACKUP);
Container<Table> buttonsContainer = new Container<Table>();
buttonsContainer.setBackground(style.buttonBackground);
buttonsContainer.setActor(buttonTable);
return buttonsContainer;
}
示例13: process
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final MenuItem actor, final String rawAttributeData) {
Image image = new Image(parser.getData().getDefaultSkin().getDrawable(rawAttributeData));
Container<Image> imageContainer = new Container<>(image);
imageContainer.setFillParent(true);
imageContainer.align(Align.left);
imageContainer.padLeft(25f);
actor.addActor(imageContainer);
}
示例14: showLogWindow
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
public void showLogWindow() {
final String log = node.getLog();
if (Strings.isEmpty(log)) return;
VisDialog dialog = (VisDialog)App.inst().getInterfaceService().getParser().parseTemplate(Gdx.files.internal("lml/dialogPackingLog.lml")).first();
Container containerLog = dialog.findActor("containerLog");
final VisScrollPane scrLog = dialog.findActor("scrLog");
final Button btnCopyToClipboard = dialog.findActor("btnCopyToClipboard");
VisLabel lblLog = new VisLabel("", "small") {
// @Override
// protected void sizeChanged() {
// super.sizeChanged();
// // Scroll down scroller
// scrLog.setScrollPercentY(1f);
// }
};
lblLog.setAlignment(Align.topLeft);
lblLog.setWrap(true);
lblLog.setText(log);
containerLog.setActor(lblLog);
btnCopyToClipboard.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Gdx.app.getClipboard().setContents(log);
}
});
dialog.getTitleLabel().setText(App.inst().getI18n().format("dialogTitlePackLog", node.getPack().getName()));
dialog.show(getStage());
getStage().setScrollFocus(scrLog);
}
示例15: processList
import com.badlogic.gdx.scenes.scene2d.ui.Container; //导入依赖的package包/类
@Override
public void processList(final List<RemoteScore> scoresList) {
Gdx.app.debug("FillTableProcessor", "Begin process");
if (scoresList.size() > 1){
// Sort remote score list
Gdx.app.debug("FillTableProcessor", "Sort collection");
// Use comparator to sort with descending order
Collections.sort(scoresList, new Comparator<RemoteScore>() {
@Override
public int compare(RemoteScore o1, RemoteScore o2) {
return o2.compareTo(o1);
};
});
// Post runnable to synchronize update with rendering
Gdx.app.debug("FillTableProcessor", "Send postRunnable");
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
int rangIncremeter = 1;
for (RemoteScore remoteScore : scoresList) {
scoreTable.row();
scoreTable.add(new Container<Label>(new Label("" + rangIncremeter++, skin)));
scoreTable.add(new Container<Label>(new Label(remoteScore.getPlayerName(), skin)));
scoreTable.add(new Container<Label>(new Label(remoteScore.getFormatedPlayDate(), skin)));
scoreTable.add(new Container<Label>(new Label("" + remoteScore.getScore(), skin)));
Label seedLabel = new Label("" + remoteScore.getSeed(), skin);
if (confirmSeedDialog != null)
seedLabel.addListener(new ShowSeedPlayGameDialogListener(confirmSeedDialog, remoteScore.getSeed()));
scoreTable.add(new Container<Label>(seedLabel));
}
}
});
}
}