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, columnNumber: 5,
era:"Medieval", era:"Medieval",
techCost: 250, techCost: 275,
buildingCost:160, buildingCost:160,
wonderCost:400, wonderCost:400,
techs:[ techs:[
@ -199,12 +199,13 @@
{ {
columnNumber: 6, columnNumber: 6,
era:"Medieval", era:"Medieval",
techCost: 440, techCost: 485,
buildingCost:200, buildingCost:200,
wonderCost:500, wonderCost:500,
techs:[ techs:[
{ {
name:"Compass", name:"Compass",
cost:375,
row:1, row:1,
prerequisites:["Optics","Theology"], 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" 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, columnNumber: 7,
era:"Renaissance", era:"Renaissance",
techCost: 650, techCost: 780,
buildingCost:250, buildingCost:250,
wonderCost:625, wonderCost:625,
techs:[ techs:[
@ -286,7 +287,7 @@
{ {
columnNumber: 8, columnNumber: 8,
era:"Renaissance", era:"Renaissance",
techCost: 900, techCost: 1150,
buildingCost:300, buildingCost:300,
wonderCost:750, wonderCost:750,
techs:[ techs:[
@ -325,7 +326,7 @@
{ {
columnNumber: 9, columnNumber: 9,
era:"Industrial", era:"Industrial",
techCost: 1300, techCost: 1600,
buildingCost:360, buildingCost:360,
wonderCost:920, wonderCost:920,
techs:[ techs:[
@ -370,7 +371,7 @@
{ {
columnNumber: 10, columnNumber: 10,
era:"Industrial", era:"Industrial",
techCost: 1680, techCost: 2350,
buildingCost:500, buildingCost:500,
wonderCost:1060, wonderCost:1060,
techs:[ techs:[
@ -404,7 +405,7 @@
{ {
columnNumber: 11, columnNumber: 11,
era:"Modern", era:"Modern",
techCost: 3000, techCost: 3100,
buildingCost:500, buildingCost:500,
wonderCost:1250, wonderCost:1250,
techs:[ techs:[
@ -476,7 +477,7 @@
{ {
columnNumber: 13, columnNumber: 13,
era:"Information", era:"Information",
techCost: 5330, techCost: 5100,
buildingCost:500, buildingCost:500,
wonderCost:1250, wonderCost:1250,
techs:[ techs:[
@ -509,7 +510,7 @@
{ {
columnNumber: 14, columnNumber: 14,
era:"Information", era:"Information",
techCost: 6850, techCost: 6400,
buildingCost:750, buildingCost:750,
wonderCost:2000, wonderCost:2000,
techs:[ techs:[
@ -543,7 +544,7 @@
{ {
columnNumber: 15, columnNumber: 15,
era:"Future", era:"Future",
techCost: 8182, techCost: 7700,
buildingCost:750, buildingCost:750,
wonderCost:1250, wonderCost:1250,
techs:[ techs:[
@ -579,7 +580,7 @@
{ {
columnNumber: 16, columnNumber: 16,
era:"Future", era:"Future",
techCost: 9500, techCost: 8800,
buildingCost:750, buildingCost:750,
wonderCost:1250, wonderCost:1250,
techs:[ techs:[

View File

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

View File

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

View File

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

View File

@ -62,15 +62,15 @@ open class CameraStageBaseScreen : Screen {
} }
fun resetFonts(){ fun resetFonts(){
skin.get(TextButton.TextButtonStyle::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(20) skin.get(CheckBox.CheckBoxStyle::class.java).font= Fonts().getFont(45).apply { data.setScale(20/45f) }
skin.get(Label.LabelStyle::class.java).apply { skin.get(Label.LabelStyle::class.java).apply {
font = Fonts().getFont(18) font = Fonts().getFont(45).apply { data.setScale(18/45f) }
fontColor= Color.WHITE fontColor= Color.WHITE
} }
skin.get(TextField.TextFieldStyle::class.java).font = Fonts().getFont(18) skin.get(TextField.TextFieldStyle::class.java).font = Fonts().getFont(45).apply { data.setScale(18/45f) }
skin.get(SelectBox.SelectBoxStyle::class.java).font = Fonts().getFont(20) 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(20) 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 skin.get(CheckBox.CheckBoxStyle::class.java).fontColor= Color.WHITE
} }
internal var batch: Batch = SpriteBatch() 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 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 = Label.LabelStyle(labelStyle) // clone this to another
labelStyle.fontColor = fontColor 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 { fun Label.setFontSize(size:Int): Label {
style = Label.LabelStyle(style) 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. 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
} }