我想使用分辨率文件解析器为我的应用选择正确的纹理图集,所以我创建了一个具有几种分辨率的RFR:
Resolution _568x1136 = new Resolution(568, 1136, ".568x1136");
Resolution _1200x1920 = new Resolution(568, 1136, ".1200x1920");
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), _568x1136, _1200x1920);
manager = new AssetManager();
manager.setLoader(TextureAtlas.class, new TextureAtlasLoader(resolver));
现在我想知道,我如何命名/放置文件??????
我尝试将.1200x1920和.568x1136添加到.png和.atlas(.png.568.1136等)之后,但这不起作用。
我也尝试过使用文件夹(parent / 568x1136 / file.atlas)。
我尝试按以下方式加载地图集:
manager.load("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class); // First make sure the splash screen
manager.finishLoading(); // is loaded before loading anything
Assets.splashAtlas = manager.get("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class); // else
答案 0 :(得分:5)
// no dots were used for the "suffix"
Resolution _568x1136 = new Resolution(568, 1136, "568x1136");
Resolution _1200x1920 = new Resolution(568, 1136, "1200x1920");
ResolutionFileResolver resolver = new ResolutionFileResolver(new InternalFileHandleResolver(), _568x1136, _1200x1920);
manager.load("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class);
manager.finishLoading();
Assets.splashAtlas = manager.get("data/atlas/splashscreen/splashscreen.atlas", TextureAtlas.class);
尽管有关ResolutionFileResolver
的stackoverflow的其他答案,但它实际上 使用文件夹层次结构来检索正确的图像。如果我们假设568x1136
是最佳匹配分辨率,它将立即搜索data/atlas/splashscreen/568x1136/splashscreen.atlas
。如果找不到此文件,则后备将仅为data/atlas/splashscreen/splashscreen.atlas
。如果此文件也不存在,则会发生异常。
所以名字"后缀"不再是真的正确了。实施似乎随着时间的推移而发生了变化。 "后缀"没有被附加到文件。