本文整理匯總了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);
}
}
}
示例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;
}
示例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);
}
示例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 :/
}
}
示例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;
}
}
}
}
示例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;
}
示例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);
}