time for a crusade against dialogs
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 2.3 KiB |
@@ -130,7 +130,7 @@ connecting.data = [accent]Loading world data...
|
|||||||
server.port = Port:
|
server.port = Port:
|
||||||
server.addressinuse = Address already in use!
|
server.addressinuse = Address already in use!
|
||||||
server.invalidport = Invalid port number!
|
server.invalidport = Invalid port number!
|
||||||
server.error = [crimson]Error hosting server: [accent]{0}
|
server.error = [crimson]Error hosting server.
|
||||||
save.old = This save is for an older version of the game, and can no longer be used.\n\n[lightgray]Save backwards compatibility will be implemented in the full 4.0 release.
|
save.old = This save is for an older version of the game, and can no longer be used.\n\n[lightgray]Save backwards compatibility will be implemented in the full 4.0 release.
|
||||||
save.new = New Save
|
save.new = New Save
|
||||||
save.overwrite = Are you sure you want to overwrite\nthis save slot?
|
save.overwrite = Are you sure you want to overwrite\nthis save slot?
|
||||||
@@ -227,13 +227,14 @@ waves.invalid = Invalid waves in clipboard.
|
|||||||
waves.copied = Waves copied.
|
waves.copied = Waves copied.
|
||||||
waves.none = No enemies defined.\nNote that empty wave layouts will automatically be replaced with the default layout.
|
waves.none = No enemies defined.\nNote that empty wave layouts will automatically be replaced with the default layout.
|
||||||
editor.default = [lightgray]<Default>
|
editor.default = [lightgray]<Default>
|
||||||
|
details = Details...
|
||||||
edit = Edit...
|
edit = Edit...
|
||||||
editor.name = Name:
|
editor.name = Name:
|
||||||
editor.spawn = Spawn Unit
|
editor.spawn = Spawn Unit
|
||||||
editor.removeunit = Remove Unit
|
editor.removeunit = Remove Unit
|
||||||
editor.teams = Teams
|
editor.teams = Teams
|
||||||
editor.errorload = Error loading file:\n[accent]{0}
|
editor.errorload = Error loading file.
|
||||||
editor.errorsave = Error saving file:\n[accent]{0}
|
editor.errorsave = Error saving file.
|
||||||
editor.errorimage = That's an image, not a map.\n\nIf you want to import a 3.5/build 40 map, use the 'Import Legacy Map' button in the editor.
|
editor.errorimage = That's an image, not a map.\n\nIf you want to import a 3.5/build 40 map, use the 'Import Legacy Map' button in the editor.
|
||||||
editor.errorlegacy = This map is too old, and uses a legacy map format that is no longer supported.
|
editor.errorlegacy = This map is too old, and uses a legacy map format that is no longer supported.
|
||||||
editor.errornot = This is not a map file.
|
editor.errornot = This is not a map file.
|
||||||
|
|||||||
@@ -15156,7 +15156,7 @@ window-empty
|
|||||||
rotate: false
|
rotate: false
|
||||||
xy: 1308, 494
|
xy: 1308, 494
|
||||||
size: 27, 61
|
size: 27, 61
|
||||||
split: 8, 8, 44, 11
|
split: 2, 2, 2, 2
|
||||||
orig: 27, 61
|
orig: 27, 61
|
||||||
offset: 0, 0
|
offset: 0, 0
|
||||||
index: -1
|
index: -1
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ public class Bullets implements ContentList{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
arc = new BulletType(0.001f, 25){
|
arc = new BulletType(0.001f, 21){
|
||||||
{
|
{
|
||||||
lifetime = 1;
|
lifetime = 1;
|
||||||
despawnEffect = Fx.none;
|
despawnEffect = Fx.none;
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public class StatusEffects implements ContentList{
|
|||||||
speedMultiplier = 0.9f;
|
speedMultiplier = 0.9f;
|
||||||
effect = Fx.wet;
|
effect = Fx.wet;
|
||||||
|
|
||||||
trans(() -> shocked, ((unit, time, newTime, result) -> unit.damage(15f)));
|
trans(() -> shocked, ((unit, time, newTime, result) -> unit.damage(20f)));
|
||||||
opposite(() -> burning, () -> shocked);
|
opposite(() -> burning);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
melting = new StatusEffect(){{
|
melting = new StatusEffect(){{
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
net.host(port);
|
net.host(port);
|
||||||
player.isAdmin = true;
|
player.isAdmin = true;
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
ui.showError(Core.bundle.format("server.error", Strings.parseException(e, true)));
|
ui.showException("$server.error", e);
|
||||||
Core.app.post(() -> state.set(State.menu));
|
Core.app.post(() -> state.set(State.menu));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
c.uuid = platform.getUUID();
|
c.uuid = platform.getUUID();
|
||||||
|
|
||||||
if(c.uuid == null){
|
if(c.uuid == null){
|
||||||
ui.showError("$invalidid");
|
ui.showErrorMessage("$invalidid");
|
||||||
ui.loadfrag.hide();
|
ui.loadfrag.hide();
|
||||||
disconnectQuietly();
|
disconnectQuietly();
|
||||||
return;
|
return;
|
||||||
@@ -117,7 +117,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
ui.showSmall("$disconnect", "$disconnect.error");
|
ui.showSmall("$disconnect", "$disconnect.error");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ui.showError("$disconnect");
|
ui.showErrorMessage("$disconnect");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ public class NetClient implements ApplicationListener{
|
|||||||
Log.err("Failed to load data!");
|
Log.err("Failed to load data!");
|
||||||
ui.loadfrag.hide();
|
ui.loadfrag.hide();
|
||||||
quiet = true;
|
quiet = true;
|
||||||
ui.showError("$disconnect.data");
|
ui.showErrorMessage("$disconnect.data");
|
||||||
net.disconnect();
|
net.disconnect();
|
||||||
timeoutTime = 0f;
|
timeoutTime = 0f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import io.anuke.arc.function.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.util.serialization.*;
|
import io.anuke.arc.util.serialization.*;
|
||||||
|
import io.anuke.mindustry.maps.*;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.net.Net.*;
|
import io.anuke.mindustry.net.Net.*;
|
||||||
import io.anuke.mindustry.ui.dialogs.*;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
@@ -15,16 +16,20 @@ import static io.anuke.mindustry.Vars.mobile;
|
|||||||
|
|
||||||
public interface Platform{
|
public interface Platform{
|
||||||
|
|
||||||
|
/** Steam: Update lobby visibility.*/
|
||||||
|
default void updateLobby(){}
|
||||||
|
|
||||||
|
/** Steam: Show multiplayer friend invite dialog.*/
|
||||||
|
default void inviteFriends(){}
|
||||||
|
|
||||||
|
/** Steam: Share a map on the workshop.*/
|
||||||
|
default void publishMap(Map map){}
|
||||||
|
|
||||||
/** Get the networking implementation.*/
|
/** Get the networking implementation.*/
|
||||||
default NetProvider getNet(){
|
default NetProvider getNet(){
|
||||||
return new ArcNetImpl();
|
return new ArcNetImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Steam: Update lobby visibility.*/
|
|
||||||
default void updateLobby(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Add a text input dialog that should show up after the field is tapped. */
|
/** Add a text input dialog that should show up after the field is tapped. */
|
||||||
default void addDialog(TextField field){
|
default void addDialog(TextField field){
|
||||||
addDialog(field, 16);
|
addDialog(field, 16);
|
||||||
@@ -95,11 +100,11 @@ public interface Platform{
|
|||||||
default void hide(){
|
default void hide(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Forces the app into landscape mode. Currently Android only. */
|
/** Forces the app into landscape mode.*/
|
||||||
default void beginForceLandscape(){
|
default void beginForceLandscape(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Stops forcing the app into landscape orientation. Currently Android only. */
|
/** Stops forcing the app into landscape orientation.*/
|
||||||
default void endForceLandscape(){
|
default void endForceLandscape(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
settings.put("bloom", false);
|
settings.put("bloom", false);
|
||||||
settings.save();
|
settings.save();
|
||||||
ui.showError("$error.bloom");
|
ui.showErrorMessage("$error.bloom");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
|
|
||||||
Core.settings.setErrorHandler(e -> {
|
Core.settings.setErrorHandler(e -> {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
Core.app.post(() -> showError("Failed to access local storage.\nSettings will not be saved."));
|
Core.app.post(() -> showErrorMessage("Failed to access local storage.\nSettings will not be saved."));
|
||||||
});
|
});
|
||||||
|
|
||||||
ClickListener.clicked = () -> Sounds.press.play();
|
ClickListener.clicked = () -> Sounds.press.play();
|
||||||
@@ -330,19 +330,42 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showError(String text){
|
public void showErrorMessage(String text){
|
||||||
new Dialog("", "dialog"){{
|
new Dialog("", "dialog"){{
|
||||||
setFillParent(true);
|
setFillParent(false);
|
||||||
|
cont.margin(15f);
|
||||||
cont.add("$error.title");
|
cont.add("$error.title");
|
||||||
cont.row();
|
cont.row();
|
||||||
cont.margin(15).pane(t -> {
|
cont.addImage("whiteui").fillX().pad(2).height(4f).color(Color.SCARLET);
|
||||||
Label l = t.add(text).pad(14f).get();
|
cont.row();
|
||||||
l.setAlignment(Align.center, Align.left);
|
cont.add(text).pad(2f);
|
||||||
if(mobile){
|
buttons.addButton("$ok", this::hide).size(120, 50).pad(4);
|
||||||
t.getCell(l).wrap().width(400f);
|
}}.show();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
buttons.addButton("$ok", this::hide).size(90, 50).pad(4);
|
public void showException(Throwable t){
|
||||||
|
showException("", t);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showException(String text, Throwable exc){
|
||||||
|
new Dialog("", "dialog"){{
|
||||||
|
String message = Strings.getFinalMesage(exc);
|
||||||
|
|
||||||
|
setFillParent(true);
|
||||||
|
cont.margin(15);
|
||||||
|
cont.add("$error.title").colspan(2);
|
||||||
|
cont.row();
|
||||||
|
cont.addImage("whiteui").fillX().pad(2).colspan(2).height(4f).color(Color.SCARLET);
|
||||||
|
cont.row();
|
||||||
|
cont.add((text.startsWith("$") ? Core.bundle.get(text.substring(1)) : text) + (message == null ? "" : "\n[lightgray](" + message + ")")).colspan(2).center().get().setAlignment(Align.center);
|
||||||
|
cont.row();
|
||||||
|
|
||||||
|
Collapser col = new Collapser(base -> base.pane(t -> t.margin(14f).add(Strings.parseException(exc, true)).color(Color.LIGHT_GRAY).left()), true);
|
||||||
|
|
||||||
|
cont.addButton("$details", "toggle", col::toggle).size(180f, 50f).checked(b -> !col.isCollapsed()).fillX().right();
|
||||||
|
cont.addButton("$ok", this::hide).size(100, 50).fillX().left();
|
||||||
|
cont.row();
|
||||||
|
cont.add(col).colspan(2).pad(2);
|
||||||
}}.show();
|
}}.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ public class World{
|
|||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
if(!headless){
|
if(!headless){
|
||||||
ui.showError("$map.invalid");
|
ui.showErrorMessage("$map.invalid");
|
||||||
Core.app.post(() -> state.set(State.menu));
|
Core.app.post(() -> state.set(State.menu));
|
||||||
invalidMap = true;
|
invalidMap = true;
|
||||||
}
|
}
|
||||||
@@ -229,7 +229,7 @@ public class World{
|
|||||||
|
|
||||||
if(!headless){
|
if(!headless){
|
||||||
if(state.teams.get(defaultTeam).cores.size == 0 && !checkRules.pvp){
|
if(state.teams.get(defaultTeam).cores.size == 0 && !checkRules.pvp){
|
||||||
ui.showError("$map.nospawn");
|
ui.showErrorMessage("$map.nospawn");
|
||||||
invalidMap = true;
|
invalidMap = true;
|
||||||
}else if(checkRules.pvp){ //pvp maps need two cores to be valid
|
}else if(checkRules.pvp){ //pvp maps need two cores to be valid
|
||||||
int teams = 0;
|
int teams = 0;
|
||||||
@@ -240,12 +240,12 @@ public class World{
|
|||||||
}
|
}
|
||||||
if(teams < 2){
|
if(teams < 2){
|
||||||
invalidMap = true;
|
invalidMap = true;
|
||||||
ui.showError("$map.nospawn.pvp");
|
ui.showErrorMessage("$map.nospawn.pvp");
|
||||||
}
|
}
|
||||||
}else if(checkRules.attackMode){ //attack maps need two cores to be valid
|
}else if(checkRules.attackMode){ //attack maps need two cores to be valid
|
||||||
invalidMap = state.teams.get(waveTeam).cores.isEmpty();
|
invalidMap = state.teams.get(waveTeam).cores.isEmpty();
|
||||||
if(invalidMap){
|
if(invalidMap){
|
||||||
ui.showError("$map.nospawn.attack");
|
ui.showErrorMessage("$map.nospawn.attack");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
editor.beginEdit(pixmap);
|
editor.beginEdit(pixmap);
|
||||||
pixmap.dispose();
|
pixmap.dispose();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Core.bundle.format("editor.errorload", Strings.parseException(e, true)));
|
ui.showException("$editor.errorload", e);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
})))
|
})))
|
||||||
@@ -126,7 +126,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
}
|
}
|
||||||
MapIO.writeMap(file, editor.createMap(file));
|
MapIO.writeMap(file, editor.createMap(file));
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Core.bundle.format("editor.errorsave", Strings.parseException(e, true)));
|
ui.showException("$editor.errorsave", e);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -138,7 +138,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
MapIO.writeMap(result, editor.createMap(result));
|
MapIO.writeMap(result, editor.createMap(result));
|
||||||
platform.shareFile(result);
|
platform.shareFile(result);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Core.bundle.format("editor.errorsave", Strings.parseException(e, true)));
|
ui.showException("$editor.errorsave", e);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -173,7 +173,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
try{
|
try{
|
||||||
editor.beginEdit(map);
|
editor.beginEdit(map);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Core.bundle.format("editor.errorload", Strings.parseException(e, true)));
|
ui.showException("$editor.errorload", e);
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -227,11 +227,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
shown(this::build);
|
shown(this::build);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawBackground(float x, float y){
|
|
||||||
drawDefaultBackground(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resumeEditing(){
|
public void resumeEditing(){
|
||||||
state.set(State.menu);
|
state.set(State.menu);
|
||||||
shownWithMap = true;
|
shownWithMap = true;
|
||||||
@@ -280,7 +275,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
if(name.isEmpty()){
|
if(name.isEmpty()){
|
||||||
infoDialog.show();
|
infoDialog.show();
|
||||||
Core.app.post(() -> ui.showError("$editor.save.noname"));
|
Core.app.post(() -> ui.showErrorMessage("$editor.save.noname"));
|
||||||
}else{
|
}else{
|
||||||
Map map = maps.all().find(m -> m.name().equals(name));
|
Map map = maps.all().find(m -> m.name().equals(name));
|
||||||
if(map != null && !map.custom){
|
if(map != null && !map.custom){
|
||||||
@@ -297,7 +292,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
/** Called when a built-in map save is attempted.*/
|
/** Called when a built-in map save is attempted.*/
|
||||||
protected void handleSaveBuiltin(Map map){
|
protected void handleSaveBuiltin(Map map){
|
||||||
ui.showError("$editor.save.overwrite");
|
ui.showErrorMessage("$editor.save.overwrite");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -366,7 +361,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
show();
|
show();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Log.err(e);
|
Log.err(e);
|
||||||
ui.showError(Core.bundle.format("editor.errorload", Strings.parseException(e, true)));
|
ui.showException("$editor.errorload", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class MapSaveDialog extends FloatingDialog{
|
|||||||
if(!invalid()){
|
if(!invalid()){
|
||||||
listener.accept(field.getText());
|
listener.accept(field.getText());
|
||||||
}else{
|
}else{
|
||||||
ui.showError("$editor.failoverwrite");
|
ui.showErrorMessage("$editor.failoverwrite");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class WaveInfoDialog extends FloatingDialog{
|
|||||||
groups = maps.readWaves(Core.app.getClipboardText());
|
groups = maps.readWaves(Core.app.getClipboardText());
|
||||||
buildGroups();
|
buildGroups();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError("$waves.invalid");
|
ui.showErrorMessage("$waves.invalid");
|
||||||
}
|
}
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
}).disabled(b -> Core.app.getClipboardText() == null || Core.app.getClipboardText().isEmpty());
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import io.anuke.mindustry.graphics.Pal;
|
|||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.type.Item;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.effectGroup;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class ItemTransfer extends TimedEntity implements DrawTrait{
|
public class ItemTransfer extends TimedEntity implements DrawTrait{
|
||||||
private Vector2 from = new Vector2();
|
private Vector2 from = new Vector2();
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public enum Gamemode{
|
|||||||
attack(rules -> {
|
attack(rules -> {
|
||||||
rules.unitDrops = true;
|
rules.unitDrops = true;
|
||||||
rules.attackMode = true;
|
rules.attackMode = true;
|
||||||
rules.waves = true;
|
|
||||||
}, map -> map.teams.contains(waveTeam.ordinal())),
|
}, map -> map.teams.contains(waveTeam.ordinal())),
|
||||||
pvp(rules -> {
|
pvp(rules -> {
|
||||||
rules.pvp = true;
|
rules.pvp = true;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import io.anuke.mindustry.entities.type.*;
|
|||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.net.Net;
|
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.type.*;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.ui.fragments.*;
|
import io.anuke.mindustry.ui.fragments.*;
|
||||||
@@ -60,11 +59,11 @@ public abstract class InputHandler implements InputProcessor{
|
|||||||
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
||||||
public static void transferInventory(Player player, Tile tile){
|
public static void transferInventory(Player player, Tile tile){
|
||||||
if(!player.timer.get(Player.timerTransfer, 40)) return;
|
if(!player.timer.get(Player.timerTransfer, 40)) return;
|
||||||
if(net.server() && (player.item().amount <= 0 || player.isTransferring)){
|
if(net.server() && (player.item().amount <= 0 || player.isTransferring|| !tile.interactable(player.getTeam()))){
|
||||||
throw new ValidateException(player, "Player cannot transfer an item.");
|
throw new ValidateException(player, "Player cannot transfer an item.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(player == null || tile.entity == null) return;
|
if(tile.entity == null) return;
|
||||||
|
|
||||||
player.isTransferring = true;
|
player.isTransferring = true;
|
||||||
|
|
||||||
|
|||||||
@@ -207,11 +207,11 @@ public class Maps{
|
|||||||
Log.err(e);
|
Log.err(e);
|
||||||
|
|
||||||
if("Outdated legacy map format".equals(e.getMessage())){
|
if("Outdated legacy map format".equals(e.getMessage())){
|
||||||
ui.showError("$editor.errornot");
|
ui.showErrorMessage("$editor.errornot");
|
||||||
}else if(e.getMessage() != null && e.getMessage().contains("Incorrect header!")){
|
}else if(e.getMessage() != null && e.getMessage().contains("Incorrect header!")){
|
||||||
ui.showError("$editor.errorheader");
|
ui.showErrorMessage("$editor.errorheader");
|
||||||
}else{
|
}else{
|
||||||
ui.showError(Core.bundle.format("editor.errorload", Strings.parseException(e, true)));
|
ui.showException("$editor.errorload", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ public class Net{
|
|||||||
}else if(error.equals("alreadyconnected") || error.contains("connection is closed")){
|
}else if(error.equals("alreadyconnected") || error.contains("connection is closed")){
|
||||||
error = Core.bundle.get("error.alreadyconnected");
|
error = Core.bundle.get("error.alreadyconnected");
|
||||||
}else if(!error.isEmpty()){
|
}else if(!error.isEmpty()){
|
||||||
error = Core.bundle.get("error.any") + "\n" + Strings.parseException(e, true);
|
error = Core.bundle.get("error.any");
|
||||||
isError = true;
|
isError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isError){
|
if(isError){
|
||||||
ui.showError(Core.bundle.format("connectfail", error));
|
ui.showException("$error.any", e);
|
||||||
}else{
|
}else{
|
||||||
ui.showText("", Core.bundle.format("connectfail", error));
|
ui.showText("", Core.bundle.format("connectfail", error));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ public class Plugins{
|
|||||||
|
|
||||||
PluginMeta meta = JsonIO.read(PluginMeta.class, metaf.readString());
|
PluginMeta meta = JsonIO.read(PluginMeta.class, metaf.readString());
|
||||||
|
|
||||||
|
|
||||||
URLClassLoader classLoader = new URLClassLoader(new URL[]{jar.file().toURI().toURL()}, ClassLoader.getSystemClassLoader());
|
URLClassLoader classLoader = new URLClassLoader(new URL[]{jar.file().toURI().toURL()}, ClassLoader.getSystemClassLoader());
|
||||||
Class<?> main = classLoader.loadClass(meta.main);
|
Class<?> main = classLoader.loadClass(meta.main);
|
||||||
return new LoadedPlugin(jar, zip, (Plugin)main.newInstance(), meta);
|
return new LoadedPlugin(jar, zip, (Plugin)main.newInstance(), meta);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class AboutDialog extends FloatingDialog{
|
|||||||
|
|
||||||
table.addImageButton("icon-link", iconsize, () -> {
|
table.addImageButton("icon-link", iconsize, () -> {
|
||||||
if(!Core.net.openURI(link.link)){
|
if(!Core.net.openURI(link.link)){
|
||||||
ui.showError("$linkfail");
|
ui.showErrorMessage("$linkfail");
|
||||||
Core.app.setClipboardText(link.link);
|
Core.app.setClipboardText(link.link);
|
||||||
}
|
}
|
||||||
}).size(h - 5, h);
|
}).size(h - 5, h);
|
||||||
|
|||||||
@@ -168,11 +168,6 @@ public class DeployDialog extends FloatingDialog{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawBackground(float x, float y){
|
|
||||||
drawDefaultBackground(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void buildButton(Zone zone, Button button){
|
void buildButton(Zone zone, Button button){
|
||||||
button.setDisabled(() -> hidden(zone));
|
button.setDisabled(() -> hidden(zone));
|
||||||
button.clicked(() -> info.show(zone));
|
button.clicked(() -> info.show(zone));
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class DiscordDialog extends Dialog{
|
|||||||
});
|
});
|
||||||
buttons.addButton("$openlink", () -> {
|
buttons.addButton("$openlink", () -> {
|
||||||
if(!Core.net.openURI(discordURL)){
|
if(!Core.net.openURI(discordURL)){
|
||||||
ui.showError("$linkfail");
|
ui.showErrorMessage("$linkfail");
|
||||||
Core.app.setClipboardText(discordURL);
|
Core.app.setClipboardText(discordURL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.*;
|
||||||
import io.anuke.arc.function.Consumer;
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.function.Predicate;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.graphics.g2d.GlyphLayout;
|
import io.anuke.arc.scene.event.*;
|
||||||
import io.anuke.arc.scene.event.Touchable;
|
|
||||||
import io.anuke.arc.scene.ui.*;
|
import io.anuke.arc.scene.ui.*;
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.*;
|
||||||
import io.anuke.arc.scene.ui.layout.UnitScl;
|
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.pooling.Pools;
|
import io.anuke.arc.util.pooling.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -31,13 +29,9 @@ public class FileChooser extends FloatingDialog{
|
|||||||
private Consumer<FileHandle> selectListener;
|
private Consumer<FileHandle> selectListener;
|
||||||
private boolean open;
|
private boolean open;
|
||||||
|
|
||||||
public static final Predicate<String> pngFiles = str -> str.equals("png");
|
|
||||||
public static final Predicate<String> anyMapFiles = str -> str.equals(oldMapExtension) || str.equals(mapExtension);
|
|
||||||
public static final Predicate<String> mapFiles = str -> str.equals(mapExtension);
|
|
||||||
public static final Predicate<String> saveFiles = str -> str.equals(saveExtension);
|
|
||||||
|
|
||||||
public FileChooser(String title, Predicate<FileHandle> filter, boolean open, Consumer<FileHandle> result){
|
public FileChooser(String title, Predicate<FileHandle> filter, boolean open, Consumer<FileHandle> result){
|
||||||
super(title);
|
super(title);
|
||||||
|
setFillParent(true);
|
||||||
this.open = open;
|
this.open = open;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.selectListener = result;
|
this.selectListener = result;
|
||||||
@@ -88,11 +82,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
files.marginRight(10);
|
files.marginRight(10);
|
||||||
files.marginLeft(3);
|
files.marginLeft(3);
|
||||||
|
|
||||||
pane = new ScrollPane(files){
|
pane = new ScrollPane(files);
|
||||||
public float getPrefHeight(){
|
|
||||||
return Core.graphics.getHeight();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
pane.setOverscroll(false, false);
|
pane.setOverscroll(false, false);
|
||||||
pane.setFadeScrollBars(false);
|
pane.setFadeScrollBars(false);
|
||||||
|
|
||||||
@@ -152,7 +142,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
content.add(icontable).expandX().fillX();
|
content.add(icontable).expandX().fillX();
|
||||||
content.row();
|
content.row();
|
||||||
|
|
||||||
content.center().add(pane).width(Core.graphics.isPortrait() ? Core.graphics.getWidth() / UnitScl.dp.scl(1) : Core.graphics.getWidth() / UnitScl.dp.scl(2)).colspan(3).grow();
|
content.center().add(pane).colspan(3).grow();
|
||||||
content.row();
|
content.row();
|
||||||
|
|
||||||
if(!open){
|
if(!open){
|
||||||
@@ -162,7 +152,7 @@ public class FileChooser extends FloatingDialog{
|
|||||||
|
|
||||||
content.add(buttons).growX();
|
content.add(buttons).growX();
|
||||||
|
|
||||||
cont.add(content);
|
cont.add(content).grow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFileFieldStatus(){
|
private void updateFileFieldStatus(){
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class HostDialog extends FloatingDialog{
|
|||||||
net.host(Vars.port);
|
net.host(Vars.port);
|
||||||
player.isAdmin = true;
|
player.isAdmin = true;
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
ui.showError(Core.bundle.format("server.error", Strings.parseException(e, true)));
|
ui.showException("$server.error", e);
|
||||||
}
|
}
|
||||||
ui.loadfrag.hide();
|
ui.loadfrag.hide();
|
||||||
hide();
|
hide();
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
slot.exportFile(file);
|
slot.exportFile(file);
|
||||||
setup();
|
setup();
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
ui.showError(Core.bundle.format("save.export.fail", Strings.parseException(e, true)));
|
ui.showException("save.export.fail", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
@@ -103,7 +103,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
slot.exportFile(file);
|
slot.exportFile(file);
|
||||||
platform.shareFile(file);
|
platform.shareFile(file);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Core.bundle.format("save.export.fail", Strings.parseException(e, true)));
|
ui.showException("save.export.fail", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).size(iconsize).right();
|
}).size(iconsize).right();
|
||||||
@@ -177,10 +177,10 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
setup();
|
setup();
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ui.showError(Core.bundle.format("save.import.fail", Strings.parseException(e, true)));
|
ui.showException("save.import.fail", e);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
ui.showError("$save.import.invalid");
|
ui.showErrorMessage("$save.import.invalid");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
|
}).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
|
||||||
@@ -199,7 +199,7 @@ public class LoadDialog extends FloatingDialog{
|
|||||||
Log.err(e);
|
Log.err(e);
|
||||||
state.set(State.menu);
|
state.set(State.menu);
|
||||||
logic.reset();
|
logic.reset();
|
||||||
ui.showError("$save.corrupted");
|
ui.showErrorMessage("$save.corrupted");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
maps.tryCatchMapError(() -> {
|
maps.tryCatchMapError(() -> {
|
||||||
if(MapIO.isImage(file)){
|
if(MapIO.isImage(file)){
|
||||||
ui.showError("$editor.errorimage");
|
ui.showErrorMessage("$editor.errorimage");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
|
|
||||||
//this will never actually get called, but it remains just in case
|
//this will never actually get called, but it remains just in case
|
||||||
if(name == null){
|
if(name == null){
|
||||||
ui.showError("$editor.errorname");
|
ui.showErrorMessage("$editor.errorname");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
hide();
|
hide();
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ui.showError("$error.mapnotfound");
|
ui.showErrorMessage("$error.mapnotfound");
|
||||||
}
|
}
|
||||||
}).fillX().height(54f).marginLeft(10);
|
}).fillX().height(54f).marginLeft(10);
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,6 @@ public class MinimapDialog extends FloatingDialog{
|
|||||||
onResize(this::setup);
|
onResize(this::setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBackground(float x, float y){
|
|
||||||
drawDefaultBackground(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup(){
|
void setup(){
|
||||||
cont.clearChildren();
|
cont.clearChildren();
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
package io.anuke.mindustry.ui.dialogs;
|
||||||
|
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.net.Net;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -123,7 +122,7 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
control.saves.getCurrent().save();
|
control.saves.getCurrent().save();
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ui.showError("[accent]" + Core.bundle.get("savefail"));
|
ui.showException("[accent]" + Core.bundle.get("savefail"), e);
|
||||||
}
|
}
|
||||||
state.set(State.menu);
|
state.set(State.menu);
|
||||||
logic.reset();
|
logic.reset();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class SaveDialog extends LoadDialog{
|
|||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
ui.showError("[accent]" + Core.bundle.get("savefail"));
|
ui.showException("[accent]" + Core.bundle.get("savefail"), e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import io.anuke.arc.util.*;
|
|||||||
import io.anuke.mindustry.core.GameState.*;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.gen.*;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.net.Net;
|
|
||||||
|
|
||||||
import static io.anuke.arc.Core.bundle;
|
import static io.anuke.arc.Core.bundle;
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
@@ -108,7 +107,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
try{
|
try{
|
||||||
data.exportData(file);
|
data.exportData(file);
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
ui.showError(Strings.parseException(e, true));
|
ui.showException(e);
|
||||||
}
|
}
|
||||||
platform.shareFile(file);
|
platform.shareFile(file);
|
||||||
}else{
|
}else{
|
||||||
@@ -118,7 +117,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
ui.showInfo("$data.exported");
|
ui.showInfo("$data.exported");
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ui.showError(Strings.parseException(e, true));
|
ui.showException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -133,13 +132,13 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
data.importData(file);
|
data.importData(file);
|
||||||
Core.app.exit();
|
Core.app.exit();
|
||||||
}catch(IllegalArgumentException e){
|
}catch(IllegalArgumentException e){
|
||||||
ui.showError("$data.invalid");
|
ui.showErrorMessage("$data.invalid");
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if(e.getMessage() == null || !e.getMessage().contains("too short")){
|
if(e.getMessage() == null || !e.getMessage().contains("too short")){
|
||||||
ui.showError(Strings.parseException(e, true));
|
ui.showException(e);
|
||||||
}else{
|
}else{
|
||||||
ui.showError("$data.invalid");
|
ui.showErrorMessage("$data.invalid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})));
|
})));
|
||||||
@@ -215,9 +214,11 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
game.checkPref("savecreate", true);
|
game.checkPref("savecreate", true);
|
||||||
|
|
||||||
game.checkPref("publichost", false, i -> {
|
if(steam){
|
||||||
platform.updateLobby();
|
game.checkPref("publichost", false, i -> {
|
||||||
});
|
platform.updateLobby();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
game.pref(new Setting(){
|
game.pref(new Setting(){
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -53,11 +53,6 @@ public class TechTreeDialog extends FloatingDialog{
|
|||||||
}).size(210f, 64f);
|
}).size(210f, 64f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawBackground(float x, float y){
|
|
||||||
drawDefaultBackground(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void treeLayout(){
|
void treeLayout(){
|
||||||
TreeLayout layout = new TreeLayout();
|
TreeLayout layout = new TreeLayout();
|
||||||
layout.gapBetweenLevels = UnitScl.dp.scl(60f);
|
layout.gapBetweenLevels = UnitScl.dp.scl(60f);
|
||||||
|
|||||||
@@ -24,11 +24,6 @@ public class ZoneInfoDialog extends FloatingDialog{
|
|||||||
addCloseButton();
|
addCloseButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawBackground(float x, float y){
|
|
||||||
drawDefaultBackground(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show(Zone zone){
|
public void show(Zone zone){
|
||||||
setup(zone);
|
setup(zone);
|
||||||
show();
|
show();
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class BlockInventoryFragment extends Fragment{
|
|||||||
|
|
||||||
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
@Remote(called = Loc.server, targets = Loc.both, forward = true)
|
||||||
public static void requestItem(Player player, Tile tile, Item item, int amount){
|
public static void requestItem(Player player, Tile tile, Item item, int amount){
|
||||||
if(player == null || tile == null || !player.timer.get(Player.timerTransfer, 20)) return;
|
if(player == null || tile == null || !player.timer.get(Player.timerTransfer, 20) || !tile.interactable(player.getTeam())) return;
|
||||||
|
|
||||||
int removed = tile.block().removeStack(tile, item, amount);
|
int removed = tile.block().removeStack(tile, item, amount);
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,24 @@
|
|||||||
package io.anuke.mindustry.world.blocks.distribution;
|
package io.anuke.mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import io.anuke.annotations.Annotations.Loc;
|
import io.anuke.annotations.Annotations.*;
|
||||||
import io.anuke.annotations.Annotations.Remote;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.collection.IntArray;
|
import io.anuke.arc.collection.IntSet.*;
|
||||||
import io.anuke.arc.collection.IntSet;
|
import io.anuke.arc.graphics.*;
|
||||||
import io.anuke.arc.collection.IntSet.IntSetIterator;
|
|
||||||
import io.anuke.arc.graphics.Color;
|
|
||||||
import io.anuke.arc.graphics.g2d.*;
|
import io.anuke.arc.graphics.g2d.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.geom.Geometry;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.entities.type.Player;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.gen.*;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.graphics.Pal;
|
|
||||||
import io.anuke.mindustry.type.Item;
|
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.meta.BlockGroup;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
import static io.anuke.mindustry.Vars.world;
|
|
||||||
|
|
||||||
public class ItemBridge extends Block{
|
public class ItemBridge extends Block{
|
||||||
protected int timerTransport = timers++;
|
protected int timerTransport = timers++;
|
||||||
@@ -270,6 +265,52 @@ public class ItemBridge extends Block{
|
|||||||
return tile.entity.items.total() < itemCapacity;
|
return tile.entity.items.total() < itemCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
||||||
|
ItemBridgeEntity entity = tile.entity();
|
||||||
|
|
||||||
|
Tile other = world.tile(entity.link);
|
||||||
|
if(!linkValid(tile, other)){
|
||||||
|
Tile edge = Edges.getFacingEdge(to, tile);
|
||||||
|
int i = tile.absoluteRelativeTo(edge.x, edge.y);
|
||||||
|
|
||||||
|
IntSetIterator it = entity.incoming.iterator();
|
||||||
|
|
||||||
|
while(it.hasNext){
|
||||||
|
int v = it.next();
|
||||||
|
if(tile.absoluteRelativeTo(Pos.x(v), Pos.y(v)) == i){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rel = tile.absoluteRelativeTo(other.x, other.y);
|
||||||
|
int rel2 = tile.relativeTo(to.x, to.y);
|
||||||
|
|
||||||
|
return rel != rel2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||||
|
if(tile.getTeam() != source.getTeam()) return false;
|
||||||
|
|
||||||
|
ItemBridgeEntity entity = tile.entity();
|
||||||
|
Tile other = world.tile(entity.link);
|
||||||
|
|
||||||
|
if(linkValid(tile, other)){
|
||||||
|
int rel = tile.absoluteRelativeTo(other.x, other.y);
|
||||||
|
int rel2 = tile.relativeTo(source.x, source.y);
|
||||||
|
|
||||||
|
if(rel == rel2) return false;
|
||||||
|
}else if(!(source.block() instanceof ItemBridge && source.<ItemBridgeEntity>entity().link == tile.pos())){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDump(Tile tile, Tile to, Item item){
|
public boolean canDump(Tile tile, Tile to, Item item){
|
||||||
ItemBridgeEntity entity = tile.entity();
|
ItemBridgeEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package io.anuke.mindustry.world.blocks.distribution;
|
package io.anuke.mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import io.anuke.arc.collection.IntSet.IntSetIterator;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Item;
|
|
||||||
import io.anuke.mindustry.type.Liquid;
|
|
||||||
import io.anuke.mindustry.world.*;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.world.meta.BlockGroup;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
@@ -56,49 +54,4 @@ public class LiquidBridge extends ItemBridge{
|
|||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
|
||||||
if(tile.getTeam() != source.getTeam()) return false;
|
|
||||||
|
|
||||||
ItemBridgeEntity entity = tile.entity();
|
|
||||||
Tile other = world.tile(entity.link);
|
|
||||||
|
|
||||||
if(linkValid(tile, other)){
|
|
||||||
int rel = tile.absoluteRelativeTo(other.x, other.y);
|
|
||||||
int rel2 = tile.relativeTo(source.x, source.y);
|
|
||||||
|
|
||||||
if(rel == rel2) return false;
|
|
||||||
}else if(!(source.block() instanceof ItemBridge && source.<ItemBridgeEntity>entity().link == tile.pos())){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
|
||||||
ItemBridgeEntity entity = tile.entity();
|
|
||||||
|
|
||||||
Tile other = world.tile(entity.link);
|
|
||||||
if(!linkValid(tile, other)){
|
|
||||||
Tile edge = Edges.getFacingEdge(to, tile);
|
|
||||||
int i = tile.absoluteRelativeTo(edge.x, edge.y);
|
|
||||||
|
|
||||||
IntSetIterator it = entity.incoming.iterator();
|
|
||||||
|
|
||||||
while(it.hasNext){
|
|
||||||
int v = it.next();
|
|
||||||
if(tile.absoluteRelativeTo(Pos.x(v), Pos.y(v)) == i){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rel = tile.absoluteRelativeTo(other.x, other.y);
|
|
||||||
int rel2 = tile.relativeTo(to.x, to.y);
|
|
||||||
|
|
||||||
return rel != rel2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package io.anuke.mindustry.world.blocks.distribution;
|
package io.anuke.mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import io.anuke.arc.collection.IntSet.IntSetIterator;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.Time;
|
import io.anuke.mindustry.type.*;
|
||||||
import io.anuke.mindustry.type.Item;
|
import io.anuke.mindustry.world.*;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.world.meta.*;
|
||||||
import io.anuke.mindustry.world.Pos;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import io.anuke.mindustry.world.meta.BlockGroup;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
@@ -53,34 +50,4 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
|||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
|
||||||
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
|
||||||
ItemBridgeEntity entity = tile.entity();
|
|
||||||
|
|
||||||
Tile other = world.tile(entity.link);
|
|
||||||
if(!linkValid(tile, other)){
|
|
||||||
int i = tile.absoluteRelativeTo(to.x, to.y);
|
|
||||||
|
|
||||||
IntSetIterator it = entity.incoming.iterator();
|
|
||||||
|
|
||||||
while(it.hasNext){
|
|
||||||
int v = it.next();
|
|
||||||
if(tile.absoluteRelativeTo(Pos.x(v), Pos.y(v)) == i){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int rel = tile.absoluteRelativeTo(other.x, other.y);
|
|
||||||
int rel2 = tile.relativeTo(to.x, to.y);
|
|
||||||
|
|
||||||
return rel != rel2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import io.anuke.mindustry.core.GameState.*;
|
|||||||
import io.anuke.mindustry.desktop.steam.*;
|
import io.anuke.mindustry.desktop.steam.*;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.game.Version;
|
import io.anuke.mindustry.game.Version;
|
||||||
|
import io.anuke.mindustry.maps.Map;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.net.Net.*;
|
import io.anuke.mindustry.net.Net.*;
|
||||||
|
|
||||||
@@ -29,10 +30,9 @@ import static io.anuke.mindustry.Vars.*;
|
|||||||
|
|
||||||
|
|
||||||
public class DesktopLauncher extends ClientLauncher{
|
public class DesktopLauncher extends ClientLauncher{
|
||||||
private final static String applicationId = "610508934456934412";
|
public final static String discordID = "610508934456934412";
|
||||||
|
|
||||||
boolean useDiscord = OS.is64Bit, showConsole = true;
|
boolean useDiscord = OS.is64Bit, showConsole = true;
|
||||||
SteamCoreNetImpl steamCore;
|
|
||||||
|
|
||||||
public static void main(String[] arg){
|
public static void main(String[] arg){
|
||||||
try{
|
try{
|
||||||
@@ -58,7 +58,7 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
if(useDiscord){
|
if(useDiscord){
|
||||||
try{
|
try{
|
||||||
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
DiscordEventHandlers handlers = new DiscordEventHandlers();
|
||||||
DiscordRPC.INSTANCE.Discord_Initialize(applicationId, handlers, true, "1127400");
|
DiscordRPC.INSTANCE.Discord_Initialize(discordID, handlers, true, "1127400");
|
||||||
Log.info("Initialized Discord rich presence.");
|
Log.info("Initialized Discord rich presence.");
|
||||||
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown));
|
Runtime.getRuntime().addShutdownHook(new Thread(DiscordRPC.INSTANCE::Discord_Shutdown));
|
||||||
@@ -111,21 +111,8 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
Log.err("Steam client not running.");
|
Log.err("Steam client not running.");
|
||||||
}else{
|
}else{
|
||||||
Vars.steam = true;
|
Vars.steam = true;
|
||||||
steamCore = new SteamCoreNetImpl(new ArcNetImpl());
|
initSteam();
|
||||||
Events.on(ClientLoadEvent.class, event -> {
|
|
||||||
Core.settings.defaults("name", steamCore.friends.getPersonaName());
|
|
||||||
//update callbacks
|
|
||||||
Core.app.addListener(new ApplicationListener(){
|
|
||||||
@Override
|
|
||||||
public void update(){
|
|
||||||
if(SteamAPI.isSteamRunning()){
|
|
||||||
SteamAPI.runCallbacks();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//steam shutdown hook
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(SteamAPI::shutdown));
|
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
}catch(Exception e){
|
||||||
Log.err("Failed to load Steam native libraries.");
|
Log.err("Failed to load Steam native libraries.");
|
||||||
@@ -134,6 +121,27 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initSteam(){
|
||||||
|
SVars.net = new SNet(new ArcNetImpl());
|
||||||
|
SVars.stats = new SStats();
|
||||||
|
SVars.workshop = new SWorkshop();
|
||||||
|
|
||||||
|
Events.on(ClientLoadEvent.class, event -> {
|
||||||
|
Core.settings.defaults("name", SVars.net.friends.getPersonaName());
|
||||||
|
//update callbacks
|
||||||
|
Core.app.addListener(new ApplicationListener(){
|
||||||
|
@Override
|
||||||
|
public void update(){
|
||||||
|
if(SteamAPI.isSteamRunning()){
|
||||||
|
SteamAPI.runCallbacks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//steam shutdown hook
|
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(SteamAPI::shutdown));
|
||||||
|
}
|
||||||
|
|
||||||
static void handleCrash(Throwable e){
|
static void handleCrash(Throwable e){
|
||||||
Consumer<Runnable> dialog = Runnable::run;
|
Consumer<Runnable> dialog = Runnable::run;
|
||||||
boolean badGPU = false;
|
boolean badGPU = false;
|
||||||
@@ -159,12 +167,22 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetProvider getNet(){
|
public NetProvider getNet(){
|
||||||
return steam ? steamCore : new ArcNetImpl();
|
return steam ? SVars.net : new ArcNetImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void publishMap(Map map){
|
||||||
|
SVars.workshop.publishMap(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void inviteFriends(){
|
||||||
|
SVars.net.showFriendInvites();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLobby(){
|
public void updateLobby(){
|
||||||
steamCore.updateLobby();
|
SVars.net.updateLobby();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package io.anuke.mindustry.desktop.steam;
|
||||||
|
|
||||||
|
import io.anuke.arc.function.*;
|
||||||
|
|
||||||
|
public enum SAchievement{
|
||||||
|
;
|
||||||
|
|
||||||
|
private final BooleanProvider completed;
|
||||||
|
|
||||||
|
public static final SAchievement[] all = values();
|
||||||
|
|
||||||
|
SAchievement(BooleanProvider completed){
|
||||||
|
this.completed = completed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creates an achievement that is triggered when this stat reaches a number.*/
|
||||||
|
SAchievement(SStat stat, int required){
|
||||||
|
this(() -> stat.get() >= required);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkCompletion(){
|
||||||
|
if(!achieved() && conditionsMet()){
|
||||||
|
SVars.stats.stats.setAchievement(name());
|
||||||
|
SVars.stats.stats.storeStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean achieved(){
|
||||||
|
return SVars.stats.stats.isAchieved(name(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean conditionsMet(){
|
||||||
|
return completed.get();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@ import java.util.concurrent.*;
|
|||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
public class SteamCoreNetImpl implements SteamNetworkingCallback, SteamMatchmakingCallback, SteamFriendsCallback, NetProvider{
|
public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback, SteamFriendsCallback, NetProvider{
|
||||||
public final SteamNetworking snet = new SteamNetworking(this);
|
public final SteamNetworking snet = new SteamNetworking(this);
|
||||||
public final SteamMatchmaking smat = new SteamMatchmaking(this);
|
public final SteamMatchmaking smat = new SteamMatchmaking(this);
|
||||||
public final SteamFriends friends = new SteamFriends(this);
|
public final SteamFriends friends = new SteamFriends(this);
|
||||||
@@ -43,7 +43,7 @@ public class SteamCoreNetImpl implements SteamNetworkingCallback, SteamMatchmaki
|
|||||||
Consumer<Host> lobbyCallback;
|
Consumer<Host> lobbyCallback;
|
||||||
Runnable lobbyDoneCallback, joinCallback;
|
Runnable lobbyDoneCallback, joinCallback;
|
||||||
|
|
||||||
public SteamCoreNetImpl(NetProvider provider){
|
public SNet(NetProvider provider){
|
||||||
this.provider = provider;
|
this.provider = provider;
|
||||||
|
|
||||||
Events.on(ClientLoadEvent.class, e -> Core.app.addListener(new ApplicationListener(){
|
Events.on(ClientLoadEvent.class, e -> Core.app.addListener(new ApplicationListener(){
|
||||||
@@ -324,7 +324,11 @@ public class SteamCoreNetImpl implements SteamNetworkingCallback, SteamMatchmaki
|
|||||||
smat.setLobbyData(steamID, "versionType", Version.type);
|
smat.setLobbyData(steamID, "versionType", Version.type);
|
||||||
smat.setLobbyData(steamID, "wave", state.wave + "");
|
smat.setLobbyData(steamID, "wave", state.wave + "");
|
||||||
smat.setLobbyData(steamID, "gamemode", Gamemode.bestFit(state.rules) + "");
|
smat.setLobbyData(steamID, "gamemode", Gamemode.bestFit(state.rules) + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showFriendInvites(){
|
||||||
|
if(currentLobby != null){
|
||||||
friends.activateGameOverlayInviteDialog(currentLobby);
|
friends.activateGameOverlayInviteDialog(currentLobby);
|
||||||
Log.info("Activating overlay dialog");
|
Log.info("Activating overlay dialog");
|
||||||
}
|
}
|
||||||
22
desktop/src/io/anuke/mindustry/desktop/steam/SStat.java
Normal file
22
desktop/src/io/anuke/mindustry/desktop/steam/SStat.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package io.anuke.mindustry.desktop.steam;
|
||||||
|
|
||||||
|
public enum SStat{
|
||||||
|
unitsDestroyed;
|
||||||
|
|
||||||
|
public int get(){
|
||||||
|
return SVars.stats.stats.getStatI(name(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(int amount){
|
||||||
|
SVars.stats.stats.setStatI(name(), get() + amount);
|
||||||
|
SVars.stats.onUpdate();
|
||||||
|
|
||||||
|
for(SAchievement a : SAchievement.all){
|
||||||
|
a.checkCompletion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(){
|
||||||
|
add(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
67
desktop/src/io/anuke/mindustry/desktop/steam/SStats.java
Normal file
67
desktop/src/io/anuke/mindustry/desktop/steam/SStats.java
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package io.anuke.mindustry.desktop.steam;
|
||||||
|
|
||||||
|
import com.codedisaster.steamworks.*;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
|
||||||
|
public class SStats implements SteamUserStatsCallback{
|
||||||
|
public final SteamUserStats stats = new SteamUserStats(this);
|
||||||
|
|
||||||
|
//todo store stats periodically
|
||||||
|
private boolean updated = false;
|
||||||
|
|
||||||
|
public SStats(){
|
||||||
|
stats.requestCurrentStats();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onUpdate(){
|
||||||
|
this.updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerEvents(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserStatsReceived(long gameID, SteamID steamID, SteamResult result){
|
||||||
|
if(result == SteamResult.OK){
|
||||||
|
registerEvents();
|
||||||
|
}else{
|
||||||
|
Log.err("Failed to recieve steam stats: {0}", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserStatsStored(long l, SteamResult steamResult){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserStatsUnloaded(SteamID steamID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserAchievementStored(long l, boolean b, String s, int i, int i1){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLeaderboardFindResult(SteamLeaderboardHandle steamLeaderboardHandle, boolean b){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLeaderboardScoresDownloaded(SteamLeaderboardHandle steamLeaderboardHandle, SteamLeaderboardEntriesHandle steamLeaderboardEntriesHandle, int i){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLeaderboardScoreUploaded(boolean b, SteamLeaderboardHandle steamLeaderboardHandle, int i, boolean b1, int i1, int i2){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGlobalStatsReceived(long l, SteamResult steamResult){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
9
desktop/src/io/anuke/mindustry/desktop/steam/SVars.java
Normal file
9
desktop/src/io/anuke/mindustry/desktop/steam/SVars.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package io.anuke.mindustry.desktop.steam;
|
||||||
|
|
||||||
|
public class SVars{
|
||||||
|
public final static int steamID = 1127400;
|
||||||
|
|
||||||
|
public static SNet net;
|
||||||
|
public static SStats stats;
|
||||||
|
public static SWorkshop workshop;
|
||||||
|
}
|
||||||
@@ -4,16 +4,15 @@ import com.codedisaster.steamworks.*;
|
|||||||
import com.codedisaster.steamworks.SteamRemoteStorage.*;
|
import com.codedisaster.steamworks.SteamRemoteStorage.*;
|
||||||
import io.anuke.mindustry.maps.*;
|
import io.anuke.mindustry.maps.*;
|
||||||
|
|
||||||
public class WorkshopImpl implements SteamUGCCallback{
|
public class SWorkshop implements SteamUGCCallback{
|
||||||
private SteamUGC ugc = new SteamUGC(this);
|
public final SteamUGC ugc = new SteamUGC(this);
|
||||||
|
|
||||||
public void publishMap(Map map){
|
public void publishMap(Map map){
|
||||||
ugc.createItem(1127400, WorkshopFileType.GameManagedItem);
|
ugc.createItem(SVars.steamID, WorkshopFileType.GameManagedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUGCQueryCompleted(SteamUGCQuery query, int numResultsReturned, int totalMatchingResults, boolean isCachedData, SteamResult result){
|
public void onUGCQueryCompleted(SteamUGCQuery query, int numResultsReturned, int totalMatchingResults, boolean isCachedData, SteamResult result){
|
||||||
//ugc.submitItemUpdate()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,6 +34,12 @@ public class WorkshopImpl implements SteamUGCCallback{
|
|||||||
@Override
|
@Override
|
||||||
public void onCreateItem(SteamPublishedFileID publishedFileID, boolean needsToAcceptWLA, SteamResult result){
|
public void onCreateItem(SteamPublishedFileID publishedFileID, boolean needsToAcceptWLA, SteamResult result){
|
||||||
//TODO
|
//TODO
|
||||||
|
if(result == SteamResult.OK){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//TODO show "failed to create" dialog
|
||||||
|
//ui.showError("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Reference in New Issue
Block a user