本文整理汇总了Java中com.badlogic.gdx.utils.StringBuilder类的典型用法代码示例。如果您正苦于以下问题:Java StringBuilder类的具体用法?Java StringBuilder怎么用?Java StringBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringBuilder类属于com.badlogic.gdx.utils包,在下文中一共展示了StringBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSceneFile
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
private FileHandle createSceneFile(float width,float height,String name) throws IOException {
if (!path.isDirectory()){
path = path.parent();
}
StringBuilder filePath = new StringBuilder();
filePath.append(path.path());
filePath.append("/");
filePath.append(name);
filePath.append(".");
filePath.append(Config.sceneExtension);
FileHandle fileHandle = new FileHandle(filePath.toString());
if (fileHandle.file().exists()) fileHandle.delete();
fileHandle.file().createNewFile();
Writer writer = new FileWriter(fileHandle.file());
FileUtils.createScene(writer,width,height,name);
writer.close();
return fileHandle;
}
示例2: getValue
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
Coordinate getValue() {
StringBuilder sb = new StringBuilder();
SnapshotArray<Actor> childs = this.getChildren();
for (Actor actor : childs) {
if (actor == null) {
sb.append(" ");
} else {
if (actor instanceof VisTextButton) {
sb.append(((VisTextButton) actor).getText());
} else if (actor instanceof VisLabel) {
sb.append(((VisLabel) actor).getText());
}
}
}
return new Coordinate(sb.toString());
}
示例3: getScoreHash
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
private String getScoreHash(IRScoreData score) {
byte[] cipher_byte;
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update((hashkey + score.getSha256() + "," + score.getExscore() + "," + score.getEpg() + ","
+ score.getLpg() + "," + score.getEgr() + "," + score.getLgr() + "," + score.getEgd() + ","
+ score.getLgd() + "," + score.getEbd() + "," + score.getLbd() + "," + score.getEpr() + ","
+ score.getLpr() + "," + score.getEms() + "," + score.getLms() + "," + score.getClear() + ","
+ score.getMinbp() + "," + score.getCombo() + "," + score.getMode() + "," + score.getClearcount()
+ "," + score.getPlaycount() + "," + score.getOption() + "," + score.getRandom() + ","
+ score.getHistory() + "," + score.getDate()).getBytes());
cipher_byte = md.digest();
StringBuilder sb = new StringBuilder(2 * cipher_byte.length);
for (byte b : cipher_byte) {
sb.append(String.format("%02x", b & 0xff));
}
return "035" + sb.toString();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
示例4: getReplayDataFilePath
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
private String getReplayDataFilePath(String[] hashes, boolean ln, int lnmode, int index,
CourseData.CourseDataConstraint[] constraint) {
StringBuilder hash = new StringBuilder();
for (String s : hashes) {
hash.append(s.substring(0, 10));
}
StringBuilder sb = new StringBuilder();
for (CourseData.CourseDataConstraint c : constraint) {
if (c != CLASS && c != MIRROR && c != RANDOM) {
sb.append(String.format("%02d", c.id));
}
}
return "player" + File.separatorChar + player + File.separatorChar + "replay" + File.separatorChar
+ (ln ? replay[lnmode] : "") + hash + (sb.length() > 0 ? "_" + sb.toString() : "")
+ (index > 0 ? "_" + index : "");
}
示例5: getStory
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
/**
* Returns the history of this quest (descriptions and times
* of all its states) in a human readable string form.
*
* Returns an empty string if the quest is not started.
*
* @return
*/
public String getStory() {
StringBuilder builder = StringUtil.getFSB();
int i = 0;
for (State<QuestTransition> state : story) {
String description = state.getDescription();
if (description != null && !description.isEmpty()) {
String separator = i == story.size-1 ? "" : "\n\n";
builder.append(storyTimes.get(i).toStringNoTime());
builder.append(": ");
builder.append(description);
builder.append(separator);
}
++i;
}
String returnValue = builder.toString();
StringUtil.freeFSB(builder);
return returnValue;
}
示例6: getEffectsAsString
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
/**
* Gets the effects of this Perk as a human
* readable string.
*
* This does not include any modifiers
* associated with this Perk.
*
* @return null if there are no associated effects, the string otherwise
*/
public static String getEffectsAsString(EffectContainer ec, Object user) {
ObjectMap<Effect, Array<EffectParameter>> effects = ec.getEffects();
if (effects.size == 0) {
return null;
}
StringBuilder fsb = StringUtil.getFSB();
int i = 0;
for (Effect effect : effects.keys()) {
String desc = effect.getDescription(user, effects.get(effect));
if (desc == null) {
continue;
}
if (i > 0) {
fsb.append("\n");
}
fsb.append(desc);
++i;
}
String returnValue = fsb.toString();
StringUtil.freeFSB(fsb);
return returnValue;
}
示例7: toString
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
/**
* Prints this Modifier into a user-friendly string.
*
* If includeName is set to true, the resulting string
* will also include the name of the Modifier.
*
* @param includeName
* @return
*/
public String toString(boolean includeName) {
StringBuilder fsb = StringUtil.getFSB();
if (includeName) {
fsb.append(getName());
fsb.append(": ");
}
for (ModifiableStat mod : ModifiableStat.values()) {
fsb.append(modToString(mod, ", "));
}
String returnValue = fsb.toString();
StringUtil.freeFSB(fsb);
if (returnValue.endsWith(": ")) {
returnValue = "";
} else if (returnValue.endsWith(", ")) {
returnValue = returnValue.substring(0, returnValue.lastIndexOf(", "));
}
return returnValue;
}
示例8: modToString
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
private String modToString(ModifiableStat mod, String separator) {
float value = getMod(mod);
boolean multiply = mod.isMultiplier();
if ((value == 0 && !multiply) || (multiply && value == 1)) {
return "";
}
StringBuilder fsb = StringUtil.getFSB();
fsb.append(mod.toUIString());
fsb.append(": ");
fsb.append(getModAsString(mod));
if (separator != null) {
fsb.append(separator);
}
String returnValue = fsb.toString();
StringUtil.freeFSB(fsb);
return returnValue;
}
示例9: getModifiersAsString
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
/**
* Prints all the Modifiers in the suppled ModifierContainer
* in a user-friendly String. The supplied separator
* is used to separate individual Modifiers. If includeNames
* is true, the Modifiers names will also be printed.
* @param mc
* @param separator
* @param includeNames
* @return
*/
public static String getModifiersAsString(ModifierContainer mc, String separator, boolean includeNames) {
StringBuilder builder = StringUtil.getFSB();
Iterator<Modifier> modifiers = mc.getModifiers();
int i = 0;
while (modifiers.hasNext()) {
Modifier modifier = modifiers.next();
if (modifier.isNonZero()) {
if (i > 0) {
builder.append(separator);
}
builder.append(modifier.toString(includeNames));
}
++i;
}
String returnValue = builder.toString();
StringUtil.freeFSB(builder);
return returnValue;
}
示例10: buildActivationRequirements
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
@Override
protected void buildActivationRequirements(GameCharacter character,
StringBuilder fsb) {
super.buildActivationRequirements(character, fsb);
ObjectMap<String, Boolean> foci = spell.getFoci();
if (foci.size > 0) {
addLine();
addLine(Strings.getString(Spell.STRING_TABLE, "foci"), style.headingStyle);
Inventory inventory = character.getInventory();
for (Entry<String, Boolean> entry : foci.entries()) {
fsb.append(InventoryItem.getItemPrototype(entry.key).getName());
if (entry.value) {
fsb.append(" (");
fsb.append(Strings.getString(Spell.STRING_TABLE, "consumed"));
fsb.append(")");
}
addLine(fsb.toString(),
inventory.getItem(entry.key) != null ? style.reqsReachedStyle
: style.reqsNotReachedStyle);
fsb.setLength(0);
}
}
}
示例11: updateText
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
public void updateText(GameCharacter ic) {
clear();
StringBuilder fsb = StringUtil.getFSB();
buildName(ic, fsb);
buildDescription(fsb);
buildOwner(ic, fsb);
buildArmorInfo(fsb);
buildWeaponInfo(fsb);
buildUsesLeft(fsb);
buildUseRequirements(ic, fsb);
buildEquipRequirements(ic, fsb);
buildEffectsAndModifiers(ic, fsb);
StringUtil.freeFSB(fsb);
}
示例12: buildEffectsAndModifiers
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
protected void buildEffectsAndModifiers(GameCharacter ic, StringBuilder fsb) {
String modifiers = Modifier.getModifiersAsString(item, ", ", false);
String effects = null;
if (item instanceof EffectContainer) {
effects = Effect.getEffectsAsString((EffectContainer)item, ic);
}
if (!modifiers.isEmpty() || effects != null) {
addLine();
addLine(Strings.getString(InventoryItem.STRING_TABLE, "effects"), style.subheadingStyle);
}
if (!modifiers.isEmpty()) {
addLine(modifiers);
}
if (effects != null) {
addLine(effects);
}
}
示例13: updateText
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
public void updateText(GameCharacter character, boolean includeLearnRequirements) {
clear();
StringBuilder fsb = StringUtil.getFSB();
buildName(fsb);
buildDescription(fsb);
if (includeLearnRequirements) {
buildLearnRequirements(character, fsb);
}
if (perk.isActivated()) {
buildActivationRequirements(character, fsb);
buildTarget(character, fsb);
}
buildEffectsAndModifiers(character, fsb);
buildSynergiesDescription(fsb);
StringUtil.freeFSB(fsb);
}
示例14: buildEffectsAndModifiers
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
protected void buildEffectsAndModifiers(GameCharacter character, StringBuilder fsb) {
String modifiers = Modifier.getModifiersAsString(perk, ", ", false);
String effects = Effect.getEffectsAsString(perk, character);
if (!modifiers.isEmpty() || effects != null) {
addLine();
addLine(Strings.getString(Perk.STRING_TABLE, "effects"), style.subheadingStyle);
}
if (!modifiers.isEmpty()) {
addLine(modifiers);
}
if (effects != null) {
addLine(effects);
}
}
示例15: buildLearnRequirements
import com.badlogic.gdx.utils.StringBuilder; //导入依赖的package包/类
protected void buildLearnRequirements(GameCharacter character, StringBuilder fsb) {
addLine();
addLine(Strings.getString(Perk.STRING_TABLE, "learnRequirements"), style.subheadingStyle);
fsb.append(Strings.getString(ModifiableStat.STRING_TABLE, "level"));
fsb.append(": ");
fsb.append(Integer.toString(perk.getLevelRequirement()));
if (perk.getLevelRequirement() > character.stats().getLevel()) {
addLine(fsb.toString(), style.reqsNotReachedStyle);
} else {
addLine(fsb.toString(), style.reqsReachedStyle);
}
fsb.setLength(0);
Array<ConditionResult> learnReqs = perk.evaluateLearnRequirements(character);
if (learnReqs != null) {
for (ConditionResult result : learnReqs) {
addLine(result.conditionName, result.passed ? style.reqsReachedStyle : style.reqsNotReachedStyle);
}
}
}