Java 类com.badlogic.gdx.scenes.scene2d.ui.List 实例源码

项目:JavityEngine    文件:JXmlUi.java   
private void addList(Table table, Element element) {
    Gdx.app.log("JXmlUi", "addList");
    ObjectMap<String, String> atrributes = element.getAttributes();
    if (atrributes == null)
        atrributes = new ObjectMap<String, String>();

    List<String> list = new List<String>(skin);
    list.getSelection().setMultiple(false);

    ScrollPane scrollPane = new ScrollPane(list, skin);

    Cell<ScrollPane> cell = table.add(scrollPane);
    for (String key : atrributes.keys()) {
        if (key.equalsIgnoreCase("name")) {
            list.setName(atrributes.get(key));
            scrollPane.setName(atrributes.get(key) + "-scroll-panel");
        }
    }
    cellPrepare(cell, atrributes);

    actorsMap.put(list.getName(), list);
    actorsMap.put(scrollPane.getName(), scrollPane);

    addElementsInList(element, list);
}
项目:JavityEngine    文件:JXmlUi.java   
private void addElementsInList(Element element, List list) {
    Array<String> items = new Array<String>();

    int childCount = element.getChildCount();
    for (int x = 0; x < childCount; x++) {
        Element child = element.getChild(x);
        if (!child.getName().equalsIgnoreCase("list-element"))
            continue;
        // Gdx.app.log("JXmlUi", "addListElement");
        String text = child.getAttribute("text");
        items.add(text);

    }

    list.setItems(items);
}
项目:gdx-lml    文件:SelectedLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final List<?> actor, final String rawAttributeData) {
    LmlUtilities.getLmlUserObject(actor).addOnCloseAction(new ActorConsumer<Object, Object>() {
        @Override
        @SuppressWarnings("unchecked")
        public Object consume(final Object widget) {
            try {
                actor.setSelectedIndex(parser.parseInt(rawAttributeData, actor));
            } catch (final Exception exception) {
                Exceptions.ignore(exception); // Possible number format exception. Trying to select string.
                ((List<String>) actor).setSelected(parser.parseString(rawAttributeData, actor));
            }
            return null;
        }
    });
}
项目:libgdxcn    文件:BaseG3dHudTest.java   
protected CollapsableWindow addListWindow (String title, List list, float x, float y) {
    CollapsableWindow window = new CollapsableWindow(title, skin);
    window.row();
    ScrollPane pane = new ScrollPane(list, skin);
    pane.setFadeScrollBars(false);
    window.add(pane);
    window.pack();
    window.pack();
    if (window.getHeight() > hudHeight) {
        window.setHeight(hudHeight);
    }
    window.setX(x < 0 ? hudWidth - (window.getWidth() - (x + 1)) : x);
    window.setY(y < 0 ? hudHeight - (window.getHeight() - (y + 1)) : y);
    window.layout();
    window.collapse();
    hud.addActor(window);
    pane.setScrollX(0);
    pane.setScrollY(0);
    return window;
}
项目:libgdxcn    文件:ControllersTest.java   
private void setupUi () {
    // setup a tiny ui with a console and a clear button.
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    stage = new Stage();
    ui = new Table();
    ui.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    console = new List(skin);
    scrollPane = new ScrollPane(console);
    scrollPane.setScrollbarsOnTop(true);
    TextButton clear = new TextButton("Clear", skin);
    ui.add(scrollPane).expand(true, true).fill();
    ui.row();
    ui.add(clear).expand(true, false).fill();
    stage.addActor(ui);
    clear.addListener(new ClickListener() {
        @Override
        public void clicked (InputEvent event, float x, float y) {
            clear();
        }
    });
    Gdx.input.setInputProcessor(stage);
}
项目:Terminkalender    文件:GameDialogActor.java   
private void addTask(String taskName, String taskLimit, String whatString, String whereString, List<String> list) {
    if(!taskName.equals("") && validateFieldString(taskName)) {
        boolean add = true;
        String task = taskName + " [" + taskLimit + "]";
        if(validateTaskSecondaryFieldString(whatString)) {
            task = task + " [" + whatString + "]";
        }
        else add = false;
        taskWhatText.setText("");
        if(validateTaskSecondaryFieldString(whereString)) {
            task = task + " [" + whereString + "]";
        }
        else add = false;
        taskWhereText.setText("");
        if(add) {
            addInList(task, list);
        }
    }
}
项目:GdxStudio    文件:SceneEditor.java   
public static void doClick(Actor actor){
    addField.remove();
    Frame.actorPanel.lock();
    Frame.propertyPanel.clear();
    Frame.effectPanel.clear();
    Frame.eventPanel.clear();
    selectedActor = actor;
    Scene.getCurrentScene().outline(actor);
    Frame.actorPanel.list.setSelectedIndex(Frame.actorPanel.indexOf(actor.getName()));
    StatusBar.updateSelected(actor.getName());
    Frame.dashPanel.update();
    Frame.propertyPanel.update();
    Frame.effectPanel.update();
    Frame.eventPanel.update();
    Frame.actorPanel.unlock();
    if(selectedActor instanceof List || selectedActor instanceof SelectBox){
        addField.setPosition(actor.getX(), actor.getY() - addField.getHeight());
        Scene.getRoot().addActor(addField);
    }
}
项目:GdxStudio    文件:Serializer.java   
public static void setup(){
    registerSerializer(Actor.class, new ActorSerializer());
    registerSerializer(Scene.class, new SceneSerializer());
    registerSerializer(ImageJson.class, new ImageJson());
    registerSerializer(Label.class, new LabelSerializer());
    registerSerializer(Button.class, new ButtonSerializer());
    registerSerializer(TextButton.class, new TextButtonSerializer());
    registerSerializer(Table.class, new TableSerializer());
    registerSerializer(CheckBox.class, new CheckBoxSerializer());
    registerSerializer(SelectBox.class, new SelectBoxSerializer());
    registerSerializer(List.class, new ListSerializer());
    registerSerializer(Slider.class, new SliderSerializer());
    registerSerializer(TextField.class, new TextFieldSerializer());
    registerSerializer(Touchpad.class, new TouchpadSerializer());
    registerSerializer(Sprite.class, new SpriteSerializer());

    registerSerializer(Dialog.class, new DialogSerializer());
    registerSerializer(SplitPane.class, new SplitPaneSerializer());
    registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
    registerSerializer(Stack.class, new StackSerializer());
    registerSerializer(Tree.class, new TreeSerializer());
    registerSerializer(Table.class, new TableSerializer());
    registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
    registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
    registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
项目:gdx-ai    文件:SteeringBehaviorsTest.java   
private List<String> createTestList (final int engineIndex) {
    // Create test names
    int numTests = tests[engineIndex].length;
    String[] testNames = new String[numTests];
    for (int i = 0; i < numTests; i++) {
        testNames[i] = tests[engineIndex][i].testName;
    }

    final List<String> testList = new List<String>(skin);
    testList.setItems(testNames);
    testList.addListener(new ClickListener() {
        @Override
        public void clicked (InputEvent event, float x, float y) {
            if (!testSelectionWindow.isCollapsed() && getTapCount() == 2) {
                changeTest(engineIndex, testList.getSelectedIndex());
                testSelectionWindow.collapse();
            }
        }
    });
    return testList;
}
项目:gdx-ai    文件:BehaviorTreeTests.java   
private List<String> createTestList () {
    // Create behavior names
    int numTests = tests.length;
    String[] testNames = new String[numTests];
    for (int i = 0; i < numTests; i++) {
        testNames[i] = tests[i].getName();
    }

    final List<String> testList = new List<String>(skin);
    testList.setItems(testNames);
    testList.addListener(new ClickListener() {
        @Override
        public void clicked (InputEvent event, float x, float y) {
            changeTest(testList.getSelectedIndex());
        }
    });
    return testList;
}
项目:gdx-ai    文件:PathFinderTests.java   
private List<String> createTestList () {
    // Create behavior names
    int numBehaviors = tests.length;
    String[] algorithmNames = new String[numBehaviors];
    for (int i = 0; i < numBehaviors; i++) {
        algorithmNames[i] = tests[i].testName;
    }

    final List<String> algorithmList = new List<String>(skin);
    algorithmList.setItems(algorithmNames);
    algorithmList.addListener(new ClickListener() {
        @Override
        public void clicked (InputEvent event, float x, float y) {
            if (!algorithmSelectionWindow.isCollapsed() && getTapCount() == 2) {
                changeTest(algorithmList.getSelectedIndex());
                algorithmSelectionWindow.collapse();
            }
        }
    });
    return algorithmList;
}
项目:gdx-ai    文件:PathFinderTests.java   
protected CollapsableWindow addBehaviorSelectionWindow (String title, List<String> testList, float x, float y) {

        CollapsableWindow window = new CollapsableWindow(title, skin);
        window.row();

        ScrollPane pane = new ScrollPane(testList, skin);
        pane.setFadeScrollBars(false);
        pane.setScrollX(0);
        pane.setScrollY(0);

        window.add(pane);
        window.pack();
        window.pack();
        if (window.getHeight() > stage.getHeight()) {
            window.setHeight(stage.getHeight());
        }
        window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
        window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
        window.layout();
        window.collapse();
        stage.addActor(window);

        return window;
    }
项目:gdx-ai    文件:MessageTests.java   
private List<String> createTestList () {
    // Create behavior names
    int numTests = tests.length;
    String[] testNames = new String[numTests];
    for (int i = 0; i < numTests; i++) {
        testNames[i] = tests[i].testName;
    }

    final List<String> testList = new List<String>(skin);
    testList.setItems(testNames);
    testList.addListener(new ClickListener() {
        @Override
        public void clicked (InputEvent event, float x, float y) {
            if (!testSelectionWindow.isCollapsed() && getTapCount() == 2) {
                changeTest(testList.getSelectedIndex());
                testSelectionWindow.collapse();
            }
        }
    });
    return testList;
}
项目:gdx-ai    文件:MessageTests.java   
protected CollapsableWindow addTestSelectionWindow (String title, List<String> testList, float x, float y) {
    CollapsableWindow window = new CollapsableWindow(title, skin);
    window.row();

    ScrollPane pane = new ScrollPane(testList, skin);
    pane.setFadeScrollBars(false);
    pane.setScrollX(0);
    pane.setScrollY(0);

    window.add(pane);
    window.pack();
    window.pack();
    if (window.getHeight() > stage.getHeight()) {
        window.setHeight(stage.getHeight());
    }
    window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
    window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
    window.layout();
    window.collapse();
    stage.addActor(window);

    return window;
}
项目:amatsukaze    文件:BaseG3dHudTest.java   
protected CollapsableWindow addListWindow (String title, List list, float x, float y) {
    CollapsableWindow window = new CollapsableWindow(title, skin);
    window.row();
    ScrollPane pane = new ScrollPane(list, skin);
    pane.setFadeScrollBars(false);
    window.add(pane);
    window.pack();
    window.pack();
    if (window.getHeight() > hudHeight) {
        window.setHeight(hudHeight);
    }
    window.setX(x < 0 ? hudWidth - (window.getWidth() - (x + 1)) : x);
    window.setY(y < 0 ? hudHeight - (window.getHeight() - (y + 1)) : y);
    window.layout();
    window.collapse();
    hud.addActor(window);
    pane.setScrollX(0);
    pane.setScrollY(0);
    return window;
}
项目:Cardshifter    文件:DeckBuilderScreen.java   
private Table scanSavedDecks(final CardshifterGame game, final List<String> savedDecks, String modName) {
    if (Gdx.files.isExternalStorageAvailable()) {
        Table saveTable = new Table();
        external = Gdx.files.external("Cardshifter/decks/" + modName + "/");
        external.mkdirs();

        if (!external.exists()) {
            Gdx.app.log("Files", external.path() + " does not exist.");
            return null;
        }

        updateSavedDeckList();

        saveTable.add(savedDecks).colspan(2).fill().row();
        return saveTable;
    }
    return null;
}
项目:Wisper    文件:WisperChooseMenu.java   
private void createTable() {
    list = new List<String>(skin);
    list.setItems(new String[] {"Thanatos", "Spark", "Bloody"});
    list.addListener(new ListListener());

    ScrollPane scrollPane = new ScrollPane(list, skin);

    TextButton start = new TextButton("Start", skin, "medium");
    start.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            fadeTo(new GameScreen(list.getSelectedIndex()));
        }
    });
    start.pad(10);

    table.padTop(50);
    table.add(new Label("Select your Wisper", skin, "big-bold")).colspan(2).expandX().spaceBottom(125).row();
    table.add(scrollPane).padLeft(10).minWidth(250).top().left();
    table.add(wisper).uniformX().expandX().expandY().center().row();
    table.add(start).colspan(2).expandX().bottom();
    table.padBottom(50);

    stage.addActor(table);
}
项目:Catan    文件:BrowseGamesWindow.java   
public BrowseGamesWindow() {
    super("Browse Games", CatanGame.skin);

    games = new ArrayList<>();
    gameList = new List<>(CatanGame.skin);

    add(gameList).pad(20).width(300).row();

    TextButton loadGame = new TextButton("Load Game", CatanGame.skin);
    loadGame.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (gameListener != null) {
                gameListener.onGameSelected(gameList.getSelected());
                close();
            }
        }
    });
    add(loadGame).right().pad(20);

    setSize(400, 400);
    setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
}
项目:fabulae    文件:ModalEnabledSelectBox.java   
@Override
public boolean isAscendantOf(Actor actor) {
    if (actor instanceof List) {
        if (getScrollPane() == actor.getParent()) {
            return true;
        }
    } else if (actor instanceof ScrollPane) {
        if (getScrollPane() == actor) {
            return true;
        }
    }
    return super.isAscendantOf(actor);
}
项目:gdx-texture-packer-gui    文件:Scene2dUtils.java   
/**
 * @param scrollPane widget will be scrolled
 * @param list must be child of scrollPane
 */
public static void scrollDownToSelectedListItem(ScrollPane scrollPane, List list) {
    if (list.getSelectedIndex() == -1) return;

    float y = list.getHeight() - (list.getSelectedIndex() * list.getItemHeight()) - list.getItemHeight();
    float height = list.getItemHeight();

    scrollPane.scrollTo(0, y, 0, height);
}
项目:ChessGDX    文件:NewGameTable.java   
/**
 * Expands on button click to give the player the option to choose their
 * color, and start a new game as the chosen color.
 * 
 * @param skin
 * @param core
 *            the foundation of the game, contains a function to revert the
 *            game to the launch state
 */
NewGameTable(Skin skin, final GameCore core) {

    String[] colors = new String[] { "              white", "              black" };

    TextButton newGame = new TextButton("New Game", skin, MenuSkin.IB_NEW);
    Label mColorLabel = new Label("Color:", skin, MenuSkin.LB_LARGE);
    final List<String> mColor = new List<String>(skin, MenuSkin.LS_COLOR_CHOOSER);
    TextButton mStartGame = new TextButton("Start", skin);

    mColorLabel.setAlignment(Align.center);
    mColor.setItems(colors);

    mStartGame.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (mColor.getSelectedIndex() == 0) {
                core.newGame(true);
            } else {
                core.newGame(false);
            }
        }
    });

    int screenWidth = Gdx.graphics.getWidth();
    int screenHeight = Gdx.graphics.getHeight();

    add(newGame).colspan(2).width((screenHeight / 3) * 0.9f);
    row().fill();
    add(mColorLabel).fill();
    add(mColor).fill();
    row();
    add(mStartGame).colspan(2).width((screenHeight / 3) * 0.9f);

    pack();

    setPosition(screenWidth + ((screenHeight / 3) * 0.05f), screenHeight - getHeight() - (getHeight() * 0.1f));
}
项目:gdx-autumn-mvc    文件:ReflectionPreference.java   
@Override
public Object extractFromActor(final Actor actor) {
    if (actor instanceof TextField) {
        return Integer.valueOf(((TextField) actor).getText());
    } else if (actor instanceof List<?>) {
        return ((List<?>) actor).getSelectedIndex();
    } else if (actor instanceof SelectBox<?>) {
        return ((SelectBox<?>) actor).getSelectedIndex();
    }
    throw new GdxRuntimeException("Cannot use default setter of int preference with actor: " + actor);
}
项目:gdx-autumn-mvc    文件:ReflectionPreference.java   
@Override
public Object extractFromActor(final Actor actor) {
    if (actor instanceof Label) {
        return ((Label) actor).getText().toString();
    } else if (actor instanceof TextButton) {
        return ((TextButton) actor).getText();
    } else if (actor instanceof TextField) {
        return ((TextField) actor).getText();
    } else if (actor instanceof List<?>) {
        return Strings.toString(((List<?>) actor).getSelected(), Strings.EMPTY_STRING);
    } else if (actor instanceof SelectBox<?>) {
        return Strings.toString(((SelectBox<?>) actor).getSelected(), Strings.EMPTY_STRING);
    }
    return Strings.toString(actor);
}
项目:gdx-lml    文件:RequiredLmlAttribute.java   
@Override
@SuppressWarnings("unchecked")
public Class<List<?>> getHandledType() {
    // Double cast as there were a problem with generics - SomeClass.class cannot be returned as
    // <Class<SomeClass<?>>, even though casting never throws ClassCastException in the end.
    return (Class<List<?>>) (Object) List.class;
}
项目:gdx-lml    文件:MultipleLmlAttribute.java   
@Override
@SuppressWarnings("unchecked")
public Class<List<?>> getHandledType() {
    // Double cast as there were a problem with generics - SomeClass.class cannot be returned as
    // <Class<SomeClass<?>>, even though casting never throws ClassCastException in the end.
    return (Class<List<?>>) (Object) List.class;
}
项目:gdx-lml    文件:SelectionDisabledLmlAttribute.java   
@Override
@SuppressWarnings("unchecked")
public Class<List<?>> getHandledType() {
    // Double cast as there were a problem with generics - SomeClass.class cannot be returned as
    // <Class<SomeClass<?>>, even though casting never throws ClassCastException in the end.
    return (Class<List<?>>) (Object) List.class;
}
项目:gdx-lml    文件:SelectedLmlAttribute.java   
@Override
@SuppressWarnings("unchecked")
public Class<List<?>> getHandledType() {
    // Double cast as there were a problem with generics - SomeClass.class cannot be returned as
    // <Class<SomeClass<?>>, even though casting never throws ClassCastException in the end.
    return (Class<List<?>>) (Object) List.class;
}
项目:gdx-lml    文件:ToggleLmlAttribute.java   
@Override
@SuppressWarnings("unchecked")
public Class<List<?>> getHandledType() {
    // Double cast as there were a problem with generics - SomeClass.class cannot be returned as
    // <Class<SomeClass<?>>, even though casting never throws ClassCastException in the end.
    return (Class<List<?>>) (Object) List.class;
}
项目:gdx-lml    文件:RangeSelectLmlAttribute.java   
@Override
@SuppressWarnings("unchecked")
public Class<List<?>> getHandledType() {
    // Double cast as there were a problem with generics - SomeClass.class cannot be returned as
    // <Class<SomeClass<?>>, even though casting never throws ClassCastException in the end.
    return (Class<List<?>>) (Object) List.class;
}
项目:gdx-lml    文件:ReflectionPreference.java   
@Override
public Object extractFromActor(final Actor actor) {
    if (actor instanceof TextField) {
        return Integer.valueOf(((TextField) actor).getText());
    } else if (actor instanceof List<?>) {
        return ((List<?>) actor).getSelectedIndex();
    } else if (actor instanceof SelectBox<?>) {
        return ((SelectBox<?>) actor).getSelectedIndex();
    }
    throw new GdxRuntimeException("Cannot use default setter of int preference with actor: " + actor);
}
项目:gdx-lml    文件:ReflectionPreference.java   
@Override
public Object extractFromActor(final Actor actor) {
    if (actor instanceof Label) {
        return ((Label) actor).getText().toString();
    } else if (actor instanceof TextButton) {
        return ((TextButton) actor).getText();
    } else if (actor instanceof TextField) {
        return ((TextField) actor).getText();
    } else if (actor instanceof List<?>) {
        return Strings.toString(((List<?>) actor).getSelected(), Strings.EMPTY_STRING);
    } else if (actor instanceof SelectBox<?>) {
        return Strings.toString(((SelectBox<?>) actor).getSelected(), Strings.EMPTY_STRING);
    }
    return Strings.toString(actor);
}
项目:Terminkalender    文件:GameDialogActor.java   
private void deleteItemtInStringList(List<String> list, String item) {
    int taskIndex = list.getSelectedIndex();
    list.getItems().removeValue(item, false);
    if(taskIndex - 1 >= 0) {
        list.setSelectedIndex(taskIndex - 1); 
    }
    else if(list.getItems().size > 0) {
        list.setSelectedIndex(0); 
    }
}
项目:Terminkalender    文件:OpenGameDialogActor.java   
public OpenGameDialogActor(Skin skin, final TeacherGame game, TextButton thisButton) {
    super(skin, game, thisButton);

    actionButton = new TextButton("Close Game", skin, "textButtonLargeRed");
    Label nameLabel = new Label("Game name: " + game.getName(), skin);
    Label passwordLabel = new Label("Password: " + game.getPassword(), skin);

    Table tasksBoxTable = new Table(skin);
    ScrollWindow tasksBoxWindow = new ScrollWindow("TASKS LIST", skin, tasksBoxTable);
    List<String> tasksBox = new List<String>(Resources.skin);
    tasksBox.setItems(tasksToTaskBox(game.getTasks()));
    Table usersBoxTable = new Table(skin);
    ScrollWindow usersBoxWindow = new ScrollWindow("USERS LIST", skin, usersBoxTable);
    List<String> usersBox = new List<String>(Resources.skin);
    usersBox.setItems(game.getUsers());

    getButtonTable().defaults().width(175).height(100);

    tasksBoxTable.add(tasksBox).expand().fill();
    usersBoxTable.add(usersBox).expand().fill();

    getContentTable().padTop(40);
    getContentTable().add(nameLabel).colspan(2).row();
    getContentTable().add(passwordLabel).colspan(2).padBottom(10).row();
    getContentTable().add(tasksBoxWindow).padTop(8).width(300).height(250).padRight(15);
    getContentTable().add(usersBoxWindow).padTop(8).width(300).height(250);
    getButtonTable().padTop(30);
    button(actionButton, "OK");
}
项目:zesp2013    文件:ScrollList.java   
public ScrollList (ListStyle liststyle,ScrollPaneStyle scrollpanestyle ) {
    super();
    list = new List (new String[]{""},liststyle);
    scrollpane = new ScrollPane (list,scrollpanestyle);
    scrollpane.setFadeScrollBars(false);
    addActor(scrollpane);
}
项目:GdxStudio    文件:StudioPanel.java   
public void createActor(String type){
    switch(type){
        case "Label":
            if(Asset.fontMap.size != 0){
                LabelStyle ls = new LabelStyle();
                ls.font = Asset.fontMap.firstValue();
                Label label = new Label("Text", ls);
                setName(label);
            }
            break;
        case "Image":
            if(Asset.texMap.size != 0){
                setName(new ImageJson(Asset.texMap.firstKey()));
            }
            break;
        case "Texture":setName(new ImageJson(Content.assetPanel.list.getSelectedValue()));break;
        case "Sprite":setName(new Sprite(1f, Asset.texMap.firstKey()));break;
        case "Particle":
            //ParticleEffect pe = new ParticleEffect();
            //pe.load(effectFile, imagesDir);
            break;

        case "Button":setName(new Button(Asset.skin));break;
        case "TextButton":setName(new TextButton("Text", Asset.skin));break;
        case "TextField":setName(new TextField("", Asset.skin));break;
        case "Table":setName(new Table(Asset.skin));break;
        case "CheckBox":setName(new CheckBox("Check", Asset.skin));break;
        case "SelectBox":setName(new SelectBox(new String[]{"First","Second","Third"}, Asset.skin));break;
        case "List":setName(new List(new String[]{"First","Second","Third"}, Asset.skin));break;
        case "Slider":setName(new Slider(0, 10, 1, false, Asset.skin));break;
        case "Dialog":setName(new Dialog("Title", Asset.skin));break;
        case "Touchpad":setName(new Touchpad(5, Asset.skin));break;
        case "Map":setName(new Map(1, 24));break;
        case "None":break;
        default:break;
    }
}
项目:GdxStudio    文件:Serializer.java   
@Override
public void write(Json json, Actor list, Class arg2) {
    json.writeObjectStart();
    writeActor(json, list);
    String items = "";
    for(String s: ((List)list).getItems())
        items+=s+",";
    json.writeValue("text", items);
    json.writeObjectEnd();
}
项目:gaiasky    文件:FileChooser.java   
public FileChooser(String title, final Skin skin, FileHandle baseDir) {
    super(title, skin);
    this.skin = skin;
    this.baseDir = baseDir;

    final Table content = getContentTable();
    content.top().left();

    fileListLabel = new Label("", skin);
    fileListLabel.setAlignment(Align.left);

    fileList = new List<FileListItem>(skin, "light");
    fileList.getSelection().setProgrammaticChangeEvents(false);

    fileNameInput = new TextField("", skin);
    fileNameLabel = new Label("File name:", skin);
    fileNameInput.setTextFieldListener(new TextFieldListener() {
        @Override
        public void keyTyped(TextField textField, char c) {
            result = textField.getText();
        }
    });

    ok = new TextButton("Ok", skin);
    button(ok, true);

    cancel = new TextButton("Cancel", skin);
    button(cancel, false);
    key(Keys.ENTER, true);
    key(Keys.ESCAPE, false);

    fileList.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            final FileListItem selected = fileList.getSelected();
            result = selected.name;
            fileNameInput.setText(result);
        }
    });
}
项目:gdx-ai    文件:SteeringBehaviorsTest.java   
private CollapsableWindow addTestSelectionWindow (String title, String[] tabTitles, Array<List<String>> tabLists,
    float x, float y) {
    if (tabTitles.length != tabLists.size)
        throw new IllegalArgumentException("tabTitles and tabList must have the same size.");
    CollapsableWindow window = new CollapsableWindow(title, skin);
    window.row();
    TabbedPane tabbedPane = new TabbedPane(skin);
    for (int i = 0; i < tabLists.size; i++) {
        ScrollPane pane = new ScrollPane(tabLists.get(i), skin);
        pane.setFadeScrollBars(false);
        pane.setScrollX(0);
        pane.setScrollY(0);

        tabbedPane.addTab(" " + tabTitles[i] + " ", pane);
    }
    window.add(tabbedPane);
    window.pack();
    window.pack();
    if (window.getHeight() > stage.getHeight()) {
        window.setHeight(stage.getHeight());
    }
    window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
    window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
    window.layout();
    window.collapse();
    stage.addActor(window);

    return window;
}
项目:gdx-ai    文件:BehaviorTreeTests.java   
public MainScreen() {
    Gdx.gl.glClearColor(.3f, .3f, .3f, 1);

    skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    stage = new Stage(new ScreenViewport());
    stage.setDebugAll(DEBUG_STAGE);

    // Create split pane
    List<String> testList = createTestList();
    ScrollPane leftScrollPane = new ScrollPane(testList, skin);
    splitPane = new SplitPane(leftScrollPane, null, false, skin, "default-horizontal");
    splitPane.setSplitAmount(Math.min((testList.getPrefWidth() + 10) / stage.getWidth(), splitPane.getSplit()));

    // Create layout
    Table t = new Table(skin);
    t.setFillParent(true);
    t.add(splitPane).colspan(3).grow();
    t.row();
    t.add(pauseButton = new PauseButton(skin)).width(90).left();
    t.add(new FpsLabel("FPS: ", skin)).left();
    t.add(testDescriptionLabel = new Label("", skin)).left();
    stage.addActor(t);

    // Set selected test
    changeTest(0);
}
项目:gdx-ai    文件:PathFinderTests.java   
@Override
public void create () {
    Gdx.gl.glClearColor(.3f, .3f, .3f, 1);

    skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    // Enable color markup
    BitmapFont font = skin.get("default-font", BitmapFont.class);
    font.getData().markupEnabled = true;

    stage = new Stage();
    stage.setDebugAll(DEBUG_STAGE);
    stageWidth = stage.getWidth();
    stageHeight = stage.getHeight();

    Gdx.input.setInputProcessor(new InputMultiplexer(stage));

    Stack stack = new Stack();
    stage.addActor(stack);
    stack.setSize(stageWidth, stageHeight);
    testsTable = new Table();
    stack.add(testsTable);

    // Create behavior selection window
    List<String> testList = createTestList();
    algorithmSelectionWindow = addBehaviorSelectionWindow("Path Finder Tests", testList, 0, -1);

    // Set selected test
    changeTest(0);

    stage.addActor(new FpsLabel("FPS: ", skin));
}