当前位置: 首页>>代码示例>>Java>>正文


Java Actor类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.Actor的典型用法代码示例。如果您正苦于以下问题:Java Actor类的具体用法?Java Actor怎么用?Java Actor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Actor类属于com.badlogic.gdx.scenes.scene2d包,在下文中一共展示了Actor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fireEventOnActor

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
protected boolean fireEventOnActor(Actor actor, InputEvent.Type type, int pointer, Actor related) {
    if (actor == null || !isActorFocussable(actor) || !isActorHittable(actor))
        return false;

    InputEvent event = Pools.obtain(InputEvent.class);
    event.setType(type);
    event.setStage(this);
    event.setRelatedActor(related);
    event.setPointer(pointer);
    event.setButton(-1);

    actor.fire(event);

    boolean handled = event.isHandled();
    Pools.free(event);
    return handled;
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:18,代码来源:ControllerMenuStage.java

示例2: AddWindowButton

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
	final TextButton btn = new TextButton(buttonText, skin);

	btn.addListener(new ChangeListener()
	{
		@Override
		public void changed(ChangeEvent event, Actor actor)
		{
			if (window.isShowing())
				window.hide();
			else
				window.show();
		}
	});

	table.add(btn);
	table.row();
}
 
开发者ID:bp2008,项目名称:blueirisviewer,代码行数:20,代码来源:MainOptionsWnd.java

示例3: getActorType

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
private static Class getActorType(Actor actor){
    if (actor instanceof Label){
        return Label.class;
    }else if (actor instanceof CheckBox){
        return CheckBox.class;
    }else if (actor instanceof Image){
        return Image.class;
    }else if (actor instanceof TextField){
        return TextField.class;
    }else if (actor instanceof Button){
        return Button.class;
    }else if (actor instanceof Group){
        return Group.class;
    }else {
        return Actor.class;
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:18,代码来源:XmlUtils.java

示例4: drag

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
@Override
public void drag(InputEvent event, float x, float y, int pointer) {
    if (pointer == -1) return;
    Actor actor = event.getListenerActor();
    actor.moveBy(x - getTouchDownX(), y - getTouchDownY());
    if (getAllActor().contains(SelectGroup.this.getParent(),false)){
        return;
    }
    for (Actor child : getAllActor()){
        if (child instanceof MainWindow){
            break;
        }else {
            child.moveBy(x-getTouchDownX(),y-getTouchDownY());
        }
    }
    Actor lastActor = selection.getLastSelected();
    if (lastActor!=null){
        EditorManager.getInstance().getEventBus().post(new AttrEvent(lastActor));
        if (getParent() instanceof MainWindow){
            MainWindow mainWindow = (MainWindow) getParent();
            if (mainWindow.getEditorLister()!=null) mainWindow.getEditorLister().change();
        }
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:25,代码来源:SelectGroup.java

示例5: isInsideCub

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
private void isInsideCub(Group group){
    for (Actor child:group.getChildren()){
        if (EditorManager.getInstance().getActorType(child).equals(Group.class)){
            isInsideCub((Group) child);
        }
        if (child instanceof SelectGroup) continue;
        Vector2 childVect2 = child.getParent().localToStageCoordinates(new Vector2(child.getX(),child.getY()));
        childRect.set(childVect2.x,childVect2.y,child.getWidth(),child.getHeight());
        if (getCullingArea().overlaps(childRect)){
            if (!selection.contains(child)){
                child.debug();
                selection.add(child);
            }
        }else if (selection.contains(child)){
            selection.remove(child);
            child.setDebug(false);
        }
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:20,代码来源:SelectGroup.java

示例6: getActorByName

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public Actor getActorByName(String name){
    switch (name){
        case "Group":
            return new Group();
        case "Label":
            return new NativeLabel("",getMainFont());
        case "CheckBox":
            return new VisCheckBox("");
        case "Image":
            return new Image(assetManager.get("badlogic.jpg",Texture.class));
        case "Button":
            return new VisImageButton(VisUI.getSkin().get(VisImageButton.VisImageButtonStyle.class));
        case "TextField":
            return new TextField("",VisUI.getSkin());
        default:
            return new Actor();
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:19,代码来源:EditorManager.java

示例7: arrange

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public static void arrange(float x, float y, float width, float height, Direction direction, Actor... actors) {
  switch (direction) {
    case Above:
    case Below:
      height = height / actors.length;
      break;
    case Left:
    case Right:
      width = width / actors.length;
      break;
  }
  if (direction == Direction.Below) {
    y -= height;
  }
  setSize(width, height, actors);
  Actor prev = actors[0];
  setPos(x, y, prev);
  for (int i = 1; i < actors.length; i++) {
    Actor curr = actors[i];
    move(curr, direction, prev);
    prev = curr;
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:24,代码来源:MenuTools.java

示例8: refreshAttr

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public void refreshAttr(Actor actor){
    if (xTextField == null){
        initGeneralAttr();
    }
    xTextField.setText(String.format("%.2f",actor.getX()));
    yTextField.setText(String.format("%.2f",actor.getY()));
    nameTextField.setText(actor.getName());
    scaleXTF.setText(String.valueOf(actor.getScaleX()));
    scaleYTF.setText(String.valueOf(actor.getScaleY()));
    orignYTextField.setText(String.format("%.2f",actor.getOriginY()));
    orignXTextField.setText(String.format("%.2f",actor.getOriginX()));
    widthText.setText(String.format("%.2f",actor.getWidth()));
    heightText.setText(String.format("%.2f",actor.getHeight()));
    rotationText.setText(String.format("%.2f",actor.getRotation()));
    colorImage.setColor(actor.getColor());
    picker.setColor(actor.getColor());
    visibleBox.setChecked(actor.isVisible());
    zIndexTF.setText(String.valueOf(actor.getZIndex()));
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:20,代码来源:AttrGeneralWindow.java

示例9: refreshAttr

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public void refreshAttr(Actor actor) {
    if (uniqueTable == null) {
        uniqueTable = new VisTable(true);
        uniqueTable.left().padLeft(10f).top().padTop(20);
        VisScrollPane scrollPane = new VisScrollPane(uniqueTable);
        scrollPane.setScrollingDisabled(true,false);
        add(scrollPane).expand().fill();
    }
    uniqueTable.clearChildren();
    if (actor instanceof Label) {
        initLabelAttr((Label) actor, uniqueTable);
    } else if (actor instanceof Image) {
        initImageAttr((Image) actor, uniqueTable);
    }  else if (actor instanceof TextField){
        initTextFieldAttr((TextField) actor,uniqueTable);
    }else if (actor instanceof CheckBox){
        initCheckBoxAttr((CheckBox) actor,uniqueTable);
    }else if (actor instanceof Button) {
        initButtonAttr((Button) actor, uniqueTable);
    }

}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:23,代码来源:AttrUniqueWindow.java

示例10: build

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public void build(FileItem fileItem) {
    clearChildren();
    if (fileItem == null) {
        addItem(new MenuItem("New Scene", new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {

            }
        }));
    }
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:12,代码来源:AssetWindow.java

示例11: MultiplayerConnectMenu

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:MultiplayerConnectMenu.java

示例12: setUpPlayButton

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public void setUpPlayButton() {
    playButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
    playButton.setPosition(Constants.WIDTH / 4 - playButton.getWidth() * 2 / 5,
            Constants.HEIGHT / 2 - playButton.getHeight() * 2.5f -2);
    playButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            //FlappySpinner.gameManager.hideAd();
            float delay = 0.3f;
            setUpFadeOut();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    game.setScreen(new GameScreen(game, 0, false));
                }
            }, delay);
        }
    });
    stage.addActor(playButton);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:21,代码来源:MenuScreen.java

示例13: isActorFocussable

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
/**
 * checks if the given actor is focussable: in the list of focussable actors, visible, touchable, and on the stage
 *
 * @param actor
 * @return true if focussable
 */
protected boolean isActorFocussable(Actor actor) {
    if (!focussableActors.contains(actor, true))
        return false;

    if (!actor.isVisible())
        return false;

    if (!actor.isTouchable())
        return false;

    if (actor.getStage() != this)
        return false;

    return true;
}
 
开发者ID:MrStahlfelge,项目名称:gdx-controllerutils,代码行数:22,代码来源:ControllerMenuStage.java

示例14: ServerSetupMenu

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
public ServerSetupMenu(final Save save) {
  super();
  title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
  saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
  saveLabel.setAlignment(Align.center);
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  start = new TextButton(Localization.get("menu.server.start"), skin);
  back = MenuTools.getBackButton(this);

  start.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT) : Integer.parseInt(port.getText());
      Adapter.setMenu(new ServerRunningMenu(save, p));
    }
  });

  stage.addActor(title);
  stage.addActor(saveLabel);
  stage.addActor(port);
  stage.addActor(start);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:26,代码来源:ServerSetupMenu.java

示例15: TradeOfferItem

import com.badlogic.gdx.scenes.scene2d.Actor; //导入依赖的package包/类
TradeOfferItem(String player, ResourceMap offer, Skin skin) {
    this.skin = skin;

    resources = new ArrayList<>(offer.size());
    counts = new ArrayList<>(offer.size());
    label = new Label(player, skin);
    accept = new TextButton("Accept", skin);
    accept.setWidth(accept.getWidth() + 40);
    accept.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (acceptListener != null) {
                acceptListener.onAcceptClicked(getOwner(), TradeOfferItem.this.offer);
            }
        }
    });

    setOffer(offer);

    if (resources.isEmpty())
        return;

    addActor(label);

    addActor(accept);
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:TradeOfferItem.java


注:本文中的com.badlogic.gdx.scenes.scene2d.Actor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。