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


Java Group.findActor方法代码示例

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


在下文中一共展示了Group.findActor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldParseSpriteView

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseSpriteView() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("animation/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    Image image = group.findActor("st_2");
    Array<Action> actions = image.getActions();
    assertThat(actions.size, is(1));
    RepeatAction repeatAction = (RepeatAction) actions.get(0);
    ParallelAction parallelAction = (ParallelAction) repeatAction.getAction();
    assertThat(parallelAction.getActions().size, is(3));
    assertThat(parallelAction.getActions(), (Matcher) everyItem(instanceOf(SequenceAction.class)));
    SequenceAction moveAction = (SequenceAction) parallelAction.getActions().get(0);
    SequenceAction scaleAction = (SequenceAction) parallelAction.getActions().get(1);
    assertThat(moveAction.getActions().size, is(4));
    assertThat(moveAction.getActions(), (Matcher) everyItem(instanceOf(MoveToAction.class)));
    assertThat(scaleAction.getActions().size, is(4));
    assertThat(scaleAction.getActions(), (Matcher) everyItem(instanceOf(ScaleToAction.class)));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:22,代码来源:CCSpriteViewTest.java

示例2: shouldParseSingleButtonWithImages

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseSingleButtonWithImages() throws Exception {
    FileHandle defaultFont = Gdx.files.internal("share/MLFZS.ttf");

    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("single-button/MainScene.json"), null, null, defaultFont, null);

    Group group = editor.createGroup();
    Actor actor = group.findActor("Button_1");

    assertThat(actor, not(nullValue()));
    assertThat(actor, instanceOf(ImageButton.class));
    ImageButton imageButton = (ImageButton) actor;
    assertThat(imageButton.getScaleX(), is(1.7958f));
    assertThat(imageButton.getScaleY(), is(1.8041f));
    ImageButton.ImageButtonStyle style = imageButton.getStyle();
    assertThat(style.imageDisabled, instanceOf(NinePatchDrawable.class));
    assertThat(style.up, instanceOf(NinePatchDrawable.class));
    assertThat(style.down, instanceOf(NinePatchDrawable.class));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:22,代码来源:CCButtonTest.java

示例3: shouldParsePageView

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParsePageView() throws Exception {
    FileHandle defaultFont = Gdx.files.internal("share/MLFZS.ttf");

    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("levelSelection/MainScene.json"), null, null, defaultFont, null);

    Group group = editor.createGroup();
    PageView pageView = group.findActor("PageView_SelectPage");
    assertThat(pageView.getChildren().get(0).getX(), is(0f));
    pageView.nextView();
    pageView.act(1000f);
    assertThat(pageView.getChildren().get(0).getX(), is(-492f));
    assertThat(pageView.getChildren().get(1).getX(), is(0f));
    pageView.previousView();
    pageView.act(1000f);
    assertThat(pageView.getChildren().get(0).getX(), is(0f));
    assertThat(pageView.getChildren().get(1).getX(), is(492f));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:21,代码来源:CCPageViewTest.java

示例4: shouldParseParticle

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseParticle() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("particle/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    CCParticleActor particleActor = group.findActor("Particle_1");
    Object modeA = Whitebox.getInternalState(particleActor, "modeA");
    Float speedVar = (Float) Whitebox.getInternalState(modeA, "speedVar");
    Float tangentialAccel = (Float) Whitebox.getInternalState(modeA, "tangentialAccel");
    Float tangentialAccelVar = (Float) Whitebox.getInternalState(modeA, "tangentialAccelVar");
    assertThat(speedVar, is(190.79f));
    assertThat(tangentialAccel, is(-92.11f));
    assertThat(tangentialAccelVar, is(65.79f));

    Object modeB = Whitebox.getInternalState(particleActor, "modeB");
    Float startRadius = (Float) Whitebox.getInternalState(modeB, "startRadius");
    Float endRadius = (Float) Whitebox.getInternalState(modeB, "endRadius");
    Float rotatePerSecond = (Float) Whitebox.getInternalState(modeB, "rotatePerSecond");
    assertThat(startRadius, is(0f));
    assertThat(endRadius, is(0f));
    assertThat(rotatePerSecond, is(0f));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:25,代码来源:CCParticleTest.java

示例5: shouldParseSliderBar

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseSliderBar() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("slideBar/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    Slider slider = group.findActor("Slider_1");
    assertThat(slider.getWidth(), is(200f));
    assertThat(slider.getHeight(), is(14f));
    assertThat(slider.getValue(), is(50f));
    Slider.SliderStyle style = slider.getStyle();
    assertThat(style.knob, instanceOf(TextureRegionDrawable.class));
    assertThat(style.background, instanceOf(TextureRegionDrawable.class));
    assertThat(style.knobBefore, instanceOf(TextureRegionDrawable.class));
    //assertThat(style.disabledKnob, instanceOf(TextureRegionDrawable.class));
   // assertThat(style.knobDown, instanceOf(TextureRegionDrawable.class));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:19,代码来源:CCSliderTest.java

示例6: shouldParseTextField

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseTextField() throws Exception {
    FileHandle defaultFont = Gdx.files.internal("share/MLFZS.ttf");
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("textField/MainScene.json"), null, null, defaultFont, null);

    Group group = editor.createGroup();
    TextField textField = group.findActor("TextField_1");
    assertThat(textField.getText(), is("Here is text"));
    assertThat(textField.getMessageText(), is("Place Holder"));
    assertThat(textField.getText(), is("Here is text"));
    assertThat(textField.getColor().toString(), is("008000ff"));
    assertThat(textField.getListeners().size, is(1));
    textField = group.findActor("TextField_2");
    assertThat(textField.getText(), is(""));
    assertThat(textField.getMessageText(), is("Place Holder"));
    assertThat(textField.getColor().toString(), is("ff0000ff"));
    assertThat(textField.getListeners().size, is(1));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:21,代码来源:CCTextFieldTest.java

示例7: InfoPanel

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
public InfoPanel(LmlParser parser) {
    align(Align.top);
    fillX();

    // Workaround of parser's only single parsing operation limitation
    LmlParser localParser = new DefaultLmlParser(parser.getData());
    localParser.setSyntax(parser.getSyntax());
    Group root = (Group) (localParser.parseTemplate(Gdx.files.internal("lml/canvasInfoPanel.lml")).first());
    setActor(root);

    lblPages = root.findActor("lblPages");
    lblZoom = root.findActor("lblZoom");
    lblPageDimens = root.findActor("lblPageDimens");
    lblFileSize = root.findActor("lblFileSize");

    updatePagesText();
    setZoomLevel(100f);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:19,代码来源:InfoPanel.java

示例8: create

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Override
protected Actor create(Skin skin, StageLayoutListener listener) {
	Group group = (Group)super.create(skin, listener);

	for(int i=0; i<actors.size; i++){
		ActorLayout layout = actors.get(i);

		group.addActor(layout.create(skin, listener));
	}

	if(sizeToActor != null){
		Actor actor = group.findActor(sizeToActor);
		if(actor != null){
			group.setWidth(actor.getWidth());
			group.setHeight(actor.getHeight());
		}
	}
	else {
		if(layout.width > 0)
			group.setWidth(layout.width);
		if(layout.height > 0)
			group.setHeight(layout.height);
	}

	return group;
}
 
开发者ID:code-disaster,项目名称:libgdx-snippets,代码行数:27,代码来源:GroupLayout.java

示例9: shouldEnableParseProjectNode

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldEnableParseProjectNode() throws Exception {
    FileHandle defaultFont = Gdx.files.internal("share/MLFZS.ttf");

    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("mainMenu/MainScene.json"), null, null, defaultFont, null);

    Group group = editor.createGroup();
    Actor button = group.findActor("Bnss_2");
    assertThat(button, not(nullValue()));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:13,代码来源:CCProjectNodeTest.java

示例10: shouldParseSingleButtonWithImages

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseSingleButtonWithImages() throws Exception {
    FileHandle defaultFont = Gdx.files.internal("share/MLFZS.ttf");

    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("levelSelection/MainScene.json"), null, null, defaultFont, null);

    Group group = editor.createGroup();
    Table table = group.findActor("Panel_7");
    assertThat(table.getBackground(), is(nullValue()));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:13,代码来源:CCPanelTest.java

示例11: shouldParseTextAtlas

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
@Test
@NeedGL
public void shouldParseTextAtlas() throws Exception {
    CocoStudioUIEditor editor = new CocoStudioUIEditor(
        Gdx.files.internal("levelSelection/MainScene.json"), null, null, null, null);

    Group group = editor.createGroup();
    LabelAtlas labelAtlas = group.findActor("LabelAtlas_CurrentScene");
    assertThat(labelAtlas.getChildren().size, is(3));
    assertThat(labelAtlas.getChildren(), (Matcher) everyItem(instanceOf(Image.class)));
    labelAtlas.setText("0/1");
    assertThat(labelAtlas.getChildren().size, is(3));
    assertThat(labelAtlas.getChildren(), (Matcher) everyItem(instanceOf(Image.class)));
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:15,代码来源:CCTextAtlasTest.java

示例12: injectActorFields

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
/** Injects actors from group into target's fields annotated with {@link InjectActor} using reflection. */
public static void injectActorFields(Object target, Group group) {
    Class<?> handledClass = target.getClass();
    while (handledClass != null && !handledClass.equals(Object.class)) {
        for (final Field field : ClassReflection.getDeclaredFields(handledClass)) {
            if (field != null && field.isAnnotationPresent(InjectActor.class)) {
                try {
                    InjectActor annotation = field.getDeclaredAnnotation(InjectActor.class).getAnnotation(InjectActor.class);
                    String actorName = annotation.value();
                    if (actorName.length() == 0) {
                        actorName = field.getName();
                    }
                    Actor actor = group.findActor(actorName);
                    if (actor == null && actorName.equals(group.getName())) {
                        actor = group;
                    }
                    if (actor == null) {
                        Gdx.app.error(TAG_INJECT_FIELDS, "Can't find actor with name: " + actorName + " in group: " + group + " to inject into: " + target);
                    } else {
                        field.setAccessible(true);
                        field.set(target, actor);
                    }
                } catch (final ReflectionException exception) {
                    Gdx.app.error(TAG_INJECT_FIELDS, "Unable to set value into field: " + field + " of object: " + target, exception);
                }
            }
        }
        handledClass = handledClass.getSuperclass();
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:31,代码来源:Scene2dUtils.java

示例13: RegularMetadataItemViewHolder

import com.badlogic.gdx.scenes.scene2d.Group; //导入方法依赖的package包/类
public RegularMetadataItemViewHolder(LmlParser parser) {
    root = (Group) parser.parseTemplate(Gdx.files.internal("lml/dialogPackingMetaRegularItem.lml")).first();
    this.parser = parser;
    lblContent = root.findActor("lblContent");
    imgIcon = root.findActor("imgIcon");
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:7,代码来源:ProcessingNodeListViewItem.java


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