mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-18 03:38:55 +07:00
Rendering performance improvements - only act on city button groups for tiles that are city centers, and only act on the group and not its subgroups
This commit is contained in:
@ -502,4 +502,8 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab
|
|||||||
super.draw(batch, parentAlpha)
|
super.draw(batch, parentAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun act(delta: Float) {
|
||||||
|
return // actions should only be for the CityButtonLayerGroup
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -14,7 +14,6 @@ import com.unciv.logic.civilization.CivilizationInfo
|
|||||||
import com.unciv.logic.map.MapUnit
|
import com.unciv.logic.map.MapUnit
|
||||||
import com.unciv.logic.map.RoadStatus
|
import com.unciv.logic.map.RoadStatus
|
||||||
import com.unciv.logic.map.TileInfo
|
import com.unciv.logic.map.TileInfo
|
||||||
import com.unciv.models.*
|
|
||||||
import com.unciv.models.helpers.MapArrowType
|
import com.unciv.models.helpers.MapArrowType
|
||||||
import com.unciv.models.helpers.MiscArrowTypes
|
import com.unciv.models.helpers.MiscArrowTypes
|
||||||
import com.unciv.models.helpers.TintedMapArrow
|
import com.unciv.models.helpers.TintedMapArrow
|
||||||
@ -119,14 +118,23 @@ open class TileGroup(var tileInfo: TileInfo, val tileSetStrings:TileSetStrings,
|
|||||||
val unitLayerGroup = UnitLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
|
val unitLayerGroup = UnitLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
|
||||||
val unitImageLayerGroup = UnitImageLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
|
val unitImageLayerGroup = UnitImageLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize);touchable = Touchable.disabled }
|
||||||
|
|
||||||
class CityButtonLayerGroupClass:Group() {
|
class CityButtonLayerGroupClass(val tileInfo: TileInfo) :Group() {
|
||||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
override fun draw(batch: Batch?, parentAlpha: Float) {
|
||||||
override fun act(delta: Float) = super.act(delta)
|
if (!tileInfo.isCityCenter()) return
|
||||||
override fun hit(x: Float, y: Float, touchable: Boolean) = super.hit(x, y, touchable)
|
super.draw(batch, parentAlpha)
|
||||||
|
}
|
||||||
|
override fun act(delta: Float) {
|
||||||
|
if (!tileInfo.isCityCenter()) return
|
||||||
|
super.act(delta)
|
||||||
|
}
|
||||||
|
override fun hit(x: Float, y: Float, touchable: Boolean): Actor? {
|
||||||
|
if (!tileInfo.isCityCenter()) return null
|
||||||
|
return super.hit(x, y, touchable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val cityButtonLayerGroup = CityButtonLayerGroupClass().apply { isTransform = false; setSize(groupSize, groupSize)
|
val cityButtonLayerGroup = CityButtonLayerGroupClass(tileInfo).apply { isTransform = false; setSize(groupSize, groupSize)
|
||||||
touchable = Touchable.childrenOnly; setOrigin(Align.center) }
|
touchable = Touchable.childrenOnly; setOrigin(Align.center); }
|
||||||
|
|
||||||
val highlightCrosshairFogLayerGroup = ActionlessGroup().apply { isTransform = false; setSize(groupSize, groupSize) }
|
val highlightCrosshairFogLayerGroup = ActionlessGroup().apply { isTransform = false; setSize(groupSize, groupSize) }
|
||||||
val highlightImage = ImageGetter.getImage(tileSetStrings.highlight) // for blue and red circles/emphasis on the tile
|
val highlightImage = ImageGetter.getImage(tileSetStrings.highlight) // for blue and red circles/emphasis on the tile
|
||||||
|
Reference in New Issue
Block a user