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