fixed item tap

This commit is contained in:
sharlotte
2021-08-26 09:55:08 +09:00
parent 09e5c4bc9e
commit 0c76cd3ec8
4 changed files with 19 additions and 25 deletions

View File

@@ -38,18 +38,6 @@ public class BarInfo {
static Seq<String> strings = Seq.with("","","","","",""); static Seq<String> strings = Seq.with("","","","","","");
static FloatSeq numbers = FloatSeq.with(0f,0f,0f,0f,0f,0f); static FloatSeq numbers = FloatSeq.with(0f,0f,0f,0f,0f,0f);
static Seq<Color> colors = Seq.with(Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear); static Seq<Color> colors = Seq.with(Color.clear,Color.clear,Color.clear,Color.clear,Color.clear,Color.clear);
static Field linkedCore; // Versions below 130 don't have this public
static {
if(Version.build <= 129) {
try {
linkedCore = StorageBlock.StorageBuild.class.getDeclaredField("linkedCore");
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
linkedCore.setAccessible(true);
}
}
public static <T extends Teamc> void getInfo(T target) throws IllegalAccessException, NoSuchFieldException { public static <T extends Teamc> void getInfo(T target) throws IllegalAccessException, NoSuchFieldException {
for(int i = 0; i < 6; i++) { //init for(int i = 0; i < 6; i++) { //init

View File

@@ -1072,16 +1072,17 @@ public class HudUi {
} }
public void setItem(Table table){ public void setItem(Table table){
table.left().defaults().minWidth(Scl.scl(modUiScale) * 54 * 8f).align(Align.center);
table.table().update(t -> { table.table().update(t -> {
t.clear(); t.clear();
for(int i = 0; i < coreItems.tables.size; i++){ for(int i = 0; i < coreItems.tables.size; i++){
if((state.rules.pvp && coreItems.teams[i] != player.team()) || coreItems.teams[i].cores().isEmpty()) continue; if((state.rules.pvp && coreItems.teams[i] != player.team()) || coreItems.teams[i].cores().isEmpty()) continue;
int finalI = i; int finalI = i;
Label label = new Label(() -> "[#" + coreItems.teams[finalI].color.toString() + "]" + coreItems.teams[finalI].name + "[]"); t.table(tt -> {
label.setFontScale(modUiScale); tt.center().defaults().minWidth(Scl.scl(modUiScale) * 54 * 8f);
t.background(Tex.underline2).add(label).center(); coreItems.tables.get(finalI).setBackground(((NinePatchDrawable)Tex.underline2).tint(coreItems.teams[finalI].color));
t.row(); tt.add(coreItems.tables.get(finalI)).left();
t.add(coreItems.tables.get(i)).left(); }).pad(4);
t.row(); t.row();
} }
}); });
@@ -1107,7 +1108,7 @@ public class HudUi {
}); });
itemTable = new Table(table -> { itemTable = new Table(table -> {
table.left().defaults().width(Scl.scl(modUiScale) * 54 * 8f).height(Scl.scl(modUiScale) * 32 * 8f).align(Align.left); table.left().defaults().minWidth(Scl.scl(modUiScale) * 54 * 8f).height(Scl.scl(modUiScale) * 32 * 8f).align(Align.left);
table.table(Tex.button, t -> { table.table(Tex.button, t -> {
t.add(itemPane); t.add(itemPane);
t.update(() -> { t.update(() -> {

View File

@@ -106,7 +106,7 @@ public class SettingS {
Seq<Seq<SharSetting>> settingSeq = new Seq<>(); Seq<Seq<SharSetting>> settingSeq = new Seq<>();
Seq<SharSetting> tapSeq = new Seq<>(); Seq<SharSetting> tapSeq = new Seq<>();
addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? "default bar" : s + "th bar", tapSeq); addGraphicSlideSetting("barstyle", 0, 0, 5, 1, s -> s == 0 ? "default bar" : s + "th bar", tapSeq);
addGraphicSlideSetting("infoUiScale", 100, 50, 100, 5, s -> s + "%", tapSeq); addGraphicSlideSetting("infoUiScale", 75, 50, 100, 5, s -> s + "%", tapSeq);
addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec", tapSeq); addGraphicSlideSetting("coreItemCheckRate", 60, 6, 180, 6, s -> Strings.fixed(s/60f,1) + "sec", tapSeq);
addGraphicTypeSetting("wavemax", 0, 100,200, true, () -> true, s -> s + "waves", tapSeq); addGraphicTypeSetting("wavemax", 0, 100,200, true, () -> true, s -> s + "waves", tapSeq);
addGraphicCheckSetting("infoui", true, tapSeq); addGraphicCheckSetting("infoui", true, tapSeq);

View File

@@ -91,6 +91,11 @@ public class CoresItemsDisplay {
} }
}); });
Label label1 = new Label(() -> "[#" + team.color.toString() + "]" + team.name + "[]");
label1.setFontScale(modUiScale);
t.add(label1).row();
t.row();
t.table(coretable -> { t.table(coretable -> {
final int[] i = {0}; final int[] i = {0};
for(CoreBlock.CoreBuild core : team.cores()) { for(CoreBlock.CoreBuild core : team.cores()) {
@@ -165,16 +170,16 @@ public class CoresItemsDisplay {
unitTable.clear(); unitTable.clear();
final int[] i = {0}; final int[] i = {0};
for(UnitType unit : content.units()){ for(UnitType unit : content.units()){
unitTable.table(tt -> { if(unit != UnitTypes.block && Groups.unit.contains(u -> u.type == unit && u.team == team)){
tt.center(); unitTable.table(tt -> {
if(unit != UnitTypes.block && Groups.unit.contains(u -> u.type == unit && u.team == team)){ tt.center();
tt.image(unit.uiIcon).size(iconSmall * modUiScale).padRight(3 * modUiScale).tooltip(ttt -> ttt.background(Styles.black6).margin(2f * modUiScale).add(unit.localizedName).style(Styles.outlineLabel)); tt.image(unit.uiIcon).size(iconSmall * modUiScale).padRight(3 * modUiScale).tooltip(ttt -> ttt.background(Styles.black6).margin(2f * modUiScale).add(unit.localizedName).style(Styles.outlineLabel));
Label label = new Label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit))); Label label = new Label(() -> core == null ? "0" : UI.formatAmount(Groups.unit.count(u -> u.team == team && u.type == unit)));
label.setFontScale(modUiScale); label.setFontScale(modUiScale);
tt.add(label).padRight(3 * modUiScale).minWidth(5 * 8f * modUiScale).left(); tt.add(label).padRight(3 * modUiScale).minWidth(5 * 8f * modUiScale).left();
if(++i[0] % 5 == 0) unitTable.row(); });
} if(++i[0] % 5 == 0) unitTable.row();
}); }
} }
}); });
}); });