本文整理了Java中com.badlogic.gdx.scenes.scene2d.Actor.isDescendantOf()
方法的一些代码示例,展示了Actor.isDescendantOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Actor.isDescendantOf()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Actor
类名称:Actor
方法名:isDescendantOf
[英]Returns true if this actor is the same as or is the descendant of the specified actor.
[中]如果此参与者与指定参与者相同或是其后代,则返回true。
代码示例来源:origin: libgdx/libgdx
/** Removes the touch, keyboard, and scroll focus for the specified actor and any descendants. */
public void unfocus (Actor actor) {
cancelTouchFocus(actor);
if (scrollFocus != null && scrollFocus.isDescendantOf(actor)) setScrollFocus(null);
if (keyboardFocus != null && keyboardFocus.isDescendantOf(actor)) setKeyboardFocus(null);
}
代码示例来源:origin: libgdx/libgdx
/** Removes the touch, keyboard, and scroll focus for the specified actor and any descendants. */
public void unfocus (Actor actor) {
cancelTouchFocus(actor);
if (scrollFocus != null && scrollFocus.isDescendantOf(actor)) setScrollFocus(null);
if (keyboardFocus != null && keyboardFocus.isDescendantOf(actor)) setKeyboardFocus(null);
}
代码示例来源:origin: libgdx/libgdx
/** Returns true if the specified position is over the specified actor or within the tap square. */
public boolean isOver (Actor actor, float x, float y) {
Actor hit = actor.hit(x, y, true);
if (hit == null || !hit.isDescendantOf(actor)) return inTapSquare(x, y);
return true;
}
代码示例来源:origin: libgdx/libgdx
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor);
if (toActor == null || !toActor.isDescendantOf(Tree.this)) setOverNode(null);
}
});
代码示例来源:origin: libgdx/libgdx
/** Returns true if the specified position is over the specified actor or within the tap square. */
public boolean isOver (Actor actor, float x, float y) {
Actor hit = actor.hit(x, y, true);
if (hit == null || !hit.isDescendantOf(actor)) return inTapSquare(x, y);
return true;
}
代码示例来源:origin: libgdx/libgdx
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor);
if (toActor == null || !toActor.isDescendantOf(Tree.this)) setOverNode(null);
}
});
代码示例来源:origin: libgdx/libgdx
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
if (toActor != null && toActor.isDescendantOf(event.getListenerActor())) return;
hide();
}
代码示例来源:origin: libgdx/libgdx
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
if (toActor != null && toActor.isDescendantOf(event.getListenerActor())) return;
hide();
}
代码示例来源:origin: libgdx/libgdx
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
if (pointer != -1) return;
if (Gdx.input.isTouched()) return;
Actor actor = event.getListenerActor();
if (fromActor != null && fromActor.isDescendantOf(actor)) return;
setContainerPosition(actor, x, y);
manager.enter(this);
}
代码示例来源:origin: libgdx/libgdx
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
if (pointer != -1) return;
if (Gdx.input.isTouched()) return;
Actor actor = event.getListenerActor();
if (fromActor != null && fromActor.isDescendantOf(actor)) return;
setContainerPosition(actor, x, y);
manager.enter(this);
}
代码示例来源:origin: libgdx/libgdx
private void focusChanged (FocusEvent event) {
Stage stage = getStage();
if (isModal && stage != null && stage.getRoot().getChildren().size > 0
&& stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor.
Actor newFocusedActor = event.getRelatedActor();
if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this)
&& !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus)))
event.cancel();
}
}
};
代码示例来源:origin: libgdx/libgdx
private void focusChanged (FocusEvent event) {
Stage stage = getStage();
if (isModal && stage != null && stage.getRoot().getChildren().size > 0
&& stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor.
Actor newFocusedActor = event.getRelatedActor();
if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this)
&& !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus)))
event.cancel();
}
}
};
代码示例来源:origin: libgdx/libgdx
/** {@link #pack() Packs} the dialog (but doesn't set the position), adds it to the stage, sets it as the keyboard and scroll
* focus, clears any actions on the dialog, and adds the specified action to it. The previous keyboard and scroll focus are
* remembered so they can be restored when the dialog is hidden.
* @param action May be null. */
public Dialog show (Stage stage, Action action) {
clearActions();
removeCaptureListener(ignoreTouchDown);
previousKeyboardFocus = null;
Actor actor = stage.getKeyboardFocus();
if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor;
previousScrollFocus = null;
actor = stage.getScrollFocus();
if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
pack();
stage.addActor(this);
stage.cancelTouchFocus();
stage.setKeyboardFocus(this);
stage.setScrollFocus(this);
if (action != null) addAction(action);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** {@link #pack() Packs} the dialog (but doesn't set the position), adds it to the stage, sets it as the keyboard and scroll
* focus, clears any actions on the dialog, and adds the specified action to it. The previous keyboard and scroll focus are
* remembered so they can be restored when the dialog is hidden.
* @param action May be null. */
public Dialog show (Stage stage, Action action) {
clearActions();
removeCaptureListener(ignoreTouchDown);
previousKeyboardFocus = null;
Actor actor = stage.getKeyboardFocus();
if (actor != null && !actor.isDescendantOf(this)) previousKeyboardFocus = actor;
previousScrollFocus = null;
actor = stage.getScrollFocus();
if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
pack();
stage.addActor(this);
stage.cancelTouchFocus();
stage.setKeyboardFocus(this);
stage.setScrollFocus(this);
if (action != null) addAction(action);
return this;
}
代码示例来源:origin: libgdx/libgdx
/** Removes the dialog from the stage, restoring the previous keyboard and scroll focus, and adds the specified action to the
* dialog.
* @param action If null, the dialog is removed immediately. Otherwise, the dialog is removed when the action completes. The
* dialog will not respond to touch down events during the action. */
public void hide (Action action) {
Stage stage = getStage();
if (stage != null) {
removeListener(focusListener);
if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null;
Actor actor = stage.getKeyboardFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus);
if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
actor = stage.getScrollFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
}
if (action != null) {
addCaptureListener(ignoreTouchDown);
addAction(sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
} else
remove();
}
代码示例来源:origin: libgdx/libgdx
/** Removes the dialog from the stage, restoring the previous keyboard and scroll focus, and adds the specified action to the
* dialog.
* @param action If null, the dialog is removed immediately. Otherwise, the dialog is removed when the action completes. The
* dialog will not respond to touch down events during the action. */
public void hide (Action action) {
Stage stage = getStage();
if (stage != null) {
removeListener(focusListener);
if (previousKeyboardFocus != null && previousKeyboardFocus.getStage() == null) previousKeyboardFocus = null;
Actor actor = stage.getKeyboardFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setKeyboardFocus(previousKeyboardFocus);
if (previousScrollFocus != null && previousScrollFocus.getStage() == null) previousScrollFocus = null;
actor = stage.getScrollFocus();
if (actor == null || actor.isDescendantOf(this)) stage.setScrollFocus(previousScrollFocus);
}
if (action != null) {
addCaptureListener(ignoreTouchDown);
addAction(sequence(action, Actions.removeListener(ignoreTouchDown, true), Actions.removeActor()));
} else
remove();
}
代码示例来源:origin: libgdx/libgdx
if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
stage.setScrollFocus(this);
代码示例来源:origin: libgdx/libgdx
if (actor != null && !actor.isDescendantOf(this)) previousScrollFocus = actor;
stage.setScrollFocus(this);
代码示例来源:origin: kotcrab/vis-ui
@Override
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor);
if (pointer == -1 && (toActor == null || toActor.isDescendantOf(owner) == false)) {
clearCustomCursor();
}
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
if (pointer != -1) return;
if (Gdx.input.isTouched()) return;
Actor actor = event.getListenerActor();
if (fromActor != null && fromActor.isDescendantOf(actor)) return;
setContainerPosition(actor, x, y);
manager.enter(this);
}
内容来源于网络,如有侵权,请联系作者删除!