Removed repeated code in asset.group
This commit is contained in:
@@ -0,0 +1,34 @@
|
|||||||
|
package io.github.eldek0.asset.group;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
|
public abstract class AssetBase {
|
||||||
|
public abstract static class Data {}
|
||||||
|
|
||||||
|
public static class FrameRange {
|
||||||
|
public String base;
|
||||||
|
public int start, end;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void queueRange(AssetManager m, FrameRange r) {
|
||||||
|
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Texture[] fetchRange(AssetManager m, FrameRange r) {
|
||||||
|
Texture[] arr = new Texture[r.end - r.start + 1];
|
||||||
|
for (int i = r.start; i <= r.end; i++)
|
||||||
|
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void disposeRange(AssetManager m, FrameRange r) {
|
||||||
|
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isRangeLoaded(AssetManager m, FrameRange r) {
|
||||||
|
for (int i = r.start; i <= r.end; i++)
|
||||||
|
if (!m.isLoaded(r.base + i + ".png")) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,16 +3,15 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class BatteryAssets implements AssetBundle<BatteryAssets.Data> {
|
public class BatteryAssets extends AssetBase implements AssetBundle<BatteryAssets.Data> {
|
||||||
|
|
||||||
|
public BatteryAssets(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String flashlightLabel;
|
public String flashlightLabel;
|
||||||
public FrameRange stages;
|
public FrameRange stages;
|
||||||
|
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture flashlightLabel;
|
public Texture flashlightLabel;
|
||||||
@@ -45,11 +44,4 @@ public class BatteryAssets implements AssetBundle<BatteryAssets.Data> {
|
|||||||
if (!manager.isLoaded(data.stages.base + i + ".png")) return false;
|
if (!manager.isLoaded(data.stages.base + i + ".png")) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class CameraAssets implements AssetBundle<CameraAssets.Data> {
|
public class CameraAssets extends AssetBase implements AssetBundle<CameraAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public Utils utils;
|
public Utils utils;
|
||||||
@@ -31,10 +31,6 @@ public class CameraAssets implements AssetBundle<CameraAssets.Data> {
|
|||||||
public String name, base;
|
public String name, base;
|
||||||
public int frameCount;
|
public int frameCount;
|
||||||
}
|
}
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture map, borderline, recordSprite, signalInterrupted;
|
public Texture map, borderline, recordSprite, signalInterrupted;
|
||||||
@@ -165,25 +161,4 @@ public class CameraAssets implements AssetBundle<CameraAssets.Data> {
|
|||||||
|
|
||||||
public Texture[] getLocationFrames(String name) { return locationFrames.get(name); }
|
public Texture[] getLocationFrames(String name) { return locationFrames.get(name); }
|
||||||
public Texture getLocationLabel(String name) { return locationLabels.get(name); }
|
public Texture getLocationLabel(String name) { return locationLabels.get(name); }
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class CustomNightAssets implements AssetBundle<CustomNightAssets.Data> {
|
public class CustomNightAssets extends AssetBase implements AssetBundle<CustomNightAssets.Data>{
|
||||||
|
|
||||||
|
public CustomNightAssets(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public Labels labels;
|
public Labels labels;
|
||||||
@@ -13,10 +17,6 @@ public class CustomNightAssets implements AssetBundle<CustomNightAssets.Data> {
|
|||||||
public String title, arrowRight, arrowLeft, readyButton;
|
public String title, arrowRight, arrowLeft, readyButton;
|
||||||
public String arrowRight2, arrowLeft2, levelInfo;
|
public String arrowRight2, arrowLeft2, levelInfo;
|
||||||
}
|
}
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture title, arrowRight, arrowLeft, readyButton;
|
public Texture title, arrowRight, arrowLeft, readyButton;
|
||||||
@@ -83,24 +83,5 @@ public class CustomNightAssets implements AssetBundle<CustomNightAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.rewards);
|
&& isRangeLoaded(manager, d.rewards);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,11 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class CutsceneAssets implements AssetBundle<CutsceneAssets.Data> {
|
public class CutsceneAssets extends AssetBase implements AssetBundle<CutsceneAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String freddy, puppet, background, black, mask, errImg, itsMe;
|
public String freddy, puppet, background, black, mask, errImg, itsMe;
|
||||||
public FrameRange chica, bonnie;
|
public FrameRange chica, bonnie;
|
||||||
|
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture freddy, puppet, background, black, mask, errImg, itsMe;
|
public Texture freddy, puppet, background, black, mask, errImg, itsMe;
|
||||||
@@ -69,25 +64,4 @@ public class CutsceneAssets implements AssetBundle<CutsceneAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.chica)
|
&& isRangeLoaded(manager, d.chica)
|
||||||
&& isRangeLoaded(manager, d.bonnie);
|
&& isRangeLoaded(manager, d.bonnie);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,12 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class JumpscareAssets implements AssetBundle<JumpscareAssets.Data> {
|
public class JumpscareAssets extends AssetBase implements AssetBundle<JumpscareAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public FrameRange puppet, toyBonnie, toyChica, toyFreddy;
|
public FrameRange puppet, toyBonnie, toyChica, toyFreddy;
|
||||||
public FrameRange witheredFreddy, witheredBonnie, witheredChica;
|
public FrameRange witheredFreddy, witheredBonnie, witheredChica;
|
||||||
public FrameRange foxy, mangle, goldenFreddy;
|
public FrameRange foxy, mangle, goldenFreddy;
|
||||||
|
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture[] puppet, toyBonnie, toyChica, toyFreddy;
|
public Texture[] puppet, toyBonnie, toyChica, toyFreddy;
|
||||||
@@ -75,25 +70,4 @@ public class JumpscareAssets implements AssetBundle<JumpscareAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.mangle)
|
&& isRangeLoaded(manager, d.mangle)
|
||||||
&& isRangeLoaded(manager, d.goldenFreddy);
|
&& isRangeLoaded(manager, d.goldenFreddy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,11 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class MaskAssets implements AssetBundle<MaskAssets.Data> {
|
public class MaskAssets extends AssetBase implements AssetBundle<MaskAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String button;
|
public String button;
|
||||||
public FrameRange sprites;
|
public FrameRange sprites;
|
||||||
|
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture button;
|
public Texture button;
|
||||||
@@ -45,11 +40,4 @@ public class MaskAssets implements AssetBundle<MaskAssets.Data> {
|
|||||||
if (!manager.isLoaded(data.sprites.base + i + ".png")) return false;
|
if (!manager.isLoaded(data.sprites.base + i + ".png")) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class MenuAssets implements AssetBundle<MenuAssets.Data> {
|
public class MenuAssets extends AssetBase implements AssetBundle<MenuAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public Logos logos;
|
public Logos logos;
|
||||||
@@ -33,10 +33,6 @@ public class MenuAssets implements AssetBundle<MenuAssets.Data> {
|
|||||||
public static class Ranges {
|
public static class Ranges {
|
||||||
public FrameRange confettiBlue, confettiGreen, confettiYellow, confettiPink;
|
public FrameRange confettiBlue, confettiGreen, confettiYellow, confettiPink;
|
||||||
}
|
}
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture title, scottCredits, selScottCredits;
|
public Texture title, scottCredits, selScottCredits;
|
||||||
@@ -190,25 +186,4 @@ public class MenuAssets implements AssetBundle<MenuAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.ranges.confettiYellow)
|
&& isRangeLoaded(manager, d.ranges.confettiYellow)
|
||||||
&& isRangeLoaded(manager, d.ranges.confettiPink);
|
&& isRangeLoaded(manager, d.ranges.confettiPink);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class MinigameAssets implements AssetBundle<MinigameAssets.Data> {
|
public class MinigameAssets extends AssetBase implements AssetBundle<MinigameAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public GiveGifts giveGifts;
|
public GiveGifts giveGifts;
|
||||||
@@ -30,10 +30,6 @@ public class MinigameAssets implements AssetBundle<MinigameAssets.Data> {
|
|||||||
public String deadChild, car, label;
|
public String deadChild, car, label;
|
||||||
public FrameRange cakeFreddy, childCrying, child;
|
public FrameRange cakeFreddy, childCrying, child;
|
||||||
}
|
}
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give Gifts Give Life
|
// Give Gifts Give Life
|
||||||
@@ -223,25 +219,4 @@ public class MinigameAssets implements AssetBundle<MinigameAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.rare)
|
&& isRangeLoaded(manager, d.rare)
|
||||||
&& isRangeLoaded(manager, d.animatronics);
|
&& isRangeLoaded(manager, d.animatronics);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,25 +3,16 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class MonitorAssets implements AssetBundle<MonitorAssets.Data> {
|
public class MonitorAssets extends AssetBase implements AssetBundle<MonitorAssets.Data> {
|
||||||
|
|
||||||
// ---- JSON data class ----
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String button;
|
public String button;
|
||||||
public FrameRange sprites;
|
public FrameRange sprites;
|
||||||
|
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Typed fields ----
|
|
||||||
public Texture button;
|
public Texture button;
|
||||||
public Texture[] sprites;
|
public Texture[] sprites;
|
||||||
|
|
||||||
// ---- AssetBundle ----
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void queue(AssetManager manager, Data data) {
|
public void queue(AssetManager manager, Data data) {
|
||||||
manager.load(data.button, Texture.class);
|
manager.load(data.button, Texture.class);
|
||||||
@@ -49,13 +40,4 @@ public class MonitorAssets implements AssetBundle<MonitorAssets.Data> {
|
|||||||
if (!manager.isLoaded(data.sprites.base + i + ".png")) return false;
|
if (!manager.isLoaded(data.sprites.base + i + ".png")) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Helpers ----
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,12 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class NumbersAssets implements AssetBundle<NumbersAssets.Data> {
|
public class NumbersAssets extends AssetBase implements AssetBundle<NumbersAssets.Data> {
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String dots, nightLabel, amLabel, bigAm;
|
public String dots, nightLabel, amLabel, bigAm;
|
||||||
public FrameRange medium, small, big, medium2, small2;
|
public FrameRange medium, small, big, medium2, small2;
|
||||||
public FrameRange fiveAnimation, sixAnimation;
|
public FrameRange fiveAnimation, sixAnimation;
|
||||||
|
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Texture dots, nightLabel, amLabel, bigAm;
|
public Texture dots, nightLabel, amLabel, bigAm;
|
||||||
@@ -79,25 +74,4 @@ public class NumbersAssets implements AssetBundle<NumbersAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.fiveAnimation)
|
&& isRangeLoaded(manager, d.fiveAnimation)
|
||||||
&& isRangeLoaded(manager, d.sixAnimation);
|
&& isRangeLoaded(manager, d.sixAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++) m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ package io.github.eldek0.asset.group;
|
|||||||
import com.badlogic.gdx.assets.AssetManager;
|
import com.badlogic.gdx.assets.AssetManager;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
|
||||||
public class OfficeAssets implements AssetBundle<OfficeAssets.Data> {
|
public class OfficeAssets extends AssetBase implements AssetBundle<OfficeAssets.Data> {
|
||||||
|
|
||||||
// ---- JSON data class ----
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
public String bg;
|
public String bg;
|
||||||
public VentButtons ventButtons;
|
public VentButtons ventButtons;
|
||||||
@@ -23,13 +22,8 @@ public class OfficeAssets implements AssetBundle<OfficeAssets.Data> {
|
|||||||
public static class Ranges {
|
public static class Ranges {
|
||||||
public FrameRange inside, hallway, rightVents, leftVents, desk, warnBig, warnSmall;
|
public FrameRange inside, hallway, rightVents, leftVents, desk, warnBig, warnSmall;
|
||||||
}
|
}
|
||||||
public static class FrameRange {
|
|
||||||
public String base;
|
|
||||||
public int start, end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Typed fields ----
|
|
||||||
public Texture bg;
|
public Texture bg;
|
||||||
public Texture rightVentButtonOff, rightVentButtonOn;
|
public Texture rightVentButtonOff, rightVentButtonOn;
|
||||||
public Texture leftVentButtonOff, leftVentButtonOn;
|
public Texture leftVentButtonOff, leftVentButtonOn;
|
||||||
@@ -37,7 +31,6 @@ public class OfficeAssets implements AssetBundle<OfficeAssets.Data> {
|
|||||||
public Texture balloonGirl, dwarf, plastic, bunny, goldenFreddy, mangle, balloonBoy;
|
public Texture balloonGirl, dwarf, plastic, bunny, goldenFreddy, mangle, balloonBoy;
|
||||||
public Texture[] inside, hallway, rightVents, leftVents, desk, warnBig, warnSmall;
|
public Texture[] inside, hallway, rightVents, leftVents, desk, warnBig, warnSmall;
|
||||||
|
|
||||||
// ---- AssetBundle ----
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void queue(AssetManager manager, Data d) {
|
public void queue(AssetManager manager, Data d) {
|
||||||
@@ -150,29 +143,4 @@ public class OfficeAssets implements AssetBundle<OfficeAssets.Data> {
|
|||||||
&& isRangeLoaded(manager, d.ranges.warnBig)
|
&& isRangeLoaded(manager, d.ranges.warnBig)
|
||||||
&& isRangeLoaded(manager, d.ranges.warnSmall);
|
&& isRangeLoaded(manager, d.ranges.warnSmall);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Range helpers ----
|
|
||||||
|
|
||||||
private void queueRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
m.load(r.base + i + ".png", Texture.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Texture[] fetchRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
Texture[] arr = new Texture[r.end - r.start + 1];
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
arr[i - r.start] = m.get(r.base + i + ".png", Texture.class);
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void disposeRange(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
m.unload(r.base + i + ".png");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isRangeLoaded(AssetManager m, Data.FrameRange r) {
|
|
||||||
for (int i = r.start; i <= r.end; i++)
|
|
||||||
if (!m.isLoaded(r.base + i + ".png")) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user