本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.setOverscroll方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setOverscroll方法的具体用法?Java ScrollPane.setOverscroll怎么用?Java ScrollPane.setOverscroll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.setOverscroll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ConsoleView
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public ConsoleView(Skin skin) {
this.skin = skin;
entriesStack = new Table(skin);
entriesStack.setFillParent(true);
scrollPane = new ScrollPane(entriesStack, skin);
scrollPane.setFadeScrollBars(false);
scrollPane.setScrollbarsOnTop(false);
scrollPane.setOverscroll(false, false);
inputField = new TextField("", skin);
this.add(scrollPane).expand().fill().pad(2).row();
this.add(inputField).expandX().fillX().pad(4);
setTouchable(Touchable.enabled);
clearEntries();
}
示例2: ScrollMap
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
/**
*
* @param tileMap ширина, высота и размер тайла берется из первого слоя:
* TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0);
* cellSize = (int) bg.getTileHeight(); mapW = bg.getWidth(); mapH =
* bg.getHeight();
*/
public ScrollMap(TiledMap tileMap) {
mapCamera = new OrthographicCamera();
mapRenderer = new OrthogonalTiledMapRenderer(tileMap, 1f/* / cellSize */);
stageViewport = new ScreenViewport(new OrthographicCamera());
TiledMapTileLayer bg = (TiledMapTileLayer) tileMap.getLayers().get(0);
cellSize = (int) bg.getTileHeight();
mapW = bg.getWidth() * cellSize;
mapH = bg.getHeight() * cellSize;
mapHolder = new Actor();
mapHolder.setSize(mapW, mapH);
scrollPane = new ScrollPane(mapHolder);
scrollPane.setOverscroll(false, false);
root = new Table();
root.setFillParent(true);
root.add(scrollPane).fill().expand();
stage = new Stage(stageViewport);
stage.addActor(root);
im = new InputMultiplexer();
gameBatch = mapRenderer.getSpriteBatch();
sprites = new Array<Sprite>();
gestureDetector = new GestureDetector(gestureListener);
}
示例3: buildComponent
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
private void buildComponent() {
Inventory inventory = ic.getInventory();
Table inventoryTable = new Table();
ScrollPane srollPane = new ScrollPane(inventoryTable, style.scrollPaneStyle);
srollPane.setFadeScrollBars(false);
srollPane.setOverscroll(false, false);
int slotCounter = 0;
int numberOfAllRows = (int) (50f*(10f / style.cols));
for (int i = 0; i < numberOfAllRows; ++i) {
for (int j = 0; j < style.cols; ++j, ++slotCounter) {
InventoryItemButton button = new InventoryItemButton(
style.inventorySlotStyle,
slotCounter,
inventory,
CoreUtil.equals(inventory.getParentContainer(), merchant) ? BagType.MERCHANT : BagType.BACKPACK,
merchant);
button.addListener(listener);
inventoryTable.add(button).width(style.inventorySlotWidth).height(style.inventorySlotHeight).space(style.inventorySlotSpacing);
}
inventoryTable.row();
}
if (label != null) {
add(new Label(" "+label+":", style.headingStyle)).prefWidth(style.cols*(style.inventorySlotWidth+style.inventorySlotSpacing)).fill();
add(new Label("", style.borderStyle)).prefWidth(style.borderWidth).fill();
}
row();
add(srollPane).prefHeight(style.rows*(style.inventorySlotHeight+style.inventorySlotSpacing)).prefWidth(style.cols*(style.inventorySlotWidth+style.inventorySlotSpacing)+style.borderWidth).colspan(2);
row();
}
示例4: SpellsComponent
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public SpellsComponent(GameCharacter character, PerksComponentStyle style, EventListener listener) {
super();
spellButtons = new Array<SpellButton>();
this.character = character;
Table spellsTable = new Table();
ScrollPane backScrollPane = new ScrollPane(spellsTable, style.scrollPaneStyle);
backScrollPane.setFadeScrollBars(false);
backScrollPane.setOverscroll(false, false);
Array<Spell> spells = character.getSpells();
spells.sort(new Comparator<Spell>() {
@Override
public int compare(Spell o1, Spell o2) {
int result = Integer.compare(o1.getLevelRequirement(), o2.getLevelRequirement());
if (result == 0) {
result = Integer.compare(o1.getRank(), o2.getRank());
}
return result;
}
});
int i = 0;
for (Spell s : spells) {
if (i == style.itemsPerRow) {
spellsTable.row();
i = 0;
}
SpellButton spellButton = new SpellButton(character, s, style.perkButtonStyle);
spellButton.addListener(listener);
spellButtons.add(spellButton);
spellsTable.add(spellButton).space(5).top().left();
++i;
}
add(backScrollPane).fill().expand().top().width(backScrollPane.getPrefWidth());
recomputeSpells();
}
示例5: LayerSelector
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public LayerSelector(GroupEditor groupeditor, GroupEditorStyle style) {
super();
this.style = style;
this.groupEditor = groupeditor;
scrollPane = new ScrollPane(layers = new LinearLayout(true));
scrollPane.setScrollingDisabled(false, true);
scrollPane.setOverscroll(false, false);
add(scrollPane).fillX();
setBackground(style.layersBackground);
this.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Actor target = event.getTarget();
if (target instanceof Layer) {
if (!groupEditor.isMultipleSelection()) {
for (Actor layer : layers.getChildren()) {
if (layer != target) {
((Layer) layer).setChecked(false);
}
}
}
groupEditor.addToSelection(((Layer) target).actor);
groupEditor.fireSelection();
}
}
});
}
示例6: doShow
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
@Override protected void doShow(final UserData userData) {
final Table items = new Table();
final ScrollPane pane = new ScrollPane(items, new ScrollPane.ScrollPaneStyle()) {
@Override public void layout() {
float w = items.getPrefWidth();
float h = Math.min(getParent().getHeight(), items.getPrefHeight());
if (w != getWidth() || h != getHeight()) {
setSize(w, h);
invalidateHierarchy();
}
super.layout();
}
};
pane.setTouchable(Touchable.childrenOnly);
pane.setOverscroll(false, false);
pane.setCancelTouchFocus(false);
pane.addListener(new ChangeListener() {
@Override public void changed(ChangeEvent event, Actor actor) {
pane.layout();
pane.layout();
items.layout();
if (actor instanceof Layout)
((Layout) actor).layout();
pane.layout();
pane.layout();
pane.scrollTo(actor.getX(), actor.getY(), actor.getWidth(), actor.getHeight() + 100);
}
});
Iterable<Die> dice = userData.dice();
int i = 1;
int count = userData.diceCount();
for (Die die : dice) {
DiePane diePane = new DiePane(die, userData, diceWindowGroup);
table.add(diePane);
diePane.setWidth(0);
diePane.pack();
diePane.setWidth(ViewController.CELL_SIZE * 6.6f);
Cell cell = items.add(diePane).fillX().maxWidth(ViewController.CELL_SIZE * 6.6f);
if (i != count) {
cell.padBottom(-1);
}
cell.row();
map.put(die, diePane);
diePane.info.addListener(createMinimizeListener(die, dice));
i++;
}
items.pack();
table.add(pane).width(items.getPrefWidth());//.size(items.getPrefWidth(), 200);
}
示例7: QuestUI
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public QuestUI() {
super("任务列表", Assets.instance.STATUSUI_SKIN);
json = new Json();
quests = new Array<QuestGraph>();
closeButton = new TextButton("X", Assets.instance.STATUSUI_SKIN);
//create
questLabel = new Label("任务:", Assets.instance.STATUSUI_SKIN);
tasksLabel = new Label("步骤:", Assets.instance.STATUSUI_SKIN);
listQuests = new List<QuestGraph>(Assets.instance.STATUSUI_SKIN);
ScrollPane scrollPane = new ScrollPane (listQuests);
scrollPane.setOverscroll(false, false);
scrollPane.setFadeScrollBars(false);
scrollPane.setForceScroll(true, false);
listTasks = new List<QuestTask>(Assets.instance.STATUSUI_SKIN);
ScrollPane scrollPaneTasks = new ScrollPane (listTasks);
scrollPaneTasks.setOverscroll(false, false);
scrollPaneTasks.setFadeScrollBars(false);
scrollPaneTasks.setForceScroll(true, false);
//layout
this.add (questLabel).align(Align.left);
this.add (tasksLabel).align(Align.left);
this.add(closeButton).align(Align.right);
this.row();
this.defaults().expand().fill();
this.add(scrollPane).padRight(15);
this.add(scrollPaneTasks).padLeft(5).colspan(2);
//this.debug();
this.pack();
//Listeners
listQuests.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
QuestGraph quest = (QuestGraph) listQuests.getSelected();
if (quest == null) return;
populateQuestTaskDialog(quest);
}
}
);
}
示例8: DialogUI
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public DialogUI(HUDScreen parent) {
super("对话", Assets.instance.STATUSUI_SKIN, "solidbackground");
hudScreen = parent;
json = new Json();
graph = new ConversationGraph();
//create
talkText = new Label("", Assets.instance.STATUSUI_SKIN);
talkText.setWrap(true);
talkText.setAlignment(Align.left);
items = new List<ConversationChoice>(Assets.instance.STATUSUI_SKIN);
closeButton = new TextButton("X", Assets.instance.STATUSUI_SKIN);
ScrollPane scrollPane = new ScrollPane(items);
scrollPane.setOverscroll(false, false);
scrollPane.setFadeScrollBars(false);
scrollPane.setScrollingDisabled(true, false);
scrollPane.setForceScroll(true, false);
scrollPane.setScrollBarPositions(false, true);
//layout
this.add();
this.add(closeButton);
this.row();
this.defaults().expand().fill();
this.add(talkText).pad(10, 10, 10, 10);
this.row();
this.add(scrollPane).pad(10,10,10,10);
//this.debug();
this.pack();
//Listeners
items.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
ConversationChoice choice = (ConversationChoice)items.getSelected();
if( choice == null ) return;
//TODO: pickup,sleep event etc
// graph.notify(graph, choice.getConversationCommandEvent());
hudScreen.executeCommandEvent(graph, choice.getConversationCommandEvent());
populateConversationDialog(choice.getDestinationId());
}
});
}
示例9: PerksComponent
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public PerksComponent(GameCharacter character, PerksComponentStyle style, EventListener listener, boolean onlyKnown, boolean onlyActivated, boolean displayHeading) {
super();
perkButtons = new Array<PerkButton>();
style.apply(this);
this.character = character;
if (displayHeading) {
perkPointsLabel = new Label(Integer.toString(character.stats().getPerkPoints()), style.headingStyle);
Table heading = new Table();
heading.add(new Label(Strings.getString(AbstractGameCharacter.STRING_TABLE,"perks")+":", style.headingStyle)).expandX().fill().align(Align.left);
heading.add(new Label(Strings.getString(AbstractGameCharacter.STRING_TABLE,"perkPoints")+": ", style.headingStyle)).align(Align.right);
heading.add(perkPointsLabel).align(Align.left);
add(heading)
.fill()
.top()
.expandX()
.pad(style.headingMarginTop, style.headingMarginLeft,
style.headingMarginBottom, style.headingMarginRight);
row();
}
Table perksTable = new Table();
ScrollPane backScrollPane = new ScrollPane(perksTable, style.scrollPaneStyle);
backScrollPane.setFadeScrollBars(false);
backScrollPane.setOverscroll(false, false);
Array<Perk> perks = Perk.getAllPerks();
perks.sort(new Comparator<Perk>() {
@Override
public int compare(Perk o1, Perk o2) {
int result = Integer.compare(o1.getLevelRequirement(), o2.getLevelRequirement());
if (result == 0) {
result = Integer.compare(o1.getRank(), o2.getRank());
}
return result;
}
});
int i = 0;
for (Perk p : perks) {
if ((!onlyKnown || character.hasPerk(p)) && (!onlyActivated || p.isActivated())) {
if (i == style.itemsPerRow) {
perksTable.row();
i = 0;
}
PerkButton perkButton = new PerkButton(character, p, style.perkButtonStyle, onlyKnown);
perkButton.addListener(listener);
perkButtons.add(perkButton);
perksTable.add(perkButton).space(style.perkButtonSpacing).top().left();
++i;
}
}
add(backScrollPane).fill().expand().top().width(backScrollPane.getPrefWidth());
recomputePerks();
}
示例10: applyStandardSettings
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public static void applyStandardSettings(ScrollPane pane) {
pane.setFadeScrollBars(false);
pane.setOverscroll(false, false);
pane.setScrollingDisabled(true, false);
pane.setScrollbarsOnTop(true);
}
示例11: process
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final ScrollPane actor,
final String rawAttributeData) {
actor.setOverscroll(parser.parseBoolean(rawAttributeData, actor), true);
}
示例12: process
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final ScrollPane actor,
final String rawAttributeData) {
actor.setOverscroll(true, parser.parseBoolean(rawAttributeData, actor));
}
示例13: process
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final ScrollPane actor,
final String rawAttributeData) {
final boolean overscroll = parser.parseBoolean(rawAttributeData, actor);
actor.setOverscroll(overscroll, overscroll);
}
示例14: SliderPagesWidget
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public SliderPagesWidget(String background, Skin skin, Actor... actors) {
super(skin);
setFillParent(true);
setBackground(skin.getDrawable(background));
wasPanDragFling = false;
numPages = actors.length;
LinearLayout linearCircles = new LinearLayout(true);
LinearLayout linearPages = new LinearLayout(true);
scroll = new ScrollPane(linearPages) {
@Override
public void act(float delta) {
super.act(delta);
if (isPanning() || isDragging() || isFlinging()) {
SliderPagesWidget.this.actualizePagesIcon();
}
if (wasPanDragFling && !isPanning() && !isDragging()
&& !isFlinging()) {
scrollToPage();
} else if (!wasPanDragFling && isPanning() || isDragging()
|| isFlinging()) {
wasPanDragFling = true;
}
}
};
scroll.setOverscroll(false, false);
iconPages = linearCircles.getChildren();
ClickListener listener = new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Actor actor = event.getListenerActor();
int index = iconPages.indexOf(actor, true);
scrollToPage(index);
}
};
for (Actor page : actors) {
linearPages.add(page);
IconButton pageCircle = new IconButton(SkinConstants.IC_CIRCLE,
skin, SkinConstants.STYLE_SLIDER_PAGES);
pageCircle.addListener(listener);
linearCircles.add(pageCircle);
}
add(scroll).expand().fill();
row();
add(linearCircles);
scrollToPage(0);
}
示例15: ChatBox
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //导入方法依赖的package包/类
public ChatBox(Stage _stage) {
super();
stage = _stage;
setWidth(stage.getWidth() * 0.7f);
setHeight(stage.getHeight() * 0.8f);
cont = new Table();
height = stage.getHeight() * 0.6f;
cheight = FourInALine.chatHeight;
position = (height) * 0.31f;
r1 = new Runnable() {
@Override
public void run() {
if (visible)
FourInALine.Instance.nativeFunctions.hideChatBox();
else
FourInALine.Instance.nativeFunctions.showChatBox();
visible = !visible;
}
};
r2 = new Runnable() {
@Override
public void run() {
animating = false;
}
};
tchat = new Table();
tchat.bottom();
cont.setHeight(height);
cont.setWidth(stage.getWidth() * 0.7f);
cont.setColor(0.85f, 0.85f, 0.85f, 0.85f);
cont.setBackground(FourInALine.Instance.skin.getDrawable("chatbox"));
scroll = new ScrollPane(tchat, FourInALine.Instance.skin);
scroll.setColor(1, 1, 1, 1);
scroll.setOverscroll(false, false);
cont.add().expandX().fillX().height(cheight);
cont.row();
cont.add(scroll).expand().fill().height((height - cheight));
add(cont).width(stage.getWidth() * 0.7f).fill();
row();
add().expand().fill();
setX((stage.getWidth() - getWidth()) / 2);
setY(stage.getHeight() - position);
setTouchable(Touchable.enabled);
addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
toggle();
}
});
}