F1rstDan's Cool UI

F1rstDan's Cool UI 1.9.0

F1rstDan

Chieftain
Joined
Feb 18, 2025
Messages
45
Download here: https://forums.civfanatics.com/resources/f1rstdans-cool-ui-quick-buy-button-added.31961/
GitHub: https://github.com/F1rstDan/Civ7_F1rstDan_Cool_UI
Hello!
Maybe we can discuss or report bugs here.

I am a novice, not very good at programming, relying on AI assistance.
F1rstDan's Cool UI - 1.png

也许可以在这里讨论或反馈bug
我是新手,不太会编程,全靠AI协助
 
Last edited:
Hey. First of all, I love your mod. You have some good ideas. The way you worked the population and connection info into the yields bar is a very elegant solution. The new "buy with gold" button in the production list is also clever. And smart to re-use the default game texts so you don't need to do localization yourself.

I do have a few suggestions for different localized strings that make the English sound better, and also to solve the missing localization string (LOF_HOF_GRAPH_... as seen in one of your screenshots). (edit: I see you already solved that in 1.6.0)

I also have a few suggestions for the population and connection tooltips:
  • remove the '+' in front of numbers inside the tooltip, because it now shows a + for numbers that are deductions as well (as shown in the third screenshot on your mod main page). You can do this but still keep the + in the tooltip title.
  • remove the total food export from towns (it's always the same as their food production)
  • hide the specialists number for towns
  • hide the "pending population" if no population assignment is pending
I have already made these changes for myself and can share the code with you. If you like (any of) these suggestion, I can either make a pull request on your GitHub or share the suggested code changes here. Just let me know.

And finally, I would consider splitting the mod in two: City Production List (3x *production-chooser*.js and dan-quick-buy-items.js) and City Yields Bar (city-yields.js, dan-city-yields-tooltip.js and 2 textures). There are several other mods that change the production-chooser-item.js file as well, and that makes them incompatible with your mod. But what you do with the yield bar is quite unique. I had to remove the production-chooser-items.js from your mod to make it work with my other mods, but not everyone will be able to do that themselves. By making two mods, everyone can choose any or both of them, depending on what they want and what other mods they already have.

Great mod, keep up the good work!
 
Last edited:
Hey. First of all, I love your mod. You have some good ideas. The way you worked the population and connection info into the yields bar is a very elegant solution. The new "buy with gold" button in the production list is also clever. And smart to re-use the default game texts so you don't need to do localization yourself.

I do have a few suggestions for different localized strings that make the English sound better, and also to solve the missing localization string (LOF_HOF_GRAPH_... as seen in one of your screenshots). (edit: I see you already solved that in 1.6.0)

I also have a few suggestions for the population and connection tooltips:
  • remove the '+' in front of numbers inside the tooltip, because it now shows a + for numbers that are deductions as well (as shown in the third screenshot on your mod main page). You can do this but still keep the + in the tooltip title.
  • remove the total food export from towns (it's always the same as their food production)
  • hide the specialists number for towns
  • hide the "pending population" if no population assignment is pending
I have already made these changes for myself and can share the code with you. If you like (any of) these suggestion, I can either make a pull request on your GitHub or share the suggested code changes here. Just let me know.

And finally, I would consider splitting the mod in two: City Production List (3x *production-chooser*.js and dan-quick-buy-items.js) and City Yields Bar (city-yields.js, dan-city-yields-tooltip.js and 2 textures). There are several other mods that change the production-chooser-item.js file as well, and that makes them incompatible with your mod. But what you do with the yield bar is quite unique. I had to remove the production-chooser-items.js from your mod to make it work with my other mods, but not everyone will be able to do that themselves. By making two mods, everyone can choose any or both of them, depending on what they want and what other mods they already have.

Great mod, keep up the good work!
Thank you for your praise and detailed feedback! Your professional suggestions are greatly appreciated. Here's my response:
1. **Regarding Localization Strings**
- The missing LOF_HOF_GRAPH string issue: I also noticed the English text existing in code but not taking effect, which was confusing. This has been resolved through alternative implementation.
- If you have better string suggestions, please feel free to share them anytime - I'll update promptly.
2. **Tooltip Optimizations**
- Implement conditional logic to eliminate erroneous "+" prefixes
- Remove total food export from towns (confirmed redundant)
- Hide specialist numbers for towns
- Hide "pending population" when value is zero
- These adjustments effectively reduce unnecessary clutter. I'll implement them immediately.
3. **Code Collaboration**
- As I'm new to Pull Requests, it would be most helpful if you could share code snippets directly here. Your support is greatly appreciated!
4. **Modular Separation**
- Considering releasing City Yields Bar as a standalone version
- Simultaneously learning non-invasive implementation approaches to enhance compatibility with other mods
Your code-level optimization insights are crucial for perfecting this mod. Please keep these expert suggestions coming - they're invaluable for the project's development!
=========================================
感谢你的赞美和详细反馈!你提出的改进建议非常专业,以下是我的回复:
1. 关于字符串本地化问题:
- 关于LOF_HOF_GRAPH_缺失字符串的问题,我在代码中发现了英文原文却未生效,这确实令人困惑。不过我已经通过替换方案解决了这个问题。
- 如果你有更好的字符串建议,非常欢迎随时与我分享,我会及时更新。
2. 对于Tooltips的优化:
- 我会尝试增加判断,使得不再出现错误的“+”前缀
- 移除城镇食物出口总量(确实冗余)
- 移除城镇的专家数量显示
- 待放置人口为0时,使其隐藏
- 这些调整非常合理,减少多余的信息,我会立即着手修改
3. 关于代码协作:
- 我尚未尝试过Pull Request,如果你方便的话,直接在此分享代码即可,非常感谢你的支持!
4. 模块拆分建议:
- 我正在考虑将City Yields Bar作为独立版本发布
- 同时也在学习如何通过非侵入式方式提高兼容性,以更好地与其他模组整合
再次感谢您专业的代码级优化建议,这对模组的完善至关重要!期待您继续提出宝贵意见。
 
How can I connect this discussion thread to a resource page?
================
如何把这个讨论帖连接到资源页面上?
 
Last edited:
- The missing LOF_HOF_GRAPH string issue: I also noticed the English text existing in code but not taking effect, which was confusing. This has been resolved through alternative implementation.
I think the Hall of Fame texts aren't loaded because there is no Hall of Fame in-game yet.
 
Last edited:
All text suggesions go into city-yields.js.

line 178: I would change LOC_ATTR_NUM_WORKERS_ON_TILE to LOC_UI_SPECIALISTS_SUBTITLE. In English this would change Specialist Count to Specialists.

line 180: I would change LOC_DIPLOMACY_START_PENDING_PROJECTS_TITLE to LOC_RESOURCE_UNASSIGNED. In English this would change Pendings Actions to Unassigned.

line 183: I would change LOC_UI_CITY_DETAILS_NEW_CITIZEN_IN_TURNS to LOC_UI_CITY_STATUS_TURNS_UNTIL_GROWTH. In English this would change New Citizens in Turns to Turns until Growth.

line 233: I would change LOC_ATTR_NUM_CITIES to LOC_UI_SETTLEMENT_TAB_BAR_CITIES. In English this would change Number of Cities to Cities. I would also remove the icon, because it already shows in the first column. So this line would just become:
JavaScript:
Locale.compose("LOC_UI_SETTLEMENT_TAB_BAR_CITIES"),

line 249: I would change LOC_ATTR_NUM_TOWNS to LOC_UI_SETTLEMENT_TAB_BAR_TOWNS. In English this would change Number of Towns to Towns. And again remove the icon.

line 289: I would change LOC_ATTR_YIELD_INCOME to LOC_GLOBAL_YIELDS_SUMMARY_TOTAL_INCOME. In English this would change Income to Total Income, which feels more appropriate here.

line 303: same as line 233
line 339: same as line 249

Example screenshots:
1741872092854.png
1741872057427.png
 
Last edited:
Code suggestion for file dan-city-yields-tooltip.js:

Change lines 227 - 233 from:
JavaScript:
                    if (child.value) {
                        if (child.valueType == -1) {
                            displayValue = child.value;
                        } else {
                            displayValue = child.isNegative ? child.value : `+${child.value}`;
                        }
                    }
to:
JavaScript:
                    if (child.value) {
                        displayValue = child.value;
                    }

This will remove the + sign for values in the table, but leave the + sign in the title of the tooltip. The code can probably be shortened some more, but I don't have enough Javascript knowledge for that :)

Example screenshot, no more +4.0 from specialists when it's actually -4.0:
1741873728815.png
 
Last edited:
Code suggestions for city-yields.js, going from back to start because otherwise line numbers will change:

Remove lines 350 - 360, to remove the food export total:
JavaScript:
                    // 3. 总共输出食物 - 只有在专业化且有食物产出时才显示
                    if (townFoodYield > 0 && city.Growth?.growthType == GrowthTypes.PROJECT) {
                        this.addChildYieldData(dataConnectivity,
                            '[icon:YIELD_FOOD]' + Locale.compose("LOC_ATTR_YIELD_MINUS_DEDUCTIONS"),
                            '[icon:YIELD_FOOD]' + (-townFoodYield).toFixed(1),
                            {
                                icon: "YIELD_FOOD",
                                iconContext: "YIELD",
                                isNegative: true
                            });
                    }


Change lines 178 - 180 from:
JavaScript:
            this.addChildYieldData(cityPopData, Locale.compose("LOC_UI_SPECIALISTS_SUBTITLE")+' '+textSpecialistMax, specialistPop);
            // 待建设人口
            this.addChildYieldData(cityPopData, Locale.compose("LOC_RESOURCE_UNASSIGNED"), pendingPop);
to:
JavaScript:
            if (!city.isTown || specialistPop > 0) {
                this.addChildYieldData(cityPopData, Locale.compose("LOC_UI_SPECIALISTS_SUBTITLE")+' '+textSpecialistMax, specialistPop);
            }
            // 待建设人口
            if (pendingPop > 0) {
                this.addChildYieldData(cityPopData, Locale.compose("LOC_RESOURCE_UNASSIGNED"), pendingPop);
            }

This will hide hide specialists from towns, unless for some reason there are specialists here (to allow for mods that would accept specialists in towns, and other special situations).
This will also hide pending (unassigned) population if there are none.

Example screenshots:
1741879230751.png
1741879340234.png
 
Last edited:
All text suggesions go into city-yields.js.

line 178: I would change LOC_ATTR_NUM_WORKERS_ON_TILE to LOC_UI_SPECIALISTS_SUBTITLE. In English this would change Specialist Count to Specialists.

line 180: I would change LOC_DIPLOMACY_START_PENDING_PROJECTS_TITLE to LOC_RESOURCE_UNASSIGNED. In English this would change Pendings Actions to Unassigned.

line 183: I would change LOC_UI_CITY_DETAILS_NEW_CITIZEN_IN_TURNS to LOC_UI_CITY_STATUS_TURNS_UNTIL_GROWTH. In English this would change New Citizens in Turns to Turns until Growth.

line 233: I would change LOC_ATTR_NUM_CITIES to LOC_UI_SETTLEMENT_TAB_BAR_CITIES. In English this would change Number of Cities to Cities. I would also remove the icon, because it already shows in the first column. So this line would just become:
JavaScript:
Locale.compose("LOC_UI_SETTLEMENT_TAB_BAR_CITIES"),

line 249: I would change LOC_ATTR_NUM_TOWNS to LOC_UI_SETTLEMENT_TAB_BAR_TOWNS. In English this would change Number of Towns to Towns. And again remove the icon.

line 289: I would change LOC_ATTR_YIELD_INCOME to LOC_GLOBAL_YIELDS_SUMMARY_TOTAL_INCOME. In English this would change Income to Total Income, which feels more appropriate here.

line 303: same as line 233
line 339: same as line 249

Example screenshots:
View attachment 724952 View attachment 724951

Thank you. All changes have been made
For “New Citizens in X Turns”, I added a hint of specialization of the town, suggesting that the population is no longer growing
=============================
谢谢,已全部修改
对于“New Citizens in X Turns”,我增加了对城镇的专业化后的提示,提示人口不再增长
1741897191417.png
1741896960276.png
1741897224340.png
1741899016600.png
 
Last edited:
Code suggestion for file dan-city-yields-tooltip.js:

Change lines 227 - 233 from:
JavaScript:
                    if (child.value) {
                        if (child.valueType == -1) {
                            displayValue = child.value;
                        } else {
                            displayValue = child.isNegative ? child.value : `+${child.value}`;
                        }
                    }
to:
JavaScript:
                    if (child.value) {
                        displayValue = child.value;
                    }

This will remove the + sign for values in the table, but leave the + sign in the title of the tooltip. The code can probably be shortened some more, but I don't have enough Javascript knowledge for that :)

Example screenshot, no more +4.0 from specialists when it's actually -4.0:
View attachment 724955

Now the plus and minus sign can be displayed correctly at the deduction level (the value plus and minus is flipped in the code)
===========================
现在在扣除的级别下能正确显示正负号(代码里翻转了数值正负)
1741897421612.png
 
Code suggestions for city-yields.js, going from back to start because otherwise line numbers will change:

Remove lines 350 - 360, to remove the food export total:
JavaScript:
                    // 3. 总共输出食物 - 只有在专业化且有食物产出时才显示
                    if (townFoodYield > 0 && city.Growth?.growthType == GrowthTypes.PROJECT) {
                        this.addChildYieldData(dataConnectivity,
                            '[icon:YIELD_FOOD]' + Locale.compose("LOC_ATTR_YIELD_MINUS_DEDUCTIONS"),
                            '[icon:YIELD_FOOD]' + (-townFoodYield).toFixed(1),
                            {
                                icon: "YIELD_FOOD",
                                iconContext: "YIELD",
                                isNegative: true
                            });
                    }


Change lines 178 - 180 from:
JavaScript:
            this.addChildYieldData(cityPopData, Locale.compose("LOC_UI_SPECIALISTS_SUBTITLE")+' '+textSpecialistMax, specialistPop);
            // 待建设人口
            this.addChildYieldData(cityPopData, Locale.compose("LOC_RESOURCE_UNASSIGNED"), pendingPop);
to:
JavaScript:
            if (!city.isTown || specialistPop > 0) {
                this.addChildYieldData(cityPopData, Locale.compose("LOC_UI_SPECIALISTS_SUBTITLE")+' '+textSpecialistMax, specialistPop);
            }
            // 待建设人口
            if (pendingPop > 0) {
                this.addChildYieldData(cityPopData, Locale.compose("LOC_RESOURCE_UNASSIGNED"), pendingPop);
            }

This will hide hide specialists from towns, unless for some reason there are specialists here (to allow for mods that would accept specialists in towns, and other special situations).
This will also hide pending (unassigned) population if there are none.

Example screenshots:
View attachment 724968 View attachment 724969

New additions, population turns into migrant when settlements cannot expand, display of migrant numbers
Thanks again for your help.
1741899431441.png
 

Attachments

  • 1741898661396.png
    1741898661396.png
    3.3 MB · Views: 117
Last edited:
Good update. Nice solutions for the +/- for values in the table and for the "infinite" turns to grow for specialized towns. I've done a quick test and it looks good. Well done!

I have two very minor suggestions for readability, for when you do a next update:
  • Add a space behind the bullet, dan-city-yields-tooltip.js line 222: displayLabel = '• ';
  • Add a space between "Specialists" and "(Maximum # per tile)". I see in your code (city-yields.js line 194) that you already added that space, but it doesn't show. The 'bold' tag is probably interfering, but no idea why.
1741903031205.png
 
This is the best mod in my book. Excellent job! Thank you for your work F1rstDan!
(Also thank you Finwickle for your excellent suggestions, making the mod even better!)
 
Rather trivial thing, but it would be nice if you stuck the files in a directory in the zip. I generally don't actually unzip, just browse it and move the files out to the mod directory. I usually delete the mod directory so there's no keep/replace issues. So I end up having to recreate the directory for your mod each time. Even more trivial is I archive the zips. Originally, I didn't know you could get them from history on this site but find I like having them readily available on my computer when browsing for learning. So, it would be nice to have the version number in the zip file. A pretty trivial issue since renaming it isn't that much trouble.

Originally you just did tooltips on the yield banner which no one else was doing. You seem to have grown into the production panel which several people are doing, City Hall being one such that I'm using. You might want to coordinate with beezany and others to be sure the right one displays when multiple are present. You, at least, want to know which ones might if a user asks why your changes aren't displaying. If I'm wrong about whether you actually changed the production panel then ignore this.
 
Good update. Nice solutions for the +/- for values in the table and for the "infinite" turns to grow for specialized towns. I've done a quick test and it looks good. Well done!

I have two very minor suggestions for readability, for when you do a next update:
  • Add a space behind the bullet, dan-city-yields-tooltip.js line 222: displayLabel = '• ';
  • Add a space between "Specialists" and "(Maximum # per tile)". I see in your code (city-yields.js line 194) that you already added that space, but it doesn't show. The 'bold' tag is probably interfering, but no idea why.
View attachment 725056
The space is not valid, just use it  
The next version update will include the above content, thank you.
=============================
空格不生效用   就可以了
下个版本更新时将附带以上内容,谢谢
 
This is the best mod in my book. Excellent job! Thank you for your work F1rstDan!
(Also thank you Finwickle for your excellent suggestions, making the mod even better!)
Your praise is the motivation for me to make the mod~
==============
你的夸奖是我制作MOD的动力~
 
Rather trivial thing, but it would be nice if you stuck the files in a directory in the zip. I generally don't actually unzip, just browse it and move the files out to the mod directory. I usually delete the mod directory so there's no keep/replace issues. So I end up having to recreate the directory for your mod each time. Even more trivial is I archive the zips. Originally, I didn't know you could get them from history on this site but find I like having them readily available on my computer when browsing for learning. So, it would be nice to have the version number in the zip file. A pretty trivial issue since renaming it isn't that much trouble.

Originally you just did tooltips on the yield banner which no one else was doing. You seem to have grown into the production panel which several people are doing, City Hall being one such that I'm using. You might want to coordinate with beezany and others to be sure the right one displays when multiple are present. You, at least, want to know which ones might if a user asks why your changes aren't displaying. If I'm wrong about whether you actually changed the production panel then ignore this.
Certainly. In the future, the version number will be included in the version zip file.
Currently, when using "City Hall" concurrently, the production list will be replaced with my version, and there don't seem to be conflicts in other areas.
I also hope to communicate more with other authors. However, I'm not quite sure where they mainly interact, and moreover, I have to rely on AI translation.
====================
好的,以后的版本压缩包将带上版本号。
目前,同时使用“City Hall”,production list 会被替换成我的版本,其他地方似乎不会发生冲突。
我也希望多和其他作者交流,但我不太清楚他们主要在哪交流,而且我也必须借助AI翻译。
 
The translation seems to be doing a pretty good job. Many developers are reluctant to use generated translations due to the fear it will generate something offensive. I imagine many would appreciate someone verifying Chinese translations. There's a Discord server for mod developers. Some mods, such as City Hall, have public GitHub projects. I'm not sure about language support in either one of those. It would seem given the number of both gamers and developers that they should, but that doesn't mean they do.
 
The translation seems to be doing a pretty good job. Many developers are reluctant to use generated translations due to the fear it will generate something offensive. I imagine many would appreciate someone verifying Chinese translations. There's a Discord server for mod developers. Some mods, such as City Hall, have public GitHub projects. I'm not sure about language support in either one of those. It would seem given the number of both gamers and developers that they should, but that doesn't mean they do.
Thanks, I have found the Discord channel.
I'm also afraid that the wrong translation will generate offensive content, so I always paste the original text.
====================
谢谢,我已经找到 Discord 频道了
我也害怕翻译错误生成冒犯内容,所以总会贴上原文
 
Back
Top Bottom