Search in sources :

Example 1 with Console

use of org.terasology.engine.logic.console.Console in project Terasology by MovingBlocks.

the class ComponentSystemManagerTest method setUp.

@BeforeEach
public void setUp() {
    Context context = mock(Context.class);
    EntityManager entityManager = mock(EntityManager.class);
    when(entityManager.getEventSystem()).thenReturn(mock(EventSystem.class));
    when(context.get(EntityManager.class)).thenReturn(entityManager);
    console = mock(Console.class);
    when(context.get(Console.class)).thenReturn(console);
    systemUnderTest = new ComponentSystemManager(context);
}
Also used : Context(org.terasology.engine.context.Context) EntityManager(org.terasology.engine.entitySystem.entity.EntityManager) Console(org.terasology.engine.logic.console.Console) EventSystem(org.terasology.engine.entitySystem.event.internal.EventSystem) ComponentSystemManager(org.terasology.engine.core.ComponentSystemManager) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with Console

use of org.terasology.engine.logic.console.Console in project Terasology by MovingBlocks.

the class ComponentSystemManager method initialise.

public void initialise() {
    if (!initialised) {
        console = context.get(Console.class);
        for (ComponentSystem system : getAllSystems()) {
            initialiseSystem(system);
        }
        initialised = true;
    } else {
        logger.error("ComponentSystemManager got initialized twice");
    }
}
Also used : Console(org.terasology.engine.logic.console.Console) ComponentSystem(org.terasology.engine.entitySystem.systems.ComponentSystem)

Example 3 with Console

use of org.terasology.engine.logic.console.Console in project Terasology by MovingBlocks.

the class StateMainMenu method init.

@Override
public void init(GameEngine gameEngine) {
    context = gameEngine.createChildContext();
    headless = context.get(DisplayDevice.class).isHeadless();
    initEntityAndComponentManagers(headless);
    createLocalPlayer(context);
    if (!headless) {
        // TODO: REMOVE this and handle refreshing of core game state at the engine level - see Issue #1127
        new RegisterInputSystem(context).step();
        nuiManager = context.get(NUIManager.class);
        eventSystem.registerEventHandler(nuiManager);
        NUIEditorSystem nuiEditorSystem = new NUIEditorSystem();
        context.put(NUIEditorSystem.class, nuiEditorSystem);
        componentSystemManager.register(nuiEditorSystem, "engine:NUIEditorSystem");
        NUISkinEditorSystem nuiSkinEditorSystem = new NUISkinEditorSystem();
        context.put(NUISkinEditorSystem.class, nuiSkinEditorSystem);
        componentSystemManager.register(nuiSkinEditorSystem, "engine:NUISkinEditorSystem");
        inputSystem = context.get(InputSystem.class);
    }
    componentSystemManager.initialise();
    console = context.get(Console.class);
    storageServiceWorker = context.get(StorageServiceWorker.class);
    playBackgroundMusic();
    if (!headless) {
        // guiManager.openWindow("main");
        context.get(NUIManager.class).pushScreen("engine:mainMenuScreen");
    }
    if (!messageOnLoad.isEmpty()) {
        TranslationSystem translationSystem = context.get(TranslationSystem.class);
        if (headless) {
            throw new RuntimeException(String.format("Game could not be started, server attempted to return to main menu: [%s]. See logs before", translationSystem.translate(messageOnLoad)));
        } else {
            MessagePopup popup = nuiManager.pushScreen(MessagePopup.ASSET_URI, MessagePopup.class);
            popup.setMessage("Error", translationSystem.translate(messageOnLoad));
        }
    }
// TODO: enable it when exposing the telemetry to users
// pushLaunchPopup();
}
Also used : NUIEditorSystem(org.terasology.engine.rendering.nui.editor.systems.NUIEditorSystem) TranslationSystem(org.terasology.engine.i18n.TranslationSystem) Console(org.terasology.engine.logic.console.Console) MessagePopup(org.terasology.engine.rendering.nui.layers.mainMenu.MessagePopup) RegisterInputSystem(org.terasology.engine.core.modes.loadProcesses.RegisterInputSystem) NUISkinEditorSystem(org.terasology.engine.rendering.nui.editor.systems.NUISkinEditorSystem) RegisterInputSystem(org.terasology.engine.core.modes.loadProcesses.RegisterInputSystem) InputSystem(org.terasology.engine.input.InputSystem) NUIManager(org.terasology.engine.rendering.nui.NUIManager) StorageServiceWorker(org.terasology.engine.identity.storageServiceClient.StorageServiceWorker)

Aggregations

Console (org.terasology.engine.logic.console.Console)3 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Context (org.terasology.engine.context.Context)1 ComponentSystemManager (org.terasology.engine.core.ComponentSystemManager)1 RegisterInputSystem (org.terasology.engine.core.modes.loadProcesses.RegisterInputSystem)1 EntityManager (org.terasology.engine.entitySystem.entity.EntityManager)1 EventSystem (org.terasology.engine.entitySystem.event.internal.EventSystem)1 ComponentSystem (org.terasology.engine.entitySystem.systems.ComponentSystem)1 TranslationSystem (org.terasology.engine.i18n.TranslationSystem)1 StorageServiceWorker (org.terasology.engine.identity.storageServiceClient.StorageServiceWorker)1 InputSystem (org.terasology.engine.input.InputSystem)1 NUIManager (org.terasology.engine.rendering.nui.NUIManager)1 NUIEditorSystem (org.terasology.engine.rendering.nui.editor.systems.NUIEditorSystem)1 NUISkinEditorSystem (org.terasology.engine.rendering.nui.editor.systems.NUISkinEditorSystem)1 MessagePopup (org.terasology.engine.rendering.nui.layers.mainMenu.MessagePopup)1