Skip to content
Snippets Groups Projects
Commit dbc6ccbc authored by Karl Aaron Rudkowski's avatar Karl Aaron Rudkowski
Browse files

Merge remote-tracking branch 'origin/MainMenuLogin' into MainMenuLogin

parents 4fb6e07b 14e98b2b
Branches gameUI
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.Button;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Events.ShopUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Inventory.InventoryUI;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Map.MapUI;
/**
* used to close the inventory
......@@ -28,6 +29,12 @@ public class InventoryCloseButton extends ImButton {
*/
private ShopUI shop;
/**
* map ui, if Button on map
* otherwise null
*/
private MapUI map;
/**
* the inventory ui, if button on inventory
* otherwise null
......@@ -45,17 +52,23 @@ public class InventoryCloseButton extends ImButton {
else if(inventory != null) {
inventory.disposeInventoryUI();
}
else if (map != null) {
map.disposeMapUI();
}
}
/**
* constructor
* @param ui the shop ui this is on, or null
* @param inventory the inventory ui this is on, or null
* @param map the map ui this is on, or null
*/
public InventoryCloseButton(float x, float y, float width, float height, ShopUI ui, InventoryUI inventory) {
public InventoryCloseButton(float x, float y, float width, float height, ShopUI ui, InventoryUI inventory, MapUI map) {
super(new Texture("close_on.png"), x, y, width, height);
shop = ui;
this.inventory = inventory;
this.map = map;
this.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
leftClick();
......
......@@ -634,6 +634,7 @@ public class GamePlay implements Screen {
}
}
}
//BIS HIER LÖSCHEN
return weapons;
}
......
......@@ -97,7 +97,7 @@ public class ShopUI {
sellElements.add(new ShopSellElement(main, stage, new Texture("laser.png"), 0, 0, this, w, 0));
}
closeButton = new InventoryCloseButton(0, 0, 10, 10, this, null);
closeButton = new InventoryCloseButton(0, 0, 10, 10, this, null, null);
stage.addActor(closeButton);
background = new Texture("shop/storeback.png");
......
......@@ -55,7 +55,7 @@ public class InventoryUI {
x = main.WIDTH/2 - inventoryBackground.getWidth()/2;
y = main.HEIGHT/2 - inventoryBackground.getHeight()/2;
closeButton = new InventoryCloseButton(x+700, y+15, 248, 50, null, this);
closeButton = new InventoryCloseButton(x+700, y+15, 248, 50, null, this, null);
stage.addActor(closeButton);
slots = new LinkedList<>();
......
......@@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
import com.galaxytrucker.galaxytruckerreloaded.Main;
import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Overworld;
import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Planet;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.InventoryCloseButton;
import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.InGameButtons.MapButton;
import com.galaxytrucker.galaxytruckerreloaded.View.UI.Ship.ShipView;
......@@ -23,6 +24,8 @@ public class MapUI {
*/
private List<MapButton> locations;
private InventoryCloseButton closeButton;
/**
* main class extending game
*/
......@@ -62,12 +65,15 @@ public class MapUI {
x = Main.WIDTH/2f - mapTexture.getWidth()/2f;
y = Main.HEIGHT/2f - mapTexture.getHeight()/2f;
closeButton = new InventoryCloseButton(x+955, y-80, 248, 50, null, null, this);
stage.addActor(closeButton);
locations = new LinkedList<>();
//TODO
for(Planet f : map.getPlanetMap()) {
float fx = f.getPosX();
float fy = f.getPosY();
MapButton mb = new MapButton(new Texture("map/map_button.png"), (x+fx), (y+fy), 20, 20, this, f);
MapButton mb = new MapButton(new Texture("map/map_button.png"), (x+fx+120), (y+fy+80), 20, 20, this, f);
locations.add(mb);
stage.addActor(mb);
}
......@@ -79,7 +85,7 @@ public class MapUI {
*/
public void render() {
main.batch.begin();
main.batch.draw(mapTexture, x, y, 1160, 626);
main.batch.draw(mapTexture, x, y-100, 1160, 626);
main.batch.end();
}
......@@ -92,7 +98,7 @@ public class MapUI {
m.remove();
}
shipView.deleteMap();
closeButton.remove();
}
/**
......@@ -104,6 +110,7 @@ public class MapUI {
boolean success = shipView.travel(planet);
if(success) {
disposeMapUI();
closeButton.remove();
}
}
......
No preview for this file type
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment