Discord integration, basic rich presence

This commit is contained in:
BeefEX
2018-01-02 17:21:03 +01:00
parent b6845d5d10
commit 12fad819b5
9 changed files with 70 additions and 7 deletions

View File

@@ -30,7 +30,10 @@ public class Mindustry extends ModuleCore {
@Override public String format(int number){ return number + ""; }
@Override public void openLink(String link){ }
@Override public void addDialog(TextField field){}
@Override public void onSceneChange(String state, String details, String icon) {}
@Override public void onGameExit() { }
};
public static boolean externalBundle = false;
@Override
@@ -45,6 +48,12 @@ public class Mindustry extends ModuleCore {
module(Vars.netClient = new NetClient());
}
@Override
public void dispose() {
platforms.onGameExit();
super.dispose();
}
public void loadBundle(){
I18NBundle.setExceptionOnMissingKey(false);

View File

@@ -42,7 +42,7 @@ public class Vars{
//how much the zoom changes every zoom button press
public static final int zoomScale = Math.round(Unit.dp.scl(1));
//if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available
public static boolean debug = false;
public static boolean debug = true;
//whether the player can clip through walls
public static boolean noclip = false;
//whether to draw chunk borders

View File

@@ -33,6 +33,7 @@ import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.graphics.Atlas;
import io.anuke.ucore.modules.Module;
import io.anuke.ucore.scene.ui.layout.Unit;
import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Input;
import io.anuke.ucore.util.InputProxy;
import io.anuke.ucore.util.Mathf;
@@ -75,6 +76,7 @@ public class Control extends Module{
private InputProxy proxy;
private float controlx, controly;
private boolean controlling;
private Map map;
public Control(){
if(Mindustry.args.contains("-debug", false))
@@ -293,6 +295,10 @@ public class Control extends Module{
});
Timers.run(18, ()-> ui.hideLoading());
this.map = map;
Mindustry.platforms.onSceneChange(Bundles.get("text.playing", "Playing on map") + ": " + map.name, Bundles.get("text.wavenumber", "Wave") + " 0", "fight");
}
public GameMode getMode(){
@@ -323,6 +329,7 @@ public class Control extends Module{
}
public void runWave(){
Mindustry.platforms.onSceneChange(Bundles.get("text.playing", "Playing on map") + ": " + map.name, Bundles.get("text.wavenumber", "Wave") + " " + wave, "fight");
if(Net.client() && Net.active()){
return;
}

View File

@@ -9,4 +9,6 @@ public interface PlatformFunction{
public String format(int number);
public void openLink(String link);
public void addDialog(TextField field);
public void onSceneChange(String state, String details, String icon);
public void onGameExit();
}

View File

@@ -2,10 +2,7 @@ package io.anuke.mindustry.resource;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.DefenseBlocks;
import io.anuke.mindustry.world.blocks.DistributionBlocks;
import io.anuke.mindustry.world.blocks.ProductionBlocks;
import io.anuke.mindustry.world.blocks.WeaponBlocks;
import io.anuke.mindustry.world.blocks.*;
import static io.anuke.mindustry.resource.Section.*;