本文整理匯總了Java中com.badlogic.gdx.files.FileHandle.isDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java FileHandle.isDirectory方法的具體用法?Java FileHandle.isDirectory怎麽用?Java FileHandle.isDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.files.FileHandle
的用法示例。
在下文中一共展示了FileHandle.isDirectory方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getNextModFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
@Override
public ModFile getNextModFile() throws IOException {
FileHandle file = files.pollFirst();
if (file != null)
return new FolderModFile(file);
FileHandle folder = folders.pollFirst();
if (folder == null)
return null;
for (FileHandle f : folder.list()) {
if (f.isDirectory()) {
folders.add(f);
} else {
files.add(f);
}
}
return new FolderModFile(folder);
}
示例2: loadMap
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
/**
* Lädt die Map aus der Datei in den Speicher.
*
* Wird von {@link #initMap()} aufgerufen.
*/
private void loadMap()
{
FileHandle mapFile = Gdx.files.internal("data/maps/" + mapName + ".tmx");
if (!mapFile.exists() || mapFile.isDirectory())
{
Gdx.app.error("ERROR", "The map file " + mapName + ".tmx doesn't exists!");
levelManager.exitToMenu();
return;
}
TmxMapLoader.Parameters mapLoaderParameters = new TmxMapLoader.Parameters();
mapLoaderParameters.textureMagFilter = Texture.TextureFilter.Nearest;
mapLoaderParameters.textureMinFilter = Texture.TextureFilter.Nearest;
tileMap = new TmxMapLoader().load(mapFile.path(), mapLoaderParameters);
}
示例3: create
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
/**
* Initialisierung.
*
* @param game zeigt auf das SchoolGame, dass das Spiel verwaltet
*/
@Override
public void create(SchoolGame game) {
this.game = game;
batch = new SpriteBatch();
font = game.getDefaultFont();
fontLayout = new GlyphLayout();
offset -= Gdx.graphics.getHeight() / 2 - 35;
FileHandle credits = Gdx.files.internal("data/misc/credits.txt");
if (credits.exists() && !credits.isDirectory())
{
prepareCredits(credits);
}
}
示例4: load
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private void load(String path) {
filesView.clearChildren();
filesView.layout();
FileHandle file = Gdx.files.absolute(path);
curFileHandle = file;
if (file.isDirectory()) {
for (FileHandle child : file.list()) {
if (child.name().startsWith(".")) continue;
loadAsset(child);
}
} else {
loadAsset(file);
}
}
示例5: getSaves
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static Save[] getSaves() {
FileHandle clientSavesFolder = getSavesFolder();
if (!clientSavesFolder.isDirectory()) return new Save[0];
FileHandle[] list = clientSavesFolder.list();
Save[] saves = new Save[list.length];
for (int i = 0; i < list.length; i++) {
saves[i] = new Save(list[i].name(), list[i]);
}
return saves;
}
示例6: FolderModInputStream
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public FolderModInputStream(FileHandle file) {
root = file;
for (FileHandle f : file.list()) {
if (f.isDirectory()) {
folders.add(f);
} else {
files.add(f);
}
}
}
示例7: saveToFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
/**
* save data to file
* @param data
* @param handle
* @return false if handle is directory
*/
public static boolean saveToFile(String data,FileHandle handle) {
if(handle.isDirectory())
return false;
handle.writeString(data, false);
return true;
}
示例8: loadDialogFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private void loadDialogFile(String fileName) throws Exception {
FileHandle dialogFile = Gdx.files.internal("data/dialog/" + fileName + ".xml");
if (!dialogFile.exists() || dialogFile.isDirectory())
{
Gdx.app.error("ERROR", "The dialog file " + fileName + ".xml doesn't exists!");
throw new FileNotFoundException("The dialog file " + fileName + ".xml doesn't exists!");
}
Schema dialogSchema;
try
{
dialogSchema = getSchema(dialogFile);
} catch (Exception e)
{
Gdx.app.error("ERROR", "The dialog file " + fileName + ".xml is not conform to the dialog.xsd!", e);
throw new Exception("The dialog file " + fileName + ".xml is not conform to the dialog.xsd!");
}
JAXBContext jaxbContext = JAXBContext.newInstance(Level.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setSchema(dialogSchema);
dialogRoot = (Level) unmarshaller.unmarshal(dialogFile.read());
loadCharacters();
}
示例9: FolderModInputStream
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public FolderModInputStream(FileHandle file) {
root = file;
for (FileHandle f : file.list()) {
if (f.isDirectory()) {
folders.add(f);
} else {
files.add(f);
}
}
}
示例10: getNextModFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
@Override
public ModFile getNextModFile() throws IOException {
FileHandle file = files.pollFirst();
if (file != null) return new FolderModFile(file);
FileHandle folder = folders.pollFirst();
if (folder == null) return null;
for (FileHandle f : folder.list()) {
if (f.isDirectory()) {
folders.add(f);
} else {
files.add(f);
}
}
return new FolderModFile(folder);
}
示例11: updateFiles
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private void updateFiles(boolean push){
if(push) stack.push(directory);
navigation.setText(directory.toString());
GlyphLayout layout = Pools.obtain(GlyphLayout.class);
layout.setText(Core.font, navigation.getText());
if(layout.width < navigation.getWidth()){
navigation.setCursorPosition(0);
}else{
navigation.setCursorPosition(navigation.getText().length());
}
Pools.free(layout);
files.clearChildren();
FileHandle[] names = getFileNames();
Image upimage = new Image("icon-folder-parent");
TextButton upbutton = new TextButton(".." + directory.toString());
upbutton.clicked(()->{
directory = directory.parent();
updateFiles(true);
});
upbutton.left().add(upimage).padRight(4f).size(14*2);
upbutton.getCells().reverse();
files.top().left().add(upbutton).align(Align.topLeft).fillX().expandX().height(50).pad(2).colspan(2);
upbutton.getLabel().setAlignment(Align.left);
files.row();
ButtonGroup<TextButton> group = new ButtonGroup<TextButton>();
group.setMinCheckCount(0);
for(FileHandle file : names){
if( !file.isDirectory() && !filter.test(file)) continue; //skip non-filtered files
String filename = file.name();
TextButton button = new TextButton(shorten(filename), "toggle");
group.add(button);
button.clicked(()->{
if( !file.isDirectory()){
filefield.setText(filename);
updateFileFieldStatus();
}else{
directory = directory.child(filename);
updateFiles(true);
}
});
filefield.changed(()->{
button.setChecked(filename.equals(filefield.getText()));
});
Image image = new Image(file.isDirectory() ? "icon-folder" : "icon-file-text");
button.add(image).padRight(4f).size(14*2f);
button.getCells().reverse();
files.top().left().add(button).align(Align.topLeft).fillX().expandX()
.height(50).pad(2).padTop(0).padBottom(0).colspan(2);
button.getLabel().setAlignment(Align.left);
files.row();
}
pane.setScrollY(0f);
updateFileFieldStatus();
if(open) filefield.clearText();
}
示例12: get
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
protected static ModInputStream get(FileHandle fileHandle) {
return fileHandle.isDirectory() ? new FolderModInputStream(fileHandle) : new ZipModInputStream(fileHandle);
}
示例13: get
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
protected static ModInputStream get(FileHandle fileHandle) {
return fileHandle.isDirectory() ? new FolderModInputStream(fileHandle) : new ZipModInputStream(fileHandle);
}