Java源码示例:com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup
示例1
@Override
public void process(LmlParser parser, LmlTag tag, VerticalGroup actor, String rawAttributeData) {
boolean grow = parser.parseBoolean(rawAttributeData);
if (grow) {
actor.expand(true);
actor.fill(1.0f);
} else {
actor.expand(false);
actor.fill(0.0f);
}
}
示例2
@Override
public Class<VerticalGroup> getHandledType() {
return VerticalGroup.class;
}
示例3
@Override
public void process(LmlParser parser, LmlTag tag, VerticalGroup actor, String rawAttributeData) {
actor.wrap(parser.parseBoolean(rawAttributeData));
}
示例4
@Override
public Class<VerticalGroup> getHandledType() {
return VerticalGroup.class;
}
示例5
@Override
public Class<VerticalGroup> getHandledType() {
return VerticalGroup.class;
}
示例6
@Override
public void process(LmlParser parser, LmlTag tag, VerticalGroup actor, String rawAttributeData) {
actor.expand(parser.parseBoolean(rawAttributeData));
}
示例7
/**
* Renders the HUD.
*
* @param main Instance of Main class
* @param batch The sprite batch to use (set in PlayScreen)
*/
public HudRenderer(Main main, SpriteBatch batch) {
this.main = main;
viewport = new FitViewport(960, 540, new OrthographicCamera());
stage = new Stage(viewport, batch);
player = WorldManager.player;
playerDetails = ComponentMappers.player.get(player);
playerAttributes = ComponentMappers.attributes.get(player);
playerPosition = ComponentMappers.position.get(player);
god = ComponentMappers.god.get(WorldManager.god);
Table topTable = new Table();
topTable.top().left();
topTable.setFillParent(true);
stage.addActor(topTable);
playerInfo = new VerticalGroup().top().left().columnLeft();
enemyInfo = new VerticalGroup().top().center().columnCenter();
gameInfo = new VerticalGroup().top().right().columnRight();
int width = Gdx.graphics.getWidth() / 3 - 20;
topTable.add(playerInfo).pad(10, 10, 10, 10).width(width).top();
topTable.add(enemyInfo).pad(10, 10, 10, 10).width(width).top();
topTable.add(gameInfo).pad(10, 10, 10, 10).width(width).top();
bottomTable = new Table();
bottomTable.bottom().left();
bottomTable.setFillParent(true);
stage.addActor(bottomTable);
actionLog = new VerticalGroup().top().left().columnLeft();
focusedTable = new Table().top().center();
buttonsAndAreaDetails = new VerticalGroup().top().right().columnRight();
areaDetails = new VerticalGroup().top().right().columnRight().pad(0, 0, 5, 0);
buttonsAndAreaDetails.addActor(areaDetails);
menuButtons = new Table().right();
setupMenuButtons();
bottomTable.add(actionLog).pad(10, 10, 10, 10).width(width).bottom();
bottomTable.add(focusedTable).pad(10, 10, 10, 10).width(width).top();
bottomTable.add(buttonsAndAreaDetails).pad(10, 10, 10, 10).width(width).bottom();
setupDeathDialog();
stage.setKeyboardFocus(bottomTable);
}
示例8
/**
* Help screen.
*
* @param main Instance of Main
*/
public HelpScreen(Main main) {
stage = new Stage(new FitViewport(960, 540));
Table table = new Table();
table.setFillParent(true);
table.left().top();
stage.addActor(table);
Table titleTable = new Table();
HorizontalGroup titleGroup = new HorizontalGroup();
titleGroup.space(10);
titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20);
ActionButton closeButton = new ActionButton("Q", null);
closeButton.setKeys(Input.Keys.Q);
closeButton.setAction(table, () -> main.setScreen(Main.playScreen));
titleGroup.addActor(closeButton);
Label title = new Label("Help", Main.skin);
titleGroup.addActor(title);
VerticalGroup group = new VerticalGroup().top().left().columnLeft();
Table helpTable = new Table();
helpTable.add(group).pad(10).top().left();
group.addActor(new Label("[DARK_GRAY]Movement & melee attacks:[] numpad keys", Main.skin));
group.addActor(new Label("[DARK_GRAY]Shoot range weapon:[] r", Main.skin));
group.addActor(new Label("[DARK_GRAY]Focused attack:[] shift + attack key", Main.skin));
group.addActor(new Label("[DARK_GRAY]Look at a tile you're not on:[] s", Main.skin));
group.addActor(new Label("[DARK_GRAY]Throw:[] t", Main.skin));
group.addActor(new Label("[DARK_GRAY]Confirm action:[] space", Main.skin));
group.addActor(new Label("[DARK_GRAY]Close dialogs or cancel actions:[] q", Main.skin));
table.add(titleTable);
table.row();
table.add(helpTable).left();
Gdx.input.setInputProcessor(stage);
stage.setKeyboardFocus(table);
}
示例9
/**
* View and use your abilities.
*
* @param main Instance of Main
*/
public AbilitiesScreen(Main main) {
this.main = main;
abilities = ComponentMappers.abilities.get(WorldManager.player).abilities;
playerDetails = ComponentMappers.player.get(WorldManager.player);
stage = new Stage(new FitViewport(960, 540));
table = new Table();
table.setFillParent(true);
table.left().top();
stage.addActor(table);
Table titleTable = new Table();
HorizontalGroup titleGroup = new HorizontalGroup();
titleGroup.space(10);
titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20);
ActionButton closeButton = new ActionButton("Q", null);
closeButton.setKeys(Input.Keys.Q);
closeButton.setAction(table, () -> main.setScreen(Main.playScreen));
titleGroup.addActor(closeButton);
Label title = new Label("Abilities", Main.skin);
titleGroup.addActor(title);
abilitiesGroup = new VerticalGroup().top().left().columnLeft();
Table abilitiesTable = new Table();
abilitiesTable.add(abilitiesGroup).pad(10).top().left().width(Gdx.graphics.getWidth() / 2);
table.add(titleTable);
table.row();
table.add(abilitiesTable).left();
setupAbilities();
Gdx.input.setInputProcessor(stage);
stage.setKeyboardFocus(table);
}
示例10
/**
* Craft screen.
*
* @param main Instance of Main
*/
public CraftScreen(Main main) {
stage = new Stage(new FitViewport(960, 540));
Constructor constructor = new Constructor(ItemData.class);
constructor.addTypeDescription(new TypeDescription(Bleed.class, "!Bleed"));
constructor.addTypeDescription(new TypeDescription(Charm.class, "!Charm"));
constructor.addTypeDescription(new TypeDescription(DealDamage.class, "!DealDamage"));
constructor.addTypeDescription(new TypeDescription(Poison.class, "!Poison"));
constructor.addTypeDescription(new TypeDescription(RaiseHealth.class, "!RaiseHealth"));
constructor.addTypeDescription(new TypeDescription(StartFire.class, "!StartFire"));
TypeDescription itemDescription = new TypeDescription(ItemData.class);
itemDescription.putListPropertyType("requiredComponent", ItemRequiredComponentData.class);
constructor.addTypeDescription(itemDescription);
Yaml yaml = new Yaml(constructor);
recipes = new HashMap<>();
for (Map.Entry<String, String> entry : Main.itemsData.entrySet()) {
ItemData data = (ItemData) yaml.load(entry.getValue());
if (data.requiredComponents != null) {
recipes.put(entry.getKey(), data);
}
}
table = new Table();
table.setFillParent(true);
table.left().top();
stage.addActor(table);
Table titleTable = new Table();
HorizontalGroup titleGroup = new HorizontalGroup();
titleGroup.space(10);
titleTable.add(titleGroup).pad(10).width(Gdx.graphics.getWidth() - 20);
ActionButton closeButton = new ActionButton("Q", null);
closeButton.setKeys(Input.Keys.Q);
closeButton.setAction(table, () -> main.setScreen(Main.playScreen));
titleGroup.addActor(closeButton);
Label title = new Label("Craft", Main.skin);
titleGroup.addActor(title);
recipeGroup = new VerticalGroup().top().left().columnLeft();
Table craftTable = new Table();
craftTable.add(recipeGroup).pad(10).top().left().width(Gdx.graphics.getWidth() / 2);
table.add(titleTable);
table.row();
table.add(craftTable).left();
setupRecipes();
Gdx.input.setInputProcessor(stage);
stage.setKeyboardFocus(table);
}
示例11
/** @param vertical if true, actors will be stored vertically, if false - horizontally. */
public DragPane (final boolean vertical) {
this(vertical ? new VerticalGroup() : new HorizontalGroup());
}
示例12
/**
* @return true if children are displayed vertically in a {@link VerticalGroup}.
* @see #getVerticalGroup()
*/
public boolean isVertical () {
return getActor() instanceof VerticalGroup;
}
示例13
/**
* @return internally managed group of actors.
* @throws ClassCastException if drag pane is not vertical.
* @see #isVertical()
*/
public VerticalGroup getVerticalGroup () {
return (VerticalGroup) getActor();
}