UI Upgrade (#3149)

* UI Update

* Replace ScrollPane with Table in Minimap
This commit is contained in:
lishaoxia1985 2020-09-18 15:59:18 +08:00 committed by GitHub
parent a0d18889e0
commit 9f4607635b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 67 additions and 109 deletions

View File

@ -521,8 +521,7 @@ Raze city = 摧毁城市
Stop razing city = 停止摧毁城市 Stop razing city = 停止摧毁城市
Buy for [amount] gold = 花费[amount]金钱购买 Buy for [amount] gold = 花费[amount]金钱购买
Buy = 购买 Buy = 购买
You have [amount] gold = 你有[amount]金钱 Currently you have [amount] gold. = 目前你有[amount]金钱。
Currently you have [amount] gold. = 目前你有[amount]金钱
Would you like to purchase [constructionName] for [buildingGoldCost] gold? = 你想花费[buildingGoldCost]金钱购买[constructionName]吗? Would you like to purchase [constructionName] for [buildingGoldCost] gold? = 你想花费[buildingGoldCost]金钱购买[constructionName]吗?
No space available to place [unit] near [city] = [city]附近没有位置部署[unit] No space available to place [unit] near [city] = [city]附近没有位置部署[unit]
Maintenance cost = 建筑维护费 Maintenance cost = 建筑维护费
@ -655,7 +654,7 @@ Closest city = 最近的城市
Action = 行动 Action = 行动
Defeated = 战败 Defeated = 战败
[numberOfCivs] Civilizations in the game = 游戏中共有[numberOfCivs]个文明 [numberOfCivs] Civilizations in the game = 游戏中共有[numberOfCivs]个文明
Our Civilization: = 我们的文明 Our Civilization: = 我们的文明:
Known and alive ([numberOfCivs]) = 已知的幸存文明 ([numberOfCivs]) Known and alive ([numberOfCivs]) = 已知的幸存文明 ([numberOfCivs])
Known and defeated ([numberOfCivs]) = 已知的陨落文明 ([numberOfCivs]) Known and defeated ([numberOfCivs]) = 已知的陨落文明 ([numberOfCivs])
Tiles = 地块 Tiles = 地块
@ -811,6 +810,7 @@ Adopt policy = 推行政策
Adopt free policy = 推行免费的政策 Adopt free policy = 推行免费的政策
Unlocked at = 解锁时代: Unlocked at = 解锁时代:
Gain 2 free technologies = 获得2项免费科技 Gain 2 free technologies = 获得2项免费科技
All policies adopted = 所有政策皆已推行
# Technologies # Technologies
@ -819,8 +819,7 @@ Mass Media = 大众传媒
# Terrains # Terrains
Impassable = 不能通行 Impassable = 不能通行
# Requires translation! Rare feature = 稀有地貌
Rare feature =
# Resources # Resources
@ -905,9 +904,8 @@ Are you SURE you want to delete this mod? = 你确定要删除这个模组吗?
[stats] from every [param] = 每个[param][stats] [stats] from every [param] = 每个[param][stats]
[stats] from [param] tiles in this city = 所在城市的[param]地块[stats] [stats] from [param] tiles in this city = 所在城市的[param]地块[stats]
[stats] for each adjacent [param] = 每个相邻的[param][stats] [stats] for each adjacent [param] = 每个相邻的[param][stats]
Must be next to [terrain] = 必须紧邻[terrain] Must be next to [terrain] = 城市必须毗邻[terrain]
# Requires translation! Must be on [terrain] = 城市必须位于[terrain]之上
Must be on [terrain] =
+[amount]% vs [unitType] = 对战[unitType]时+[amount]% +[amount]% vs [unitType] = 对战[unitType]时+[amount]%
# City filters # City filters
@ -928,8 +926,7 @@ Monument = 纪念碑
Granary = 粮仓 Granary = 粮仓
# Requires translation! Must not be on [terrain] = 城市不能位于[terrain]
Must not be on [terrain] =
Stone Works = 石工坊 Stone Works = 石工坊
'Time crumbles things; everything grows old and is forgotten under the power of time' - Aristotle = “时间能粉碎一切;所有事物终将在时流中衰老并被遗忘。”——亚里士多德 'Time crumbles things; everything grows old and is forgotten under the power of time' - Aristotle = “时间能粉碎一切;所有事物终将在时流中衰老并被遗忘。”——亚里士多德
@ -961,7 +958,7 @@ Walls of Babylon = 巴比伦城墙
'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge = “哦,别让你所受的死亡痛苦进入我的身体。我是创世神泰姆,我处在天界的最高层,神力护佑着我和所有其他神灵直到永远。”——“死者之书”译文,欧内斯特·阿尔弗雷德·沃利斯·巴吉爵士(英国考古学家) 'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge = “哦,别让你所受的死亡痛苦进入我的身体。我是创世神泰姆,我处在天界的最高层,神力护佑着我和所有其他神灵直到永远。”——“死者之书”译文,欧内斯特·阿尔弗雷德·沃利斯·巴吉爵士(英国考古学家)
Worker construction increased 25% = 设施建造速度+25% Worker construction increased 25% = 设施建造速度+25%
Provides 2 free workers = 提供2个免费工人 [amount] free [unit] units appear = [amount]个免费的[unit]出现
The Pyramids = 大金字塔 The Pyramids = 大金字塔
Barracks = 军营 Barracks = 军营
@ -1048,8 +1045,7 @@ Chichen Itza = 奇琴伊察
'Few romances can ever surpass that of the granite citadel on top of the beetling precipices of Machu Picchu, the crown of Inca Land.' - Hiram Bingham = “很少有能超越这座建立在马丘比丘顶峰峭壁上的石头城塞的浪漫,它是印加的皇冠。”——海勒姆·宾厄姆(美国探险家) 'Few romances can ever surpass that of the granite citadel on top of the beetling precipices of Machu Picchu, the crown of Inca Land.' - Hiram Bingham = “很少有能超越这座建立在马丘比丘顶峰峭壁上的石头城塞的浪漫,它是印加的皇冠。”——海勒姆·宾厄姆(美国探险家)
Gold from all trade routes +25% = 所有贸易路线的金币收益+25% Gold from all trade routes +25% = 所有贸易路线的金币收益+25%
# Requires translation! Must have an owned [terrain] within [amount] tiles = 城市[amount]格内的己方地块必须有[terrain]
Must have an owned [terrain] within [amount] tiles =
Machu Picchu = 马丘比丘 Machu Picchu = 马丘比丘
Workshop = 工坊 Workshop = 工坊
@ -1121,7 +1117,6 @@ Museum = 博物馆
Hermitage = 冬宫 Hermitage = 冬宫
'Every genuine work of art has as much reason for being as the earth and the sun' - Ralph Waldo Emerson = “每一件伟大的艺术品都应如日月般长存。”——拉尔夫·沃尔多·爱默生 'Every genuine work of art has as much reason for being as the earth and the sun' - Ralph Waldo Emerson = “每一件伟大的艺术品都应如日月般长存。”——拉尔夫·沃尔多·爱默生
2 free Great Artists appear = 2个免费的伟大艺术家出现
The Louvre = 卢浮宫 The Louvre = 卢浮宫
Seaport = 海运码头 Seaport = 海运码头
@ -1201,7 +1196,6 @@ Enables construction of Spaceship parts = 允许建造太空飞船的部件
Apollo Program = 阿波罗计划 Apollo Program = 阿波罗计划
'The wonder is, not that the field of stars is so vast, but that man has measured it.' - Anatole France = “奇迹的不是那片星域如此辽阔,而是人类竟然成功测量了它。”——阿纳托尔·法郎士(法国小说家) 'The wonder is, not that the field of stars is so vast, but that man has measured it.' - Anatole France = “奇迹的不是那片星域如此辽阔,而是人类竟然成功测量了它。”——阿纳托尔·法郎士(法国小说家)
2 free great scientists appear = 2个免费的大科学家出现
Hubble Space Telescope = 哈勃太空望远镜 Hubble Space Telescope = 哈勃太空望远镜
SS Cockpit = 飞船驾驶舱 SS Cockpit = 飞船驾驶舱
@ -1931,8 +1925,7 @@ Ruin! Ruin! Istanbul becomes Iram of the Pillars, remembered only by the melanch
From the magnificence of Topkapi, the Ottoman nation greets you, stranger! I'm Suleiman, Kayser-I Rum, and I bestow upon you my welcome! = 在托普卡利的壮丽之下,奥斯曼帝国向您致敬,陌生人!我是苏莱曼一世,在这里,我表示对您的欢迎! From the magnificence of Topkapi, the Ottoman nation greets you, stranger! I'm Suleiman, Kayser-I Rum, and I bestow upon you my welcome! = 在托普卡利的壮丽之下,奥斯曼帝国向您致敬,陌生人!我是苏莱曼一世,在这里,我表示对您的欢迎!
Let us do business! Would you be interested? = 让我们做些威尼斯商人要做的事吧,你对这个交易怎么看? Let us do business! Would you be interested? = 让我们做些威尼斯商人要做的事吧,你对这个交易怎么看?
Barbary Corsairs = 巴巴里海盗 Barbary Corsairs = 巴巴里海盗
# Requires translation! 50% chance of capturing defeated Barbarian naval units and earning 25 Gold = 50%几率俘获战败的蛮族海军单位同时获得25金钱
50% chance of capturing defeated Barbarian naval units and earning 25 Gold =
Pay only one third the usual cost for naval unit maintenance = 海上单位维护费为正常值的1/3 Pay only one third the usual cost for naval unit maintenance = 海上单位维护费为正常值的1/3
Istanbul = 伊斯坦布尔 Istanbul = 伊斯坦布尔
Edirne = 埃迪尔内 Edirne = 埃迪尔内
@ -3009,6 +3002,7 @@ Fort = 堡垒
Road = 道路 Road = 道路
Remove Forest = 砍伐森林 Remove Forest = 砍伐森林
Remove Jungle = 砍伐丛林 Remove Jungle = 砍伐丛林
@ -3035,8 +3029,7 @@ Customs house = 海关
Deal 30 damage to adjacent enemy units = 任何在军事要塞旁结束回合的敌方单位将遭受30点损伤 Deal 30 damage to adjacent enemy units = 任何在军事要塞旁结束回合的敌方单位将遭受30点损伤
Citadel = 军事要塞 Citadel = 军事要塞
# Requires translation! Can only be built on Coastal tiles = 只能建造在海滨地块
Can only be built on Coastal tiles =
Moai = 摩艾石像群 Moai = 摩艾石像群
Cannot be built on bonus resource = 无法建造在拥有奖励资源的地块 Cannot be built on bonus resource = 无法建造在拥有奖励资源的地块
@ -3282,6 +3275,7 @@ Founds a new city = 建立一座城市,组建此单位时城市的食物积累
Ignores terrain cost = 所有地形都只消耗1移动力 Ignores terrain cost = 所有地形都只消耗1移动力
Maori Warrior = 毛利勇士 Maori Warrior = 毛利勇士
Jaguar = 美洲虎战士 Jaguar = 美洲虎战士

View File

@ -534,8 +534,7 @@ Raze city = 摧毀城市
Stop razing city = 停止摧毀城市 Stop razing city = 停止摧毀城市
Buy for [amount] gold = 花費[amount]金錢購買 Buy for [amount] gold = 花費[amount]金錢購買
Buy = 購買 Buy = 購買
You have [amount] gold = 你有[amount]金錢 Currently you have [amount] gold. = 目前你有[amount]金錢。
Currently you have [amount] gold. = 目前你有[amount]金錢
Would you like to purchase [constructionName] for [buildingGoldCost] gold? = 你想花費[buildingGoldCost]金錢購買[constructionName]嗎? Would you like to purchase [constructionName] for [buildingGoldCost] gold? = 你想花費[buildingGoldCost]金錢購買[constructionName]嗎?
No space available to place [unit] near [city] = [city]附近沒有位置部署[unit] No space available to place [unit] near [city] = [city]附近沒有位置部署[unit]
Maintenance cost = 建築維護費 Maintenance cost = 建築維護費
@ -638,8 +637,7 @@ military units = 軍事單位
melee units = 近戰單位 melee units = 近戰單位
mounted units = 騎乘單位 mounted units = 騎乘單位
naval units = 海軍單位 naval units = 海軍單位
# Requires translation! ranged units = 遠程單位
ranged units =
# For the All "newly-trained [relevant] units in this city receive the [] promotion" translation. Relevant as in 'units that can receive' # For the All "newly-trained [relevant] units in this city receive the [] promotion" translation. Relevant as in 'units that can receive'
relevant = 相應的 relevant = 相應的
# For '[stats] from [Water] tiles in this city' # For '[stats] from [Water] tiles in this city'
@ -647,8 +645,7 @@ Water = 水上
# For [stats] from [Water resource] tiles in this city # For [stats] from [Water resource] tiles in this city
Water resource = 水上資源 Water resource = 水上資源
River = 河流 River = 河流
# Requires translation! Fresh water = 淡水
Fresh water =
non-fresh water = 非淡水 non-fresh water = 非淡水
Wonders = 奇觀 Wonders = 奇觀
@ -670,7 +667,7 @@ Closest city = 最近的城市
Action = 行動 Action = 行動
Defeated = 戰敗 Defeated = 戰敗
[numberOfCivs] Civilizations in the game = 遊戲中共有[numberOfCivs]個文明 [numberOfCivs] Civilizations in the game = 遊戲中共有[numberOfCivs]個文明
Our Civilization: = 我們的文明 Our Civilization: = 我們的文明:
Known and alive ([numberOfCivs]) = 已知的倖存文明 ([numberOfCivs]) Known and alive ([numberOfCivs]) = 已知的倖存文明 ([numberOfCivs])
Known and defeated ([numberOfCivs]) = 已知的殞落文明 ([numberOfCivs]) Known and defeated ([numberOfCivs]) = 已知的殞落文明 ([numberOfCivs])
Tiles = 地區 Tiles = 地區
@ -836,6 +833,7 @@ Adopt policy = 推行政策
Adopt free policy = 推行免費的政策 Adopt free policy = 推行免費的政策
Unlocked at = 解鎖時代: Unlocked at = 解鎖時代:
Gain 2 free technologies = 獲得2項免費科技 Gain 2 free technologies = 獲得2項免費科技
All policies adopted = 所有政策皆已推行
# Technologies # Technologies
@ -844,8 +842,7 @@ Mass Media = 大眾傳媒
# Terrains # Terrains
Impassable = 不能通行 Impassable = 不能通行
# Requires translation! Rare feature = 稀有地貌
Rare feature =
# Resources # Resources
@ -855,12 +852,9 @@ Cocoa = 可可
Crab = 螃蟹 Crab = 螃蟹
Citrus = 柑橘 Citrus = 柑橘
Truffles = 松露 Truffles = 松露
# Requires translation! Strategic = 戰略資源
Strategic = Bonus = 獎勵資源
# Requires translation! Luxury = 奢侈資源
Bonus =
# Requires translation!
Luxury =
# Unit types # Unit types
@ -941,11 +935,9 @@ Are you SURE you want to delete this mod? =
[stats] from every [param] = 每個[param][stats] [stats] from every [param] = 每個[param][stats]
[stats] from [param] tiles in this city = 所在城市的[param]地塊[stats] [stats] from [param] tiles in this city = 所在城市的[param]地塊[stats]
[stats] for each adjacent [param] = 每個相鄰的[param][stats] [stats] for each adjacent [param] = 每個相鄰的[param][stats]
Must be next to [terrain] = 必須緊鄰[terrain] Must be next to [terrain] = 城市必須毗鄰[terrain]
# Requires translation! Must be on [terrain] = 城市必須位於[terrain]之上
Must be on [terrain] = +[amount]% vs [unitType] = 對戰[unitType]時+[amount]%
# Requires translation!
+[amount]% vs [unitType] =
# City filters # City filters
# Requires translation! # Requires translation!
@ -965,8 +957,7 @@ Monument = 紀念碑
Granary = 糧倉 Granary = 糧倉
# Requires translation! Must not be on [terrain] = 城市不能位於[terrain]
Must not be on [terrain] =
Stone Works = 石工坊 Stone Works = 石工坊
'Time crumbles things; everything grows old and is forgotten under the power of time' - Aristotle = “時間能粉碎一切;所有事物中將在時流中衰老並被遺忘。”——亞里士多德 'Time crumbles things; everything grows old and is forgotten under the power of time' - Aristotle = “時間能粉碎一切;所有事物中將在時流中衰老並被遺忘。”——亞里士多德
@ -1003,7 +994,8 @@ Walls of Babylon = 巴比倫城牆
'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge = “哦,別讓你所受的死亡痛苦進入我的身體。我是創世神泰姆,我處在天界的最高層,神力護佑著我和所有其他神靈直到永遠。”——“死者之書”譯文,歐內斯特·阿爾弗雷德·沃利斯·巴吉爵士(英國考古學家) 'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge = “哦,別讓你所受的死亡痛苦進入我的身體。我是創世神泰姆,我處在天界的最高層,神力護佑著我和所有其他神靈直到永遠。”——“死者之書”譯文,歐內斯特·阿爾弗雷德·沃利斯·巴吉爵士(英國考古學家)
Worker construction increased 25% = 設施建造速度+25% Worker construction increased 25% = 設施建造速度+25%
Provides 2 free workers = 提供2個免費工人 # Requires translation!
[amount] free [unit] units appear =
The Pyramids = 大金字塔 The Pyramids = 大金字塔
Barracks = 軍營 Barracks = 軍營
@ -1166,7 +1158,6 @@ Museum = 博物館
Hermitage = 冬宮 Hermitage = 冬宮
'Every genuine work of art has as much reason for being as the earth and the sun' - Ralph Waldo Emerson = “每一件偉大的藝術品都應如日月般長存。”——拉爾夫·沃爾多·愛默生 'Every genuine work of art has as much reason for being as the earth and the sun' - Ralph Waldo Emerson = “每一件偉大的藝術品都應如日月般長存。”——拉爾夫·沃爾多·愛默生
2 free Great Artists appear = 2名免費的大藝術家出現
The Louvre = 羅浮宮 The Louvre = 羅浮宮
Seaport = 海運碼頭 Seaport = 海運碼頭
@ -1246,7 +1237,6 @@ Enables construction of Spaceship parts = 允許建造太空飛船的零件
Apollo Program = 阿波羅計畫 Apollo Program = 阿波羅計畫
'The wonder is, not that the field of stars is so vast, but that man has measured it.' - Anatole France = “奇跡的不是那片星域如此遼闊,而是人類竟然成功測量了它。”——阿納托爾·法郎士(法國小說家) 'The wonder is, not that the field of stars is so vast, but that man has measured it.' - Anatole France = “奇跡的不是那片星域如此遼闊,而是人類竟然成功測量了它。”——阿納托爾·法郎士(法國小說家)
2 free great scientists appear = 2個免費的大科學家出現
Hubble Space Telescope = 哈柏太空望遠鏡 Hubble Space Telescope = 哈柏太空望遠鏡
SS Cockpit = 飛船駕駛艙 SS Cockpit = 飛船駕駛艙
@ -1976,8 +1966,7 @@ Ruin! Ruin! Istanbul becomes Iram of the Pillars, remembered only by the melanch
From the magnificence of Topkapi, the Ottoman nation greets you, stranger! I'm Suleiman, Kayser-I Rum, and I bestow upon you my welcome! = 在托普卡利的壯麗之下,奧斯曼帝國向您致敬,陌生人!我是蘇萊曼一世,在這裡,我表示對您的歡迎! From the magnificence of Topkapi, the Ottoman nation greets you, stranger! I'm Suleiman, Kayser-I Rum, and I bestow upon you my welcome! = 在托普卡利的壯麗之下,奧斯曼帝國向您致敬,陌生人!我是蘇萊曼一世,在這裡,我表示對您的歡迎!
Let us do business! Would you be interested? = 讓我們做些威尼斯商人要做的事吧,你對這個交易怎麼看? Let us do business! Would you be interested? = 讓我們做些威尼斯商人要做的事吧,你對這個交易怎麼看?
Barbary Corsairs = 巴巴里海盜 Barbary Corsairs = 巴巴里海盜
# Requires translation! 50% chance of capturing defeated Barbarian naval units and earning 25 Gold = 50%幾率俘獲戰敗的蠻族海軍單位同時獲得25金錢
50% chance of capturing defeated Barbarian naval units and earning 25 Gold =
Pay only one third the usual cost for naval unit maintenance = 海上單位維護費為正常值的1/3 Pay only one third the usual cost for naval unit maintenance = 海上單位維護費為正常值的1/3
Istanbul = 伊斯坦布爾 Istanbul = 伊斯坦布爾
Edirne = 埃迪爾內 Edirne = 埃迪爾內
@ -3103,6 +3092,7 @@ Fort = 堡壘
Road = 道路 Road = 道路
Remove Forest = 砍伐森林 Remove Forest = 砍伐森林
Remove Jungle = 砍伐叢林 Remove Jungle = 砍伐叢林
@ -3377,6 +3367,7 @@ Founds a new city = 建立一座城市,組建此單位時城市的食物積累
Ignores terrain cost = 所有地形都只消耗1移動力 Ignores terrain cost = 所有地形都只消耗1移動力
Maori Warrior = 毛利勇士 Maori Warrior = 毛利勇士
# Requires translation! # Requires translation!

View File

@ -521,7 +521,6 @@ Raze city =
Stop razing city = Stop razing city =
Buy for [amount] gold = Buy for [amount] gold =
Buy = Buy =
You have [amount] gold =
Currently you have [amount] gold. = Currently you have [amount] gold. =
Would you like to purchase [constructionName] for [buildingGoldCost] gold? = Would you like to purchase [constructionName] for [buildingGoldCost] gold? =
No space available to place [unit] near [city] = No space available to place [unit] near [city] =

View File

@ -54,7 +54,7 @@ class BaseUnit : INamed, IConstruction {
fun getDescription(forPickerScreen:Boolean): String { fun getDescription(forPickerScreen:Boolean): String {
val sb = StringBuilder() val sb = StringBuilder()
if(requiredResource!=null) sb.appendln("{Requires} {$requiredResource}".tr()) if(requiredResource!=null) sb.appendln("Consumes 1 [{$requiredResource}]".tr())
if(!forPickerScreen) { if(!forPickerScreen) {
if(uniqueTo!=null) sb.appendln("Unique to [$uniqueTo], replaces [$replaces]".tr()) if(uniqueTo!=null) sb.appendln("Unique to [$uniqueTo], replaces [$replaces]".tr())
else sb.appendln("{Cost}: $cost".tr()) else sb.appendln("{Cost}: $cost".tr())
@ -77,7 +77,7 @@ class BaseUnit : INamed, IConstruction {
sb.appendln(promotions.joinToString(", ", " ") { it.tr() }) sb.appendln(promotions.joinToString(", ", " ") { it.tr() })
} }
return sb.toString() return sb.toString().trim()
} }
fun getMapUnit(ruleset: Ruleset): MapUnit { fun getMapUnit(ruleset: Ruleset): MapUnit {

View File

@ -62,7 +62,7 @@ class CityScreenCityPickerTable(val cityScreen: CityScreen) : Table(){
cityNameTable.add(currentCityLabel) cityNameTable.add(currentCityLabel)
add(cityNameTable).width(stage.width/3) add(cityNameTable).width(stage.width/4)
if (civInfo.cities.size > 1) { if (civInfo.cities.size > 1) {

View File

@ -6,11 +6,12 @@ import com.unciv.UncivGame
import com.unciv.logic.map.TileInfo import com.unciv.logic.map.TileInfo
import com.unciv.models.UncivSound import com.unciv.models.UncivSound
import com.unciv.models.stats.Stats import com.unciv.models.stats.Stats
import com.unciv.models.translations.tr
import com.unciv.ui.utils.* import com.unciv.ui.utils.*
import kotlin.math.roundToInt import kotlin.math.roundToInt
class CityScreenTileTable(val cityScreen: CityScreen): Table(){ class CityScreenTileTable(private val cityScreen: CityScreen): Table(){
val innerTable = Table() private val innerTable = Table()
val city = cityScreen.city val city = cityScreen.city
init{ init{
innerTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f)) innerTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
@ -28,7 +29,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){
innerTable.clearChildren() innerTable.clearChildren()
val stats = selectedTile.getTileStats(city, city.civInfo) val stats = selectedTile.getTileStats(city, city.civInfo)
innerTable.pad(20f) innerTable.pad(5f)
innerTable.add(selectedTile.toString(city.civInfo).toLabel()).colspan(2) innerTable.add(selectedTile.toString(city.civInfo).toLabel()).colspan(2)
innerTable.row() innerTable.row()
@ -40,8 +41,9 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){
val buyTileButton = "Buy for [$goldCostOfTile] gold".toTextButton() val buyTileButton = "Buy for [$goldCostOfTile] gold".toTextButton()
buyTileButton.onClick(UncivSound.Coin) { buyTileButton.onClick(UncivSound.Coin) {
city.expansion.buyTile(selectedTile) val purchasePrompt = "Currently you have [${city.civInfo.gold}] gold.".tr() + "\n" +
UncivGame.Current.setScreen(CityScreen(city)) "Would you like to purchase [Tile] for [$goldCostOfTile] gold?".tr()
YesNoPopup(purchasePrompt, { city.expansion.buyTile(selectedTile);UncivGame.Current.setScreen(CityScreen(city)) }, cityScreen).open()
} }
if((goldCostOfTile>city.civInfo.gold && !city.civInfo.gameInfo.gameParameters.godMode) if((goldCostOfTile>city.civInfo.gold && !city.civInfo.gameInfo.gameParameters.godMode)
|| city.isPuppet || city.isPuppet
@ -49,7 +51,6 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){
buyTileButton.disable() buyTileButton.disable()
innerTable.add(buyTileButton).row() innerTable.add(buyTileButton).row()
innerTable.add("You have [${city.civInfo.gold}] gold".toLabel(Color.YELLOW, 16)).padTop(2f)
} }
if(city.civInfo.cities.filterNot { it==city } if(city.civInfo.cities.filterNot { it==city }

View File

@ -21,7 +21,7 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
background = ImageGetter.getBackground(colorFromRGB(194,180,131)) background = ImageGetter.getBackground(colorFromRGB(194,180,131))
innerTable.pad(5f) innerTable.pad(5f)
innerTable.defaults().pad(5f) innerTable.defaults().pad(2f)
innerTable.background = ImageGetter.getBackground(Color.BLACK.cpy().apply { a=0.8f }) innerTable.background = ImageGetter.getBackground(Color.BLACK.cpy().apply { a=0.8f })
add(innerTable).fill() add(innerTable).fill()
@ -30,12 +30,11 @@ class CityStatsTable(val cityScreen: CityScreen): Table() {
fun update() { fun update() {
innerTable.clear() innerTable.clear()
val ministatsTable = Table().pad(5f) val ministatsTable = Table()
ministatsTable.defaults()
for(stat in cityInfo.cityStats.currentCityStats.toHashMap()) { for(stat in cityInfo.cityStats.currentCityStats.toHashMap()) {
if(stat.key == Stat.Happiness || stat.key == Stat.Faith) continue if(stat.key == Stat.Happiness || stat.key == Stat.Faith) continue
ministatsTable.add(ImageGetter.getStatIcon(stat.key.name)).size(20f).padRight(3f) ministatsTable.add(ImageGetter.getStatIcon(stat.key.name)).size(20f).padRight(5f)
ministatsTable.add(round(stat.value).toInt().toString().toLabel()).padRight(13f) ministatsTable.add(round(stat.value).toInt().toString().toLabel()).padRight(10f)
} }
innerTable.add(ministatsTable) innerTable.add(ministatsTable)

View File

@ -24,7 +24,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
fun update(selectedConstruction: IConstruction?) { fun update(selectedConstruction: IConstruction?) {
selectedConstructionTable.clear() selectedConstructionTable.clear()
selectedConstructionTable.pad(20f) selectedConstructionTable.pad(5f)
if (selectedConstruction == null) { if (selectedConstruction == null) {
isVisible = false isVisible = false
@ -62,21 +62,16 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
selectedConstructionTable.add(buildingText.toLabel()).row() selectedConstructionTable.add(buildingText.toLabel()).row()
val description: String val description: String = when (construction) {
if (construction is BaseUnit) is BaseUnit -> construction.getDescription(true)
description = construction.getDescription(true) is Building -> construction.getDescription(true, city.civInfo, city.civInfo.gameInfo.ruleSet)
else if (construction is Building) is PerpetualConstruction -> construction.description.replace("[rate]","[${construction.getConversionRate(city)}]") .tr()
description = construction.getDescription(true, city.civInfo, city.civInfo.gameInfo.ruleSet) else -> "" // Should never happen
else if(construction is PerpetualConstruction) }
description = construction.description.replace("[rate]","[${construction.getConversionRate(city)}]") .tr()
else description="" // Should never happen
val descriptionLabel = description.toLabel() val descriptionLabel = description.toLabel()
descriptionLabel.setWrap(true) descriptionLabel.setWrap(true)
descriptionLabel.width = stage.width / 4 selectedConstructionTable.add(descriptionLabel).colspan(2).width(stage.width / 4)
val descriptionScroll = ScrollPane(descriptionLabel)
selectedConstructionTable.add(descriptionScroll).colspan(2).width(stage.width / 4).height(stage.height / 8)
} }

View File

@ -342,7 +342,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
button.disable() button.disable()
cityScreen.closeAllPopups() cityScreen.closeAllPopups()
val purchasePrompt = "Currently you have [${city.civInfo.gold}] gold.".tr() + "\n\n" + val purchasePrompt = "Currently you have [${city.civInfo.gold}] gold.".tr() + "\n" +
"Would you like to purchase [${construction.name}] for [$constructionGoldCost] gold?".tr() "Would you like to purchase [${construction.name}] for [$constructionGoldCost] gold?".tr()
YesNoPopup(purchasePrompt, { purchaseConstruction(construction) }, cityScreen, { cityScreen.update() }).open() YesNoPopup(purchasePrompt, { purchaseConstruction(construction) }, cityScreen, { cityScreen.update() }).open()
} }

View File

@ -83,7 +83,7 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa
civTable.background = ImageGetter.getBackground(Color.BLACK) civTable.background = ImageGetter.getBackground(Color.BLACK)
civTable.add("[${relevantCivs.size}] Civilizations in the game".toLabel()).pad(5f).colspan(4).row() civTable.add("[${relevantCivs.size}] Civilizations in the game".toLabel()).pad(5f).colspan(4).row()
val titleTable = Table() val titleTable = Table()
titleTable.add("Our Civilization:".toLabel()).pad(5f) titleTable.add("Our Civilization:".toLabel())
titleTable.add(ImageGetter.getNationIndicator(viewingPlayer.nation,25f)).pad(5f) titleTable.add(ImageGetter.getNationIndicator(viewingPlayer.nation,25f)).pad(5f)
titleTable.add(viewingPlayer.civName.toLabel()).left().row() titleTable.add(viewingPlayer.civName.toLabel()).left().row()
civTable.add(titleTable).colspan(4).row() civTable.add(titleTable).colspan(4).row()

View File

@ -3,10 +3,10 @@ package com.unciv.ui.utils
import com.unciv.UncivGame import com.unciv.UncivGame
class YesNoPopup(question:String, action:()->Unit, class YesNoPopup(question:String, action:()->Unit,
screen: CameraStageBaseScreen = UncivGame.Current.worldScreen, restoredefault:()->Unit = {}) : Popup(screen){ screen: CameraStageBaseScreen = UncivGame.Current.worldScreen, restoreDefault:()->Unit = {}) : Popup(screen){
init{ init{
add(question.toLabel()).colspan(2).row() add(question.toLabel()).colspan(2).row()
add("No".toTextButton().onClick { close(); restoredefault() }) add("No".toTextButton().onClick { close(); restoreDefault() })
add("Yes".toTextButton().onClick { close(); action() }) add("Yes".toTextButton().onClick { close(); action() })
} }
} }

View File

@ -2,12 +2,9 @@ package com.unciv.ui.worldscreen
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.math.Vector2 import com.badlogic.gdx.math.Vector2
import com.badlogic.gdx.scenes.scene2d.Event
import com.badlogic.gdx.scenes.scene2d.Group import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.InputListener
import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.utils.Align import com.badlogic.gdx.utils.Align
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.logic.HexMath import com.unciv.logic.HexMath
@ -18,21 +15,12 @@ import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.surroundWithCircle import com.unciv.ui.utils.surroundWithCircle
import kotlin.math.max import kotlin.math.max
import kotlin.math.min import kotlin.math.min
import kotlin.math.sqrt
class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){ class Minimap(val mapHolder: WorldMapHolder) : Table(){
val allTiles = Group() private val allTiles = Group()
val tileImages = HashMap<TileInfo, Image>() private val tileImages = HashMap<TileInfo, Image>()
fun setScrollTomapHolder(){
scrollPercentX = mapHolder.scrollPercentX
scrollPercentY = mapHolder.scrollPercentY
}
init { init {
setScrollingDisabled(true, true)
var topX = 0f var topX = 0f
var topY = 0f var topY = 0f
var bottomX = 0f var bottomX = 0f
@ -55,7 +43,6 @@ class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){
positionalVector.y * 0.5f * groupSize) positionalVector.y * 0.5f * groupSize)
hex.onClick { hex.onClick {
mapHolder.setCenterPosition(tileInfo.position) mapHolder.setCenterPosition(tileInfo.position)
setScrollTomapHolder()
} }
allTiles.addActor(hex) allTiles.addActor(hex)
tileImages[tileInfo] = hex tileImages[tileInfo] = hex
@ -74,15 +61,8 @@ class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){
// so we zero out the starting position of the whole board so they will be displayed as well // so we zero out the starting position of the whole board so they will be displayed as well
allTiles.setSize(topX - bottomX, topY - bottomY) allTiles.setSize(topX - bottomX, topY - bottomY)
actor = allTiles add(allTiles)
layout() layout()
updateVisualScroll()
mapHolder.addListener(object : InputListener() {
override fun handle(e: Event?): Boolean {
setScrollTomapHolder()
return true
}
})
} }
fun update(cloneCivilization: CivilizationInfo) { fun update(cloneCivilization: CivilizationInfo) {
@ -100,7 +80,6 @@ class Minimap(val mapHolder: WorldMapHolder) : ScrollPane(null){
nationIcon.setPosition(hex.x - nationIcon.width/3,hex.y - nationIcon.height/3) nationIcon.setPosition(hex.x - nationIcon.width/3,hex.y - nationIcon.height/3)
nationIcon.onClick { nationIcon.onClick {
mapHolder.setCenterPosition(tileInfo.position) mapHolder.setCenterPosition(tileInfo.position)
setScrollTomapHolder()
} }
allTiles.addActor(nationIcon) allTiles.addActor(nationIcon)
} }
@ -118,7 +97,7 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){
pack() pack()
} }
fun getWrappedMinimap(): Table { private fun getWrappedMinimap(): Table {
val internalMinimapWrapper = Table() val internalMinimapWrapper = Table()
// // Temporarily disabled until we can make them work nicely together // // Temporarily disabled until we can make them work nicely together
// val sizePercent = worldScreen.game.settings.minimapSize // val sizePercent = worldScreen.game.settings.minimapSize
@ -141,7 +120,7 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){
return externalMinimapWrapper return externalMinimapWrapper
} }
fun getToggleIcons():Table{ private fun getToggleIcons():Table{
val toggleIconTable=Table() val toggleIconTable=Table()
val settings = UncivGame.Current.settings val settings = UncivGame.Current.settings