com.badlogic.gdx.scenes.scene2d.Actor.setTouchable()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中com.badlogic.gdx.scenes.scene2d.Actor.setTouchable()方法的一些代码示例,展示了Actor.setTouchable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Actor.setTouchable()方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.Actor
类名称:Actor
方法名:setTouchable

Actor.setTouchable介绍

[英]Determines how touch events are distributed to this actor. Default is Touchable#enabled.
[中]确定如何将触摸事件分发给此参与者。默认设置为可触摸#启用。

代码示例

代码示例来源:origin: libgdx/libgdx

public boolean act (float delta) {
  target.setTouchable(touchable);
  return true;
}

代码示例来源:origin: libgdx/libgdx

public boolean act (float delta) {
  target.setTouchable(touchable);
  return true;
}

代码示例来源:origin: Var3D/var3dframe

public UI<T> touchOff() {
  t.setTouchable(Touchable.disabled);
  return this;
}

代码示例来源:origin: moribitotech/MTX

/**
 * Set touchable for multiple actors at once
 * */
public static void setTouchable(Touchable touchable, Actor... actors) {
  for (Actor a : actors) {
    a.setTouchable(touchable);
  }
}

代码示例来源:origin: com.badlogicgames.gdx/gdx

public boolean act (float delta) {
  target.setTouchable(touchable);
  return true;
}

代码示例来源:origin: dingjibang/GDX-RPG

public TypedGdxQuery<T> disableTouch() {
  t.setTouchable(null);
  return this;
}

代码示例来源:origin: dingjibang/GDX-RPG

public TypedGdxQuery<T> touchable(Touchable able){
  t.setTouchable(able);
  return this;
}

代码示例来源:origin: Var3D/var3dframe

public UI<T> setTouchable(Touchable touchable) {
  t.setTouchable(touchable);
  return this;
}

代码示例来源:origin: peakgames/libgdx-stagebuilder

private void setTouchable(Actor actor, BaseModel model) {
  switch (model.getTouchable()) {
    case ENABLED:
      actor.setTouchable(Touchable.enabled);
      break;
    case DISABLED:
      actor.setTouchable(Touchable.disabled);
      break;
    case CHILDEREN_ONLY:
      actor.setTouchable(Touchable.childrenOnly);
      break;
    default:
      actor.setTouchable(Touchable.enabled);
      break;
  }
}

代码示例来源:origin: dingjibang/GDX-RPG

public GdxQuery disableTouch() {
  for(Actor actor:list())
    actor.setTouchable(null);
  return this;
}

代码示例来源:origin: dingjibang/GDX-RPG

public GdxQuery touchable(Touchable able){
  for(Actor actor:list())
    actor.setTouchable(able);
  return this;
}

代码示例来源:origin: Var3D/var3dframe

/**
 * 所有Actor恢复响应
 */
public void removeFocus() {
  for (Actor actor : getActors()) {
    actor.setTouchable(Touchable.enabled);
  }
}

代码示例来源:origin: Var3D/var3dframe

/**
 * 设置焦点(参数为null的话全屏禁止响应)
 */
public void setFocus(Actor focusActor) {
  for (Actor actor : getActors()) {
    actor.setTouchable(Touchable.disabled);
  }
  if (focusActor != null) {
    focusActor.setTouchable(Touchable.enabled);
    pop(focusActor);
  }
}

代码示例来源: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: Var3D/var3dframe

Data data = allDatas.get(actor);
actor.setDebug(false);
actor.setTouchable(data.prefTouchable);
if (actor instanceof Group) {
  for (Actor son : group.getChildren()) {
    Data sonData = data.sonDatas.get(son);
    son.setTouchable(sonData.prefTouchable);
actor.setTouchable(Touchable.enabled);
data.allListeners = actor.getListeners();
if (actor instanceof Group) {
    sonData.prefTouchable = son.getTouchable();
    data.sonDatas.put(son, sonData);
    son.setTouchable(Touchable.disabled);

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

/** 解析group控件,当前控件类型为Group的时候处理与Widget类型处理不同 */
public Group groupChildrenParse(CocoCreatorUIEditor editor,
    ObjectData widget, Group parent, Actor actor) {
  Group group = (Group) actor;
  // Group 虽然自己不接收事件,但是子控件得接收
  actor.setTouchable(widget.isTouchEnable() ? Touchable.enabled
      : Touchable.childrenOnly);
  // 必须设置Transform 为true 子控件才会跟着旋转.
  // group.setTransform(true);
  if (widget.getScale() != null || widget.getRotation() != 0) {
    group.setTransform(true);
  }
  for (AANode childrenWidget : widget._children) {
    Actor childrenActor = editor.parseWidget(group, (ObjectData) childrenWidget);
    if (childrenActor == null) {
      continue;
    }
    group.addActor(childrenActor);
  }
  sort(widget, group);
  return group;
}

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

actor.setTouchable(widget.isTouchEnable() ? Touchable.enabled
    : Touchable.disabled);

代码示例来源:origin: 121077313/cocostudio-ui-libgdx

actor.setTouchable(Touchable.disabled);

相关文章