mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-05 23:20:27 +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(){
|
public boolean isConnecting(){
|
||||||
return connecting;
|
return connecting;
|
||||||
}
|
}
|
||||||
|
@ -272,6 +272,10 @@ public class Net{
|
|||||||
throw new RuntimeException("Received stream chunk without a StreamBegin beforehand!");
|
throw new RuntimeException("Received stream chunk without a StreamBegin beforehand!");
|
||||||
}
|
}
|
||||||
builder.add(c.data);
|
builder.add(c.data);
|
||||||
|
|
||||||
|
ui.loadfrag.setProgress(builder.progress());
|
||||||
|
netClient.resetTimeout();
|
||||||
|
|
||||||
if(builder.isDone()){
|
if(builder.isDone()){
|
||||||
streams.remove(builder.id);
|
streams.remove(builder.id);
|
||||||
handleClientReceived(builder.build());
|
handleClientReceived(builder.build());
|
||||||
|
@ -17,6 +17,7 @@ public class LoadingFragment extends Fragment{
|
|||||||
private TextButton button;
|
private TextButton button;
|
||||||
private Bar bar;
|
private Bar bar;
|
||||||
private Label nameLabel;
|
private Label nameLabel;
|
||||||
|
private float progValue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void build(Group parent){
|
public void build(Group parent){
|
||||||
@ -55,6 +56,13 @@ public class LoadingFragment extends Fragment{
|
|||||||
bar.set(() -> ((int)(progress.get() * 100) + "%"), progress, Pal.accent);
|
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){
|
public void setButton(Runnable listener){
|
||||||
button.visible = true;
|
button.visible = true;
|
||||||
button.getListeners().remove(button.getListeners().size - 1);
|
button.getListeners().remove(button.getListeners().size - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user