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


Java FileHandle.writeString方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.files.FileHandle.writeString方法的典型用法代碼示例。如果您正苦於以下問題:Java FileHandle.writeString方法的具體用法?Java FileHandle.writeString怎麽用?Java FileHandle.writeString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.files.FileHandle的用法示例。


在下文中一共展示了FileHandle.writeString方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cleanBundles

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static void cleanBundles(FileHandle file){
    String[] strings = file.readString().split("\n");
    FileHandle out = Gdx.files.absolute("/home/anuke/out.properties");
    out.writeString("", false);
    for(String string : strings){
        if(!string.contains(".description")){
            out.writeString(string + "\n", true);
        }
    }
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:11,代碼來源:BundleGen.java

示例2: 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

示例3: saveState

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
/**
 * Saves to a save slot, overwriting any save that existed previously.
 * 
 * @param slot
 *            Slot to save to.
 * @param state
 *            GameStateTEMP to save.
 */
public void saveState(int slot, GameState state) {
	String saveFileName = getSaveFileName(slot);
	FileHandle handle = Gdx.files.internal(saveFileName);

	String gameStateJSON = new Gson().toJson(state);

	// overwrite!
	handle.writeString(gameStateJSON, false);
}
 
開發者ID:mcgeer,項目名稱:Climatar,代碼行數:18,代碼來源:TitleController.java

示例4: save

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static void save () {
    try {
        FileHandle filehandle = Gdx.files.local(file);

        filehandle.writeString(Boolean.toString(backForwardEnabled)+"\n", false);
        filehandle.writeString(Boolean.toString(autoMoveToNext)+"\n", true);
        filehandle.writeString(Integer.toString(bpm)+"\n", true);
    } catch (Throwable e) {
        // Nooooooo... We´ll use defaults next time it starts :/
    }
}
 
開發者ID:B4sileus,項目名稱:guitar-finger-trainer,代碼行數:12,代碼來源:SettingsUtil.java

示例5: buildBundle

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static void buildBundle(FileHandle file){
    BundleGen.file = file;

    file.writeString("", false);
    write("about.text=" + join(Vars.aboutText));
    write("discord.text=Join the mindustry discord!\n[orange]");

    Mathf.each(table -> {
        for(Setting setting : table.getSettings()){
            write("setting." + setting.name + ".name=" + setting.title);
        }
    }, Vars.ui.settings.game, Vars.ui.settings.graphics, Vars.ui.settings.sound);

    for(Map map : Vars.world.maps().list()){
        write("map." + map.name + ".name=" + map.name);
    }
    for(Tutorial.Stage stage : Stage.values()){
        write("tutorial." + stage.name() + ".text=" + stage.text);
    }
    for(Keybind bind : KeyBinds.getSection("default").keybinds.get(DeviceType.keyboard)){
        write("keybind." + bind.name + ".name=" + bind.name);
    }
    for(GameMode mode : GameMode.values()){
        write("mode." + mode.name() + ".name=" + mode.name());
    }
    for(Item item : Item.getAllItems()){
        write("item." + item.name + ".name=" + item.name);
    }
    for(Liquid liquid : Liquid.getAllLiquids()){
        write("liquid." + liquid.name + ".name=" + liquid.name);
    }
    for(Block block : Block.getAllBlocks()){
        write("block." + block.name + ".name=" + block.formalName);
        if(block.fullDescription != null) write("block." + block.name + ".fulldescription=" + block.fullDescription);
        if(block.description != null) write("block." + block.name + ".description=" + block.description);

        Array<String> a = new Array<>();
        block.getStats(a);
        for(String s : a){
            if(s.contains(":")) {
                String color = s.substring(0, s.indexOf("]")+1);
                String first = s.substring(color.length(), s.indexOf(":")).replace("/", "").replace(" ", "").toLowerCase();
                String last = s.substring(s.indexOf(":"), s.length());
                s = color + Bundles.getNotNull("text.blocks." + first) + last;
            }
        }
    }
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:49,代碼來源:BundleGen.java

示例6: stageToTxt

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public String stageToTxt(Stage stage, String name){
    String txt = json.prettyPrint(stage);
    fileHandle = new FileHandle(name);
    fileHandle.writeString(txt, true);
    return txt;
}
 
開發者ID:hypeofpipe,項目名稱:Race99,代碼行數:7,代碼來源:Converter.java

示例7: writeJSON

import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static void writeJSON(FileHandle file) {
    Json json = new Json();
    System.out.println(json.prettyPrint(true));
    file.writeString(json.prettyPrint(true), false);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:6,代碼來源:FileHandler.java


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