本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup类的典型用法代码示例。如果您正苦于以下问题:Java WidgetGroup类的具体用法?Java WidgetGroup怎么用?Java WidgetGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WidgetGroup类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了WidgetGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: backClick
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private void backClick() {
float nextXPos = Gdx.graphics.getWidth() + CB.scaledSizes.MARGIN;
if (listViews.size == 1) {
// remove all BackClickListener
while (listBackClickListener.size > 0) {
StageManager.unRegisterForBackKey(listBackClickListener.pop());
}
//Send click to Cancel button
cancelClickListener.clicked(StageManager.BACK_KEY_INPUT_EVENT, -1, -1);
return;
}
StageManager.unRegisterForBackKey(listBackClickListener.pop());
listViewsNames.pop();
WidgetGroup actWidgetGroup = listViews.pop();
WidgetGroup showingWidgetGroup = listViews.get(listViews.size - 1);
float y = actWidgetGroup.getY();
actWidgetGroup.addAction(Actions.sequence(Actions.moveTo(nextXPos, y, Menu.MORE_MENU_ANIMATION_TIME), Actions.removeActor()));
showingWidgetGroup.addAction(Actions.moveTo(CB.scaledSizes.MARGIN, y, Menu.MORE_MENU_ANIMATION_TIME));
}
示例2: showWidgetGroup
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private void showWidgetGroup() {
clearActions();
pack();
mainMenuWidgetGroup = new WidgetGroup();
mainMenuWidgetGroup.setName(this.name.toString());
mainMenuWidgetGroup.setBounds(this.getX(), this.getY(), this.getWidth(), this.getHeight());
mainMenuWidgetGroup.addActor(this);
if (this.parentMenu == null) {
showingStage = StageManager.showOnNewStage(mainMenuWidgetGroup);
} else {
showingStage = StageManager.showOnActStage(mainMenuWidgetGroup);
}
if (this.parentMenu == null)
addAction(sequence(Actions.alpha(0), Actions.fadeIn(CB.WINDOW_FADE_TIME, Interpolation.fade)));
isShowing = true;
}
示例3: Map
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
public Map(GameMap map, GameState gameState, int width, int height, ButtonStyle mapIndicatorStyle) {
mapTexture = MinimapGenerator.generate(map, gameState, width, height);
this.gameMap = map;
this.gameState = gameState;
calculateRatios(width, height);
Image image = new Image(mapTexture);
image.addListener(this);
// only add the current camera position indicator in case
// the camera does not show the whole map already
if (xRatio > 1 || yRatio > 1) {
indicator = new MapScreenIndicator(mapIndicatorStyle);
}
WidgetGroup group = new WidgetGroup();
group.addActor(image);
if (indicator != null) {
group.addActor(indicator);
indicator.addListener(this);
}
group.setWidth(width);
group.setHeight(height);
group.invalidate();
add(group).width(width).height(height);
}
示例4: create
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
@Override
public void create() {
Gdx.app.setLogLevel(Application.LOG_DEBUG);
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
stage = new Stage(new ScreenViewport());
WidgetGroup modalContainer = new WidgetGroup();
modalContainer.setFillParent(true);
WidgetGroup viewContainer = new WidgetGroup();
viewContainer.setFillParent(true);
stage.getRoot().addActor(viewContainer);
stage.getRoot().addActor(modalContainer);
Gdx.input.setInputProcessor(stage);
actor = new LoadingIndicator();
if (actor instanceof WidgetGroup) {
((WidgetGroup) actor).setFillParent(true);
}
viewContainer.addActor(actor);
}
示例5: Views
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
/**
* @param controller
* the editor controller
* @param viewsContainer
* the root container where the main view must be added
* @param modalsContainer
* the container where context menues must appear
*/
public Views(Controller controller, Group viewsContainer,
Group modalsContainer) {
this.controller = controller;
controller.getModel().addLoadListener(this);
this.viewsContainer = viewsContainer;
this.modalsContainer = modalsContainer;
if (modalsContainer instanceof WidgetGroup) {
((WidgetGroup) modalsContainer).pack();
}
modalsContainer.setTouchable(Touchable.childrenOnly);
modalsContainer.addListener(closeContextMenu);
viewsBuilders = new HashMap<Class, ViewBuilder>();
dialogBuilders = new HashMap<Class, DialogBuilder>();
viewsHistory = new ViewsHistory();
}
示例6: UI
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
public UI()
{
uiElements = new ArrayList<UIElement>();
stage = new Stage(new ScreenViewport());
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
root = new WidgetGroup();
root.setFillParent(true);
stage.addActor(root);
new MainOptionsWnd(skin);
}
示例7: backClick
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private void backClick() {
float nextXPos = Gdx.graphics.getWidth() + CB.scaledSizes.MARGIN;
if (listViews.size == 1) return;
listViewsNames.pop();
WidgetGroup actWidgetGroup = listViews.pop();
WidgetGroup showingWidgetGroup = listViews.get(listViews.size - 1);
float y = actWidgetGroup.getY();
actWidgetGroup.addAction(Actions.sequence(Actions.moveTo(nextXPos, y, Menu.MORE_MENU_ANIMATION_TIME), Actions.removeActor()));
showingWidgetGroup.addAction(Actions.moveTo(CB.scaledSizes.MARGIN, y, Menu.MORE_MENU_ANIMATION_TIME));
}
示例8: getFloatView
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private ListViewItem getFloatView(int listIndex, final de.longri.cachebox3.settings.types.SettingFloat setting) {
final VisLabel valueLabel = new VisLabel(Float.toString(setting.getValue()), valueStyle);
ListViewItem table = getNumericItemTable(listIndex, valueLabel, setting);
// add clickListener
table.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (event.getType() == InputEvent.Type.touchUp) {
new NumericInput_Activity<Float>(setting.getValue()) {
public void returnValue(Float value) {
setting.setValue(value);
WidgetGroup group = listViews.peek();
for (Actor actor : group.getChildren()) {
if (actor instanceof ListView) {
final ListView listView = (ListView) actor;
final float scrollPos = listView.getScrollPos();
listView.layout(FORCE);
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
listView.setScrollPos(scrollPos);
}
});
}
}
}
}.show();
}
}
});
return table;
}
示例9: getDblView
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private ListViewItem getDblView(int listIndex, final de.longri.cachebox3.settings.types.SettingDouble setting) {
final VisLabel valueLabel = new VisLabel(Double.toString(setting.getValue()), valueStyle);
ListViewItem table = getNumericItemTable(listIndex, valueLabel, setting);
// add clickListener
table.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (event.getType() == InputEvent.Type.touchUp) {
new NumericInput_Activity<Double>(setting.getValue()) {
public void returnValue(Double value) {
setting.setValue(value);
WidgetGroup group = listViews.peek();
for (Actor actor : group.getChildren()) {
if (actor instanceof ListView) {
final ListView listView = (ListView) actor;
final float scrollPos = listView.getScrollPos();
listView.layout(FORCE);
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
listView.setScrollPos(scrollPos);
}
});
}
}
}
}.show();
}
}
});
return table;
}
示例10: getIntView
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private ListViewItem getIntView(int listIndex, final de.longri.cachebox3.settings.types.SettingInt setting) {
final VisLabel valueLabel = new VisLabel(Integer.toString(setting.getValue()), valueStyle);
final ListViewItem table = getNumericItemTable(listIndex, valueLabel, setting);
// add clickListener
table.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
if (event.getType() == InputEvent.Type.touchUp) {
new NumericInput_Activity<Integer>(setting.getValue()) {
public void returnValue(Integer value) {
setting.setValue(value);
WidgetGroup group = listViews.peek();
for (Actor actor : group.getChildren()) {
if (actor instanceof ListView) {
final ListView listView = (ListView) actor;
final float scrollPos = listView.getScrollPos();
listView.layout(FORCE);
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
listView.setScrollPos(scrollPos);
}
});
}
}
}
}.show();
}
}
});
return table;
}
示例11: act
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
public boolean act(float delta) {
if (!added) {
added = true;
if (target instanceof WidgetGroup) {
WidgetGroup group = (WidgetGroup) target;
group.addActor(actor);
}
}
return true;
}
示例12: addAndShow
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
private static void addAndShow(WidgetGroup actor, WindowPosition position) {
stage.addActor(actor);
actor.setVisible(true);
actor.pack();
position.position(actor);
moveToTop(actor);
}
示例13: process
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
@Override
public void process(LmlParser parser, LmlTag tag, DragPane actor, String rawAttributeData) {
WidgetGroup group = actor.getGroup();
String id = parser.parseString(rawAttributeData, group);
LmlUtilities.setActorId(group, id);
parser.getActorsMappedByIds().put(id, group);
}
示例14: ToastManager
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
/** Toast manager will create own group to host toasts and put it into the stage root. */
public ToastManager (Stage stage) {
WidgetGroup widgetGroup = new WidgetGroup();
widgetGroup.setFillParent(true);
widgetGroup.setTouchable(Touchable.childrenOnly);
stage.addActor(widgetGroup);
this.root = widgetGroup;
}
示例15: setActor
import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup; //导入依赖的package包/类
/** @param group will replace the internally managed group. All current children will be moved to this group. */
@Override
public void setActor (final WidgetGroup group) {
if (group == null) {
throw new IllegalArgumentException("Group cannot be null.");
}
final Group previousGroup = getActor();
super.setActor(group);
attachListener(); // Attaches draggable to all previous group children.
for (final Actor child : previousGroup.getChildren()) {
group.addActor(child); // No need to attach draggable, child was already in pane.
}
}