v2.1.0: adjusted toolbar dimming behaviour to be less obtrusive
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -228,6 +228,7 @@ public class Toolbar extends Component {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
btnWait.icon( 176, 0, 16, 16 );
|
||||
|
||||
//hidden button for rest keybind
|
||||
add(new Button(){
|
||||
@@ -314,6 +315,7 @@ public class Toolbar extends Component {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
btnSearch.icon( 192, 0, 16, 16 );
|
||||
|
||||
add(btnInventory = new Tool(0, 0, 24, 26) {
|
||||
private CurrencyIndicator ind;
|
||||
@@ -376,7 +378,16 @@ public class Toolbar extends Component {
|
||||
arrow.y = bottom()-arrow.height-1;
|
||||
arrow.angle = bottom() == camera().height ? 0 : 180;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable(boolean value) {
|
||||
if (value != active){
|
||||
arrow.alpha( value ? 1f : 0.4f );
|
||||
}
|
||||
super.enable(value);
|
||||
}
|
||||
});
|
||||
btnInventory.icon( 160, 0, 16, 16 );
|
||||
|
||||
//hidden button for inventory selector keybind
|
||||
add(new Button(){
|
||||
@@ -681,6 +692,7 @@ public class Toolbar extends Component {
|
||||
private static final int BGCOLOR = 0x7B8073;
|
||||
|
||||
private Image base;
|
||||
private Image icon;
|
||||
|
||||
public Tool( int x, int y, int width, int height ) {
|
||||
super();
|
||||
@@ -695,6 +707,13 @@ public class Toolbar extends Component {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public void icon( int x, int y, int width, int height){
|
||||
if (icon == null) icon = new Image( Assets.Interfaces.TOOLBAR );
|
||||
add(icon);
|
||||
|
||||
icon.frame( x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createChildren() {
|
||||
@@ -710,10 +729,16 @@ public class Toolbar extends Component {
|
||||
|
||||
base.x = x;
|
||||
base.y = y;
|
||||
|
||||
if (icon != null){
|
||||
icon.x = x + (width()- icon.width())/2f;
|
||||
icon.y = y + (height()- icon.height())/2f;
|
||||
}
|
||||
}
|
||||
|
||||
public void alpha( float value ){
|
||||
base.alpha(value);
|
||||
if (icon != null) icon.alpha(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -732,11 +757,7 @@ public class Toolbar extends Component {
|
||||
|
||||
public void enable( boolean value ) {
|
||||
if (value != active) {
|
||||
if (value) {
|
||||
base.resetColor();
|
||||
} else {
|
||||
base.tint( BGCOLOR, 0.7f );
|
||||
}
|
||||
if (icon != null) icon.alpha( value ? 1f : 0.4f);
|
||||
active = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user