Fixed #509
This commit is contained in:
@@ -108,9 +108,13 @@ public class ContentLoader{
|
|||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initializes all content with the specified function. */
|
|
||||||
public void initialize(Consumer<Content> callable){
|
public void initialize(Consumer<Content> callable){
|
||||||
if(initialization.contains(callable)) return;
|
initialize(callable, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Initializes all content with the specified function. */
|
||||||
|
public void initialize(Consumer<Content> callable, boolean override){
|
||||||
|
if(initialization.contains(callable) && !override) return;
|
||||||
|
|
||||||
for(ContentType type : ContentType.values()){
|
for(ContentType type : ContentType.values()){
|
||||||
for(Content content : contentMap[type.ordinal()]){
|
for(Content content : contentMap[type.ordinal()]){
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class Control implements ApplicationListener{
|
|||||||
content.initialize(Content::init);
|
content.initialize(Content::init);
|
||||||
Core.atlas = new TextureAtlas(maxSize < 2048 ? "sprites/sprites_fallback.atlas" : "sprites/sprites.atlas");
|
Core.atlas = new TextureAtlas(maxSize < 2048 ? "sprites/sprites_fallback.atlas" : "sprites/sprites.atlas");
|
||||||
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
Draw.scl = 1f / Core.atlas.find("scale_marker").getWidth();
|
||||||
content.initialize(Content::load);
|
content.initialize(Content::load, true);
|
||||||
|
|
||||||
data.load();
|
data.load();
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ public class Units{
|
|||||||
|
|
||||||
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
||||||
public static TargetTrait closestTarget(Team team, float x, float y, float range, Predicate<Unit> unitPred, Predicate<Tile> tilePred){
|
public static TargetTrait closestTarget(Team team, float x, float y, float range, Predicate<Unit> unitPred, Predicate<Tile> tilePred){
|
||||||
|
if(team == Team.none) return null;
|
||||||
|
|
||||||
Unit unit = closestEnemy(team, x, y, range, unitPred);
|
Unit unit = closestEnemy(team, x, y, range, unitPred);
|
||||||
if(unit != null){
|
if(unit != null){
|
||||||
return unit;
|
return unit;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class RubbleDecal extends Decal{
|
|||||||
public static void create(float x, float y, int size){
|
public static void create(float x, float y, int size){
|
||||||
if(headless) return;
|
if(headless) return;
|
||||||
|
|
||||||
if(regions[size].length == 0){
|
if(regions[size].length == 0 || regions[size][0].getTexture().isDisposed()){
|
||||||
regions[size] = new TextureRegion[2];
|
regions[size] = new TextureRegion[2];
|
||||||
for(int j = 0; j < 2; j++){
|
for(int j = 0; j < 2; j++){
|
||||||
regions[size][j] = Core.atlas.find("rubble-" + size + "-" + j);
|
regions[size][j] = Core.atlas.find("rubble-" + size + "-" + j);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class ScorchDecal extends Decal{
|
|||||||
public static void create(float x, float y){
|
public static void create(float x, float y){
|
||||||
if(headless) return;
|
if(headless) return;
|
||||||
|
|
||||||
if(regions[0] == null){
|
if(regions[0] == null || regions[0].getTexture().isDisposed()){
|
||||||
for(int i = 0; i < regions.length; i++){
|
for(int i = 0; i < regions.length; i++){
|
||||||
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
regions[i] = Core.atlas.find("scorch" + (i + 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,6 @@ public class Rules{
|
|||||||
|
|
||||||
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
/** Copies this ruleset exactly. Not very efficient at all, do not use often. */
|
||||||
public Rules copy(){
|
public Rules copy(){
|
||||||
return JsonIO.read(Rules.class, JsonIO.write(this));
|
return JsonIO.copy(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,10 @@ public class MenuFragment extends Fragment{
|
|||||||
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
join = new MobileButton("icon-add", isize, "$joingame", ui.join::show),
|
||||||
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
editor = new MobileButton("icon-editor", isize, "$editor", () -> ui.loadAnd(ui.editor::show)),
|
||||||
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
tools = new MobileButton("icon-tools", isize, "$settings", ui.settings::show),
|
||||||
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL));
|
donate = new MobileButton("icon-donate", isize, "$donate", () -> Core.net.openURI(donationURL)),
|
||||||
|
exit = new MobileButton("icon-exit", isize, "$quit", () -> Core.app.exit());
|
||||||
|
|
||||||
if(Core.graphics.getWidth() > Core.graphics.getHeight()){
|
if(!Core.graphics.isPortrait()){
|
||||||
container.add(play);
|
container.add(play);
|
||||||
container.add(join);
|
container.add(join);
|
||||||
container.add(custom);
|
container.add(custom);
|
||||||
@@ -79,6 +80,7 @@ public class MenuFragment extends Fragment{
|
|||||||
table.add(tools);
|
table.add(tools);
|
||||||
|
|
||||||
if(Platform.instance.canDonate()) table.add(donate);
|
if(Platform.instance.canDonate()) table.add(donate);
|
||||||
|
table.add(exit);
|
||||||
}).colspan(4);
|
}).colspan(4);
|
||||||
}else{
|
}else{
|
||||||
container.add(play);
|
container.add(play);
|
||||||
@@ -95,6 +97,7 @@ public class MenuFragment extends Fragment{
|
|||||||
table.defaults().set(container.defaults());
|
table.defaults().set(container.defaults());
|
||||||
|
|
||||||
if(Platform.instance.canDonate()) table.add(donate);
|
if(Platform.instance.canDonate()) table.add(donate);
|
||||||
|
table.add(exit);
|
||||||
}).colspan(2);
|
}).colspan(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ public class Block extends BlockStorage{
|
|||||||
cacheRegions[i] = Core.atlas.find(cacheRegionStrings.get(i));
|
cacheRegions[i] = Core.atlas.find(cacheRegionStrings.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cracks == null){
|
if(cracks == null || cracks[0][0].getTexture().isDisposed()){
|
||||||
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
cracks = new TextureRegion[maxCrackSize][crackRegions];
|
||||||
for(int size = 1; size <= maxCrackSize; size++){
|
for(int size = 1; size <= maxCrackSize; size++){
|
||||||
for(int i = 0; i < crackRegions; i++){
|
for(int i = 0; i < crackRegions; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user