mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-20 19:56:51 +01:00
Tech picker screen performance - ~45% of render time decreased with texture swap minimization tricks
This commit is contained in:
parent
6a7945e3cb
commit
d0ea4f7753
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
android/Images.Tech/TechIcons/Circle.png
Normal file
BIN
android/Images.Tech/TechIcons/Circle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -1621,6 +1621,13 @@ UnitIcons/Circle
|
|||
orig: 178, 178
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
OtherIcons/ConstructionCircle
|
||||
rotate: false
|
||||
xy: 4, 1362
|
||||
size: 178, 178
|
||||
orig: 178, 178
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
UnitIcons/Companion Cavalry
|
||||
rotate: false
|
||||
xy: 406, 732
|
||||
|
|
|
|||
|
|
@ -6,581 +6,588 @@ filter: MipMapLinearLinear, MipMapLinearLinear
|
|||
repeat: none
|
||||
TechIcons/Acoustics
|
||||
rotate: false
|
||||
xy: 4, 868
|
||||
xy: 4, 652
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Advanced Ballistics
|
||||
rotate: false
|
||||
xy: 4, 760
|
||||
xy: 190, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Agriculture
|
||||
rotate: false
|
||||
xy: 112, 868
|
||||
xy: 4, 544
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Animal Husbandry
|
||||
rotate: false
|
||||
xy: 4, 652
|
||||
xy: 298, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Archaeology
|
||||
rotate: false
|
||||
xy: 112, 760
|
||||
xy: 4, 436
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Archery
|
||||
rotate: false
|
||||
xy: 220, 868
|
||||
xy: 406, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Architecture
|
||||
rotate: false
|
||||
xy: 4, 544
|
||||
xy: 4, 328
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Astronomy
|
||||
rotate: false
|
||||
xy: 112, 652
|
||||
xy: 514, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Atomic Theory
|
||||
rotate: false
|
||||
xy: 220, 760
|
||||
xy: 4, 220
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Ballistics
|
||||
rotate: false
|
||||
xy: 328, 868
|
||||
xy: 622, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Banking
|
||||
rotate: false
|
||||
xy: 4, 436
|
||||
xy: 4, 112
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Biology
|
||||
rotate: false
|
||||
xy: 112, 544
|
||||
xy: 730, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Bronze Working
|
||||
rotate: false
|
||||
xy: 220, 652
|
||||
xy: 4, 4
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Calendar
|
||||
rotate: false
|
||||
xy: 328, 760
|
||||
xy: 838, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Chemistry
|
||||
rotate: false
|
||||
xy: 436, 868
|
||||
xy: 946, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Chivalry
|
||||
rotate: false
|
||||
xy: 4, 328
|
||||
xy: 1054, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Circle
|
||||
rotate: false
|
||||
xy: 4, 760
|
||||
size: 178, 178
|
||||
orig: 178, 178
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Civil Service
|
||||
rotate: false
|
||||
xy: 112, 436
|
||||
xy: 1162, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Combined Arms
|
||||
rotate: false
|
||||
xy: 220, 544
|
||||
xy: 1270, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Combustion
|
||||
rotate: false
|
||||
xy: 328, 652
|
||||
xy: 1378, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Compass
|
||||
rotate: false
|
||||
xy: 436, 760
|
||||
xy: 1486, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Computers
|
||||
rotate: false
|
||||
xy: 544, 868
|
||||
xy: 1594, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Construction
|
||||
rotate: false
|
||||
xy: 4, 220
|
||||
xy: 1702, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Currency
|
||||
rotate: false
|
||||
xy: 112, 328
|
||||
xy: 1810, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Drama and Poetry
|
||||
rotate: false
|
||||
xy: 220, 436
|
||||
xy: 1918, 838
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Dynamite
|
||||
rotate: false
|
||||
xy: 328, 544
|
||||
xy: 112, 652
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Ecology
|
||||
rotate: false
|
||||
xy: 436, 652
|
||||
xy: 112, 544
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Economics
|
||||
rotate: false
|
||||
xy: 544, 760
|
||||
xy: 112, 436
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Education
|
||||
rotate: false
|
||||
xy: 652, 868
|
||||
xy: 112, 328
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Electricity
|
||||
rotate: false
|
||||
xy: 4, 112
|
||||
xy: 112, 220
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Electronics
|
||||
rotate: false
|
||||
xy: 112, 220
|
||||
xy: 112, 112
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Engineering
|
||||
rotate: false
|
||||
xy: 220, 328
|
||||
xy: 112, 4
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Fallback
|
||||
rotate: false
|
||||
xy: 328, 436
|
||||
xy: 220, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Fertilizer
|
||||
rotate: false
|
||||
xy: 436, 544
|
||||
xy: 220, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Flight
|
||||
rotate: false
|
||||
xy: 544, 652
|
||||
xy: 328, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Future Tech
|
||||
rotate: false
|
||||
xy: 652, 760
|
||||
xy: 220, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Globalization
|
||||
rotate: false
|
||||
xy: 760, 868
|
||||
xy: 328, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Guilds
|
||||
rotate: false
|
||||
xy: 4, 4
|
||||
xy: 436, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Gunpowder
|
||||
rotate: false
|
||||
xy: 112, 112
|
||||
xy: 220, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Horseback Riding
|
||||
rotate: false
|
||||
xy: 220, 220
|
||||
xy: 328, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Industrialization
|
||||
rotate: false
|
||||
xy: 328, 328
|
||||
xy: 436, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Iron Working
|
||||
rotate: false
|
||||
xy: 436, 436
|
||||
xy: 544, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Lasers
|
||||
rotate: false
|
||||
xy: 544, 544
|
||||
xy: 220, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Machinery
|
||||
rotate: false
|
||||
xy: 652, 652
|
||||
xy: 328, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Masonry
|
||||
rotate: false
|
||||
xy: 760, 760
|
||||
xy: 436, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Mass Media
|
||||
rotate: false
|
||||
xy: 868, 868
|
||||
xy: 544, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Mathematics
|
||||
rotate: false
|
||||
xy: 112, 4
|
||||
xy: 652, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Metal Casting
|
||||
rotate: false
|
||||
xy: 220, 112
|
||||
xy: 220, 190
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Metallurgy
|
||||
rotate: false
|
||||
xy: 328, 220
|
||||
xy: 328, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Military Science
|
||||
rotate: false
|
||||
xy: 436, 328
|
||||
xy: 436, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Mining
|
||||
rotate: false
|
||||
xy: 544, 436
|
||||
xy: 544, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Mobile Tactics
|
||||
rotate: false
|
||||
xy: 652, 544
|
||||
xy: 652, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Nanotechnology
|
||||
rotate: false
|
||||
xy: 760, 652
|
||||
xy: 760, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Navigation
|
||||
rotate: false
|
||||
xy: 868, 760
|
||||
xy: 220, 82
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Nuclear Fission
|
||||
rotate: false
|
||||
xy: 976, 868
|
||||
xy: 328, 190
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Nuclear Fusion
|
||||
rotate: false
|
||||
xy: 220, 4
|
||||
xy: 436, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Optics
|
||||
rotate: false
|
||||
xy: 328, 112
|
||||
xy: 544, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Particle Physics
|
||||
rotate: false
|
||||
xy: 436, 220
|
||||
xy: 652, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Pharmaceuticals
|
||||
rotate: false
|
||||
xy: 544, 328
|
||||
xy: 760, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Philosophy
|
||||
rotate: false
|
||||
xy: 652, 436
|
||||
xy: 868, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Physics
|
||||
rotate: false
|
||||
xy: 760, 544
|
||||
xy: 328, 82
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Plastics
|
||||
rotate: false
|
||||
xy: 868, 652
|
||||
xy: 436, 190
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Pottery
|
||||
rotate: false
|
||||
xy: 976, 760
|
||||
xy: 544, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Printing Press
|
||||
rotate: false
|
||||
xy: 1084, 868
|
||||
xy: 652, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Radar
|
||||
rotate: false
|
||||
xy: 328, 4
|
||||
xy: 760, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Radio
|
||||
rotate: false
|
||||
xy: 436, 112
|
||||
xy: 868, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Railroads
|
||||
rotate: false
|
||||
xy: 544, 220
|
||||
xy: 976, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Refrigeration
|
||||
rotate: false
|
||||
xy: 652, 328
|
||||
xy: 436, 82
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Replaceable Parts
|
||||
rotate: false
|
||||
xy: 760, 436
|
||||
xy: 544, 190
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Rifling
|
||||
rotate: false
|
||||
xy: 868, 544
|
||||
xy: 652, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Robotics
|
||||
rotate: false
|
||||
xy: 976, 652
|
||||
xy: 760, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Rocketry
|
||||
rotate: false
|
||||
xy: 1084, 760
|
||||
xy: 868, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Sailing
|
||||
rotate: false
|
||||
xy: 1192, 868
|
||||
xy: 976, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Satellites
|
||||
rotate: false
|
||||
xy: 436, 4
|
||||
xy: 1084, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Scientific Theory
|
||||
rotate: false
|
||||
xy: 544, 112
|
||||
xy: 544, 82
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Stealth
|
||||
rotate: false
|
||||
xy: 652, 220
|
||||
xy: 652, 190
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Steam Power
|
||||
rotate: false
|
||||
xy: 760, 328
|
||||
xy: 760, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Steel
|
||||
rotate: false
|
||||
xy: 868, 436
|
||||
xy: 868, 406
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Telecommunications
|
||||
rotate: false
|
||||
xy: 976, 544
|
||||
xy: 976, 514
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Telegraph
|
||||
rotate: false
|
||||
xy: 1084, 652
|
||||
xy: 1084, 622
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/The Wheel
|
||||
rotate: false
|
||||
xy: 1192, 760
|
||||
xy: 1192, 730
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Theology
|
||||
rotate: false
|
||||
xy: 1300, 868
|
||||
xy: 652, 82
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Trapping
|
||||
rotate: false
|
||||
xy: 544, 4
|
||||
xy: 760, 190
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
index: -1
|
||||
TechIcons/Writing
|
||||
rotate: false
|
||||
xy: 652, 112
|
||||
xy: 868, 298
|
||||
size: 100, 100
|
||||
orig: 100, 100
|
||||
offset: 0, 0
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 201 KiB After Width: | Height: | Size: 206 KiB |
|
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.files.FileHandle
|
|||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.Texture.TextureFilter
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.NinePatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
|
|
@ -358,6 +359,8 @@ object ImageGetter {
|
|||
setSize(width, height)
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
|
||||
fun setLabel(color: Color, text: String, fontSize: Int = Constants.defaultFontSize) : ProgressBar {
|
||||
label = text.toLabel()
|
||||
label?.setAlignment(Align.center)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.unciv.ui.images
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.scenes.scene2d.Group
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
|
|
@ -95,6 +96,9 @@ open class Portrait(val type: Type, val imageName: String, val size: Float, val
|
|||
else -> getDefaultImage().apply { color = getDefaultImageTint() }
|
||||
}
|
||||
}
|
||||
|
||||
// Overridable so portraits can use circle images from their texture to minimize texture swapping
|
||||
protected open fun getCircleImage() = ImageGetter.getCircle()
|
||||
|
||||
/** Border / background */
|
||||
private fun getMainBackground() : Group {
|
||||
|
|
@ -105,14 +109,16 @@ open class Portrait(val type: Type, val imageName: String, val size: Float, val
|
|||
val ratioH = image.height / backgroundImage.height
|
||||
image.setSize((size + borderSize)*ratioW, (size + borderSize)*ratioH)
|
||||
return backgroundImage.toGroup(size + borderSize)
|
||||
|
||||
} else {
|
||||
image.setSize(size*0.75f, size*0.75f)
|
||||
|
||||
val bg = Group().apply { isTransform = false }
|
||||
val bg = object: Group(){
|
||||
init { apply { isTransform = false } }
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
val circleInner = ImageGetter.getCircle()
|
||||
val circleOuter = ImageGetter.getCircle()
|
||||
val circleInner = getCircleImage()
|
||||
val circleOuter = getCircleImage()
|
||||
|
||||
circleInner.setSize(size, size)
|
||||
circleOuter.setSize(size + borderSize, size + borderSize)
|
||||
|
|
@ -159,20 +165,29 @@ class PortraitResource(name: String, size: Float, amount: Int = 0) : Portrait(Ty
|
|||
|
||||
override fun getDefaultInnerBackgroundTint(): Color =
|
||||
ruleset.tileResources[imageName]?.resourceType?.getColor() ?: Color.WHITE
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
class PortraitTech(name: String, size: Float) : Portrait(Type.Tech, name, size) {
|
||||
override fun getDefaultOuterBackgroundTint(): Color = getDefaultImageTint()
|
||||
override fun getDefaultImageTint(): Color =
|
||||
ruleset.eras[ruleset.technologies[imageName]?.era()]?.getColor()?.darken(0.6f) ?: ImageGetter.CHARCOAL
|
||||
|
||||
override fun getCircleImage(): Image = ImageGetter.getImage("TechIcons/Circle")
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
class PortraitUnit(name: String, size: Float) : Portrait(Type.Unit, name, size) {
|
||||
override fun getDefaultImageTint(): Color = Color.BLACK
|
||||
override fun getCircleImage() = ImageGetter.getImage("OtherIcons/ConstructionCircle")
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
class PortraitBuilding(name: String, size: Float) : Portrait(Type.Building, name, size) {
|
||||
override fun getDefaultImageTint(): Color = Color.BLACK
|
||||
override fun getCircleImage() = ImageGetter.getImage("OtherIcons/ConstructionCircle")
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
class PortraitUnavailableWonderForTechTree(name: String, size: Float) : Portrait(Type.Building, name, size) {
|
||||
|
|
@ -218,6 +233,8 @@ class PortraitImprovement(name: String, size: Float, dim: Boolean = false, isPil
|
|||
return getColorFromStats(improvement)
|
||||
return Color.WHITE
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
class PortraitNation(name: String, size: Float) : Portrait(Type.Nation, name, size, size*0.1f) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.unciv.ui.screens.pickerscreens
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
|
|
@ -42,10 +43,11 @@ class TechButton(
|
|||
|
||||
val path = "TechPickerScreen/TechButton"
|
||||
val default = BaseScreen.skinStrings.roundedEdgeRectangleMidShape
|
||||
backgroundImage = Image(BaseScreen.skinStrings.getUiBackground(path, default))
|
||||
backgroundImage = object : Image(BaseScreen.skinStrings.getUiBackground(path, default)){
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
background = BaseScreen.skinStrings.getUiBackground(path, default, Color.WHITE.darken(0.3f))
|
||||
|
||||
backgroundImage.toBack()
|
||||
addActor(backgroundImage)
|
||||
|
||||
pad(5f, 5f, 5f, 0f)
|
||||
|
|
@ -67,7 +69,9 @@ class TechButton(
|
|||
add(progressBar.addBorder(1f, Color.GRAY.cpy())).padLeft(0f).padRight(5f)
|
||||
}
|
||||
|
||||
val rightSide = Table()
|
||||
val rightSide = object : Table() {
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
rightSide.add(text).width(140f).top().left().padRight(15f)
|
||||
rightSide.add(turns).width(40f).top().left().padRight(10f).row()
|
||||
|
|
@ -76,6 +80,10 @@ class TechButton(
|
|||
|
||||
rightSide.centerY(this)
|
||||
add(rightSide).expandX().left()
|
||||
|
||||
// Render both Skin images adjacently to reduce a texture swap between them
|
||||
rightSide.toBack()
|
||||
backgroundImage.toBack()
|
||||
pack()
|
||||
|
||||
backgroundImage.setSize(width - 3f, height - 3f)
|
||||
|
|
@ -91,7 +99,10 @@ class TechButton(
|
|||
}
|
||||
|
||||
private fun addTechEnabledIcons(techName: String, rightSide: Table) {
|
||||
val techEnabledIcons = Table().align(Align.left)
|
||||
val techEnabledIcons = object : Table(){
|
||||
init { align(Align.left) }
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
techEnabledIcons.background = BaseScreen.skinStrings.getUiBackground(
|
||||
"TechPickerScreen/TechButtonIconsOutline",
|
||||
BaseScreen.skinStrings.roundedEdgeRectangleSmallShape,
|
||||
|
|
@ -113,6 +124,10 @@ class TechButton(
|
|||
.prefWidth(195f)
|
||||
.maxWidth(195f)
|
||||
.expandX().left().row()
|
||||
|
||||
techEnabledIcons.toBack() // First thing in the table to render so the 2 skin textures are rendered back to back
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.unciv.ui.screens.pickerscreens
|
||||
|
||||
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.ui.Image
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
|
|
@ -52,7 +53,9 @@ class TechPickerScreen(
|
|||
* Having this be a separate table allows us to leave the TopTable as is (that is: auto-width to fit the scrollPane)
|
||||
* leaving us the juicy small tech tree right in the center.
|
||||
*/
|
||||
private val techTable = Table()
|
||||
private val techTable = object : Table(){
|
||||
override fun draw(batch: Batch?, parentAlpha: Float) = super.draw(batch, parentAlpha)
|
||||
}
|
||||
|
||||
// All these are to counter performance problems when updating buttons for all techs.
|
||||
private var researchableTechs = ruleset.technologies.keys
|
||||
|
|
@ -463,5 +466,4 @@ class TechPickerScreen(
|
|||
rightSideButton.disable()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user