Logic progress

This commit is contained in:
Anuken
2020-08-06 12:31:04 -04:00
parent 7482e2a988
commit 5dc78a24e0
30 changed files with 2933 additions and 2582 deletions
@@ -128,6 +128,13 @@ public class Annotations{
String fallback() default "error"; String fallback() default "error";
} }
/** Registers a logic node's slot. */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface NodeSlotDef{
boolean input() default false;
}
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface StyleDefaults{ public @interface StyleDefaults{
@@ -0,0 +1,81 @@
package mindustry.annotations.misc;
import arc.struct.*;
import arc.util.*;
import com.squareup.javapoet.*;
import mindustry.annotations.Annotations.*;
import mindustry.annotations.*;
import mindustry.annotations.util.*;
import javax.annotation.processing.*;
import javax.lang.model.element.*;
import javax.lang.model.type.*;
@SupportedAnnotationTypes("mindustry.annotations.Annotations.NodeSlotDef")
public class NodeSlotProcessor extends BaseProcessor{
@Override
public void process(RoundEnvironment env) throws Exception{
TypeSpec.Builder slotClass = TypeSpec.classBuilder("LogicSlotMap")
.addModifiers(Modifier.PUBLIC);
ObjectMap<Stype, Seq<String>> fields = new ObjectMap<>();
for(Svar var : fields(NodeSlotDef.class)){
String type = var.mirror().toString();
boolean overrideInput = var.annotation(NodeSlotDef.class).input();
boolean output = (type.contains("SetObj") || type.contains("SetNum") || type.contains("Runnable")) && !overrideInput;
String objType = output ?
type.contains("SetNum") ? "double" :
type.contains("SetObj") ? ((DeclaredType)var.mirror()).getTypeArguments().get(0).toString() :
type : type;
String dataType = objType.equals("double") ? "number" :
objType.contains("Content") ? "content" :
objType.equals("mindustry.gen.Building") ? "building" :
objType.equals("mindustry.gen.Unit") ? "unit" :
objType.equals("java.lang.Void") || objType.equals("java.lang.Runnable") ? "control" :
objType.equals("java.lang.String") ? "string" :
"<<invalid>>";
if(dataType.equals("<<invalid>>")) err("Unknown logic node type: " + objType, var);
boolean numeric = dataType.equals("number");
String name = Strings.capitalize(var.name());
String lambda = output ?
"(" + var.enclosingType() + " node, " + objType + " val__) -> node." + var.name() + (objType.contains("Runnable") ? ".run()" : ".set(val__)") :
"(" + var.enclosingType() + " node, " + objType + " val__) -> node." + var.name() + " = val__";
//NodeSlot(String name, boolean input, DataType type, NumOutput<N> numOutput, ObjOutput<N, T> setObject)
String constructed = Strings.format(
"new mindustry.logic.LogicNode.NodeSlot(\"@\", @, mindustry.logic.LogicNode.DataType.@, @, @)",
name,
!output,
dataType,
numeric ? lambda : "null",
!numeric ? lambda : "null"
);
fields.get(var.enclosingType(), Seq::new).add(constructed);
}
slotClass.addField(FieldSpec.builder(
ParameterizedTypeName.get(ClassName.get(ObjectMap.class),
TypeName.get(Class.class),
TypeName.OBJECT), //screw type safety, I don't care anymore
"map", Modifier.PUBLIC, Modifier.FINAL, Modifier.STATIC).initializer("new ObjectMap<>()").build());
CodeBlock.Builder code = CodeBlock.builder();
fields.each((type, inits) -> {
code.addStatement("map.put($L.class, new mindustry.logic.LogicNode.NodeSlot[]{$L})", type.toString(), inits.toString(","));
});
slotClass.addStaticBlock(code.build());
write(slotClass);
}
}
@@ -0,0 +1 @@
{version:1,fields:[{name:collided,type:arc.struct.IntSeq,size:-1},{name:damage,type:float,size:4},{name:data,type:java.lang.Object,size:-1},{name:lifetime,type:float,size:4},{name:owner,type:Entityc,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:type,type:mindustry.entities.bullet.BulletType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
@@ -0,0 +1 @@
{version:2,fields:[{name:collided,type:arc.struct.IntSeq,size:-1},{name:damage,type:float,size:4},{name:data,type:java.lang.Object,size:-1},{name:lifetime,type:float,size:4},{name:owner,type:mindustry.gen.Entityc,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:time,type:float,size:4},{name:type,type:mindustry.entities.bullet.BulletType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
@@ -0,0 +1 @@
{version:1,fields:[{name:color,type:arc.graphics.Color,size:-1},{name:data,type:java.lang.Object,size:-1},{name:effect,type:mindustry.entities.Effect,size:-1},{name:lifetime,type:float,size:4},{name:offsetX,type:float,size:4},{name:offsetY,type:float,size:4},{name:parent,type:Posc,size:-1},{name:rotation,type:float,size:4},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}
@@ -0,0 +1 @@
{version:2,fields:[{name:color,type:arc.graphics.Color,size:-1},{name:data,type:java.lang.Object,size:-1},{name:effect,type:mindustry.entities.Effect,size:-1},{name:lifetime,type:float,size:4},{name:offsetX,type:float,size:4},{name:offsetY,type:float,size:4},{name:parent,type:mindustry.gen.Posc,size:-1},{name:rotation,type:float,size:4},{name:time,type:float,size:4},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

+1
View File
@@ -280,3 +280,4 @@
63464=block|unit-block-medium 63464=block|unit-block-medium
63463=risso|unit-risso-medium 63463=risso|unit-risso-medium
63462=overdrive-dome|block-overdrive-dome-medium 63462=overdrive-dome|block-overdrive-dome-medium
63461=logic-processor|block-logic-processor-medium
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 385 KiB

After

Width:  |  Height:  |  Size: 385 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

+7 -7
View File
@@ -81,10 +81,10 @@ public class Blocks implements ContentList{
repairPoint, resupplyPoint, repairPoint, resupplyPoint,
//campaign //campaign
launchPad, launchPadLarge, dataProcessor, launchPad, launchPadLarge,
//misc experimental //misc experimental
blockForge, blockLoader, blockUnloader; logicProcessor, blockForge, blockLoader, blockUnloader;
@Override @Override
public void load(){ public void load(){
@@ -1883,16 +1883,16 @@ public class Blocks implements ContentList{
consumes.power(6f); consumes.power(6f);
}}; }};
dataProcessor = new ResearchBlock("data-processor"){{ //endregion campaign
//requirements(Category.effect, BuildVisibility.campaignOnly, with(Items.copper, 200, Items.lead, 100)); //region experimental
logicProcessor = new ResearchBlock("logic-processor"){{
requirements(Category.effect, BuildVisibility.debugOnly, with(Items.copper, 200, Items.lead, 100));
size = 3; size = 3;
alwaysUnlocked = true; alwaysUnlocked = true;
}}; }};
//endregion campaign
//region experimental
blockForge = new BlockForge("block-forge"){{ blockForge = new BlockForge("block-forge"){{
requirements(Category.production, BuildVisibility.debugOnly, with(Items.thorium, 100)); requirements(Category.production, BuildVisibility.debugOnly, with(Items.thorium, 100));
hasPower = true; hasPower = true;
+3
View File
@@ -24,6 +24,7 @@ import mindustry.editor.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.ui.*; import mindustry.ui.*;
import mindustry.ui.dialogs.*; import mindustry.ui.dialogs.*;
import mindustry.ui.fragments.*; import mindustry.ui.fragments.*;
@@ -67,6 +68,7 @@ public class UI implements ApplicationListener, Loadable{
public SchematicsDialog schematics; public SchematicsDialog schematics;
public ModsDialog mods; public ModsDialog mods;
public ColorPicker picker; public ColorPicker picker;
public LogicDialog logic;
public Cursor drillCursor, unloadCursor; public Cursor drillCursor, unloadCursor;
@@ -179,6 +181,7 @@ public class UI implements ApplicationListener, Loadable{
research = new ResearchDialog(); research = new ResearchDialog();
mods = new ModsDialog(); mods = new ModsDialog();
schematics = new SchematicsDialog(); schematics = new SchematicsDialog();
logic = new LogicDialog();
Group group = Core.scene.root; Group group = Core.scene.root;
+1 -1
View File
@@ -278,7 +278,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
units.sort(u -> u.dst2(player.unit())); units.sort(u -> u.dst2(player.unit()));
units.truncate(player.unit().type().commandLimit); units.truncate(player.unit().type().commandLimit);
if(units.any()) pattern.spacing = units.max(u -> u.hitSize).hitSize * 2.4f; if(units.any()) pattern.spacing = units.max(u -> u.hitSize).hitSize * 2f;
commander.command(formation, units); commander.command(formation, units);
} }
+9 -6
View File
@@ -6,6 +6,11 @@ public enum BinaryOp{
mul("*", (a, b) -> a * b), mul("*", (a, b) -> a * b),
div("/", (a, b) -> a / b), div("/", (a, b) -> a / b),
mod("%", (a, b) -> a % b), mod("%", (a, b) -> a % b),
equal("=", (a, b) -> Math.abs(a - b) < 0.000001 ? 1 : 0),
lessThan("<", (a, b) -> a < b ? 1 : 0),
lessThanEq("<=", (a, b) -> a <= b ? 1 : 0),
greaterThan(">", (a, b) -> a > b ? 1 : 0),
greaterThanEq(">=", (a, b) -> a >= b ? 1 : 0),
pow("^", Math::pow), pow("^", Math::pow),
shl(">>", (a, b) -> (int)a >> (int)b), shl(">>", (a, b) -> (int)a >> (int)b),
shr("<<", (a, b) -> (int)a << (int)b), shr("<<", (a, b) -> (int)a << (int)b),
@@ -13,18 +18,16 @@ public enum BinaryOp{
and("and", (a, b) -> (int)a & (int)b), and("and", (a, b) -> (int)a & (int)b),
xor("xor", (a, b) -> (int)a ^ (int)b); xor("xor", (a, b) -> (int)a ^ (int)b);
final OpLambda function; public static final BinaryOp[] all = values();
final String symbol;
public final OpLambda function;
public final String symbol;
BinaryOp(String symbol, OpLambda function){ BinaryOp(String symbol, OpLambda function){
this.symbol = symbol; this.symbol = symbol;
this.function = function; this.function = function;
} }
public double get(double a, double b){
return function.get(a, b);
}
interface OpLambda{ interface OpLambda{
double get(double a, double b); double get(double a, double b);
} }
+62 -32
View File
@@ -14,23 +14,33 @@ import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.logic.LogicNode.*;
import mindustry.ui.*; import mindustry.ui.*;
public class LogicCanvas extends WidgetGroup{ public class LogicCanvas extends WidgetGroup{
private static final Color backgroundCol = Color.black, gridCol = Pal.accent.cpy().mul(0.2f); private static final Color backgroundCol = Pal.darkMetal.cpy().mul(0.1f), gridCol = Pal.darkMetal.cpy().mul(0.5f);
private static final Color outCol = Pal.place, inCol = Pal.remove;
private Element selected; private Element selected;
private Element entered; private Element entered;
private Seq<LogicNode> nodes = new Seq<>(); private Seq<LogicNode> nodes = new Seq<>();
{ {
for(int i = 0; i < 3; i++){ add(new BinaryOpNode());
LogicElement e = new LogicElement(); add(new BinaryOpNode());
e.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f); add(new BinaryOpNode());
addChild(e); add(new NumberNode());
e.pack(); add(new NumberNode());
} add(new NumberNode());
add(new ConditionNode());
add(new ConditionNode());
add(new SignalNode());
}
private void add(LogicNode node){
LogicElement e = new LogicElement(node);
e.setPosition(Core.graphics.getWidth()/2f, Core.graphics.getHeight()/2f);
addChild(e);
e.pack();
} }
@Override @Override
@@ -64,14 +74,14 @@ public class LogicCanvas extends WidgetGroup{
if(e instanceof LogicElement){ if(e instanceof LogicElement){
LogicElement l = (LogicElement)e; LogicElement l = (LogicElement)e;
for(NodeField field : l.fields){ for(SlotTable field : l.slots){
field.drawConnection(); field.drawConnection();
} }
} }
} }
if(selected != null){ if(selected != null){
NodeField field = (NodeField)selected.userObject; SlotTable field = (SlotTable)selected.userObject;
Vec2 dest = selected.localToStageCoordinates(Tmp.v1.set(selected.getWidth()/2f, selected.getHeight()/2f)); Vec2 dest = selected.localToStageCoordinates(Tmp.v1.set(selected.getWidth()/2f, selected.getHeight()/2f));
Vec2 mouse = Core.input.mouse(); Vec2 mouse = Core.input.mouse();
drawCurve(dest.x, dest.y, mouse.x, mouse.y, field.color); drawCurve(dest.x, dest.y, mouse.x, mouse.y, field.color);
@@ -80,10 +90,13 @@ public class LogicCanvas extends WidgetGroup{
void drawCurve(float x, float y, float x2, float y2, Color color){ void drawCurve(float x, float y, float x2, float y2, Color color){
Lines.stroke(4f, color); Lines.stroke(4f, color);
float dist = Math.abs(x - x2)/2f;
Lines.curve( Lines.curve(
x, y, x, y,
x2, y, x + dist, y,
x, y2, x2 - dist, y2,
x2, y2, x2, y2,
Math.max(3, (int)(Mathf.dst(x, y, x2, y2) / 5)) Math.max(3, (int)(Mathf.dst(x, y, x2, y2) / 5))
); );
@@ -92,12 +105,22 @@ public class LogicCanvas extends WidgetGroup{
} }
class LogicElement extends Table{ class LogicElement extends Table{
LogicNode node; final LogicNode node;
NodeField[] fields = {new NodeField(true, "input 1"), new NodeField(true, "input 2"), new NodeField(false, "output 1"), new NodeField(false, "output 2")}; final SlotTable[] slots;
LogicElement(LogicNode node){
this.node = node;
nodes.add(node);
NodeSlot[] nslots = node.slots();
this.slots = new SlotTable[nslots.length];
for(int i = 0; i < nslots.length; i++){
this.slots[i] = new SlotTable(nslots[i]);
}
LogicElement(){
background(Tex.whitePane); background(Tex.whitePane);
setColor(Pal.accent.cpy().mul(0.9f).shiftSaturation(-0.3f)); setColor(node.category().color);
margin(0f); margin(0f);
table(Tex.whiteui, t -> { table(Tex.whiteui, t -> {
@@ -108,11 +131,12 @@ public class LogicCanvas extends WidgetGroup{
t.margin(8f); t.margin(8f);
t.touchable = Touchable.enabled; t.touchable = Touchable.enabled;
t.add("Node").style(Styles.outlineLabel).color(color); t.add(node.name()).style(Styles.outlineLabel).color(color).padRight(8);
t.add().growX(); t.add().growX();
t.button(Icon.cancel, Styles.onlyi, () -> { t.button(Icon.cancel, Styles.onlyi, () -> {
//TODO disconnect things //TODO disconnect things
remove(); remove();
nodes.remove(node);
}); });
t.addListener(new InputListener(){ t.addListener(new InputListener(){
float lastx, lasty; float lastx, lasty;
@@ -139,10 +163,14 @@ public class LogicCanvas extends WidgetGroup{
row(); row();
node.build(this);
row();
defaults().height(30); defaults().height(30);
for(NodeField field : fields){ for(SlotTable field : slots){
add(field).align(field.input ? Align.left : Align.right); add(field).align(field.slot.input ? Align.left : Align.right);
row(); row();
} }
@@ -162,19 +190,20 @@ public class LogicCanvas extends WidgetGroup{
} }
} }
class NodeField extends Table{ class SlotTable extends Table{
boolean input; final NodeSlot slot;
ImageButton button; ImageButton button;
Element connection; Element connection;
NodeField(boolean input, String name){ SlotTable(NodeSlot slot){
this.input = input; this.slot = slot;
//TODO color should depend on data type
setColor(outCol); setColor(slot.type.color);
float marg = 24f; float marg = 24f;
if(input){ if(slot.input){
addIcon(); addIcon();
left(); left();
marginRight(marg); marginRight(marg);
@@ -183,9 +212,9 @@ public class LogicCanvas extends WidgetGroup{
marginLeft(marg); marginLeft(marg);
} }
add(name).padLeft(5).padRight(5).style(Styles.outlineLabel).color(color); add(slot.name).padLeft(5).padRight(5).style(Styles.outlineLabel).color(color);
if(!input){ if(!slot.input){
addIcon(); addIcon();
} }
} }
@@ -211,7 +240,7 @@ public class LogicCanvas extends WidgetGroup{
float pad = s/2f - 3f; float pad = s/2f - 3f;
if(input){ if(slot.input){
c.padLeft(-pad); c.padLeft(-pad);
}else{ }else{
c.padRight(-pad); c.padRight(-pad);
@@ -236,9 +265,10 @@ public class LogicCanvas extends WidgetGroup{
localToStageCoordinates(Tmp.v1.set(x, y)); localToStageCoordinates(Tmp.v1.set(x, y));
Element element = entered; Element element = entered;
if(element != null && element.userObject instanceof NodeField){ if(element != null && element.userObject instanceof SlotTable){
NodeField field = (NodeField)element.userObject; SlotTable field = (SlotTable)element.userObject;
if(field != NodeField.this && field.input != input){ //make sure inputs are matched to outputs, and that slot types match
if(field != SlotTable.this && field.slot.input != slot.input && field.slot.type == slot.type){
connection = element; connection = element;
//field.connection = button; //field.connection = button;
} }
+173 -9
View File
@@ -1,29 +1,193 @@
package mindustry.logic; package mindustry.logic;
import arc.func.*; import arc.graphics.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
/** Base class for a type of logic node. */
public abstract class LogicNode{ public abstract class LogicNode{
/** Runs the calculation(s) and sets the output value. */
public void run(){} public void run(){}
public NodeInput[] inputs(){ public NodeSlot[] slots(){
return new NodeInput[0]; return (NodeSlot[])LogicSlotMap.map.get(getClass());
} }
public static class BinaryOpNode{ public abstract NodeCategory category();
public void build(Table table){}
public String name(){
return getClass().getSimpleName().replace("Node", "");
}
public static class BinaryOpNode extends LogicNode{
public BinaryOp op = BinaryOp.add; public BinaryOp op = BinaryOp.add;
@NodeSlotDef
public double a, b; public double a, b;
@NodeSlotDef
public SetNum result = val -> {};
@Override
public void build(Table table){
TextButton[] button = {null};
button[0] = table.button(op.symbol, Styles.cleart, () -> {
op = BinaryOp.all[(op.ordinal() + 1) % BinaryOp.all.length];
button[0].setText(op.symbol);
}).size(100f, 40f).pad(2f).get();
}
@Override
public void run(){
result.set(op.function.get(a, b));
}
@Override
public NodeCategory category(){
return NodeCategory.operations;
}
} }
public static class NodeInput<T>{ public static class ConditionNode extends LogicNode{
public boolean num; @NodeSlotDef(input = true)
public String name; public Runnable input = this::run;
public SetNum setNum; @NodeSlotDef
public Cons<T> setObject; public double condition;
@NodeSlotDef
public Runnable yes, no;
@Override
public void run(){
if(condition > 0){
yes.run();
}else{
no.run();
}
}
@Override
public NodeCategory category(){
return NodeCategory.controlFlow;
}
}
public static class NumberNode extends LogicNode{
@NodeSlotDef
public SetNum value;
public double var;
@Override
public void build(Table table){
table.field(var + "", Styles.nodeField, str -> var = Strings.parseDouble(str, var))
.valid(Strings::canParsePositiveFloat)
.size(100f, 40f).pad(2f).color(table.color)
.update(f -> f.setColor(f.isValid() ? table.color : Color.white));
}
@Override
public void run(){
value.set(var);
}
@Override
public NodeCategory category(){
return NodeCategory.controlFlow;
}
}
public static class SignalNode extends LogicNode{
@NodeSlotDef
public Runnable run;
@Override
public void run(){
run.run();
}
@Override
public NodeCategory category(){
return NodeCategory.controlFlow;
}
}
/** A field for a node, either an input or output. */
public static class NodeSlot{
/** The slot's display name. */
public final String name;
/** If true this field accepts values. */
public final boolean input;
/** The type of data accepted or returned by this slot. */
public final DataType type;
public final NumOutput<?> numOutput;
public final ObjOutput<?, ?> objOutput;
public NodeSlot(String name, boolean input, DataType type, NumOutput<?> numOutput, ObjOutput<?, ?> objOutput){
this.name = name;
this.input = input;
this.type = type;
this.numOutput = numOutput;
this.objOutput = objOutput;
}
}
static{
new NodeSlot("a", true, DataType.number, (BinaryOpNode node, double val) -> node.a = val, null);
}
public interface NumOutput<N>{
void set(N node, double val);
}
public interface ObjOutput<N, T>{
void set(N node, T val);
} }
public interface SetNum{ public interface SetNum{
void set(double val); void set(double val);
} }
public interface SetObj<T>{
void set(T val);
}
public enum NodeCategory{
controlFlow(Pal.accentBack),
operations(Pal.place.cpy().shiftSaturation(-0.4f).mul(0.7f));
public final Color color;
NodeCategory(Color color){
this.color = color;
}
}
/** The types of data a node field can be. */
public enum DataType{
/** A double. Used for integer calculations as well. */
number(Pal.place),
/** Any type of content, e.g. item. */
content(Color.cyan),
/** A building of a tile. */
building(Pal.items),
/** A unit on the map. */
unit(Pal.health),
/** Control flow (void)*/
control(Color.white),
/** Java string */
string(Color.royal);
public final Color color;
DataType(Color color){
this.color = color;
}
}
} }
+15 -1
View File
@@ -31,7 +31,7 @@ public class Styles{
public static KeybindDialogStyle defaultKeybindDialog; public static KeybindDialogStyle defaultKeybindDialog;
public static SliderStyle defaultSlider, vSlider; public static SliderStyle defaultSlider, vSlider;
public static LabelStyle defaultLabel, outlineLabel, techLabel; public static LabelStyle defaultLabel, outlineLabel, techLabel;
public static TextFieldStyle defaultField, areaField; public static TextFieldStyle defaultField, nodeField, areaField;
public static CheckBoxStyle defaultCheck; public static CheckBoxStyle defaultCheck;
public static DialogStyle defaultDialog, fullDialog; public static DialogStyle defaultDialog, fullDialog;
@@ -306,6 +306,20 @@ public class Styles{
messageFont = Fonts.def; messageFont = Fonts.def;
messageFontColor = Color.gray; messageFontColor = Color.gray;
}}; }};
nodeField = new TextFieldStyle(){{
font = Fonts.chat;
fontColor = Color.white;
disabledFontColor = Color.gray;
disabledBackground = underlineDisabled;
selection = Tex.selection;
background = underlineWhite;
invalidBackground = underlineRed;
cursor = Tex.cursor;
messageFont = Fonts.def;
messageFontColor = Color.gray;
}};
areaField = new TextFieldStyle(){{ areaField = new TextFieldStyle(){{
font = Fonts.chat; font = Fonts.chat;
fontColor = Color.white; fontColor = Color.white;
@@ -0,0 +1,28 @@
package mindustry.world.blocks.logic;
import mindustry.*;
import mindustry.gen.*;
import mindustry.world.*;
public class LogicProcessor extends Block{
public LogicProcessor(String name){
super(name);
update = true;
configurable = true;
}
public class LogicEntity extends Building{
@Override
public void updateTile(){
}
@Override
public boolean configTapped(){
Vars.ui.logic.show();
return false;
}
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=c47296a40165be7bf7c15d4ae9262c3de401e48e archash=ebfb38e52d8af4d0a48fbbdfc702846a0d135e21