why does this work

This commit is contained in:
Anuken
2019-10-02 23:17:06 -04:00
parent 3369de6bf7
commit cce0040eaf
4 changed files with 15 additions and 3 deletions

View File

@@ -139,7 +139,7 @@ public class AssetsAnnotationProcessor extends AbstractProcessor{
loadBegin.addStatement("io.anuke.arc.Core.assets.load("+filename +", "+rtype+".class).loaded = a -> " + name + " = ("+rtype+")a", filepath, filepath.replace(".ogg", ".mp3")); loadBegin.addStatement("io.anuke.arc.Core.assets.load("+filename +", "+rtype+".class).loaded = a -> " + name + " = ("+rtype+")a", filepath, filepath.replace(".ogg", ".mp3"));
dispose.addStatement(name + ".dispose()"); dispose.addStatement("io.anuke.arc.Core.assets.unload(" + filename + ")");
dispose.addStatement(name + " = null"); dispose.addStatement(name + " = null");
type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), name, Modifier.STATIC, Modifier.PUBLIC).initializer("new io.anuke.arc.audio.mock.Mock" + rtype.substring(rtype.lastIndexOf(".") + 1)+ "()").build()); type.addField(FieldSpec.builder(ClassName.bestGuess(rtype), name, Modifier.STATIC, Modifier.PUBLIC).initializer("new io.anuke.arc.audio.mock.Mock" + rtype.substring(rtype.lastIndexOf(".") + 1)+ "()").build());
}); });

View File

@@ -75,6 +75,7 @@ mod.disabled = [scarlet]Disabled
mod.disable = Disable mod.disable = Disable
mod.enable = Enable mod.enable = Enable
mod.requiresrestart = The game will now close to apply the mod changes. mod.requiresrestart = The game will now close to apply the mod changes.
mod.reloadrequired = [scarlet]Reload Required
mod.import = Import Mod mod.import = Import Mod
mod.remove.confirm = This mod will be deleted. mod.remove.confirm = This mod will be deleted.
mod.author = [LIGHT_GRAY]Author:[] {0} mod.author = [LIGHT_GRAY]Author:[] {0}

View File

@@ -221,18 +221,26 @@ public class Mods implements Loadable{
} }
} }
/** Reloads all mod content.*/ /** Reloads all mod content. How does this even work? I refuse to believe that it functions correctly.*/
public void reloadContent(){ public void reloadContent(){
//epic memory leak //epic memory leak
Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas")); Core.atlas = new TextureAtlas(Core.files.internal("sprites/sprites.atlas"));
Tex.load(); Tex.load();
Tex.loadStyles(); Tex.loadStyles();
Styles.load(); Styles.load();
loaded.clear();
disabled.clear();
load();
buildFiles();
Musics.dispose();
Sounds.dispose();
Musics.load();
Sounds.load();
Core.assets.finishLoading();
content.clear(); content.clear();
content.createContent(); content.createContent();
loadAsync(); loadAsync();
loadSync(); loadSync();
buildFiles();
content.init(); content.init();
content.load(); content.load();
content.loadColors(); content.loadColors();

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.arc.*; import io.anuke.arc.*;
import io.anuke.arc.collection.*; import io.anuke.arc.collection.*;
import io.anuke.arc.util.*;
import io.anuke.mindustry.gen.*; import io.anuke.mindustry.gen.*;
import io.anuke.mindustry.graphics.*; import io.anuke.mindustry.graphics.*;
import io.anuke.mindustry.mod.Mods.*; import io.anuke.mindustry.mod.Mods.*;
@@ -36,6 +37,8 @@ public class ModsDialog extends FloatingDialog{
void setup(){ void setup(){
cont.clear(); cont.clear();
cont.defaults().width(520f).pad(4); cont.defaults().width(520f).pad(4);
cont.add("$mod.reloadrequired").visible(mods::requiresReload).center().get().setAlignment(Align.center);
cont.row();
if(!(mods.all().isEmpty() && mods.disabled().isEmpty())){ if(!(mods.all().isEmpty() && mods.disabled().isEmpty())){
cont.pane(table -> { cont.pane(table -> {
table.margin(10f).top(); table.margin(10f).top();