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


Java ResourceLoader.resourceExists方法代码示例

本文整理汇总了Java中org.newdawn.slick.util.ResourceLoader.resourceExists方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceLoader.resourceExists方法的具体用法?Java ResourceLoader.resourceExists怎么用?Java ResourceLoader.resourceExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.util.ResourceLoader的用法示例。


在下文中一共展示了ResourceLoader.resourceExists方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSoundFileName

import org.newdawn.slick.util.ResourceLoader; //导入方法依赖的package包/类
/**
 * Returns the sound file name, with extension, by first looking through
 * the skins directory and then the default resource locations.
 * @param filename the base file name
 * @return the full file name, or null if no file found
 */
private static String getSoundFileName(String filename) {
	String wav = String.format("%s.wav", filename), mp3 = String.format("%s.mp3", filename);
	File skinDir = SkinService.skin.getDirectory();
	if (skinDir != null) {
		File skinWAV = new File(skinDir, wav), skinMP3 = new File(skinDir, mp3);
		if (skinWAV.isFile())
			return skinWAV.getAbsolutePath();
		if (skinMP3.isFile())
			return skinMP3.getAbsolutePath();
	}
	if (ResourceLoader.resourceExists(wav))
		return wav;
	if (ResourceLoader.resourceExists(mp3))
		return mp3;
	return null;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:23,代码来源:SoundController.java

示例2: getTextureData

import org.newdawn.slick.util.ResourceLoader; //导入方法依赖的package包/类
/**
 * Gets the texture data.
 *
 * @param string the string
 * @return the texture data
 */
public static AnimationData getTextureData(String string) {
	AnimationData t = textures.get(string);
	if(t != null) {
		return t;
	} else {
		//try to get it, in case we forgot
		System.err.println("Warn: " + string + " not explicitly defined");
		for(String loc: searchFolders){
			if(ResourceLoader.resourceExists("res/" + loc + "/" + string + ".png")){
				AnimationData txt = new AnimationData("res/" + loc + "/" + string + ".png");
				textures.put(string, txt);
				return txt;
			}
			
		}
		return textures.get("whoops");
	}
}
 
开发者ID:eliatlarge,项目名称:FEMultiPlayer-V2,代码行数:25,代码来源:FEResources.java

示例3: getSoundFileName

import org.newdawn.slick.util.ResourceLoader; //导入方法依赖的package包/类
/**
 * Returns the sound file name, with extension, by first looking through
 * the skins directory and then the default resource locations.
 * @param filename the base file name
 * @return the full file name, or null if no file found
 */
private static String getSoundFileName(String filename) {
	String wav = String.format("%s.wav", filename), mp3 = String.format("%s.mp3", filename);
	File skinDir = Options.getSkin().getDirectory();
	if (skinDir != null) {
		File skinWAV = new File(skinDir, wav), skinMP3 = new File(skinDir, mp3);
		if (skinWAV.isFile())
			return skinWAV.getAbsolutePath();
		if (skinMP3.isFile())
			return skinMP3.getAbsolutePath();
	}
	if (ResourceLoader.resourceExists(wav))
		return wav;
	if (ResourceLoader.resourceExists(mp3))
		return mp3;
	return null;
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:23,代码来源:SoundController.java

示例4: play

import org.newdawn.slick.util.ResourceLoader; //导入方法依赖的package包/类
/**
 * Plays an audio file at the preview position.
 * If the audio file is already playing, then nothing will happen.
 * @param beatmap the beatmap to play
 * @param loop whether or not to loop the track
 * @param preview whether to start at the preview time (true) or beginning (false)
 */
public static void play(final Beatmap beatmap, final boolean loop, final boolean preview) {
	// new track: load and play
	if (lastBeatmap == null || !beatmap.audioFilename.equals(lastBeatmap.audioFilename)) {
		final File audioFile = beatmap.audioFilename;
		if (!audioFile.isFile() && !ResourceLoader.resourceExists(audioFile.getPath())) {
			BarNotifListener.EVENT.make().onBarNotif(String.format("Could not find track '%s'.",
				audioFile.getName()));
			return;
		}

		reset();
		System.gc();

		switch (Utils.getFileExtension(beatmap.audioFilename.getName())) {
		case "ogg":
		case "mp3":
			trackLoader = new Thread() {
				@Override
				public void run() {
					loadTrack(audioFile, (preview) ? beatmap.previewTime : 0, loop);
				}
			};
			trackLoader.start();
			break;
		default:
			break;
		}
	}

	// new track position: play at position
	else if (beatmap.previewTime != lastBeatmap.previewTime)
		playAt(beatmap.previewTime, loop);

	lastBeatmap = beatmap;
}
 
开发者ID:yugecin,项目名称:opsu-dance,代码行数:43,代码来源:MusicController.java

示例5: read

import org.newdawn.slick.util.ResourceLoader; //导入方法依赖的package包/类
@Override
public void read(String s) {
	String oldThemeString = themeString;
	themeString = s;
	Beatmap beatmap = getThemeBeatmap();
	if (beatmap == null) {
		themeString = oldThemeString;
		Log.warn(String.format("The theme song string [%s] is malformed.", s));
	} else if (!beatmap.audioFilename.isFile() && !ResourceLoader.resourceExists(beatmap.audioFilename.getName())) {
		themeString = oldThemeString;
		Log.warn(String.format("Cannot find theme song [%s].", beatmap.audioFilename.getAbsolutePath()));
	}
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:14,代码来源:Options.java

示例6: play

import org.newdawn.slick.util.ResourceLoader; //导入方法依赖的package包/类
/**
 * Plays an audio file at the preview position.
 * If the audio file is already playing, then nothing will happen.
 * @param beatmap the beatmap to play
 * @param loop whether or not to loop the track
 * @param preview whether to start at the preview time (true) or beginning (false)
 */
public static void play(final Beatmap beatmap, final boolean loop, final boolean preview) {
	// new track: load and play
	if (lastBeatmap == null || !beatmap.audioFilename.equals(lastBeatmap.audioFilename)) {
		final File audioFile = beatmap.audioFilename;
		if (!audioFile.isFile() && !ResourceLoader.resourceExists(audioFile.getPath())) {
			UI.getNotificationManager().sendBarNotification(String.format("Could not find track '%s'.", audioFile.getName()));
			return;
		}

		reset();
		Utils.gc(false);

		switch (BeatmapParser.getExtension(beatmap.audioFilename.getName())) {
		case "ogg":
		case "mp3":
			trackLoader = new Thread() {
				@Override
				public void run() {
					loadTrack(audioFile, (preview) ? beatmap.previewTime : 0, loop);
				}
			};
			trackLoader.start();
			break;
		default:
			break;
		}
	}

	// new track position: play at position
	else if (beatmap.previewTime != lastBeatmap.previewTime)
		playAt(beatmap.previewTime, loop);

	lastBeatmap = beatmap;
}
 
开发者ID:itdelatrisu,项目名称:opsu,代码行数:42,代码来源:MusicController.java


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