v1.4.2: Buff bar can now squish itself, max visible hero buffs up to 15
This commit is contained in:
@@ -129,6 +129,12 @@ public class PointerArea extends Visual implements Signal.Listener<PointerEvent>
|
|||||||
public void reset() {
|
public void reset() {
|
||||||
curEvent = null;
|
curEvent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//moves this pointer area to the front of the pointer event order
|
||||||
|
public void givePointerPriority(){
|
||||||
|
PointerEvent.removePointerListener( this );
|
||||||
|
PointerEvent.addPointerListener( this );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import com.watabou.noosa.tweeners.AlphaTweener;
|
|||||||
import com.watabou.noosa.ui.Component;
|
import com.watabou.noosa.ui.Component;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
public class BuffIndicator extends Component {
|
public class BuffIndicator extends Component {
|
||||||
@@ -200,6 +201,7 @@ public class BuffIndicator extends Component {
|
|||||||
|
|
||||||
//layout
|
//layout
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
float lastIconLeft = 0;
|
||||||
for (BuffButton icon : buffButtons.values()){
|
for (BuffButton icon : buffButtons.values()){
|
||||||
icon.updateIcon();
|
icon.updateIcon();
|
||||||
//button areas are slightly oversized, especially on small buttons
|
//button areas are slightly oversized, especially on small buttons
|
||||||
@@ -208,6 +210,28 @@ public class BuffIndicator extends Component {
|
|||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
icon.visible = icon.left() <= right();
|
icon.visible = icon.left() <= right();
|
||||||
|
lastIconLeft = icon.left();
|
||||||
|
}
|
||||||
|
|
||||||
|
//squish buff icons together if there isn't enough room
|
||||||
|
float excessWidth = lastIconLeft - right();
|
||||||
|
if (excessWidth > 0) {
|
||||||
|
float leftAdjust = excessWidth/(buffButtons.size()-1);
|
||||||
|
//can't squish by more than 50% on desktop and 62% on mobile
|
||||||
|
if (large && leftAdjust >= size*0.48f) leftAdjust = size*0.5f;
|
||||||
|
if (!large && leftAdjust >= size*0.62f) leftAdjust = size*0.65f;
|
||||||
|
float cumulativeAdjust = leftAdjust * (buffButtons.size()-1);
|
||||||
|
|
||||||
|
ArrayList<BuffButton> buttons = new ArrayList<>(buffButtons.values());
|
||||||
|
Collections.reverse(buttons);
|
||||||
|
for (BuffButton icon : buttons) {
|
||||||
|
icon.setPos(icon.left() - cumulativeAdjust, icon.top());
|
||||||
|
icon.visible = icon.left() <= right();
|
||||||
|
PixelScene.align(icon);
|
||||||
|
bringToFront(icon);
|
||||||
|
icon.givePointerPriority();
|
||||||
|
cumulativeAdjust -= leftAdjust;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,5 +210,9 @@ public class Button extends Component {
|
|||||||
KeyEvent.removeKeyListener( keyListener );
|
KeyEvent.removeKeyListener( keyListener );
|
||||||
killTooltip();
|
killTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void givePointerPriority(){
|
||||||
|
hotArea.givePointerPriority();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user