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


Java AssetKey.getName方法代码示例

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


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

示例1: locate

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@Override
@JMEThread
public AssetInfo locate(@NotNull final AssetManager manager, @NotNull final AssetKey key) {
    if (IGNORE_LOCAL.get() == Boolean.TRUE) return null;

    final Path absoluteFile = Paths.get(key.getName());
    if (Files.exists(absoluteFile)) return null;

    final EditorConfig editorConfig = EditorConfig.getInstance();
    final Path currentAsset = editorConfig.getCurrentAsset();
    if (currentAsset == null) return null;

    final String name = key.getName();
    final Path resolve = currentAsset.resolve(name);
    if (!Files.exists(resolve)) return null;

    return new PathAssetInfo(manager, key, resolve);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:19,代码来源:FolderAssetLocator.java

示例2: locate

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@Override
public AssetInfo locate(final AssetManager manager, final AssetKey key) {

    File assetsDir = new File(Manager.getConfigManager().getMainAssetDir()); 
   
    File file = new File(assetsDir, key.getName());

    if (!file.exists()) {
        LOG.log(Level.WARNING, "Asset not found, assetDir={0}, key={1}"
                , new Object[] {assetsDir.getAbsolutePath(), key.getName()});
        return null;
    }

    try {
        return new StreamAssetInfo(manager, key, new BufferedInputStream(new FileInputStream(file)));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:20,代码来源:EditAssetLocator.java

示例3: locate

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public AssetInfo locate(com.jme3.asset.AssetManager manager, AssetKey key) 
{
    InputStream in = null;
    String sAssetPath = rootPath + key.getName();
    // Fix path issues
    if (sAssetPath.startsWith("/"))
    {
        // Remove leading /
        sAssetPath = sAssetPath.substring(1);
    }
    sAssetPath = sAssetPath.replace("//", "/");
    try {      
        in = androidManager.open(sAssetPath);
        if (in == null)
            return null;

        return new AndroidAssetInfo(manager, key, sAssetPath);
    } 
    catch (IOException ex) 
    {
        //logger.log(Level.WARNING, "Failed to locate {0} ", sAssetPath);
    }
    return null;
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:27,代码来源:AndroidLocator.java

示例4: locate

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
public AssetInfo locate(AssetManager manager, AssetKey key) {
    String name = key.getName();
    File file = new File(root, name);
    if (file.exists() && file.isFile()){
        try {
            // Now, check asset name requirements
            String canonical = file.getCanonicalPath();
            String absolute = file.getAbsolutePath();
            if (!canonical.endsWith(absolute)){
                throw new AssetNotFoundException("Asset name doesn't match requirements.\n"+
                                                 "\"" + canonical + "\" doesn't match \"" + absolute + "\"");
            }
        } catch (IOException ex) {
            throw new AssetLoadException("Failed to get file canonical path " + file, ex);
        }
        
        return new AssetInfoFile(manager, key, file);
    }else{
        return null;
    }
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:22,代码来源:FileLocator.java

示例5: locate

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
public AssetInfo locate(AssetManager manager, AssetKey key) {
    String name = key.getName();
    ZipEntry entry = zipfile.getEntry(name);
    if (entry == null)
        return null;
    
    return new JarAssetInfo(manager, key, entry);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:9,代码来源:ZipLocator.java

示例6: locate

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
public AssetInfo locate(AssetManager manager, AssetKey key) {
    String name = key.getName();
    File file = new File(root, name);
    if (file.exists() && file.isFile()){
        return new AssetInfoFile(manager, key, file);
    }else{
        return null;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:10,代码来源:FileLocator.java

示例7: getUserPath

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
private FileObject getUserPath(AssetKey key) {
    NotifyDescriptor.Confirmation msg = new NotifyDescriptor.Confirmation(
            "Referenced file " + key.getName() + " cannot be found!\nDo you want to look for it?",
            NotifyDescriptor.YES_NO_OPTION,
            NotifyDescriptor.WARNING_MESSAGE);
    Object result = DialogDisplayer.getDefault().notify(msg);
    if (!NotifyDescriptor.YES_OPTION.equals(result)) {
        return null;
    }
    final String ext = key.getExtension();
    FileChooserBuilder fcb = new FileChooserBuilder(this.getClass());
    fcb.setTitle("Locate " + key.getName());
    fcb.setFileFilter(new FileFilter() {
        @Override
        public boolean accept(File f) {
            if (f.getName().endsWith(ext)) {
                return true;
            }
            return false;
        }

        @Override
        public String getDescription() {
            return "Filter for " + ext;
        }
    });
    fcb.setFilesOnly(true);
    fcb.setApproveText("Select file");
    File file = fcb.showOpenDialog();
    if (file == null) {
        return null;
    }
    logger.log(Level.INFO, "Got user file input");
    file = FileUtil.normalizeFile(file);
    return FileUtil.toFileObject(file);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:37,代码来源:UberAssetLocator.java

示例8: load

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
@Override
	public Object load(AssetInfo assetInfo) throws IOException {
		Node root = new Node(assetInfo.getKey().getName());
		InputStream in = null ;
		try {
			XbufKey xbufkey=null;
			AssetKey<?> key=assetInfo.getKey();
			if(key instanceof XbufKey){
				xbufkey=(XbufKey)key;
			}else{
				xbufkey=new XbufKey(key.getName());
			}
			in = assetInfo.openStream();

			Xbuf xbuf = XbufLoader.xbufFactory.apply(assetInfo.getManager());
			Data src = Data.parseFrom(in, xbuf.registry);
			XbufContext context=new XbufContext();
			LoggerCollector log = new LoggerCollector("parse:" + assetInfo.getKey().getName());
//			context.log=log;
			context.setSettings(xbufkey);
			xbuf.merge(src, root, context, log);
			log.debug("Context:\n{}",context.toString());
			log.dumpTo(LoggerFactory.getLogger(this.getClass()));
		} catch (Exception exc) {
			throw new IOException("wrap xbuf loading exception", exc);
		} finally {
			if(in!=null)in.close();
		}
		// if
//		MikktspaceTangentGenerator.generate(root);
		//		if (root.getQuantity() == 1) { < not good. will cause inconsistent behaviour ...
		//			return root.getChild(0);
		//		} else {
		//			return root;
		//		}
		return root;
	}
 
开发者ID:xbuf,项目名称:jme3_xbuf,代码行数:38,代码来源:XbufLoader.java

示例9: getAssetFileObject

import com.jme3.asset.AssetKey; //导入方法依赖的package包/类
/**
 * Returns the
 * <code>FileObject</code> for a given asset path, or null if no such asset
 * exists. First looks in the asset folder(s) for the file, then proceeds to
 * scan the classpath folders and jar files for it.The returned FileObject
 * might be inside a jar file and not writeable!
 *
 * @param assetKey The asset key to get the file object for
 * @return Either a FileObject for the asset or null if not found.
 */
public FileObject getAssetFileObject(AssetKey<?> assetKey) {
    String name = assetKey.getName();
    return getAssetFileObject(name);
}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:15,代码来源:ProjectAssetManager.java


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