public boolean build() { scrollPaneTable.clearChildren(); if (properties.getProxies().first() instanceof GroupEntityProxy) { return false; } boolean atLeastOneComponentAdded = false; for (Class<? extends Component> clazz : componentClasses) { if (EntityUtils.isComponentCommon(clazz, properties.getProxies()) == false) { VisTextButton button = new VisTextButton(clazz.getSimpleName(), buttonStyle); button.setFocusBorderEnabled(false); scrollPaneTable.add(button).expandX().fillX().row(); button.addListener( new VisChangeListener( (event, actor) -> { listener.selected(clazz); remove(); })); atLeastOneComponentAdded = true; } } invalidateHierarchy(); return atLeastOneComponentAdded; }
public List<VisTextButton> getButtons(Class<? extends Annotation> cls) { List<VisTextButton> btnList = new ArrayList<>(); Reflections r = new Reflections("net.ncguy.impossible.graph.nodes"); Set<Class<?>> clsSet = r.getTypesAnnotatedWith(cls); r.save("nodeBtns.bin"); System.out.println("gfdsgfd"); for (Class<?> c : clsSet) { VisTextButton btn = new VisTextButton("Add " + TextUtils.formatString(c.getSimpleName())); btn.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); try { BaseNode node = (BaseNode) c.getConstructor(GraphBase.class).newInstance(graphBase); addNode(node); } catch (Exception e) { e.printStackTrace(); } graphBase.rebuildDnD(); } }); btnList.add(btn); } return btnList; }
public DefaultExporterSettingsDialog( EditorSettingsIOModule settingsIO, DefaultExporterSettings settings) { super("Settings"); this.settingsIO = settingsIO; this.settings = settings; TableUtils.setSpacingDefaults(this); setModal(true); closeOnEscape(); addCloseButton(); left(); defaults().left(); VisTextButton cancelButton = new VisTextButton("Cancel"); VisTextButton okButton = new VisTextButton("OK"); VisTable buttonTable = new VisTable(true); buttonTable.add(cancelButton); buttonTable.add(okButton); skipDefaultCheck = new VisCheckBox("Skip default values"); VisImage skipDefaultHelpImage = new VisImage(Icons.QUESTION_BIG.drawable()); new Tooltip.Builder( "Reduces output file size by skipping default values like '0' or 'null'.\n" + "Typically there is no need to disable it but you can do it if you want to inspect\n" + "output scene file.", Align.left) .target(skipDefaultHelpImage) .build(); add(skipDefaultCheck); add(skipDefaultHelpImage).size(22).row(); minimalOutputCheck = new VisCheckBox("Use minimal output type"); VisImage minimalOutputHelpImage = new VisImage(Icons.QUESTION_BIG.drawable()); new Tooltip.Builder( "If checked output JSON will use minimal format, unnecessary double quotes\n" + "will be skipped unless needed. This format may not be supported by all JSON parsers.\nUncheck" + "this to disable minimal format.", Align.left) .target(minimalOutputHelpImage) .build(); add(minimalOutputCheck); add(minimalOutputHelpImage).size(22).row(); packageSeparateAtlasForEachSceneCheck = new VisCheckBox("Package separate atlas for each scene"); VisImage packageSeparateAtlasForEachSceneHelpImage = new VisImage(Icons.QUESTION_BIG.drawable()); new Tooltip.Builder( "If checked each exported scene will have it's own separate texture atlas. This is useful\n" + "when you have many texture assets but they are split between scenes.\nNote when this is checked 'master'" + "atlas containing all texture will not be created.", Align.left) .target(packageSeparateAtlasForEachSceneHelpImage) .build(); add(packageSeparateAtlasForEachSceneCheck); add(packageSeparateAtlasForEachSceneHelpImage).size(22).row(); migFilterSelectBox = new EnumSelectBox<>(Texture.TextureFilter.class, new DefaultEnumNameProvider<>()); magFilterSelectBox = new EnumSelectBox<>(Texture.TextureFilter.class, new DefaultEnumNameProvider<>()); add(TableBuilder.build(new VisLabel("Mig Texture Filter"), migFilterSelectBox)).row(); add(TableBuilder.build(new VisLabel("Mag Texture Filter"), magFilterSelectBox)).row(); add(buttonTable).right().colspan(2); cancelButton.addListener( new VisChangeListener( (event1, actor1) -> { setUIFromSettings(); fadeOut(); })); okButton.addListener( new VisChangeListener( (event, actor) -> { setToSettings(); fadeOut(); })); setUIFromSettings(); pack(); centerWindow(); }
public void buildNodeController() { List<VisTextButton> actionBtns = getButtons(AActionNode.class); List<VisTextButton> dataBtns = getButtons(ADataNode.class); List<VisTextButton> utilBtns = getButtons(AUtilNode.class); VisTextButton actionTableToggle = new VisTextButton("Action nodes"); VisTextButton dataTableToggle = new VisTextButton("Data nodes"); VisTextButton utilTableToggle = new VisTextButton("Util nodes"); VisTable actionTable = new VisTable(true); VisTable dataTable = new VisTable(true); VisTable utilTable = new VisTable(true); CollapsibleWidget actionWidget = new CollapsibleWidget(actionTable); CollapsibleWidget dataWidget = new CollapsibleWidget(dataTable); CollapsibleWidget utilWidget = new CollapsibleWidget(utilTable); actionWidget.setCollapsed(true, false); dataWidget.setCollapsed(true, false); utilWidget.setCollapsed(true, false); for (VisTextButton actBtn : actionBtns) { actionTable.add(actBtn).fillX(); actionTable.row(); } for (VisTextButton dataBtn : dataBtns) { dataTable.add(dataBtn).fillX(); dataTable.row(); } for (VisTextButton utilBtn : utilBtns) { utilTable.add(utilBtn).fillX(); utilTable.row(); } actionTableToggle.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { actionWidget.setCollapsed(!actionWidget.isCollapsed(), true); } }); dataTableToggle.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { dataWidget.setCollapsed(!dataWidget.isCollapsed(), true); } }); utilTableToggle.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { utilWidget.setCollapsed(!utilWidget.isCollapsed(), true); } }); addNodeTable.add(actionTableToggle).fillX(); addNodeTable.row(); addNodeTable.add(actionWidget).fillX(); addNodeTable.row(); addNodeTable.add(dataTableToggle).fillX(); addNodeTable.row(); addNodeTable.add(dataWidget).fillX(); addNodeTable.row(); addNodeTable.add(utilTableToggle).fillX(); addNodeTable.row(); addNodeTable.add(utilWidget).fillX(); addNodeTable.row(); addNodeTable.addSeparator(); addNodeTable.row(); addNodeTable.add(compileGraph).fillX(); compileGraph.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); // graphBase.targetComponent = // Launcher.instance().editorScreen.getComponentAtLocation(0, 0, 0); if (graphBase.getTargetComponent() == null) { Dialogs.showErrorDialog(getStage(), "No component selected"); return; } graphBase .getTargetComponent() .setActionGraph(graphBase.compiler.compileGraph(graphBase)); graphBase.getTargetComponent().setActionGraphData(graphBase.compileToData()); } }); }