Implemented player list for android
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 192 B |
+174
-167
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 826 B |
@@ -10,7 +10,7 @@ import io.anuke.ucore.UCore;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
|
||||
public class Vars{
|
||||
public static final boolean testAndroid = false;
|
||||
public static final boolean testAndroid = true;
|
||||
//shorthand for whether or not this is running on android
|
||||
public static final boolean android = (Gdx.app.getType() == ApplicationType.Android) || testAndroid;
|
||||
//shorthand for whether or not this is running on GWT
|
||||
|
||||
@@ -36,6 +36,8 @@ public class HudFragment implements Fragment{
|
||||
atop();
|
||||
aleft();
|
||||
|
||||
new table(){{
|
||||
|
||||
new table() {{
|
||||
left();
|
||||
float dsize = 58;
|
||||
@@ -65,17 +67,13 @@ public class HudFragment implements Fragment{
|
||||
|
||||
new imagebutton("icon-pause", isize, () -> {
|
||||
if (Net.active() && Vars.android) {
|
||||
if(ui.chatfrag.chatOpen()){
|
||||
ui.chatfrag.hide();
|
||||
}else{
|
||||
ui.chatfrag.toggle();
|
||||
}
|
||||
ui.listfrag.visible = !ui.listfrag.visible;
|
||||
} else {
|
||||
GameState.set(GameState.is(State.paused) ? State.playing : State.paused);
|
||||
}
|
||||
}).update(i -> {
|
||||
if (Net.active() && Vars.android) {
|
||||
i.getStyle().imageUp = Core.skin.getDrawable("icon-chat");
|
||||
i.getStyle().imageUp = Core.skin.getDrawable("icon-players");
|
||||
} else {
|
||||
i.setDisabled(Net.active());
|
||||
i.getStyle().imageUp = Core.skin.getDrawable(GameState.is(State.paused) ? "icon-play" : "icon-pause");
|
||||
@@ -103,6 +101,16 @@ public class HudFragment implements Fragment{
|
||||
|
||||
}}.end();
|
||||
|
||||
new imagebutton("icon-chat", 40f, () -> {
|
||||
if (ui.chatfrag.chatOpen()) {
|
||||
ui.chatfrag.hide();
|
||||
} else {
|
||||
ui.chatfrag.toggle();
|
||||
}
|
||||
}).visible(() -> Net.active() && android).top().left().size(58f).get();
|
||||
|
||||
}}.end();
|
||||
|
||||
//tutorial ui table
|
||||
new table(){{
|
||||
control.getTutorial().buildUI(this);
|
||||
|
||||
@@ -15,6 +15,7 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public class PlayerListFragment implements Fragment{
|
||||
public boolean visible = false;
|
||||
Table content = new Table();
|
||||
int last = 0;
|
||||
|
||||
@@ -41,13 +42,19 @@ public class PlayerListFragment implements Fragment{
|
||||
}}.end();
|
||||
|
||||
update(t -> {
|
||||
if(!Vars.android){
|
||||
visible = Inputs.keyDown("player_list");
|
||||
}
|
||||
if(!(Net.active() && !GameState.is(State.menu))){
|
||||
visible = false;
|
||||
}
|
||||
if(Vars.control.playerGroup.amount() != last){
|
||||
rebuild();
|
||||
last = Vars.control.playerGroup.amount();
|
||||
}
|
||||
});
|
||||
|
||||
visible(() -> Inputs.keyDown("player_list") && Net.active() && !GameState.is(State.menu));
|
||||
visible(() -> visible);
|
||||
}}.end();
|
||||
|
||||
rebuild();
|
||||
|
||||
Reference in New Issue
Block a user