Fixed build errors
This commit is contained in:
@@ -27,7 +27,18 @@ import static io.anuke.mindustry.Vars.control;
|
|||||||
import static io.anuke.ucore.scene.actions.Actions.*;
|
import static io.anuke.ucore.scene.actions.Actions.*;
|
||||||
|
|
||||||
public class UI extends SceneModule{
|
public class UI extends SceneModule{
|
||||||
public Dialog about, restart, levels, upgrades, load, discord, join, menu, prefs, keys, editor, host;
|
public AboutDialog about;
|
||||||
|
public RestartDialog restart;
|
||||||
|
public LevelDialog levels;
|
||||||
|
public LoadDialog load;
|
||||||
|
public DiscordDialog discord;
|
||||||
|
public JoinDialog join;
|
||||||
|
public HostDialog host;
|
||||||
|
public MenuDialog menu;
|
||||||
|
public SettingsMenuDialog settings;
|
||||||
|
public ControlsDialog controls;
|
||||||
|
public MapEditorDialog editor;
|
||||||
|
public UpgradeDialog upgrades;
|
||||||
|
|
||||||
public final MenuFragment menufrag = new MenuFragment();
|
public final MenuFragment menufrag = new MenuFragment();
|
||||||
public final ToolFragment toolfrag = new ToolFragment();
|
public final ToolFragment toolfrag = new ToolFragment();
|
||||||
@@ -118,19 +129,16 @@ public class UI extends SceneModule{
|
|||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void init(){
|
||||||
|
|
||||||
if(!Vars.gwt){
|
editor = new MapEditorDialog();
|
||||||
editor = new MapEditorDialog();
|
controls = new ControlsDialog();
|
||||||
}
|
|
||||||
|
|
||||||
restart = new RestartDialog();
|
restart = new RestartDialog();
|
||||||
join = new JoinDialog();
|
join = new JoinDialog();
|
||||||
discord = new DiscordDialog();
|
discord = new DiscordDialog();
|
||||||
load = new LoadDialog();
|
load = new LoadDialog();
|
||||||
upgrades = new UpgradeDialog();
|
upgrades = new UpgradeDialog();
|
||||||
levels = new LevelDialog();
|
levels = new LevelDialog();
|
||||||
prefs = new SettingsMenuDialog();
|
settings = new SettingsMenuDialog();
|
||||||
menu = new MenuDialog();
|
menu = new MenuDialog();
|
||||||
keys = new ControlsDialog();
|
|
||||||
about = new AboutDialog();
|
about = new AboutDialog();
|
||||||
host = new HostDialog();
|
host = new HostDialog();
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
endx = Gdx.input.getX();
|
endx = Gdx.input.getX();
|
||||||
endy = Gdx.input.getY();
|
endy = Gdx.input.getY();
|
||||||
|
|
||||||
if(Inputs.getAxisActive("zoom") && Inputs.keyDown("zoom_hold") && !GameState.is(State.menu) && !ui.onDialog()){
|
if(Inputs.getAxisActive("zoom") && Inputs.keyDown("zoom_hold") && !GameState.is(State.menu) && !ui.hasDialog()){
|
||||||
renderer.scaleCamera((int)Inputs.getAxis("zoom"));
|
renderer.scaleCamera((int)Inputs.getAxis("zoom"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public enum PlaceMode{
|
|||||||
endx = this.endx; endy = this.endy;
|
endx = this.endx; endy = this.endy;
|
||||||
|
|
||||||
if(Vars.android){
|
if(Vars.android){
|
||||||
ToolFragment t = Vars.ui.getTools();
|
ToolFragment t = Vars.ui.toolfrag;
|
||||||
if(!t.confirming || t.px != tilex || t.py != tiley || t.px2 != endx || t.py2 != endy) {
|
if(!t.confirming || t.px != tilex || t.py != tiley || t.px2 != endx || t.py2 != endy) {
|
||||||
t.confirming = true;
|
t.confirming = true;
|
||||||
t.px = tilex;
|
t.px = tilex;
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ import io.anuke.mindustry.world.Map;
|
|||||||
import io.anuke.ucore.core.Inputs.DeviceType;
|
import io.anuke.ucore.core.Inputs.DeviceType;
|
||||||
import io.anuke.ucore.core.KeyBinds;
|
import io.anuke.ucore.core.KeyBinds;
|
||||||
import io.anuke.ucore.core.KeyBinds.Keybind;
|
import io.anuke.ucore.core.KeyBinds.Keybind;
|
||||||
import io.anuke.ucore.scene.ui.SettingsDialog.SettingsTable.Setting;
|
|
||||||
import io.anuke.ucore.util.Bundles;
|
import io.anuke.ucore.util.Bundles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
|
||||||
|
|
||||||
public class BundleGen {
|
public class BundleGen {
|
||||||
private static FileHandle file;
|
private static FileHandle file;
|
||||||
@@ -27,12 +25,12 @@ public class BundleGen {
|
|||||||
file.writeString("", false);
|
file.writeString("", false);
|
||||||
write("about.text=" + join(Vars.aboutText));
|
write("about.text=" + join(Vars.aboutText));
|
||||||
write("discord.text=Join the mindustry discord!\n[orange]");
|
write("discord.text=Join the mindustry discord!\n[orange]");
|
||||||
|
/*
|
||||||
Mathf.each(table -> {
|
Mathf.each(table -> {
|
||||||
for(Setting setting : table.getSettings()){
|
for(Setting setting : table.getSettings()){
|
||||||
write("setting." + setting.name + ".name=" + setting.title);
|
write("setting." + setting.name + ".name=" + setting.title);
|
||||||
}
|
}
|
||||||
}, Vars.ui.getPrefs().game, Vars.ui.getPrefs().graphics, Vars.ui.getPrefs().sound);
|
}, Vars.ui.getPrefs().game, Vars.ui.getPrefs().graphics, Vars.ui.getPrefs().sound);*/
|
||||||
|
|
||||||
for(Map map : Vars.world.maps().list()){
|
for(Map map : Vars.world.maps().list()){
|
||||||
write("map." + map.name + ".name=" + map.name);
|
write("map." + map.name + ".name=" + map.name);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class Maps implements Disposable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
saveCustomMap(map);
|
saveCustomMap(map);
|
||||||
Vars.ui.reloadLevels();
|
Vars.ui.levels.reload();
|
||||||
//TODO reload map dialog
|
//TODO reload map dialog
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public class NetworkIO {
|
|||||||
Vars.control.getItems()[i] = stream.readInt();
|
Vars.control.getItems()[i] = stream.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vars.ui.updateItems();
|
Vars.ui.hudfrag.updateItems();
|
||||||
|
|
||||||
//enemies
|
//enemies
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class Save12 extends SaveFileVersion {
|
|||||||
Vars.control.addWeapon(Weapon.values()[stream.readByte()]);
|
Vars.control.addWeapon(Weapon.values()[stream.readByte()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vars.ui.updateWeapons();
|
Vars.ui.weaponfrag.updateWeapons();
|
||||||
|
|
||||||
//inventory
|
//inventory
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ public class Save12 extends SaveFileVersion {
|
|||||||
Vars.control.getItems()[item.id] = amount;
|
Vars.control.getItems()[item.id] = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vars.ui.updateItems();
|
Vars.ui.hudfrag.updateItems();
|
||||||
|
|
||||||
//enemies
|
//enemies
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class Save14 extends SaveFileVersion{
|
|||||||
Vars.control.addWeapon(Weapon.values()[stream.readByte()]);
|
Vars.control.addWeapon(Weapon.values()[stream.readByte()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vars.ui.updateWeapons();
|
Vars.ui.weaponfrag.updateWeapons();
|
||||||
|
|
||||||
//inventory
|
//inventory
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public class Save14 extends SaveFileVersion{
|
|||||||
Vars.control.getItems()[item.id] = amount;
|
Vars.control.getItems()[item.id] = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vars.ui.updateItems();
|
Vars.ui.hudfrag.updateItems();
|
||||||
|
|
||||||
//enemies
|
//enemies
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package io.anuke.mindustry.mapeditor;
|
package io.anuke.mindustry.mapeditor;
|
||||||
|
|
||||||
import java.util.Stack;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
import com.badlogic.gdx.math.GridPoint2;
|
import com.badlogic.gdx.math.GridPoint2;
|
||||||
import com.badlogic.gdx.utils.IntSet;
|
import com.badlogic.gdx.utils.IntSet;
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.ColorMapper;
|
import io.anuke.mindustry.world.ColorMapper;
|
||||||
import io.anuke.mindustry.world.ColorMapper.BlockPair;
|
import io.anuke.mindustry.world.ColorMapper.BlockPair;
|
||||||
|
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
public enum EditorTool{
|
public enum EditorTool{
|
||||||
pick{
|
pick{
|
||||||
public void touched(MapEditor editor, int x, int y){
|
public void touched(MapEditor editor, int x, int y){
|
||||||
@@ -18,7 +17,7 @@ public enum EditorTool{
|
|||||||
if(pair == null) return;
|
if(pair == null) return;
|
||||||
Block block = pair.dominant();
|
Block block = pair.dominant();
|
||||||
editor.setDrawBlock(block);
|
editor.setDrawBlock(block);
|
||||||
Vars.ui.getEditorDialog().updateSelectedBlock();
|
Vars.ui.editor.updateSelectedBlock();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pencil{
|
pencil{
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ public class MapEditorDialog extends Dialog{
|
|||||||
|
|
||||||
public MapEditorDialog(){
|
public MapEditorDialog(){
|
||||||
super("$text.mapeditor", "dialog");
|
super("$text.mapeditor", "dialog");
|
||||||
|
if(Vars.gwt) return;
|
||||||
|
|
||||||
editor = new MapEditor();
|
editor = new MapEditor();
|
||||||
dialog = new MapGenerateDialog(editor);
|
dialog = new MapGenerateDialog(editor);
|
||||||
view = new MapView(editor);
|
view = new MapView(editor);
|
||||||
|
|||||||
@@ -71,14 +71,14 @@ public class MapGenerateDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
buttons().addButton("$text.update", this::apply);
|
buttons().addButton("$text.update", this::apply);
|
||||||
buttons().addButton("$text.apply", () ->{
|
buttons().addButton("$text.apply", () ->{
|
||||||
Vars.ui.showLoading();
|
Vars.ui.loadfrag.show();
|
||||||
|
|
||||||
Timers.run(3f, () ->{
|
Timers.run(3f, () ->{
|
||||||
Pixmap copy = Pixmaps.copy(editor.pixmap());
|
Pixmap copy = Pixmaps.copy(editor.pixmap());
|
||||||
editor.applyFilter();
|
editor.applyFilter();
|
||||||
Vars.ui.getEditorDialog().getView().push(copy, Pixmaps.copy(editor.pixmap()));
|
Vars.ui.editor.getView().push(copy, Pixmaps.copy(editor.pixmap()));
|
||||||
Vars.ui.hideLoading();
|
Vars.ui.loadfrag.hide();
|
||||||
Vars.ui.getEditorDialog().resetSaved();
|
Vars.ui.editor.resetSaved();
|
||||||
hide();
|
hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry.mapeditor;
|
package io.anuke.mindustry.mapeditor;
|
||||||
|
|
||||||
import com.badlogic.gdx.Input;
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Colors;
|
import com.badlogic.gdx.graphics.Colors;
|
||||||
import com.badlogic.gdx.graphics.Pixmap;
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
@@ -12,12 +11,13 @@ import com.badlogic.gdx.math.GridPoint2;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
|
import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.ui.GridImage;
|
import io.anuke.mindustry.ui.GridImage;
|
||||||
import io.anuke.mindustry.world.ColorMapper;
|
import io.anuke.mindustry.world.ColorMapper;
|
||||||
import io.anuke.ucore.UCore;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.*;
|
import io.anuke.ucore.core.Draw;
|
||||||
|
import io.anuke.ucore.core.Graphics;
|
||||||
|
import io.anuke.ucore.core.Inputs;
|
||||||
import io.anuke.ucore.graphics.Pixmaps;
|
import io.anuke.ucore.graphics.Pixmaps;
|
||||||
import io.anuke.ucore.scene.Element;
|
import io.anuke.ucore.scene.Element;
|
||||||
import io.anuke.ucore.scene.event.InputEvent;
|
import io.anuke.ucore.scene.event.InputEvent;
|
||||||
@@ -115,7 +115,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
|
|
||||||
if(tool.edit){
|
if(tool.edit){
|
||||||
updated = true;
|
updated = true;
|
||||||
Vars.ui.getEditorDialog().resetSaved();
|
Vars.ui.editor.resetSaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
op = new DrawOperation(editor.pixmap());
|
op = new DrawOperation(editor.pixmap());
|
||||||
@@ -131,7 +131,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
GridPoint2 p = project(x, y);
|
GridPoint2 p = project(x, y);
|
||||||
|
|
||||||
if(tool == EditorTool.line){
|
if(tool == EditorTool.line){
|
||||||
Vars.ui.getEditorDialog().resetSaved();
|
Vars.ui.editor.resetSaved();
|
||||||
Array<GridPoint2> points = br.line(startx, starty, p.x, p.y);
|
Array<GridPoint2> points = br.line(startx, starty, p.x, p.y);
|
||||||
for(GridPoint2 point : points){
|
for(GridPoint2 point : points){
|
||||||
editor.draw(point.x, point.y);
|
editor.draw(point.x, point.y);
|
||||||
@@ -154,7 +154,7 @@ public class MapView extends Element implements GestureListener{
|
|||||||
GridPoint2 p = project(x, y);
|
GridPoint2 p = project(x, y);
|
||||||
|
|
||||||
if(drawing && tool == EditorTool.pencil){
|
if(drawing && tool == EditorTool.pencil){
|
||||||
Vars.ui.getEditorDialog().resetSaved();
|
Vars.ui.editor.resetSaved();
|
||||||
Array<GridPoint2> points = br.line(lastx, lasty, p.x, p.y);
|
Array<GridPoint2> points = br.line(lastx, lasty, p.x, p.y);
|
||||||
for(GridPoint2 point : points){
|
for(GridPoint2 point : points){
|
||||||
editor.draw(point.x, point.y);
|
editor.draw(point.x, point.y);
|
||||||
@@ -255,8 +255,8 @@ public class MapView extends Element implements GestureListener{
|
|||||||
|
|
||||||
private boolean active(){
|
private boolean active(){
|
||||||
return Core.scene.getKeyboardFocus() != null
|
return Core.scene.getKeyboardFocus() != null
|
||||||
&& Core.scene.getKeyboardFocus().isDescendantOf(Vars.ui.getEditorDialog())
|
&& Core.scene.getKeyboardFocus().isDescendantOf(Vars.ui.editor)
|
||||||
&& Vars.ui.isEditing() && tool == EditorTool.zoom &&
|
&& Vars.ui.editor.isShown() && tool == EditorTool.zoom &&
|
||||||
Core.scene.hit(Graphics.mouse().x, Graphics.mouse().y, true) == this;
|
Core.scene.hit(Graphics.mouse().x, Graphics.mouse().y, true) == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
content().row();
|
content().row();
|
||||||
content().addButton("$text.settings", ui.prefs::show);
|
content().addButton("$text.settings", ui.settings::show);
|
||||||
|
|
||||||
content().row();
|
content().row();
|
||||||
content().addButton("$text.savegame", () -> {
|
content().addButton("$text.savegame", () -> {
|
||||||
@@ -87,7 +87,7 @@ public class MenuDialog extends FloatingDialog{
|
|||||||
GameState.set(State.playing);
|
GameState.set(State.playing);
|
||||||
}).text("$text.back").padTop(4f);
|
}).text("$text.back").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-tools", isize, ui.prefs::show).text("$text.settings").padTop(4f);
|
new imagebutton("icon-tools", isize, ui.settings::show).text("$text.settings").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-save", isize, save::show).text("$text.save").padTop(4f);
|
new imagebutton("icon-save", isize, save::show).text("$text.save").padTop(4f);
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
if(!Vars.android) {
|
if(!Vars.android) {
|
||||||
menu.row();
|
menu.row();
|
||||||
menu.addButton("$text.settings.controls", Vars.ui.keys::show);
|
menu.addButton("$text.settings.controls", Vars.ui.controls::show);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs.clearChildren();
|
prefs.clearChildren();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package io.anuke.mindustry.ui.fragments;
|
package io.anuke.mindustry.ui.fragments;
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
import io.anuke.mindustry.core.GameState;
|
||||||
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Draw;
|
import io.anuke.ucore.core.Draw;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
@@ -27,6 +29,6 @@ public class BackgroundFragment implements Fragment {
|
|||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15, logow, logoh);
|
Core.batch.draw(logo, w/2 - logow/2, h - logoh + 15, logow, logoh);
|
||||||
});
|
}).visible(() -> GameState.is(State.menu)).grow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class MenuFragment implements Fragment{
|
|||||||
row();
|
row();
|
||||||
}
|
}
|
||||||
|
|
||||||
add(new MenuButton("$text.settings", group, ui.prefs::show));
|
add(new MenuButton("$text.settings", group, ui.settings::show));
|
||||||
row();
|
row();
|
||||||
|
|
||||||
if(!gwt){
|
if(!gwt){
|
||||||
@@ -73,7 +73,7 @@ public class MenuFragment implements Fragment{
|
|||||||
|
|
||||||
new imagebutton("icon-editor", isize, ui.editor::show).text("$text.editor").padTop(4f);
|
new imagebutton("icon-editor", isize, ui.editor::show).text("$text.editor").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-tools", isize, ui.prefs::show).text("$text.settings").padTop(4f);
|
new imagebutton("icon-tools", isize, ui.settings::show).text("$text.settings").padTop(4f);
|
||||||
|
|
||||||
new imagebutton("icon-info", isize, ui.about::show).text("$text.about.button").padTop(4f);
|
new imagebutton("icon-info", isize, ui.about::show).text("$text.about.button").padTop(4f);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user