Added show ground labels for items (not selectable yet)

Added button to show all labels for items on the ground
Fixed issue where dropped items were overwriting existing entities -- going to replace with ashley soon
This commit is contained in:
Collin Smith 2019-03-12 01:48:48 -07:00
parent 053c975fe7
commit abde0c9fdc
2 changed files with 22 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package com.riiablo.map;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Array;
@ -87,7 +88,9 @@ public class MapListener {
Riiablo.cursor.setItem(null);
Entity item = new ItemHolder(cursor);
item.position().set(gameScreen.player.position());
gameScreen.entities.put(gameScreen.entities.size + 1, item);
int randomId;
while (gameScreen.entities.get(randomId = MathUtils.random.nextInt(Integer.MAX_VALUE)) != null);
gameScreen.entities.put(randomId, item);
requireRelease = true;
return;
}

View File

@ -103,6 +103,7 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
NpcMenu menu;
NpcDialogBox dialog;
Actor details;
boolean showItems;
public TextArea input;
TextArea output;
@ -504,6 +505,23 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
details.draw(b, 1);
b.end();
}
showItems = UIUtils.alt();
if (showItems) {
clearLabels();
for (Entity entity : entities.values()) {
if (entity instanceof ItemHolder) {
Actor label = entity.getLabel();
addLabel(label);
}
}
layoutLabels();
b.begin();
for (Actor label : labels) label.draw(b, 1);
b.end();
}
}
@Override