當前位置: 首頁>>代碼示例>>Java>>正文


Java FileHandle.isDirectory方法代碼示例

本文整理匯總了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);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:18,代碼來源:ModInputStream.java

示例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);
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:23,代碼來源:Level.java

示例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);
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:24,代碼來源:Credits.java

示例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);
    }
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:15,代碼來源:AssetWindow.java

示例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;
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:11,代碼來源:ClientSaveManager.java

示例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);
		}
	}
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:11,代碼來源:ModInputStream.java

示例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;
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:13,代碼來源:SaveUtils.java

示例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();
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:30,代碼來源:DialogManager.java

示例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);
    }
  }
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:11,代碼來源:ModInputStream.java

示例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);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:16,代碼來源:ModInputStream.java

示例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();
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:76,代碼來源:FileChooser.java

示例12: get

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
protected static ModInputStream get(FileHandle fileHandle) {
	return fileHandle.isDirectory() ? new FolderModInputStream(fileHandle) : new ZipModInputStream(fileHandle);
}
 
開發者ID:RedTroop,項目名稱:Cubes_2,代碼行數:4,代碼來源:ModInputStream.java

示例13: get

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
protected static ModInputStream get(FileHandle fileHandle) {
  return fileHandle.isDirectory() ? new FolderModInputStream(fileHandle) : new ZipModInputStream(fileHandle);
}
 
開發者ID:RedTroop,項目名稱:Cubes,代碼行數:4,代碼來源:ModInputStream.java


注:本文中的com.badlogic.gdx.files.FileHandle.isDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。