now you only need to create font once. (#1269)

* update

* update

* update

* update

* update

* update

* update

* range extension

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update
This commit is contained in:
lishaoxia1985 2019-11-08 21:31:11 +08:00 committed by Yair Morgenstern
parent 39314a5543
commit 4d5ae8fa25
5 changed files with 27 additions and 25 deletions

View file

@ -164,7 +164,7 @@
{
columnNumber: 5,
era:"Medieval",
techCost: 250,
techCost: 275,
buildingCost:160,
wonderCost:400,
techs:[
@ -199,12 +199,13 @@
{
columnNumber: 6,
era:"Medieval",
techCost: 440,
techCost: 485,
buildingCost:200,
wonderCost:500,
techs:[
{
name:"Compass",
cost:375,
row:1,
prerequisites:["Optics","Theology"],
quote:"'I find the great thing in this world is not so much where we stand, as in what direction we are moving.' - Oliver Wendell Holmes"
@ -246,7 +247,7 @@
{
columnNumber: 7,
era:"Renaissance",
techCost: 650,
techCost: 780,
buildingCost:250,
wonderCost:625,
techs:[
@ -286,7 +287,7 @@
{
columnNumber: 8,
era:"Renaissance",
techCost: 900,
techCost: 1150,
buildingCost:300,
wonderCost:750,
techs:[
@ -325,7 +326,7 @@
{
columnNumber: 9,
era:"Industrial",
techCost: 1300,
techCost: 1600,
buildingCost:360,
wonderCost:920,
techs:[
@ -370,7 +371,7 @@
{
columnNumber: 10,
era:"Industrial",
techCost: 1680,
techCost: 2350,
buildingCost:500,
wonderCost:1060,
techs:[
@ -404,7 +405,7 @@
{
columnNumber: 11,
era:"Modern",
techCost: 3000,
techCost: 3100,
buildingCost:500,
wonderCost:1250,
techs:[
@ -476,7 +477,7 @@
{
columnNumber: 13,
era:"Information",
techCost: 5330,
techCost: 5100,
buildingCost:500,
wonderCost:1250,
techs:[
@ -509,7 +510,7 @@
{
columnNumber: 14,
era:"Information",
techCost: 6850,
techCost: 6400,
buildingCost:750,
wonderCost:2000,
techs:[
@ -543,7 +544,7 @@
{
columnNumber: 15,
era:"Future",
techCost: 8182,
techCost: 7700,
buildingCost:750,
wonderCost:1250,
techs:[
@ -579,7 +580,7 @@
{
columnNumber: 16,
era:"Future",
techCost: 9500,
techCost: 8800,
buildingCost:750,
wonderCost:1250,
techs:[

View file

@ -156,9 +156,9 @@
"HIGHLY EXPERIMENTAL - YOU HAVE BEEN WARNED!": {
Italian:"IN FASE DI PRODUZIONE - TI ABBIAMO AVVERTITO!"
Simplified_Chinese:"⚠警告!试验性功能!"
Simplified_Chinese:"⚠警告!试验性功能!"
Ukrainian:"ПЕРЕБУВАЄ В РОЗРОБЦІ — ВАС ПОПЕРЕДЖЕНО!"
Traditional_Chinese:"⚠警告!實驗性功能!"
Traditional_Chinese:"⚠警告!實驗性功能!"
Czech:"VYSOCE EXPERIMENTÁLNÍ - BYLI JSTE VAROVÁNÍ!"
Polish:"TRYB EKSPERYMENTALNY - NA WŁASNĄ ODPOWIEDZIALNOŚĆ!"
Russian:"В РАЗРАБОТКЕ - ВЫ ПРЕДУПРЕЖДЕНЫ!"

View file

@ -16,6 +16,7 @@ import com.unciv.ui.utils.CameraStageBaseScreen
import com.unciv.ui.utils.ImageGetter
import com.unciv.ui.worldscreen.WorldScreen
import java.util.*
import kotlin.concurrent.thread
class UnCivGame(val version: String) : Game() {
var gameInfo: GameInfo = GameInfo()
@ -56,7 +57,7 @@ class UnCivGame(val version: String) : Game() {
}
else setScreen(LanguagePickerScreen())
startMusic()
thread { startMusic() }
}
fun startMusic(){

View file

@ -41,7 +41,7 @@ object GameBasics {
val techColumns = getFromJson(Array<TechColumn>::class.java, "Techs")
for (techColumn in techColumns) {
for (tech in techColumn.techs) {
tech.cost = techColumn.techCost
if (tech.cost==0) tech.cost = techColumn.techCost
tech.column = techColumn
Technologies[tech.name] = tech
}

View file

@ -62,15 +62,15 @@ open class CameraStageBaseScreen : Screen {
}
fun resetFonts(){
skin.get(TextButton.TextButtonStyle::class.java).font = Fonts().getFont(20)
skin.get(CheckBox.CheckBoxStyle::class.java).font= Fonts().getFont(20)
skin.get(TextButton.TextButtonStyle::class.java).font = Fonts().getFont(45).apply { data.setScale(20/45f) }
skin.get(CheckBox.CheckBoxStyle::class.java).font= Fonts().getFont(45).apply { data.setScale(20/45f) }
skin.get(Label.LabelStyle::class.java).apply {
font = Fonts().getFont(18)
font = Fonts().getFont(45).apply { data.setScale(18/45f) }
fontColor= Color.WHITE
}
skin.get(TextField.TextFieldStyle::class.java).font = Fonts().getFont(18)
skin.get(SelectBox.SelectBoxStyle::class.java).font = Fonts().getFont(20)
skin.get(SelectBox.SelectBoxStyle::class.java).listStyle.font = Fonts().getFont(20)
skin.get(TextField.TextFieldStyle::class.java).font = Fonts().getFont(45).apply { data.setScale(18/45f) }
skin.get(SelectBox.SelectBoxStyle::class.java).font = Fonts().getFont(45).apply { data.setScale(20/45f) }
skin.get(SelectBox.SelectBoxStyle::class.java).listStyle.font = Fonts().getFont(45).apply { data.setScale(20/45f) }
skin.get(CheckBox.CheckBoxStyle::class.java).fontColor= Color.WHITE
}
internal var batch: Batch = SpriteBatch()
@ -208,9 +208,9 @@ fun String.toLabel(fontColor:Color= Color.WHITE, fontSize:Int=18): Label {
if(fontColor!= Color.WHITE || fontSize!=18) { // if we want the default we don't need to create another style
labelStyle = Label.LabelStyle(labelStyle) // clone this to another
labelStyle.fontColor = fontColor
if (fontSize != 18) labelStyle.font = Fonts().getFont(fontSize)
if (fontSize != 18) labelStyle.font = Fonts().getFont(45)
}
return Label(this.tr(),labelStyle)
return Label(this.tr(),labelStyle).apply { setFontScale(fontSize/45f) }
}
@ -218,7 +218,7 @@ fun Label.setFontColor(color:Color): Label {style=Label.LabelStyle(style).apply
fun Label.setFontSize(size:Int): Label {
style = Label.LabelStyle(style)
style.font = Fonts().getFont(size)
style.font = Fonts().getFont(45)
style = style // because we need it to call the SetStyle function. Yuk, I know.
return this // for chaining
return this.apply { setFontScale(size/45f) } // for chaining
}