v1.4.3: adjusted mod info windows to be able to show compressed buffs
This commit is contained in:
@@ -152,6 +152,8 @@ public class BuffIndicator extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean buffsHidden = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
|
|
||||||
@@ -213,11 +215,12 @@ public class BuffIndicator extends Component {
|
|||||||
lastIconLeft = icon.left();
|
lastIconLeft = icon.left();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffsHidden = false;
|
||||||
//squish buff icons together if there isn't enough room
|
//squish buff icons together if there isn't enough room
|
||||||
float excessWidth = lastIconLeft - right();
|
float excessWidth = lastIconLeft - right();
|
||||||
if (excessWidth > 0) {
|
if (excessWidth > 0) {
|
||||||
float leftAdjust = excessWidth/(buffButtons.size()-1);
|
float leftAdjust = excessWidth/(buffButtons.size()-1);
|
||||||
//can't squish by more than 50% on desktop and 62% on mobile
|
//can't squish by more than 50% on large and 62% on small
|
||||||
if (large && leftAdjust >= size*0.48f) leftAdjust = size*0.5f;
|
if (large && leftAdjust >= size*0.48f) leftAdjust = size*0.5f;
|
||||||
if (!large && leftAdjust >= size*0.62f) leftAdjust = size*0.65f;
|
if (!large && leftAdjust >= size*0.62f) leftAdjust = size*0.65f;
|
||||||
float cumulativeAdjust = leftAdjust * (buffButtons.size()-1);
|
float cumulativeAdjust = leftAdjust * (buffButtons.size()-1);
|
||||||
@@ -227,6 +230,7 @@ public class BuffIndicator extends Component {
|
|||||||
for (BuffButton icon : buttons) {
|
for (BuffButton icon : buttons) {
|
||||||
icon.setPos(icon.left() - cumulativeAdjust, icon.top());
|
icon.setPos(icon.left() - cumulativeAdjust, icon.top());
|
||||||
icon.visible = icon.left() <= right();
|
icon.visible = icon.left() <= right();
|
||||||
|
if (!icon.visible) buffsHidden = true;
|
||||||
PixelScene.align(icon);
|
PixelScene.align(icon);
|
||||||
bringToFront(icon);
|
bringToFront(icon);
|
||||||
icon.givePointerPriority();
|
icon.givePointerPriority();
|
||||||
@@ -235,6 +239,10 @@ public class BuffIndicator extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean allBuffsVisible(){
|
||||||
|
return !buffsHidden;
|
||||||
|
}
|
||||||
|
|
||||||
private static class BuffButton extends IconButton {
|
private static class BuffButton extends IconButton {
|
||||||
|
|
||||||
private Buff buff;
|
private Buff buff;
|
||||||
|
|||||||
@@ -71,19 +71,21 @@ public class WndInfoMob extends WndTitledMessage {
|
|||||||
image.y = Math.max( 0, name.height() + health.height() - image.height() );
|
image.y = Math.max( 0, name.height() + health.height() - image.height() );
|
||||||
|
|
||||||
float w = width - image.width() - GAP;
|
float w = width - image.width() - GAP;
|
||||||
|
int extraBuffSpace = 0;
|
||||||
|
|
||||||
|
//Tries to make space for up to 11 visible buffs
|
||||||
|
do {
|
||||||
|
name.maxWidth((int)w - extraBuffSpace);
|
||||||
|
buffs.setSize(w - name.width() - 8, 8);
|
||||||
|
extraBuffSpace += 8;
|
||||||
|
} while (extraBuffSpace <= 40 && !buffs.allBuffsVisible());
|
||||||
|
|
||||||
name.maxWidth((int)w);
|
|
||||||
name.setPos(x + image.width + GAP,
|
name.setPos(x + image.width + GAP,
|
||||||
image.height() > name.height() ? y +(image.height() - name.height()) / 2 : y);
|
image.height() > name.height() ? y +(image.height() - name.height()) / 2 : y);
|
||||||
|
|
||||||
health.setRect(image.width() + GAP, name.bottom() + GAP, w, health.height());
|
health.setRect(image.width() + GAP, name.bottom() + GAP, w, health.height());
|
||||||
|
|
||||||
buffs.setRect(
|
buffs.setPos(name.right(), name.bottom() - BuffIndicator.SIZE_SMALL-2);
|
||||||
name.right() + GAP-1,
|
|
||||||
name.bottom() - BuffIndicator.SIZE_SMALL-2,
|
|
||||||
w,
|
|
||||||
8
|
|
||||||
);
|
|
||||||
|
|
||||||
height = health.bottom();
|
height = health.bottom();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user