Skip to content

Commit 0f8d97d

Browse files
committed
feat(nui): convert MapScreen and WaypointCreationScreen to NUI
1 parent 3df4f94 commit 0f8d97d

File tree

16 files changed

+790
-365
lines changed

16 files changed

+790
-365
lines changed

engine/src/main/java/org/destinationsol/FactionDisplay.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void drawFactionNames(SolGame game, UiDrawer uiDrawer, SolInputManager in
4444
isPressed = !isPressed;
4545
}
4646
// angle must be zero as the camera angles on planets mess up the text display
47-
if (isPressed && camera.getAngle() == 0 && !inputManager.isScreenOn(game.getScreens().mapScreen)) {
47+
if (isPressed && camera.getAngle() == 0 && !game.getSolApplication().getNuiManager().hasScreen(game.getScreens().mapScreen)) {
4848
for (SolObject obj : objManager.getObjects()) {
4949
if (obj instanceof SolShip) {
5050
SolShip ship = (SolShip) obj;

engine/src/main/java/org/destinationsol/game/screens/GameScreens.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import org.destinationsol.game.console.Console;
2020
import org.destinationsol.game.context.Context;
2121
import org.destinationsol.ui.SolLayouts;
22+
import org.destinationsol.ui.nui.screens.MapScreen;
23+
import org.destinationsol.ui.nui.screens.WaypointCreationScreen;
2224

2325
import javax.inject.Inject;
2426

@@ -36,11 +38,15 @@ public GameScreens(SolApplication cmp, Context context) {
3638
SolLayouts layouts = cmp.getLayouts();
3739
RightPaneLayout rightPaneLayout = layouts.rightPaneLayout;
3840
mainGameScreen = new MainGameScreen(rightPaneLayout, context);
39-
mapScreen = new MapScreen(rightPaneLayout, cmp.isMobile(), cmp.getOptions());
41+
if (!cmp.isMobile()) {
42+
mapScreen = (MapScreen) cmp.getNuiManager().createScreen("engine:mapScreen_desktop");
43+
} else {
44+
mapScreen = (MapScreen) cmp.getNuiManager().createScreen("engine:mapScreen_mobile");
45+
}
4046
menuScreen = new MenuScreen(layouts.menuLayout, cmp.getOptions());
4147
inventoryScreen = new InventoryScreen(cmp.getOptions());
4248
talkScreen = new TalkScreen(layouts.menuLayout, cmp.getOptions());
43-
waypointCreationScreen = new WaypointCreationScreen(layouts.menuLayout, cmp.getOptions(), mapScreen);
49+
waypointCreationScreen = (WaypointCreationScreen) cmp.getNuiManager().createScreen("engine:waypointCreationScreen");
4450
consoleScreen = new ConsoleScreen(context.get(Console.class));
4551
}
4652

engine/src/main/java/org/destinationsol/game/screens/MapScreen.java

Lines changed: 0 additions & 226 deletions
This file was deleted.

engine/src/main/java/org/destinationsol/game/screens/ShipMouseControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void update(SolApplication solApplication, boolean enabled) {
5252
game.getCam().screenToWorld(myMouseWorldPos);
5353
SolInputManager im = solApplication.getInputManager();
5454
boolean clicked = im.getPtrs()[0].pressed;
55-
boolean onMap = im.isScreenOn(game.getScreens().mapScreen);
55+
boolean onMap = solApplication.getNuiManager().hasScreen(game.getScreens().mapScreen);
5656
BeaconHandler.Action a = game.getBeaconHandler().processMouse(game, myMouseWorldPos, clicked, onMap);
5757
if (a == BeaconHandler.Action.ATTACK) {
5858
myCursor = myAttackCursor;

engine/src/main/java/org/destinationsol/game/screens/WaypointCreationScreen.java

Lines changed: 0 additions & 126 deletions
This file was deleted.

0 commit comments

Comments
 (0)