Resolving issues #16 and #20

This commit is contained in:
Song Minjae
2017-04-24 02:23:13 +09:00
parent 6399c2d66b
commit 5cd5ebbea3
21 changed files with 158 additions and 76 deletions

View File

@@ -217,17 +217,17 @@ class StateInGame : BasicGameState() {
uiAliases = arrayListOf(
uiPieMenu,
uiQuickBar,
uiInventoryPlayer,
//uiInventoryContainer,
uiVitalPrimary,
uiVitalSecondary,
uiVitalItem
)
uiAlasesPausing = arrayListOf(
uiInventoryPlayer,
//uiInventoryContainer,
consoleHandler
)
uiAlasesPausing.forEach { uiContainer.add(it) } // put them all to the UIContainer
uiAliases.forEach { uiContainer.add(it) } // put them all to the UIContainer
uiAlasesPausing.forEach { addUI(it) } // put them all to the UIContainer
uiAliases.forEach { addUI(it) } // put them all to the UIContainer
@@ -795,6 +795,15 @@ class StateInGame : BasicGameState() {
particlesContainer.add(particle)
}
fun addUI(ui: UIHandler) {
// check for exact duplicates
if (uiContainer.contains(ui)) {
throw IllegalArgumentException("Exact copy of the UI already exists: The instance of ${ui.UI.javaClass.simpleName}")
}
uiContainer.add(ui)
}
fun getActorByID(ID: Int): Actor {
if (actorContainer.size == 0 && actorContainerInactive.size == 0)
throw IllegalArgumentException("Actor with ID $ID does not exist.")