mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-05 07:00:49 +07:00
Added world data progress bar
This commit is contained in:
parent
a5fe8970c6
commit
def1094357
@ -507,6 +507,11 @@ public class NetClient implements ApplicationListener{
|
||||
}
|
||||
}
|
||||
|
||||
/** Resets the world data timeout counter. */
|
||||
public void resetTimeout(){
|
||||
timeoutTime = 0f;
|
||||
}
|
||||
|
||||
public boolean isConnecting(){
|
||||
return connecting;
|
||||
}
|
||||
|
@ -272,6 +272,10 @@ public class Net{
|
||||
throw new RuntimeException("Received stream chunk without a StreamBegin beforehand!");
|
||||
}
|
||||
builder.add(c.data);
|
||||
|
||||
ui.loadfrag.setProgress(builder.progress());
|
||||
netClient.resetTimeout();
|
||||
|
||||
if(builder.isDone()){
|
||||
streams.remove(builder.id);
|
||||
handleClientReceived(builder.build());
|
||||
|
@ -17,6 +17,7 @@ public class LoadingFragment extends Fragment{
|
||||
private TextButton button;
|
||||
private Bar bar;
|
||||
private Label nameLabel;
|
||||
private float progValue;
|
||||
|
||||
@Override
|
||||
public void build(Group parent){
|
||||
@ -55,6 +56,13 @@ public class LoadingFragment extends Fragment{
|
||||
bar.set(() -> ((int)(progress.get() * 100) + "%"), progress, Pal.accent);
|
||||
}
|
||||
|
||||
public void setProgress(float progress){
|
||||
progValue = progress;
|
||||
if(!bar.visible){
|
||||
setProgress(() -> progValue);
|
||||
}
|
||||
}
|
||||
|
||||
public void setButton(Runnable listener){
|
||||
button.visible = true;
|
||||
button.getListeners().remove(button.getListeners().size - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user