Fixed #7403
This commit is contained in:
@@ -10,6 +10,7 @@ import arc.scene.ui.layout.*;
|
|||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.core.GameState.*;
|
import mindustry.core.GameState.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.logic.LExecutor.*;
|
import mindustry.logic.LExecutor.*;
|
||||||
@@ -50,6 +51,33 @@ public class LogicDialog extends BaseDialog{
|
|||||||
add(buttons).growX().name("canvas");
|
add(buttons).growX().name("canvas");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Color typeColor(Var s, Color color){
|
||||||
|
return color.set(
|
||||||
|
!s.isobj ? Pal.place :
|
||||||
|
s.objval == null ? Color.darkGray :
|
||||||
|
s.objval instanceof String ? Pal.ammo :
|
||||||
|
s.objval instanceof Content ? Pal.logicOperations :
|
||||||
|
s.objval instanceof Building ? Pal.logicBlocks :
|
||||||
|
s.objval instanceof Unit ? Pal.logicUnits :
|
||||||
|
s.objval instanceof Team ? Pal.logicUnits :
|
||||||
|
s.objval instanceof Enum<?> ? Pal.logicIo :
|
||||||
|
Color.white
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String typeName(Var s){
|
||||||
|
return
|
||||||
|
!s.isobj ? "number" :
|
||||||
|
s.objval == null ? "null" :
|
||||||
|
s.objval instanceof String ? "string" :
|
||||||
|
s.objval instanceof Content ? "content" :
|
||||||
|
s.objval instanceof Building ? "building" :
|
||||||
|
s.objval instanceof Team ? "team" :
|
||||||
|
s.objval instanceof Unit ? "unit" :
|
||||||
|
s.objval instanceof Enum<?> ? "enum" :
|
||||||
|
"unknown";
|
||||||
|
}
|
||||||
|
|
||||||
private void setup(){
|
private void setup(){
|
||||||
buttons.clearChildren();
|
buttons.clearChildren();
|
||||||
buttons.defaults().size(160f, 64f);
|
buttons.defaults().size(160f, 64f);
|
||||||
@@ -109,26 +137,6 @@ public class LogicDialog extends BaseDialog{
|
|||||||
Color varColor = Pal.gray;
|
Color varColor = Pal.gray;
|
||||||
float stub = 8f, mul = 0.5f, pad = 4;
|
float stub = 8f, mul = 0.5f, pad = 4;
|
||||||
|
|
||||||
Color color =
|
|
||||||
!s.isobj ? Pal.place :
|
|
||||||
s.objval == null ? Color.darkGray :
|
|
||||||
s.objval instanceof String ? Pal.ammo :
|
|
||||||
s.objval instanceof Content ? Pal.logicOperations :
|
|
||||||
s.objval instanceof Building ? Pal.logicBlocks :
|
|
||||||
s.objval instanceof Unit ? Pal.logicUnits :
|
|
||||||
s.objval instanceof Enum<?> ? Pal.logicIo :
|
|
||||||
Color.white;
|
|
||||||
|
|
||||||
String typeName =
|
|
||||||
!s.isobj ? "number" :
|
|
||||||
s.objval == null ? "null" :
|
|
||||||
s.objval instanceof String ? "string" :
|
|
||||||
s.objval instanceof Content ? "content" :
|
|
||||||
s.objval instanceof Building ? "building" :
|
|
||||||
s.objval instanceof Unit ? "unit" :
|
|
||||||
s.objval instanceof Enum<?> ? "enum" :
|
|
||||||
"unknown";
|
|
||||||
|
|
||||||
t.add(new Image(Tex.whiteui, varColor.cpy().mul(mul))).width(stub);
|
t.add(new Image(Tex.whiteui, varColor.cpy().mul(mul))).width(stub);
|
||||||
t.stack(new Image(Tex.whiteui, varColor), new Label(" " + s.name + " ", Styles.outlineLabel){{
|
t.stack(new Image(Tex.whiteui, varColor), new Label(" " + s.name + " ", Styles.outlineLabel){{
|
||||||
setColor(Pal.accent);
|
setColor(Pal.accent);
|
||||||
@@ -154,9 +162,13 @@ public class LogicDialog extends BaseDialog{
|
|||||||
label.act(1f);
|
label.act(1f);
|
||||||
}).padRight(pad);
|
}).padRight(pad);
|
||||||
|
|
||||||
//TODO type name does not update, is this important?
|
t.add(new Image(Tex.whiteui, typeColor(s, new Color()).mul(mul))).update(i -> i.setColor(typeColor(s, i.color).mul(mul))).width(stub);
|
||||||
t.add(new Image(Tex.whiteui, color.cpy().mul(mul))).width(stub);
|
|
||||||
t.stack(new Image(Tex.whiteui, color), new Label(" " + typeName + " ", Styles.outlineLabel));
|
t.stack(new Image(Tex.whiteui, typeColor(s, new Color())){{
|
||||||
|
update(() -> setColor(typeColor(s, color)));
|
||||||
|
}}, new Label(() -> " " + typeName(s) + " "){{
|
||||||
|
setStyle(Styles.outlineLabel);
|
||||||
|
}});
|
||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user