WIP launch animation progress

This commit is contained in:
Anuken
2021-07-27 17:43:12 -04:00
parent 00e3a59463
commit 737fa4fa69
7 changed files with 55 additions and 24 deletions

View File

@@ -913,6 +913,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
}else{
CoreBlock block = from.info.bestCoreType instanceof CoreBlock b ? b : (CoreBlock)Blocks.coreShard;
//TODO load launchFrom sector right before launching so animation is correct
loadouts.show(block, from, () -> {
from.removeItems(universe.getLastLoadout().requirements());
from.removeItems(universe.getLaunchResources());
@@ -923,7 +924,8 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
//TODO
renderer.showLaunch();
hide();
Time.runTask(launchDuration, () -> control.playSector(from, sector));
//run with less delay, as the loading animation is delayed by several frames
Time.runTask(coreLandDuration - 8f, () -> control.playSector(from, sector));
});
}
}else if(mode == select){

View File

@@ -545,11 +545,21 @@ public class HudFragment extends Fragment{
}
}
public void showLaunchDirect(){
public void showLaunch(){
float margin = 30f;
Image image = new Image();
image.color.a = 0f;
image.touchable = Touchable.disabled;
image.setFillParent(true);
image.actions(Actions.fadeIn(launchDuration / 60f, Interp.pow2In), Actions.delay(8f / 60f), Actions.remove());
image.actions(Actions.delay((coreLandDuration - margin) / 60f), Actions.fadeIn(margin / 60f, Interp.pow2In), Actions.delay(6f / 60f), Actions.remove());
image.update(() -> {
image.toFront();
ui.loadfrag.toFront();
if(state.isMenu()){
image.remove();
}
});
Core.scene.add(image);
}
@@ -558,9 +568,10 @@ public class HudFragment extends Fragment{
image.color.a = 1f;
image.touchable = Touchable.disabled;
image.setFillParent(true);
image.actions(Actions.fadeOut(0.8f), Actions.remove());
image.actions(Actions.fadeOut(35f / 60f), Actions.remove());
image.update(() -> {
image.toFront();
ui.loadfrag.toFront();
if(state.isMenu()){
image.remove();
}

View File

@@ -45,6 +45,10 @@ public class LoadingFragment extends Fragment{
});
}
public void toFront(){
table.toFront();
}
public void setProgress(Floatp progress){
bar.reset(0f);
bar.visible = true;