1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-13 07:15:28 +03:00
This commit is contained in:
Anuken 2020-05-26 19:39:50 -04:00
parent ddb3afc255
commit a375dd3fc2
53 changed files with 146 additions and 315 deletions

View File

@ -42,7 +42,7 @@ task deploy(type: Copy){
}
android{
buildToolsVersion '29.0.2'
buildToolsVersion '29.0.3'
compileSdkVersion 29
sourceSets{
main{

View File

@ -0,0 +1 @@
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:requests,type:arc.struct.Queue<mindustry.entities.units.BuildRequest>,size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@ -0,0 +1 @@
{version:1,fields:[{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

View File

@ -0,0 +1 @@
{fields:[{name:armor,type:float,size:4},{name:baseRotation,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Array<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -280,50 +280,6 @@ public class TechTree implements ContentList{
});
});
});
/*
node(draugFactory, () -> {
node(spiritFactory, () -> {
node(phantomFactory);
});
node(daggerFactory, () -> {
node(commandCenter, () -> {});
node(crawlerFactory, () -> {
node(titanFactory, () -> {
node(fortressFactory, () -> {
});
});
});
node(wraithFactory, () -> {
node(ghoulFactory, () -> {
node(revenantFactory, () -> {
});
});
});
});
});
/*
node(dartPad, () -> {
node(deltaPad, () -> {
node(javelinPad, () -> {
node(tridentPad, () -> {
node(glaivePad);
});
});
node(tauPad, () -> {
node(omegaPad, () -> {
});
});
});
});*/
});
});
});
@ -367,8 +323,7 @@ public class TechTree implements ContentList{
/** Extra objectives needed to research this. TODO implement */
public Objective[] objectives = {};
/** Turns required to research this content. */
//TODO keep track of turns that have been used so far
public int turns = 1;
public int turns = 3; //TODO keep track of turns that have been used so far
/** Nodes that depend on this node. */
public final Array<TechNode> children = new Array<>();

View File

@ -400,7 +400,7 @@ public class Control implements ApplicationListener, Loadable{
//display UI scale changed dialog
if(Core.settings.getBool("uiscalechanged", false)){
Core.app.post(() -> Core.app.post(() -> {
FloatingDialog dialog = new FloatingDialog("$confirm");
BaseDialog dialog = new BaseDialog("$confirm");
dialog.setFillParent(true);
float[] countdown = {60 * 11};

View File

@ -449,7 +449,7 @@ public class UI implements ApplicationListener, Loadable{
}
public void showConfirm(String title, String text, Boolp hide, Runnable confirmed){
FloatingDialog dialog = new FloatingDialog(title);
BaseDialog dialog = new BaseDialog(title);
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
dialog.buttons.defaults().size(200f, 54f).pad(2f);
dialog.setFillParent(false);
@ -475,7 +475,7 @@ public class UI implements ApplicationListener, Loadable{
}
public void showCustomConfirm(String title, String text, String yes, String no, Runnable confirmed, Runnable denied){
FloatingDialog dialog = new FloatingDialog(title);
BaseDialog dialog = new BaseDialog(title);
dialog.cont.add(text).width(mobile ? 400f : 500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
dialog.buttons.defaults().size(200f, 54f).pad(2f);
dialog.setFillParent(false);
@ -493,7 +493,7 @@ public class UI implements ApplicationListener, Loadable{
}
public void showOkText(String title, String text, Runnable confirmed){
FloatingDialog dialog = new FloatingDialog(title);
BaseDialog dialog = new BaseDialog(title);
dialog.cont.add(text).width(500f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
dialog.buttons.defaults().size(200f, 54f).pad(2f);
dialog.setFillParent(false);

View File

@ -42,7 +42,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
private MapResizeDialog resizeDialog;
private MapGenerateDialog generateDialog;
private ScrollPane pane;
private FloatingDialog menu;
private BaseDialog menu;
private Rules lastSavedRules;
private boolean saved = false;
private boolean shownWithMap = false;
@ -58,7 +58,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
infoDialog = new MapInfoDialog(editor);
generateDialog = new MapGenerateDialog(editor, true);
menu = new FloatingDialog("$menu");
menu = new BaseDialog("$menu");
menu.addCloseButton();
float swidth = 180f;
@ -309,7 +309,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
* 3) listener
*/
private void createDialog(String title, Object... arguments){
FloatingDialog dialog = new FloatingDialog(title);
BaseDialog dialog = new BaseDialog(title);
float h = 90f;

View File

@ -26,7 +26,7 @@ import mindustry.world.blocks.environment.*;
import static mindustry.Vars.*;
@SuppressWarnings("unchecked")
public class MapGenerateDialog extends FloatingDialog{
public class MapGenerateDialog extends BaseDialog{
private final Prov<GenerateFilter>[] filterTypes = new Prov[]{
NoiseFilter::new, ScatterFilter::new, TerrainFilter::new, DistortFilter::new,
RiverNoiseFilter::new, OreFilter::new, OreMedianFilter::new, MedianFilter::new,
@ -284,7 +284,7 @@ public class MapGenerateDialog extends FloatingDialog{
}
void showAdd(){
FloatingDialog selection = new FloatingDialog("$add");
BaseDialog selection = new BaseDialog("$add");
selection.setFillParent(false);
selection.cont.defaults().size(210f, 60f);
int i = 0;

View File

@ -9,7 +9,7 @@ import mindustry.io.*;
import mindustry.ui.*;
import mindustry.ui.dialogs.*;
public class MapInfoDialog extends FloatingDialog{
public class MapInfoDialog extends BaseDialog{
private final MapEditor editor;
private final WaveInfoDialog waveInfo;
private final MapGenerateDialog generate;

View File

@ -10,7 +10,7 @@ import mindustry.ui.dialogs.*;
import static mindustry.Vars.maps;
public class MapLoadDialog extends FloatingDialog{
public class MapLoadDialog extends BaseDialog{
private Map selected = null;
public MapLoadDialog(Cons<Map> loader){

View File

@ -6,7 +6,7 @@ import arc.scene.ui.layout.*;
import mindustry.gen.*;
import mindustry.ui.dialogs.*;
public class MapResizeDialog extends FloatingDialog{
public class MapResizeDialog extends BaseDialog{
private static final int minSize = 50, maxSize = 500, increment = 50;
int width, height;

View File

@ -8,7 +8,7 @@ import mindustry.ui.dialogs.*;
import static mindustry.Vars.ui;
public class MapSaveDialog extends FloatingDialog{
public class MapSaveDialog extends BaseDialog{
private TextField field;
private Cons<String> listener;

View File

@ -24,7 +24,7 @@ import mindustry.ui.dialogs.*;
import static mindustry.Vars.*;
import static mindustry.game.SpawnGroup.never;
public class WaveInfoDialog extends FloatingDialog{
public class WaveInfoDialog extends BaseDialog{
private final static int displayed = 20;
private Array<SpawnGroup> groups = new Array<>();
@ -49,7 +49,7 @@ public class WaveInfoDialog extends FloatingDialog{
addCloseButton();
buttons.button("$waves.edit", () -> {
FloatingDialog dialog = new FloatingDialog("$waves.edit");
BaseDialog dialog = new BaseDialog("$waves.edit");
dialog.addCloseButton();
dialog.setFillParent(false);
dialog.cont.defaults().size(210f, 64f);
@ -235,7 +235,7 @@ public class WaveInfoDialog extends FloatingDialog{
}
void showUpdate(SpawnGroup group){
FloatingDialog dialog = new FloatingDialog("");
BaseDialog dialog = new BaseDialog("");
dialog.setFillParent(true);
dialog.cont.pane(p -> {
int i = 0;

View File

@ -9,28 +9,6 @@ import mindustry.world.*;
/** Holds objective classes. */
public class Objectives{
//TODO
public static class Wave implements Objective{
public int wave;
public Wave(int wave){
this.wave = wave;
}
protected Wave(){}
@Override
public boolean complete(){
return false;
}
@Override
public String display(){
//TODO
return null;
}
}
public static class Unlock implements Objective{
public @NonNull Block block;
@ -102,9 +80,8 @@ public class Objectives{
boolean complete();
/** @return the string displayed when this objective is completed, in imperative form.
* e.g. when the objective is 'complete 10 waves', this would display "complete 10 waves".
* If this objective should not be displayed, should return null.*/
@Nullable String display();
* e.g. when the objective is 'complete 10 waves', this would display "complete 10 waves". */
String display();
/** Build a display for this zone requirement.*/
default void build(Table table){

View File

@ -2,7 +2,7 @@ package mindustry.logic;
import mindustry.ui.dialogs.*;
public class LogicDialog extends FloatingDialog{
public class LogicDialog extends BaseDialog{
public LogicDialog(){
super("");

View File

@ -90,7 +90,7 @@ public abstract class FilterOption{
public void build(Table table){
table.button(b -> b.image(supplier.get().icon(Cicon.small)).update(i -> ((TextureRegionDrawable)i.getDrawable())
.setRegion(supplier.get() == Blocks.air ? Icon.block.getRegion() : supplier.get().icon(Cicon.small))).size(8 * 3), () -> {
FloatingDialog dialog = new FloatingDialog("");
BaseDialog dialog = new BaseDialog("");
dialog.setFillParent(false);
int i = 0;
for(Block block : Vars.content.blocks()){

View File

@ -91,7 +91,7 @@ public class BeControl{
int[] length = {0};
Fi file = bebuildDirectory.child("client-be-" + updateBuild + ".jar");
FloatingDialog dialog = new FloatingDialog("$be.updating");
BaseDialog dialog = new BaseDialog("$be.updating");
download(updateUrl, file, i -> length[0] = i, v -> progress[0] = v, () -> cancel[0], () -> {
try{
Runtime.getRuntime().exec(new String[]{"java", "-DlastBuild=" + Version.build, "-Dberestart", "-jar", file.absolutePath()});

View File

@ -14,7 +14,7 @@ import mindustry.ui.Links.*;
import static mindustry.Vars.*;
public class AboutDialog extends FloatingDialog{
public class AboutDialog extends BaseDialog{
private Array<String> contributors = new Array<>();
private static ObjectSet<String> bannedItems = ObjectSet.with("google-play", "itch.io", "dev-builds", "f-droid");
@ -93,7 +93,7 @@ public class AboutDialog extends FloatingDialog{
}
public void showCredits(){
FloatingDialog dialog = new FloatingDialog("$credits");
BaseDialog dialog = new BaseDialog("$credits");
dialog.addCloseButton();
dialog.cont.add("$credits.text").fillX().wrap().get().setAlignment(Align.center);
dialog.cont.row();

View File

@ -7,7 +7,7 @@ import mindustry.net.Administration.*;
import static mindustry.Vars.*;
public class AdminsDialog extends FloatingDialog{
public class AdminsDialog extends BaseDialog{
public AdminsDialog(){
super("$server.admins");

View File

@ -7,7 +7,7 @@ import mindustry.net.Administration.*;
import static mindustry.Vars.*;
public class BansDialog extends FloatingDialog{
public class BansDialog extends BaseDialog{
public BansDialog(){
super("$server.bans");

View File

@ -11,11 +11,11 @@ import mindustry.graphics.*;
import static mindustry.Vars.*;
public class FloatingDialog extends Dialog{
public class BaseDialog extends Dialog{
private boolean wasPaused;
protected boolean shouldPause;
public FloatingDialog(String title, DialogStyle style){
public BaseDialog(String title, DialogStyle style){
super(title, style);
setFillParent(true);
this.title.setAlignment(Align.center);
@ -40,7 +40,7 @@ public class FloatingDialog extends Dialog{
});
}
public FloatingDialog(String title){
public BaseDialog(String title){
this(title, Core.scene.getStyle(DialogStyle.class));
}

View File

@ -6,7 +6,7 @@ import arc.scene.ui.*;
import mindustry.gen.*;
import mindustry.graphics.*;
public class ColorPicker extends FloatingDialog{
public class ColorPicker extends BaseDialog{
private Cons<Color> cons = c -> {};
private Color current = new Color();

View File

@ -4,7 +4,7 @@ import arc.scene.ui.ScrollPane;
import arc.scene.ui.layout.Table;
import mindustry.ctype.UnlockableContent;
public class ContentInfoDialog extends FloatingDialog{
public class ContentInfoDialog extends BaseDialog{
public ContentInfoDialog(){
super("$info.title");

View File

@ -20,8 +20,7 @@ public class ControlsDialog extends KeybindDialog{
buttons.button("$back", Icon.left, this::hide).size(230f, 64f);
keyDown(key -> {
if(key == KeyCode.escape || key == KeyCode.back)
hide();
if(key == KeyCode.escape || key == KeyCode.back) hide();
});
}
}

View File

@ -14,7 +14,7 @@ import mindustry.graphics.*;
import mindustry.maps.*;
import mindustry.ui.*;
public class CustomGameDialog extends FloatingDialog{
public class CustomGameDialog extends BaseDialog{
private MapPlayDialog dialog = new MapPlayDialog();
public CustomGameDialog(){

View File

@ -19,18 +19,18 @@ import mindustry.world.*;
import static mindustry.Vars.*;
public class CustomRulesDialog extends FloatingDialog{
public class CustomRulesDialog extends BaseDialog{
private Table main;
private Rules rules;
private Prov<Rules> resetter;
private LoadoutDialog loadoutDialog;
private FloatingDialog banDialog;
private BaseDialog banDialog;
public CustomRulesDialog(){
super("$mode.custom");
loadoutDialog = new LoadoutDialog();
banDialog = new FloatingDialog("$bannedblocks");
banDialog = new BaseDialog("$bannedblocks");
banDialog.addCloseButton();
banDialog.shown(this::rebuildBanned);
@ -84,7 +84,7 @@ public class CustomRulesDialog extends FloatingDialog{
}).get().setScrollYForce(previousScroll);
banDialog.cont.row();
banDialog.cont.button("$add", Icon.add, () -> {
FloatingDialog dialog = new FloatingDialog("$add");
BaseDialog dialog = new BaseDialog("$add");
dialog.cont.pane(t -> {
t.left().margin(14f);
int[] i = {0};

View File

@ -16,7 +16,7 @@ import mindustry.ui.*;
import static mindustry.Vars.ui;
public class DatabaseDialog extends FloatingDialog{
public class DatabaseDialog extends BaseDialog{
public DatabaseDialog(){
super("$database");

View File

@ -17,7 +17,7 @@ import java.util.*;
import static mindustry.Vars.platform;
public class FileChooser extends FloatingDialog{
public class FileChooser extends BaseDialog{
private static final Fi homeDirectory = Core.files.absolute(Core.files.getExternalStoragePath());
private static Fi lastDirectory = homeDirectory;

View File

@ -9,7 +9,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class GameOverDialog extends FloatingDialog{
public class GameOverDialog extends BaseDialog{
private Team winner;
public GameOverDialog(){

View File

@ -12,7 +12,7 @@ import java.io.*;
import static mindustry.Vars.*;
public class HostDialog extends FloatingDialog{
public class HostDialog extends BaseDialog{
float w = 300;
public HostDialog(){

View File

@ -19,7 +19,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class JoinDialog extends FloatingDialog{
public class JoinDialog extends BaseDialog{
Array<Server> servers = new Array<>();
Dialog add;
Server renaming;
@ -44,7 +44,7 @@ public class JoinDialog extends FloatingDialog{
buttons.button("?", () -> ui.showInfo("$join.info")).size(60f, 64f).width(-1);
}
add = new FloatingDialog("$joingame.title");
add = new BaseDialog("$joingame.title");
add.cont.add("$joingame.ip").padRight(5f).left();
TextField field = add.cont.field(Core.settings.getString("ip"), text -> {

View File

@ -13,7 +13,7 @@ import java.util.Locale;
import static mindustry.Vars.locales;
import static mindustry.Vars.ui;
public class LanguageDialog extends FloatingDialog{
public class LanguageDialog extends BaseDialog{
private Locale lastLocale;
private ObjectMap<Locale, String> displayNames = ObjectMap.of(
Locale.TRADITIONAL_CHINESE, "正體中文",

View File

@ -19,7 +19,7 @@ import java.io.*;
import static mindustry.Vars.*;
public class LoadDialog extends FloatingDialog{
public class LoadDialog extends BaseDialog{
ScrollPane pane;
Table slots;

View File

@ -11,7 +11,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class LoadoutDialog extends FloatingDialog{
public class LoadoutDialog extends BaseDialog{
private Runnable hider;
private Runnable resetter;
private Runnable updater;

View File

@ -12,7 +12,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class MapPlayDialog extends FloatingDialog{
public class MapPlayDialog extends BaseDialog{
CustomRulesDialog dialog = new CustomRulesDialog();
Rules rules;
@NonNull Gamemode selectedGamemode = Gamemode.survival;
@ -89,7 +89,7 @@ public class MapPlayDialog extends FloatingDialog{
}
private void displayGameModeHelp(){
FloatingDialog d = new FloatingDialog(Core.bundle.get("mode.help.title"));
BaseDialog d = new BaseDialog(Core.bundle.get("mode.help.title"));
d.setFillParent(false);
Table table = new Table();
table.defaults().pad(1f);

View File

@ -17,8 +17,8 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class MapsDialog extends FloatingDialog{
private FloatingDialog dialog;
public class MapsDialog extends BaseDialog{
private BaseDialog dialog;
public MapsDialog(){
super("$maps");
@ -158,7 +158,7 @@ public class MapsDialog extends FloatingDialog{
}
void showMapInfo(Map map){
dialog = new FloatingDialog("$editor.mapinfo");
dialog = new BaseDialog("$editor.mapinfo");
dialog.addCloseButton();
float mapsize = Core.graphics.isPortrait() ? 160f : 300f;

View File

@ -10,7 +10,7 @@ import mindustry.gen.*;
import static mindustry.Vars.renderer;
public class MinimapDialog extends FloatingDialog{
public class MinimapDialog extends BaseDialog{
public MinimapDialog(){
super("$minimap");

View File

@ -17,7 +17,7 @@ import java.io.*;
import static mindustry.Vars.*;
public class ModsDialog extends FloatingDialog{
public class ModsDialog extends BaseDialog{
public ModsDialog(){
super("$mods");
@ -25,7 +25,6 @@ public class ModsDialog extends FloatingDialog{
buttons.button("$mods.guide", Icon.link, () -> Core.app.openURI(modGuideURL)).size(210, 64f);
shown(this::setup);
hidden(() -> {
@ -67,7 +66,7 @@ public class ModsDialog extends FloatingDialog{
float margin = 12f;
buttons.button("$mod.import", Icon.add, style, () -> {
FloatingDialog dialog = new FloatingDialog("$mod.import");
BaseDialog dialog = new BaseDialog("$mod.import");
TextButtonStyle bstyle = Styles.cleart;
@ -245,7 +244,7 @@ public class ModsDialog extends FloatingDialog{
}
private void showMod(LoadedMod mod){
FloatingDialog dialog = new FloatingDialog(mod.meta.displayName());
BaseDialog dialog = new BaseDialog(mod.meta.displayName());
dialog.addCloseButton();

View File

@ -6,7 +6,7 @@ import mindustry.gen.*;
import static mindustry.Vars.*;
public class PausedDialog extends FloatingDialog{
public class PausedDialog extends BaseDialog{
private SaveDialog save = new SaveDialog();
private LoadDialog load = new LoadDialog();
private boolean wasClient = false;

View File

@ -29,7 +29,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class PlanetDialog extends FloatingDialog{
public class PlanetDialog extends BaseDialog{
private static final Color
outlineColor = Pal.accent.cpy().a(1f),
hoverColor = Pal.accent.cpy().a(0.5f),

View File

@ -7,7 +7,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class ResourcesDialog extends FloatingDialog{
public class ResourcesDialog extends BaseDialog{
public ResourcesDialog(){
super("//TODO resources");

View File

@ -20,7 +20,7 @@ import mindustry.ui.*;
import static mindustry.Vars.*;
public class SchematicsDialog extends FloatingDialog{
public class SchematicsDialog extends BaseDialog{
private SchematicInfoDialog info = new SchematicInfoDialog();
private Schematic firstSchematic;
private String search = "";
@ -168,7 +168,7 @@ public class SchematicsDialog extends FloatingDialog{
}
public void showImport(){
FloatingDialog dialog = new FloatingDialog("$editor.export");
BaseDialog dialog = new BaseDialog("$editor.export");
dialog.cont.pane(p -> {
p.margin(10f);
p.table(Tex.button, t -> {
@ -217,7 +217,7 @@ public class SchematicsDialog extends FloatingDialog{
}
public void showExport(Schematic s){
FloatingDialog dialog = new FloatingDialog("$editor.export");
BaseDialog dialog = new BaseDialog("$editor.export");
dialog.cont.pane(p -> {
p.margin(10f);
p.table(Tex.button, t -> {
@ -312,7 +312,7 @@ public class SchematicsDialog extends FloatingDialog{
}
}
public static class SchematicInfoDialog extends FloatingDialog{
public static class SchematicInfoDialog extends BaseDialog{
SchematicInfoDialog(){
super("");

View File

@ -31,7 +31,7 @@ public class SettingsMenuDialog extends SettingsDialog{
private Table prefs;
private Table menu;
private FloatingDialog dataDialog;
private BaseDialog dataDialog;
private boolean wasPaused;
public SettingsMenuDialog(){
@ -77,7 +77,7 @@ public class SettingsMenuDialog extends SettingsDialog{
prefs.clearChildren();
prefs.add(menu);
dataDialog = new FloatingDialog("$settings.data");
dataDialog = new BaseDialog("$settings.data");
dataDialog.addCloseButton();
dataDialog.cont.table(Tex.button, t -> {

View File

@ -1,8 +1,6 @@
package mindustry.ui.dialogs;
import arc.*;
import arc.scene.ui.layout.Stack;
import arc.struct.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.input.*;
@ -13,11 +11,14 @@ import arc.scene.actions.*;
import arc.scene.event.*;
import arc.scene.style.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.Stack;
import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.content.TechTree.*;
import mindustry.game.EventType.*;
import mindustry.game.Objectives.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
@ -29,7 +30,7 @@ import java.util.*;
import static mindustry.Vars.*;
public class TechTreeDialog extends FloatingDialog{
public class TechTreeDialog extends BaseDialog{
private final float nodeSize = Scl.scl(60f);
private ObjectSet<TechTreeNode> nodes = new ObjectSet<>();
private TechTreeNode root = new TechTreeNode(TechTree.root, null);
@ -361,6 +362,21 @@ public class TechTreeDialog extends FloatingDialog{
}).fillX().left();
t.row();
}
//TODO test if this works
if(node.objectives.length > 0){
t.table(r -> {
r.add("$complete").colspan(2).left();
r.row();
for(Objective o : node.objectives){
r.image(Icon.right).padRight(4);
r.add(o.display()).color(Color.lightGray);
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
r.row();
}
});
t.row();
}
});
}else{
desc.add("$completed");

View File

@ -5,7 +5,7 @@ import arc.scene.ui.layout.Table;
import mindustry.gen.*;
import mindustry.net.Administration.TraceInfo;
public class TraceDialog extends FloatingDialog{
public class TraceDialog extends BaseDialog{
public TraceDialog(){
super("$trace");

View File

@ -1,171 +0,0 @@
package mindustry.ui.dialogs;
import arc.*;
import arc.struct.*;
import arc.graphics.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import mindustry.game.*;
import mindustry.game.Objectives.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.Cicon;
import static mindustry.Vars.*;
//TODO remove
public class ZoneInfoDialog extends FloatingDialog{
private LoadoutDialog loadout = new LoadoutDialog();
public ZoneInfoDialog(){
super("");
titleTable.remove();
addCloseButton();
}
public void show(SectorPreset zone){
setup(zone);
show();
}
private void setup(SectorPreset zone){
cont.clear();
Table iteminfo = new Table();
Runnable rebuildItems = () -> {
int i = 0;
iteminfo.clear();
if(!zone.unlocked()) return;
for(ItemStack stack : zone.getLaunchCost()){
if(stack.amount == 0) continue;
if(i++ % 2 == 0){
iteminfo.row();
}
iteminfo.image(stack.item.icon(Cicon.small)).size(8 * 3).padRight(1);
iteminfo.add(stack.amount + "").color(Color.lightGray).padRight(5);
}
};
rebuildItems.run();
cont.pane(cont -> {
if(zone.locked()){
cont.image(Icon.lock);
cont.row();
cont.add("$locked").padBottom(6);
cont.row();
cont.table(req -> {
req.defaults().left();
Array<Objectives.Objective> zones = zone.requirements.select(o -> !(o instanceof Unlock));
if(!zones.isEmpty()){
req.table(r -> {
r.add("$complete").colspan(2).left();
r.row();
for(Objectives.Objective o : zones){
r.image(Icon.terrain).padRight(4);
r.add(o.display()).color(Color.lightGray);
r.image(o.complete() ? Icon.ok : Icon.cancel, o.complete() ? Color.lightGray : Color.scarlet).padLeft(3);
r.row();
}
});
}
req.row();
Array<Unlock> blocks = zone.requirements.select(o -> o instanceof Unlock).as();
if(!blocks.isEmpty()){
req.table(r -> {
r.add("$research.list").colspan(2).left();
r.row();
for(Unlock blocko : blocks){
r.image(blocko.block.icon(Cicon.small)).size(8 * 3).padRight(5);
r.add(blocko.block.localizedName).color(Color.lightGray).left();
r.image(blocko.block.unlocked() ? Icon.ok : Icon.cancel, blocko.block.unlocked() ? Color.lightGray : Color.scarlet).padLeft(3);
r.row();
}
}).padTop(10);
}
}).growX();
}else{
cont.add(zone.localizedName).color(Pal.accent).growX().center();
cont.row();
cont.image().color(Pal.accent).height(3).pad(6).growX();
cont.row();
cont.table(desc -> {
desc.left().defaults().left().width(Core.graphics.isPortrait() ? 350f : 500f);
desc.pane(t -> t.marginRight(12f).add(zone.description).wrap().growX()).fillX().maxHeight(mobile ? 300f : 450f).pad(2).padBottom(8f).get().setScrollingDisabled(true, false);
desc.row();
desc.table(t -> {
t.left();
t.add("$zone.resources").padRight(6);
/*
if(zone.resources.size > 0){
t.table(r -> {
t.left();
int i = 0;
for(Item item : zone.resources){
r.image(item.icon(Cicon.small)).size(8 * 3);
if(++i % 4 == 0){
r.row();
}
}
});
}else{
t.add("$none");
}*/
});
Rules rules = zone.getRules();
desc.row();
desc.add(Core.bundle.format("zone.objective", Core.bundle.get(!rules.attackMode ? "zone.objective.survival" : "zone.objective.attack")));
if(zone.bestWave() > 0){
desc.row();
desc.add(Core.bundle.format("bestwave", zone.bestWave()));
}
});
cont.row();
}
cont.marginRight(12f);
});
cont.row();
/*
cont.button(zone.canConfigure() ? "$configure" : Core.bundle.format("configure.locked", zone.configureObjective.display()),
() -> loadout.show(zone.loadout.findCore().itemCapacity, zone.getStartingItems(), zone::resetStartingItems, zone::updateLaunchCost, rebuildItems)
).fillX().pad(3).disabled(b -> !zone.canConfigure());*/
cont.row();
Button button = cont.button(zone.locked() ? "$uncover" : "$launch", () -> {
if(!data.isUnlocked(zone)){
Sounds.unlock.play();
data.unlockContent(zone);
ui.planet.setup();
setup(zone);
}else{
ui.planet.hide();
data.removeItems(zone.getLaunchCost());
hide();
//control.playZone(zone);
}
}).minWidth(200f).margin(13f).padTop(5).disabled(b -> zone.locked() ? !zone.canUnlock() : !data.hasItems(zone.getLaunchCost())).uniformY().get();
button.row();
button.add(iteminfo);
}
}

View File

@ -532,7 +532,7 @@ public class HudFragment extends Fragment{
}
private void showLaunchConfirm(){
FloatingDialog dialog = new FloatingDialog("$launch");
BaseDialog dialog = new BaseDialog("$launch");
dialog.update(() -> {
if(!inLaunchWave()){
dialog.hide();

View File

@ -0,0 +1,53 @@
package mindustry.world.blocks.production;
import arc.util.ArcAnnotate.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.world.*;
public class ResearchBlock extends Block{
public ResearchBlock(String name){
super(name);
update = true;
solid = true;
hasPower = true;
hasItems = true;
}
public class ResearchBlockEntity extends TileEntity{
public @Nullable UnlockableContent researching;
@Override
public void updateTile(){
}
@Override
public void write(Writes write){
super.write(write);
if(researching != null){
write.b(researching.getContentType().ordinal());
write.s(researching.id);
}else{
write.b(-1);
}
}
@Override
public void read(Reads read, byte revision){
super.read(read, revision);
byte type = read.b();
if(type != -1){
researching = Vars.content.getByID(ContentType.all[type], read.s());
}else{
researching = null;
}
}
}
}

View File

@ -98,7 +98,7 @@ public class MessageBlock extends Block{
accepted = str -> configure(str);
}});
}else{
FloatingDialog dialog = new FloatingDialog("$editmessage");
BaseDialog dialog = new BaseDialog("$editmessage");
dialog.setFillParent(false);
TextArea a = dialog.cont.add(new TextArea(message.replace("\n", "\r"))).size(380f, 160f).get();
a.setFilter((textField, c) -> {

View File

@ -96,7 +96,7 @@ public class SWorkshop implements SteamUGCCallback{
if(details.getResult() == SteamResult.OK){
if(details.getOwnerID().equals(SVars.user.user.getSteamID())){
FloatingDialog dialog = new FloatingDialog("$workshop.info");
BaseDialog dialog = new BaseDialog("$workshop.info");
dialog.setFillParent(false);
dialog.cont.add("$workshop.menu").pad(20f);
dialog.addCloseButton();
@ -107,7 +107,7 @@ public class SWorkshop implements SteamUGCCallback{
}).size(210f, 64f);
dialog.buttons.button("$workshop.update", Icon.up, () -> {
new FloatingDialog("$workshop.update"){{
new BaseDialog("$workshop.update"){{
setFillParent(false);
cont.margin(10).add("$changelog").padRight(6f);
cont.row();
@ -177,7 +177,7 @@ public class SWorkshop implements SteamUGCCallback{
}
void showPublish(Cons<SteamPublishedFileID> published){
FloatingDialog dialog = new FloatingDialog("$confirm");
BaseDialog dialog = new BaseDialog("$confirm");
dialog.setFillParent(false);
dialog.cont.add("$publish.confirm").width(600f).wrap();
dialog.addCloseButton();