core camera for enemies

This commit is contained in:
Sharlotte
2021-07-22 19:21:17 +09:00
parent 97d09ac77c
commit 5c7233bb64

View File

@@ -782,25 +782,36 @@ public class HudUi {
} }
public void setCore(Table table){ public void setCore(Table table){
table.add(new Table(t -> { table.table(t -> {
if(Vars.player.unit() == null) return; if (Vars.player.unit() == null) return;
coreamount = Vars.player.unit().team().cores().size;
for(int r = 0; r < coreamount; r++){
CoreBlock.CoreBuild core = Vars.player.unit().team().cores().get(r);
if(coreamount > 1 && r % 3 == 0) t.row(); for(int i = 0; i < coreItems.tables.size; i++){
else if(r % 3 == 0) t.row(); int finalI = i;
t.table(Tex.underline2, head -> {
head.table(label -> {
label.center();
label.label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]");
});
});
t.row();
coreamount = coreItems.teams[i].cores().size;
for (int r = 0; r < coreamount; r++) {
CoreBlock.CoreBuild core = coreItems.teams[i].cores().get(r);
if (coreamount > 1 && r % 3 == 0) t.row();
else if (r % 3 == 0) t.row();
t.table(tt -> { t.table(tt -> {
tt.add(new Stack(){{ tt.add(new Stack() {{
add(new Table(s -> { add(new Table(s -> {
s.left(); s.left();
Image image = new Image(core.block.uiIcon); Image image = new Image(core.block.uiIcon);
image.clicked(() -> { image.clicked(() -> {
if(control.input instanceof DesktopInput) ((DesktopInput) control.input).panning = true; if (control.input instanceof DesktopInput)
((DesktopInput) control.input).panning = true;
Core.camera.position.set(core.x, core.y); Core.camera.position.set(core.x, core.y);
}); });
if(!mobile){ if (!mobile) {
HandCursorListener listener1 = new HandCursorListener(); HandCursorListener listener1 = new HandCursorListener();
image.addListener(listener1); image.addListener(listener1);
image.update(() -> image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta))); image.update(() -> image.color.lerp(!listener1.isOver() ? Color.lightGray : Color.white, Mathf.clamp(0.4f * Time.delta)));
@@ -819,12 +830,14 @@ public class HudUi {
})); }));
}}); }});
tt.row(); tt.row();
Label label = new Label(() -> "(" + (int)core.x / 8 + ", " + (int)core.y / 8 + ")"); Label label = new Label(() -> "(" + (int) core.x / 8 + ", " + (int) core.y / 8 + ")");
label.setFontScale(Scl.scl()); label.setFontScale(Scl.scl());
tt.add(label); tt.add(label);
}); });
} }
})); t.row();
}
});
} }
public void addCoreTable(){ public void addCoreTable(){
@@ -840,8 +853,8 @@ public class HudUi {
} }
} }
coreScrollPos = corePane.getScrollY(); coreScrollPos = corePane.getScrollY();
if(coreamount != Vars.player.unit().team().cores().size && Vars.player != null) corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
}); });
corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
corePane.setOverscroll(false, false); corePane.setOverscroll(false, false);
if(Vars.player != null) corePane.setWidget(new Table(tx -> tx.table(this::setCore).left())); if(Vars.player != null) corePane.setWidget(new Table(tx -> tx.table(this::setCore).left()));
coreTable = new Table(table -> { coreTable = new Table(table -> {