Progress bar should no longer appear after getting a tech in the middle of research for free
Generalized unique fonts to fit Korean as well as Chinese
This commit is contained in:
parent
965217d95c
commit
e6ecc53615
3 changed files with 22 additions and 16 deletions
|
@ -21,8 +21,8 @@ android {
|
|||
applicationId "com.unciv.app"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 29
|
||||
versionCode 310
|
||||
versionName "3.1.7"
|
||||
versionCode 311
|
||||
versionName "3.1.8"
|
||||
}
|
||||
|
||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||
|
|
|
@ -110,7 +110,6 @@ class TechManager {
|
|||
return
|
||||
|
||||
// We finished it!
|
||||
techsInProgress.remove(currentTechnology)
|
||||
addTechnology(currentTechnology)
|
||||
}
|
||||
|
||||
|
@ -122,6 +121,7 @@ class TechManager {
|
|||
fun addTechnology(techName:String) {
|
||||
if(techName!= Constants.futureTech)
|
||||
techsToResearch.remove(techName)
|
||||
techsInProgress.remove(techName)
|
||||
|
||||
val previousEra = civInfo.getEra()
|
||||
techsResearched.add(techName)
|
||||
|
|
|
@ -53,7 +53,7 @@ class Fonts {
|
|||
return false
|
||||
}
|
||||
|
||||
fun getCharsForFont(withChinese:Boolean): String {
|
||||
fun getCharsForFont(language:String=""): String {
|
||||
val defaultText = "ABCČĆDĐEFGHIJKLMNOPQRSŠTUVWXYZŽaäàâăbcčćçdđeéfghiîjklmnoöpqrsșštțuüvwxyzž" +
|
||||
"АБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюя" + // Russian
|
||||
"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάßΆέΈέΉίϊΐΊόΌύΰϋΎΫΏ" + // Greek
|
||||
|
@ -64,23 +64,25 @@ class Fonts {
|
|||
val charSet = HashSet<Char>()
|
||||
charSet.addAll(defaultText.asIterable())
|
||||
|
||||
if(withChinese) {
|
||||
if (Gdx.files.internal("jsons/BasicHelp/BasicHelp_Simplified_Chinese.json").exists())
|
||||
charSet.addAll(Gdx.files.internal("jsons/BasicHelp/BasicHelp_Simplified_Chinese.json").readString().asIterable())
|
||||
if (Gdx.files.internal("jsons/Nations/Nations_Simplified_Chinese.json").exists())
|
||||
charSet.addAll(Gdx.files.internal("jsons/Nations/Nations_Simplified_Chinese.json").readString().asIterable())
|
||||
if (Gdx.files.internal("jsons/Tutorials/Tutorials_Simplified_Chinese.json").exists())
|
||||
charSet.addAll(Gdx.files.internal("jsons/Tutorials/Tutorials_Simplified_Chinese.json").readString().asIterable())
|
||||
if(language != "") {
|
||||
if (Gdx.files.internal("jsons/BasicHelp/BasicHelp_$language.json").exists())
|
||||
charSet.addAll(Gdx.files.internal("jsons/BasicHelp/BasicHelp_$language.json").readString().asIterable())
|
||||
if (Gdx.files.internal("jsons/Nations/Nations_$language.json").exists())
|
||||
charSet.addAll(Gdx.files.internal("jsons/Nations/Nations_$language.json").readString().asIterable())
|
||||
if (Gdx.files.internal("jsons/Tutorials/Tutorials_$language.json").exists())
|
||||
charSet.addAll(Gdx.files.internal("jsons/Tutorials/Tutorials_$language.json").readString().asIterable())
|
||||
|
||||
for (entry in GameBasics.Translations.entries) {
|
||||
for (lang in entry.value) {
|
||||
if (lang.key.contains("Chinese")) charSet.addAll(lang.value.asIterable())
|
||||
if (lang.key==language) charSet.addAll(lang.value.asIterable())
|
||||
}
|
||||
}
|
||||
}
|
||||
return charSet.joinToString("")
|
||||
}
|
||||
|
||||
fun getFont(size: Int): BitmapFont {
|
||||
|
||||
if(UnCivGame.Current.settings.fontSet=="WenQuanYiMicroHei"){
|
||||
val fontForLanguage="WenQuanYiMicroHei"
|
||||
val keyForFont = "$fontForLanguage $size"
|
||||
|
@ -96,24 +98,28 @@ class Fonts {
|
|||
checksumFailed.open()
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
val generator = FreeTypeFontGenerator(Gdx.files.local("fonts/WenQuanYiMicroHei.ttf"))
|
||||
val parameter = FreeTypeFontGenerator.FreeTypeFontParameter()
|
||||
parameter.size = size
|
||||
parameter.minFilter = Texture.TextureFilter.Linear
|
||||
parameter.magFilter = Texture.TextureFilter.Linear
|
||||
parameter.characters = getCharsForFont(true)
|
||||
parameter.characters = getCharsForFont(UnCivGame.Current.settings.language)
|
||||
val font = generator.generateFont(parameter)
|
||||
fontCache[keyForFont] = font
|
||||
return font
|
||||
}
|
||||
}
|
||||
|
||||
val language = UnCivGame.Current.settings.language
|
||||
val fontForLanguage ="Nativefont"
|
||||
val withChinese = UnCivGame.Current.settings.language.contains("Chinese")
|
||||
val keyForFont = if(!withChinese) "$fontForLanguage $size" else "$fontForLanguage $size withChinese" // different cache for chinese
|
||||
val isUniqueFont = language.contains("Chinese") || language == "Korean"
|
||||
val keyForFont = if(!isUniqueFont) "$fontForLanguage $size" else "$fontForLanguage $size $language"
|
||||
if (fontCache.containsKey(keyForFont)) return fontCache[keyForFont]!!
|
||||
|
||||
val font=NativeFont(NativeFontPaint(size))
|
||||
val charsForFont = getCharsForFont(withChinese)
|
||||
val charsForFont = getCharsForFont(if(isUniqueFont) language else "")
|
||||
font.appendText(charsForFont)
|
||||
fontCache[keyForFont] = font
|
||||
return font
|
||||
|
|
Loading…
Reference in a new issue