File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
blade-engine/src/com/bladecoder/engine/ui Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ public AnimButton(Skin skin, String styleName) {
8
8
super (skin , styleName );
9
9
}
10
10
11
+ public AnimButton (ButtonStyle style ) {
12
+ super (style );
13
+ }
14
+
11
15
@ Override
12
16
public void act (float delta ) {
13
17
ButtonStyle style = getStyle ();
Original file line number Diff line number Diff line change 6
6
import com .badlogic .gdx .scenes .scene2d .utils .ChangeListener ;
7
7
import com .bladecoder .engine .model .World ;
8
8
import com .bladecoder .engine .ui .InventoryUI .InventoryPos ;
9
+ import com .bladecoder .engine .ui .InventoryUI .InventoryUIStyle ;
9
10
import com .bladecoder .engine .util .DPIUtils ;
10
11
11
12
public class InventoryButton extends AnimButton {
@@ -15,8 +16,19 @@ public class InventoryButton extends AnimButton {
15
16
16
17
private int numItems = Integer .MAX_VALUE ;
17
18
19
+ private static ButtonStyle getDefaultStyle (Skin skin ) {
20
+ InventoryUIStyle inventoryUIStyle = skin .get (InventoryUIStyle .class );
21
+ ButtonStyle inventoryButtonStyle = inventoryUIStyle .inventoryButtonStyle ;
22
+
23
+ if (inventoryButtonStyle == null ) {
24
+ inventoryButtonStyle = skin .get ("inventory" , ButtonStyle .class );
25
+ }
26
+
27
+ return inventoryButtonStyle ;
28
+ }
29
+
18
30
public InventoryButton (Skin skin , World w , InventoryUI inv ) {
19
- super (skin , "inventory" );
31
+ super (getDefaultStyle ( skin ) );
20
32
this .inventory = inv ;
21
33
this .world = w ;
22
34
Original file line number Diff line number Diff line change 26
26
import com .badlogic .gdx .scenes .scene2d .InputListener ;
27
27
import com .badlogic .gdx .scenes .scene2d .actions .Actions ;
28
28
import com .badlogic .gdx .scenes .scene2d .ui .Button ;
29
- import com .badlogic .gdx .scenes .scene2d .ui .ImageButton . ImageButtonStyle ;
29
+ import com .badlogic .gdx .scenes .scene2d .ui .Button . ButtonStyle ;
30
30
import com .badlogic .gdx .scenes .scene2d .utils .ChangeListener ;
31
31
import com .badlogic .gdx .scenes .scene2d .utils .Drawable ;
32
32
import com .bladecoder .engine .model .ActorRenderer ;
@@ -368,7 +368,8 @@ static public class InventoryUIStyle {
368
368
public Drawable background ;
369
369
/** Optional. */
370
370
public Drawable itemBackground ;
371
- public ImageButtonStyle menuButtonStyle ;
371
+ public ButtonStyle menuButtonStyle ;
372
+ public ButtonStyle inventoryButtonStyle ;
372
373
373
374
public InventoryUIStyle () {
374
375
}
@@ -377,6 +378,7 @@ public InventoryUIStyle(InventoryUIStyle style) {
377
378
background = style .background ;
378
379
menuButtonStyle = style .menuButtonStyle ;
379
380
itemBackground = style .itemBackground ;
381
+ inventoryButtonStyle = style .inventoryButtonStyle ;
380
382
}
381
383
}
382
384
}
You can’t perform that action at this time.
0 commit comments