mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 23:24:25 +07:00
Add passthrough functions to all layers for perf work
This commit is contained in:
parent
8e0115263b
commit
7b075bcf7c
@ -1,5 +1,6 @@
|
||||
package com.unciv.ui.components.tilegroups.layers
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.unciv.logic.civilization.Civilization
|
||||
@ -20,6 +21,7 @@ class TileLayerBorders(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
||||
|
||||
override fun act(delta: Float) {}
|
||||
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
|
||||
private var previousTileOwner: Civilization? = null
|
||||
private val borderSegments = HashMap<Tile, BorderSegment>()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.ui.components.tilegroups.layers
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.unciv.logic.civilization.Civilization
|
||||
@ -22,6 +23,7 @@ class TileLayerFeatures(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup
|
||||
|
||||
override fun act(delta: Float) {}
|
||||
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
|
||||
private fun updateRoadImages() {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui.components.tilegroups.layers
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.math.Vector2
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
@ -67,6 +68,8 @@ class TileLayerMisc(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, si
|
||||
}
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
|
||||
private val yields = YieldGroup().apply {
|
||||
// Unlike resource or improvement this is created and added only once,
|
||||
// It's the contents that get updated
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui.components.tilegroups.layers
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.unciv.Constants
|
||||
@ -13,6 +14,7 @@ class TileLayerOverlay(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
||||
|
||||
override fun act(delta: Float) {}
|
||||
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha) // perf
|
||||
|
||||
private var highlight: Image? = null // for blue and red circles/emphasis on the tile
|
||||
private var crosshair: Image? = null // for when a unit is targeted
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui.components.tilegroups.layers
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.math.Vector2
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
@ -17,6 +18,7 @@ class TileLayerTerrain(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup,
|
||||
|
||||
override fun act(delta: Float) {}
|
||||
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
|
||||
private val tileBaseImages: ArrayList<Image> = ArrayList()
|
||||
private var tileImageIdentifiers = listOf<String>()
|
||||
|
@ -9,10 +9,10 @@ import com.unciv.logic.civilization.Civilization
|
||||
import com.unciv.logic.map.mapunit.MapUnit
|
||||
import com.unciv.models.ruleset.unique.LocalUniqueCache
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.widgets.UnitIconGroup
|
||||
import com.unciv.ui.components.extensions.center
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
import com.unciv.ui.components.tilegroups.TileGroup
|
||||
import com.unciv.ui.components.widgets.UnitIconGroup
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
|
||||
|
@ -21,6 +21,10 @@ class TileLayerUnitSprite(tileGroup: TileGroup, size: Float) : TileLayer(tileGro
|
||||
|
||||
override fun act(delta: Float) {}
|
||||
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) {
|
||||
if (civilianSlot.imageLocation.isEmpty() && militarySlot.imageLocation.isEmpty()) return
|
||||
super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
private var civilianSlot: UnitSpriteSlot = UnitSpriteSlot()
|
||||
private var militarySlot: UnitSpriteSlot = UnitSpriteSlot()
|
||||
@ -94,9 +98,4 @@ class TileLayerUnitSprite(tileGroup: TileGroup, size: Float) : TileLayer(tileGro
|
||||
civilianSlot.imageLocation = ""
|
||||
militarySlot.imageLocation = ""
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) {
|
||||
if (civilianSlot.imageLocation.isEmpty() && militarySlot.imageLocation.isEmpty()) return
|
||||
super.draw(batch, parentAlpha)
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui.screens.worldscreen
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||
import com.badlogic.gdx.scenes.scene2d.actions.Actions
|
||||
@ -490,11 +491,13 @@ class NotificationsScroll(
|
||||
// Actions are blocked while update() is rebuilding the UI elements - to be safe from unexpected state changes
|
||||
if (!blockAct) super.act(delta)
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
private fun getUserSettingCheckDisabled(): Boolean {
|
||||
val settingString = GUI.getSettings().notificationScroll
|
||||
val setting = UserSetting.values().firstOrNull { it.name == settingString }
|
||||
val setting = UserSetting.entries.firstOrNull { it.name == settingString }
|
||||
?: UserSetting.default()
|
||||
userSettingChanged = false
|
||||
if (setting == userSetting)
|
||||
|
Loading…
Reference in New Issue
Block a user