本文整理了Java中com.badlogic.gdx.scenes.scene2d.Actor.getListeners()
方法的一些代码示例,展示了Actor.getListeners()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Actor.getListeners()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Actor
类名称:Actor
方法名:getListeners
暂无
代码示例来源:origin: kotcrab/vis-ui
/**
* Remove any attached tooltip from target actor
* @param target that tooltips will be removed
*/
public static void removeTooltip (Actor target) {
Array<EventListener> listeners = target.getListeners();
for (EventListener listener : listeners) {
if (listener instanceof TooltipInputListener) target.removeListener(listener);
}
}
代码示例来源:origin: kotcrab/vis-ui
/**
* Attaches tooltip to current target, must be called if tooltip listener was removed from target (for example by
* calling target.clearListeners() )
*/
public void attach () {
if (target == null) return;
Array<EventListener> listeners = target.getListeners();
for (EventListener listener : listeners) {
if (listener instanceof TooltipInputListener) {
throw new IllegalStateException("More than one tooltip cannot be added to the same target!");
}
}
target.addListener(listener);
}
代码示例来源:origin: kotcrab/vis-ui
/**
* @param actor will have this listener attached and all other {@link Draggable} listeners removed. If you want multiple
* {@link Draggable} listeners or you are sure that the widget has no other {@link Draggable}s attached, you can add
* the listener using the standard method: {@link Actor#addListener(EventListener)} - avoiding validation and
* iteration over actor's listeners.
*/
public void attachTo (final Actor actor) {
for (final Iterator<EventListener> listeners = actor.getListeners().iterator(); listeners.hasNext(); ) {
final EventListener listener = listeners.next();
if (listener instanceof Draggable) {
listeners.remove();
}
}
actor.addListener(this);
}
代码示例来源:origin: stackoverflow.com
static void removeAllListeners(Actor actor) {
Array<EventListener> listeners = new Array<>(actor.getListeners());
for (EventListener listener : listeners) {
actor.removeListener(listener);
}
}
代码示例来源:origin: kotcrab/vis-ui
protected void prepareViewBeforeAddingToTable (ItemT item, ViewT view) {
boolean listenerMissing = true;
for (EventListener listener : view.getListeners()) {
if (listener instanceof AbstractListAdapter.ListClickListener) {
listenerMissing = false;
break;
}
}
if (listenerMissing) {
view.setTouchable(Touchable.enabled);
view.addListener(new ListClickListener(view, item));
}
}
代码示例来源:origin: crashinvaders/gdx-texture-packer-gui
@Override
public void process(final LmlParser parser, final LmlTag tag, Actor actor, final String rawAttributeData) {
// Due to ListView tricky structure we should dig a little to get to the scrollable actor
if (actor instanceof ListView.ListViewTable) {
actor = ((ListView.ListViewTable) actor).getListView().getScrollPane();
}
boolean value = Boolean.parseBoolean(rawAttributeData);
if (value) {
// Add scroll focus capture listeners
actor.addListener(new ScrollFocusCaptureInputListener());
} else {
// Remove scroll focus capture listener
Iterator<EventListener> iterator = actor.getListeners().iterator();
while (iterator.hasNext()) {
EventListener listener = iterator.next();
if (listener instanceof ScrollFocusCaptureInputListener) {
iterator.remove();
}
}
}
}
}
代码示例来源:origin: dingjibang/GDX-RPG
private TypedGdxQuery<T> _tryRegListener() {
if(!t.getListeners().contains(clickListener(), true))
t.addListener(clickListener());
return this;
}
代码示例来源:origin: dingjibang/GDX-RPG
private GdxQuery _tryRegListener() {
for(Actor actor:list())
if(!actor.getListeners().contains(clickListener(), true))
actor.addListener(clickListener());
return this;
}
代码示例来源:origin: Var3D/var3dframe
data.allListeners = actor.getListeners();
if (actor instanceof Group) {
代码示例来源:origin: Catacomb-Snatch/Catacomb-Snatch
@Override
public void tick(float delta) {
// Draw background
if (drawBackground && background != null) {
getBatch().begin();
getBatch().setColor(backgroundColor);
getBatch().draw(background, 0, 0, Screen.getWidth(), Screen.getHeight());
getBatch().end();
}
// Similar to Google's Android "Project Butter":
// Updating mouse dependent stuff in render()
if (!Gdx.input.isTouched()) {
mousePos = screenToStageCoordinates(mousePos.set(Gdx.input.getX(), Gdx.input.getY()));
for (Actor a : getActors()) {
currentActorRect.set(a.getX(), a.getY(), a.getWidth(), a.getHeight());
for (EventListener el : a.getListeners()) {
if (!(el instanceof InputListener)) continue;
InputListener il = (InputListener) el;
if (currentActorRect.contains(mousePos.x, mousePos.y)) {
il.enter(null, mousePos.x, mousePos.y, -1, null);
} else {
il.exit(null, mousePos.x, mousePos.y, -1, null);
}
}
}
}
super.draw();
getBatch().begin();
}
内容来源于网络,如有侵权,请联系作者删除!