use of com.kotcrab.vis.ui.widget.file.FileChooser in project bladecoder-adventure-engine by bladecoder.
the class ToolsWindow method exportTSV.
private void exportTSV() {
FileChooser fileChooser = new FileChooser(Mode.SAVE);
fileChooser.setSize(Gdx.graphics.getWidth() * 0.7f, Gdx.graphics.getHeight() * 0.7f);
fileChooser.setViewMode(ViewMode.LIST);
fileChooser.setSelectionMode(SelectionMode.FILES);
getStage().addActor(fileChooser);
fileChooser.setListener(new FileChooserListener() {
@Override
public void selected(Array<FileHandle> files) {
try {
// fileChooser.setTitle("Select the file to export the
// project texts");
I18NUtils.exportTSV(Ctx.project.getAssetPath() + Project.MODEL_PATH, files.get(0).file().getAbsolutePath(), Ctx.project.getChapter().getId(), "default");
Message.showMsg(getStage(), files.get(0).file().getName() + " exported sucessfully.", 4);
} catch (IOException e) {
Message.showMsg(getStage(), "There was a problem generating the .tsv file.", 4);
EditorLogger.printStackTrace(e);
}
}
@Override
public void canceled() {
}
});
}
use of com.kotcrab.vis.ui.widget.file.FileChooser in project bladecoder-adventure-engine by bladecoder.
the class ToolsWindow method createUIAtlas.
protected void createUIAtlas() {
FileChooser fileChooser = new FileChooser(Mode.OPEN);
fileChooser.setSize(Gdx.graphics.getWidth() * 0.7f, Gdx.graphics.getHeight() * 0.7f);
fileChooser.setViewMode(ViewMode.LIST);
fileChooser.setSelectionMode(SelectionMode.DIRECTORIES);
getStage().addActor(fileChooser);
fileChooser.setListener(new FileChooserListener() {
@Override
public void selected(Array<FileHandle> files) {
List<String> res = Ctx.project.getResolutions();
for (String r : res) {
float scale = Float.parseFloat(r);
try {
int maxWH = (int) (ImageUtils.getRecommendedAtlasSize() * scale);
ImageUtils.createAtlas(files.get(0).file().getAbsolutePath(), Ctx.project.getAssetPath() + Project.UI_PATH + "/" + r, "ui" + ".atlas", scale, maxWH, maxWH, TextureFilter.Linear, TextureFilter.Nearest, "png", false);
} catch (IOException e) {
EditorLogger.error(e.getMessage());
Message.showMsgDialog(getStage(), "Error creating atlas", e.getMessage());
return;
}
}
Message.showMsg(getStage(), "UI Atlas created sucessfully.", 4);
}
@Override
public void canceled() {
}
});
}
use of com.kotcrab.vis.ui.widget.file.FileChooser in project talos by rockbite.
the class UIStage method initFileChoosers.
private void initFileChoosers() {
fileChooser = new FileChooser(FileChooser.Mode.SAVE);
fileChooser.setBackground(skin.getDrawable("window-noborder"));
}
use of com.kotcrab.vis.ui.widget.file.FileChooser in project talos by rockbite.
the class SettingsDialog method addScriptPathSetting.
public void addScriptPathSetting(Table container) {
Table inputTable = new Table();
String sceneEditorExportScriptPath = TalosMain.Instance().Prefs().getString("sceneEditorExportScriptPath", null);
inputTable.add(new Label("BuildScript location (JS)", getSkin())).width(180);
exportScriptPathField = new TextField(sceneEditorExportScriptPath, getSkin());
inputTable.add(exportScriptPathField).padLeft(13).width(130);
TextButton browseInputBtn = new TextButton("Browse", getSkin());
inputTable.add(browseInputBtn).padLeft(3);
FileChooser fileChooser = new FileChooser(FileChooser.Mode.SAVE);
fileChooser.setBackground(getSkin().getDrawable("window-noborder"));
browseInputBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
fileChooser.setMode(FileChooser.Mode.SAVE);
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
String currentProjectPath = TalosMain.Instance().ProjectController().getCurrentProjectPath();
String sceneEditorExportScriptPath = TalosMain.Instance().Prefs().getString("sceneEditorExportScriptPath", null);
if (sceneEditorExportScriptPath != null) {
FileHandle path = Gdx.files.absolute(sceneEditorExportScriptPath);
fileChooser.setDirectory(path.parent().file());
fileChooser.setDefaultFileName(path.name());
exportScriptPathField.setText(path.path());
} else {
fileChooser.setDirectory(Gdx.files.absolute(currentProjectPath).parent().file());
fileChooser.setDefaultFileName("buildscript.js");
}
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected(Array<FileHandle> files) {
FileHandle file = files.first();
exportScriptPathField.setText(file.path());
}
});
getStage().addActor(fileChooser.fadeIn());
}
});
container.add(inputTable).pad(10).expand().growX().left();
container.row();
}
use of com.kotcrab.vis.ui.widget.file.FileChooser in project talos by rockbite.
the class UIStage method legacyImportAction.
public void legacyImportAction() {
fileChooser.setMode(FileChooser.Mode.OPEN);
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setFileFilter(new FileChooser.DefaultFileFilter(fileChooser));
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setListener(new FileChooserAdapter() {
@Override
public void selected(Array<FileHandle> file) {
TalosMain.Instance().TalosProject().importFromLegacyFormat(file.get(0));
TalosMain.Instance().ProjectController().unbindFromFile();
}
});
stage.addActor(fileChooser.fadeIn());
}
Aggregations