window modification signal
This commit is contained in:
parent
b9ccf5990c
commit
3db24ef6c7
@ -11,6 +11,7 @@ import electrosphere.client.targeting.crosshair.Crosshair;
|
||||
import electrosphere.client.terrain.cells.DrawCellManager;
|
||||
import electrosphere.controls.ControlHandler;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.engine.signal.Signal.SignalType;
|
||||
import electrosphere.engine.threads.LabeledThread.ThreadLabel;
|
||||
import electrosphere.entity.DrawableUtils;
|
||||
import electrosphere.entity.Entity;
|
||||
@ -62,10 +63,10 @@ public class ClientLoading {
|
||||
|
||||
|
||||
protected static void loadClientWorld(Object[] params){
|
||||
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||
loadingWindow.setVisible(true);
|
||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
||||
WindowUtils.closeWindow(WindowStrings.WINDOW_MENU_MAIN);
|
||||
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, true);
|
||||
});
|
||||
//disable menu input
|
||||
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
||||
//initialize the "real" objects simulation
|
||||
@ -83,7 +84,9 @@ public class ClientLoading {
|
||||
//sets micro and macro sims to ready if they exist
|
||||
setSimulationsToReady();
|
||||
//make loading window disappear
|
||||
loadingWindow.setVisible(false);
|
||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
||||
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false);
|
||||
});
|
||||
//recapture screen
|
||||
Globals.controlHandler.setRecapture(true);
|
||||
//set rendering flags to main game mode
|
||||
@ -102,10 +105,10 @@ public class ClientLoading {
|
||||
* Loads the viewport
|
||||
*/
|
||||
protected static void loadViewport(Object[] params){
|
||||
Window loadingWindow = (Window)Globals.elementService.getWindow(WindowStrings.WINDOW_LOADING);
|
||||
WindowUtils.replaceMainMenuContents(MenuGenerators.createEmptyMainMenu());
|
||||
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(WindowStrings.WINDOW_MENU_MAIN), false);
|
||||
loadingWindow.setVisible(true);
|
||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
||||
WindowUtils.closeWindow(WindowStrings.WINDOW_MENU_MAIN);
|
||||
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, true);
|
||||
});
|
||||
//disable menu input
|
||||
Globals.controlHandler.hintUpdateControlState(ControlHandler.ControlsState.NO_INPUT);
|
||||
|
||||
@ -124,7 +127,9 @@ public class ClientLoading {
|
||||
//sets micro and macro sims to ready if they exist
|
||||
setSimulationsToReady();
|
||||
//make loading window disappear
|
||||
loadingWindow.setVisible(false);
|
||||
Globals.signalSystem.post(SignalType.UI_MODIFICATION, () -> {
|
||||
WindowUtils.recursiveSetVisible(WindowStrings.WINDOW_LOADING, false);
|
||||
});
|
||||
//recapture screen
|
||||
Globals.controlHandler.setRecapture(true);
|
||||
//set rendering flags to main game mode
|
||||
|
||||
@ -22,6 +22,7 @@ public class Signal {
|
||||
//
|
||||
YOGA_APPLY,
|
||||
YOGA_DESTROY,
|
||||
UI_MODIFICATION,
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -111,5 +111,13 @@ public class SignalSystem implements Service {
|
||||
public void post(SignalType type){
|
||||
this.post(type,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts a signal
|
||||
* @param type The type of signal
|
||||
*/
|
||||
public void post(SignalType type, Runnable runnable){
|
||||
this.post(type,(Object)runnable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -56,6 +56,15 @@ public class WindowUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively sets a window as visible or not
|
||||
* @param topLevelMenu The window string
|
||||
* @param visible true for visible, false for invisible
|
||||
*/
|
||||
public static void recursiveSetVisible(String windowString, boolean visible){
|
||||
WindowUtils.recursiveSetVisible(Globals.elementService.getWindow(windowString), visible);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the window string is visible
|
||||
* @param windowString The window string
|
||||
|
||||
@ -523,6 +523,11 @@ public class ElementService extends SignalServiceImpl {
|
||||
target.destroy();
|
||||
rVal = true;
|
||||
} break;
|
||||
case UI_MODIFICATION: {
|
||||
Runnable modificationCallback = (Runnable)signal.getData();
|
||||
modificationCallback.run();
|
||||
rVal = true;
|
||||
} break;
|
||||
default: {
|
||||
} break;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user