[libgdx] SkeletonViewAtlas -> SkeletonViewerAtlas.

This commit is contained in:
Nathan Sweet 2021-06-13 00:34:48 -04:00
parent 3e16d21e3d
commit ee3c6aff3c
2 changed files with 8 additions and 4 deletions

View File

@ -73,7 +73,7 @@ public class SkeletonViewer extends ApplicationAdapter {
SkeletonRendererDebug debugRenderer; SkeletonRendererDebug debugRenderer;
SkeletonViewerUI ui; SkeletonViewerUI ui;
SkeletonViewAtlas atlas; SkeletonViewerAtlas atlas;
SkeletonData skeletonData; SkeletonData skeletonData;
Skeleton skeleton; Skeleton skeleton;
AnimationState state; AnimationState state;
@ -123,7 +123,7 @@ public class SkeletonViewer extends ApplicationAdapter {
reloadTimer = 0; reloadTimer = 0;
try { try {
atlas = new SkeletonViewAtlas(this, skeletonFile); atlas = new SkeletonViewerAtlas(this, skeletonFile);
// Load skeleton data. // Load skeleton data.
String extension = skeletonFile.extension(); String extension = skeletonFile.extension();

View File

@ -14,12 +14,12 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData.Page; import com.badlogic.gdx.graphics.g2d.TextureAtlas.TextureAtlasData.Page;
import com.badlogic.gdx.utils.Null; import com.badlogic.gdx.utils.Null;
class SkeletonViewAtlas extends TextureAtlas { class SkeletonViewerAtlas extends TextureAtlas {
private final SkeletonViewer viewer; private final SkeletonViewer viewer;
private @Null FileHandle atlasFile; private @Null FileHandle atlasFile;
private final AtlasRegion fake; private final AtlasRegion fake;
public SkeletonViewAtlas (final SkeletonViewer viewer, @Null FileHandle skeletonFile) { public SkeletonViewerAtlas (final SkeletonViewer viewer, @Null FileHandle skeletonFile) {
this.viewer = viewer; this.viewer = viewer;
atlasFile = findAtlasFile(skeletonFile); atlasFile = findAtlasFile(skeletonFile);
@ -64,6 +64,7 @@ class SkeletonViewAtlas extends TextureAtlas {
for (String endSuffix : endSuffixes) { for (String endSuffix : endSuffixes) {
for (String dataSuffix : dataSuffixes) { for (String dataSuffix : dataSuffixes) {
String suffix = startSuffix + dataSuffix + endSuffix; String suffix = startSuffix + dataSuffix + endSuffix;
System.out.println(suffix);
if (baseName.endsWith(suffix)) { if (baseName.endsWith(suffix)) {
FileHandle file = findAtlasFile(skeletonFile, baseName.substring(0, baseName.length() - suffix.length())); FileHandle file = findAtlasFile(skeletonFile, baseName.substring(0, baseName.length() - suffix.length()));
if (file != null) return file; if (file != null) return file;
@ -79,6 +80,9 @@ class SkeletonViewAtlas extends TextureAtlas {
for (String endSuffix : endSuffixes) { for (String endSuffix : endSuffixes) {
for (String suffix : atlasSuffixes) { for (String suffix : atlasSuffixes) {
FileHandle file = skeletonFile.sibling(baseName + startSuffix + suffix + endSuffix); FileHandle file = skeletonFile.sibling(baseName + startSuffix + suffix + endSuffix);
System.out.println(baseName + startSuffix + suffix + endSuffix);
if (file.exists())
System.out.println();
if (file.exists()) return file; if (file.exists()) return file;
} }
} }