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

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

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

Actor.getName介绍

暂无

代码示例

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

/** Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the
 * group. */
public <T extends Actor> T findActor (String name) {
  Array<Actor> children = this.children;
  for (int i = 0, n = children.size; i < n; i++)
    if (name.equals(children.get(i).getName())) return (T)children.get(i);
  for (int i = 0, n = children.size; i < n; i++) {
    Actor child = children.get(i);
    if (child instanceof Group) {
      Actor actor = ((Group)child).findActor(name);
      if (actor != null) return (T)actor;
    }
  }
  return null;
}

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

/** Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the
 * group. */
public <T extends Actor> T findActor (String name) {
  Array<Actor> children = this.children;
  for (int i = 0, n = children.size; i < n; i++)
    if (name.equals(children.get(i).getName())) return (T)children.get(i);
  for (int i = 0, n = children.size; i < n; i++) {
    Actor child = children.get(i);
    if (child instanceof Group) {
      Actor actor = ((Group)child).findActor(name);
      if (actor != null) return (T)actor;
    }
  }
  return null;
}

代码示例来源:origin: stackoverflow.com

int len = stageActors.size;
for(i=0; i<len; i++){
  Actor a = stageActors.get(i);
  if(a.getName().equals("myactor")){
    //a is your Actor!
    break;
  }
}

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

private static void logCollision1(Actor a1, Actor a2) {
  MtxLogger.log(logActive, true, logTag,
      "Collision detected: Actor (Name: " + a1.getName()
          + ") and Actor (Name: " + a2.getName() + ")");
}

代码示例来源:origin: stackoverflow.com

public void onItemClick(AdapterView<?> arg0, View arg1, int position,
       long id) {
     // TODO Auto-generated method stub
     Toast.makeText(getApplicationContext(), actorsList.get(position).getName(), Toast.LENGTH_LONG).show();
     Actor selectedActor = actorsList.get(position);
     JSONObject obj = new JsonObject();
     obj.put("name",selectedActor.getName());
     //add other values of actor like that
     Intent i = new Intent(MainActirity.this,otherActivity.class);
     i.putExtra("Actor",obj.toString());
     startActivity(i);
   }

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

@Override
  public void keyboardFocusChanged(FocusEvent event, Actor actor,
      boolean focused) {
    if(focused && actor instanceof TextField) {
      textFieldFocusChanged(actor.getName());
    }
  }
});

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

/** Easy logger */
  private static void log(String msj, Actor actor) {
    MtxLogger.log(logActive, true, logTag,
        msj + " (Actor Name: " + actor.getName() + ")");
  }
}

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

@Override
  public int compare(Actor arg0, Actor arg1) {
    return getZOrder(widget, arg0.getName())
        - getZOrder(widget, arg1.getName());
  }
});

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

private static void logCollision2(Actor a1) {
    MtxLogger.log(
        logActive,
        true,
        logTag,
        "Collision detected on touch point: Actor (Name: "
            + a1.getName() + ")");
  }
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

@Override
  public void keyboardFocusChanged(FocusEvent event, Actor actor, boolean focused) {
    if (!focused) {
      updateModel(actor.getName(), ((TextField) actor).getText());
      EditorLogger.debug("Updating property: " + actor.getName());
    }
  }
});

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

public String text() {
  Actor actor = t;
  return actor instanceof Label ? ((Label) actor).getText().toString() : (actor.getName()==null?actor.toString(): actor.getName());
}

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

public String text() {
  Actor actor = get();
  return actor instanceof Label ? ((Label) actor).getText().toString() : (actor.getName()==null?actor.toString(): actor.getName());
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

@SuppressWarnings("unchecked")
  @Override
  public void changed(ChangeEvent event, Actor actor) {
    updateModel(actor.getName(), ((SelectBox<String>) actor).getSelected());
  }
});

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

@SuppressWarnings("unchecked")
  @Override
  public void changed(ChangeEvent event, Actor actor) {
    updateModel(actor.getName(), ((SelectBox<String>) actor).getSelected());
  }
});

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

protected void addActor(CocoCreatorUIEditor editor, Actor actor,
    ObjectData option) {
  Array<Actor> arrayActors = editor.getActors().get(actor.getName());
  if (arrayActors == null) {
    arrayActors = new Array<Actor>();
  }
  arrayActors.add(actor);
  editor.getActors().put(actor.getName(), arrayActors);
  editor.getActionActors().put(option.getActionTag(), actor);
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

@SuppressWarnings("unchecked")
public void setProperty(String name, String value) {
  SnapshotArray<Actor> actors = table.getChildren();
  for (Actor a : actors) {
    if (name.equals(a.getName())) {
      if (a instanceof SelectBox<?>) {
        ((SelectBox<String>) a).setSelected(value == null ? "" : value);
      } else {
        ((TextField) a).setText(value == null ? "" : value);
      }
      return;
    }
  }
}

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

/** Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the
 * group. */
public <T extends Actor> T findActor (String name) {
  Array<Actor> children = this.children;
  for (int i = 0, n = children.size; i < n; i++)
    if (name.equals(children.get(i).getName())) return (T)children.get(i);
  for (int i = 0, n = children.size; i < n; i++) {
    Actor child = children.get(i);
    if (child instanceof Group) {
      Actor actor = ((Group)child).findActor(name);
      if (actor != null) return (T)actor;
    }
  }
  return null;
}

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

public void clicked(InputEvent event, float x, float y) {
    currentVerb = event.getListenerActor().getName();
    infoLine.setText(((TextButton) event.getListenerActor()).getText());
    target = null;
  }
});

代码示例来源:origin: bladecoder/bladecoder-adventure-engine

@Override
  public void clicked(InputEvent event, float x, float y) {
    final World world = ui.getWorld();
    final String filename = event.getListenerActor().getName() + WorldSerialization.GAMESTATE_EXT;
    try {
      world.getSerializer().saveGameState(filename, true);
      ui.setCurrentScreen(Screens.SCENE_SCREEN);
    } catch (IOException e) {
      EngineLogger.error(e.getMessage());
    }
  }
};

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

private static void removeActor(Group group, Actor actor) {
    if (group != null && actor != null) {
      actor.clearActions();
      String actorName = actor.getName();
      if (group.removeActor(actor)) {
        MtxLogger.log(logActive, true, logTag, "Actor removed! (Name: "
            + actorName + ")");
      } else {
        MtxLogger.log(logActive, true, logTag,
            "Actor not removed! (Name: " + actorName + ")");
      }
    }
  }
}

相关文章