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