当前位置: 首页>>代码示例>>Java>>正文


Java StringBuilder类代码示例

本文整理汇总了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;
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:20,代码来源:NewSceneDialog.java

示例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());
        }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:18,代码来源:CoordinateActivity.java

示例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;
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:23,代码来源:PlayDataAccessor.java

示例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 : "");
}
 
开发者ID:exch-bms2,项目名称:beatoraja,代码行数:17,代码来源:PlayDataAccessor.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:27,代码来源:Quest.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:32,代码来源:Effect.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:32,代码来源:Modifier.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:23,代码来源:Modifier.java

示例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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:29,代码来源:Modifier.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:26,代码来源:SpellTooltip.java

示例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);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:18,代码来源:ItemTooltip.java

示例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);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:ItemTooltip.java

示例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);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:PerkTooltip.java

示例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);
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:17,代码来源:PerkTooltip.java

示例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);
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:22,代码来源:PerkTooltip.java


注:本文中的com.badlogic.gdx.utils.StringBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。