Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public void play(boolean tut, String shipName, boolean isNewGame, WorldConfig wo

factionDisplay = new FactionDisplay(gameContext.getBean(SolCam.class));
nuiManager.removeScreen(menuScreens.loading);
inputManager.setScreen(this, solGame.getScreens().mainGameScreen);
inputManager.setScreen(this, solGame.getScreens().oldMainGameScreen);
}

public SolInputManager getInputManager() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private Pilot createPilot(SolGame game, boolean isMouseControl) {
if (isMouseControl) {
return new AiPilot(new BeaconDestProvider(), true, Faction.LAANI, false, "you", Const.AI_DET_DIST);
} else {
return new UiControlledPilot(game.getScreens().getMainGameScreen().getShipControl());
return new UiControlledPilot(game.getScreens().getOldMainGameScreen().getShipControl());
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/src/main/java/org/destinationsol/game/SolCam.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void applyPos(float posX, float posY) {
}

private void applyInput(SolGame game) {
MainGameScreen screen = game.getScreens().mainGameScreen;
MainGameScreen screen = game.getScreens().oldMainGameScreen;
boolean d = screen.isCameraDown();
boolean u = screen.isCameraUp();
boolean l = screen.isCameraLeft();
Expand Down
5 changes: 1 addition & 4 deletions engine/src/main/java/org/destinationsol/game/SolGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.destinationsol.ContextWrapper;
import org.destinationsol.GameOptions;
import org.destinationsol.SolApplication;
import org.destinationsol.assets.Assets;
import org.destinationsol.assets.sound.OggSoundManager;
import org.destinationsol.assets.sound.SpecialSounds;
import org.destinationsol.common.DebugCol;
Expand Down Expand Up @@ -68,10 +67,8 @@
import org.destinationsol.ui.nui.screens.MainGameScreen;
import org.destinationsol.world.GalaxyBuilder;
import org.terasology.context.exception.BeanNotFoundException;
import org.terasology.gestalt.assets.ResourceUrn;
import org.terasology.gestalt.di.BeanContext;
import org.terasology.gestalt.entitysystem.entity.EntityRef;
import org.terasology.nui.asset.UIElement;

import javax.inject.Inject;
import java.util.ArrayList;
Expand Down Expand Up @@ -266,7 +263,7 @@ public void run() {
}
}, 0, 30);
gameScreens.consoleScreen.init(this);
solApplication.getNuiManager().pushScreen(mainGameScreen);
solApplication.getNuiManager().pushScreen(gameScreens.mainGameScreen);
tutorialManager.ifPresent(TutorialManager::start);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ public void fillContainer(ItemContainer itemContainer, String items) {
}
}

public ItemConfig parseItem(String item) {
List<ItemConfig> items = parseItems(item);
if (items.isEmpty()) {
return null;
}
return items.get(0);
}

public List<ItemConfig> parseItems(String items) {
ArrayList<ItemConfig> result = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class BorderDrawer {
private final ArrayList<PlanetProximityIndicator> planetProximityIndicators;
private final Vector2 myTmpVec = new Vector2();

BorderDrawer() {
public BorderDrawer() {
displayDimensions = SolApplication.displayDimensions;

TextureAtlas.AtlasRegion texture = Assets.getAtlasRegion("engine:uiPlanetProximityIndicator");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void updateCustom(SolApplication solApplication, SolInputManager.InputPoi
TalkScreen talkScreen = game.getScreens().talkScreen;
SolShip target = talkScreen.getTarget();
if (talkScreen.isTargetFar(hero)) {
solApplication.getInputManager().setScreen(solApplication, game.getScreens().mainGameScreen);
solApplication.getInputManager().setScreen(solApplication, game.getScreens().oldMainGameScreen);
return;
}
SolItem selItem = is.getSelectedItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void updateCustom(SolApplication solApplication, SolInputManager.InputPoi
Hero hero = game.getHero();
TalkScreen talkScreen = game.getScreens().talkScreen;
if (talkScreen.isTargetFar(hero)) {
solApplication.getInputManager().setScreen(solApplication, game.getScreens().mainGameScreen);
solApplication.getInputManager().setScreen(solApplication, game.getScreens().oldMainGameScreen);
return;
}
SolItem selItem = is.getSelectedItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ public void updateCustom(SolApplication solApplication, SolInputManager.InputPoi

if (giveControl.isJustOff() && selNull) {
SolShip solship = ((MercItem) selItem).getSolShip();
inputMan.setScreen(solApplication, screens.mainGameScreen);
inputMan.setScreen(solApplication, screens.oldMainGameScreen);
is.giveItemsScreen.setTarget(solship);
is.setOperations(is.giveItemsScreen);
inputMan.addScreen(solApplication, is);
} else if (takeControl.isJustOff() && selNull) {
SolShip solship = ((MercItem) selItem).getSolShip();
inputMan.setScreen(solApplication, screens.mainGameScreen);
inputMan.setScreen(solApplication, screens.oldMainGameScreen);
is.takeItems.setTarget(solship);
is.setOperations(is.takeItems);
inputMan.addScreen(solApplication, is);
} else if (equipControl.isJustOff() && selNull) {
SolShip solship = ((MercItem) selItem).getSolShip();
inputMan.setScreen(solApplication, screens.mainGameScreen);
inputMan.setScreen(solApplication, screens.oldMainGameScreen);
is.showInventory.setTarget(solship);
is.setOperations(is.showInventory);
inputMan.addScreen(solApplication, is);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void onAdd(SolApplication solApplication) {
@Override
public void updateCustom(SolApplication solApplication, SolInputManager.InputPointer[] inputPointers, boolean clickedOutside) {
if (exitControl.isJustOff()) {
solApplication.getInputManager().setScreen(solApplication, solApplication.getGame().getScreens().mainGameScreen);
solApplication.getInputManager().setScreen(solApplication, solApplication.getGame().getScreens().oldMainGameScreen);
}
if (commandHistoryUpControl.isJustOff()) {
if (commandHistoryIndex > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
import javax.inject.Inject;

public class GameScreens {
public final MainGameScreen mainGameScreen;
private static final String NUI_MAIN_GAME_SCREEN_DESKTOP_URI = "engine:mainGameScreen_desktop";
private static final String NUI_MAIN_GAME_SCREEN_MOBILE_URI = "engine:mainGameScreen_mobile";
public final MainGameScreen oldMainGameScreen;
public final org.destinationsol.ui.nui.screens.MainGameScreen mainGameScreen;
public final MapScreen mapScreen;
public final MenuScreen menuScreen;
public final InventoryScreen inventoryScreen;
Expand All @@ -35,7 +38,13 @@ public class GameScreens {
public GameScreens(SolApplication cmp, Context context) {
SolLayouts layouts = cmp.getLayouts();
RightPaneLayout rightPaneLayout = layouts.rightPaneLayout;
mainGameScreen = new MainGameScreen(rightPaneLayout, context);
oldMainGameScreen = new MainGameScreen(rightPaneLayout, context);
boolean isMobile = cmp.isMobile();
if (!isMobile) {
mainGameScreen = (org.destinationsol.ui.nui.screens.MainGameScreen) cmp.getNuiManager().createScreen(NUI_MAIN_GAME_SCREEN_DESKTOP_URI);
} else {
mainGameScreen = (org.destinationsol.ui.nui.screens.MainGameScreen) cmp.getNuiManager().createScreen(NUI_MAIN_GAME_SCREEN_MOBILE_URI);
}
mapScreen = new MapScreen(rightPaneLayout, cmp.isMobile(), cmp.getOptions());
menuScreen = new MenuScreen(layouts.menuLayout, cmp.getOptions());
inventoryScreen = new InventoryScreen(cmp.getOptions());
Expand All @@ -46,7 +55,7 @@ public GameScreens(SolApplication cmp, Context context) {

// This was added for PlayerCreatorTest.java (used in PlayerCreator)
// so that it can successfully mock the returned result.
public MainGameScreen getMainGameScreen() {
return mainGameScreen;
public MainGameScreen getOldMainGameScreen() {
return oldMainGameScreen;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void updateCustom(SolApplication solApplication, SolInputManager.InputPoi
Hero hero = game.getHero();
TalkScreen talkScreen = game.getScreens().talkScreen;
if (talkScreen.isTargetFar(hero)) {
solApplication.getInputManager().setScreen(solApplication, game.getScreens().mainGameScreen);
solApplication.getInputManager().setScreen(solApplication, game.getScreens().oldMainGameScreen);
return;
}
SolItem selItem = is.getSelectedItem();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ public void updateCustom(SolApplication solApplication, SolInputManager.InputPoi
GameScreens screens = game.getScreens();
InventoryScreen is = screens.inventoryScreen;

inputMan.setScreen(solApplication, screens.mainGameScreen);
inputMan.setScreen(solApplication, screens.oldMainGameScreen);
is.setOperations(is.chooseMercenaryScreen);
inputMan.addScreen(solApplication, is);
}
solApplication.getInputManager().setScreen(solApplication, solApplication.getGame().getScreens().mainGameScreen);
solApplication.getInputManager().setScreen(solApplication, solApplication.getGame().getScreens().oldMainGameScreen);
return;
}
if (previousControl.isJustOff()) {
Expand Down
Loading