Modding: allow custom ResourcePortraits (#8330)

* Modding: allow custom ResourcePortraits

* Modding: big generification of the icons/portraits mechanism

* Resolve conflict

* Fix background fallback, remove dimming of improvement icons

Co-authored-by: tunerzinc@gmail.com <vfylfhby>
This commit is contained in:
vegeta1k95
2023-01-09 20:03:00 +01:00
committed by GitHub
parent 506d9e65ff
commit 0006aaef55
45 changed files with 1401 additions and 1242 deletions

View File

@ -601,6 +601,8 @@ Unless otherwise specified, all the following are from [the Noun Project](https:
- [pennant](https://thenounproject.com/term/pennant/194797/) by Sara Jeffries
- [Maya civilization](https://thenounproject.com/term/maya-civilization/1715786/) by Olena Panasovska for The Maya
- Aztec icon by Kāne, on Unciv Discord server
- [Questionmark](https://thenounproject.com/icon/questionmark-4248169/) by YURR.studio for Random nation indicator
- [View](https://thenounproject.com/icon/view-4211245/) by Adrien Coquet for Spectator
### Promotions

View File

@ -41,11 +41,11 @@ These work best if they are square, between 100x100 and 256x256 pixels, and incl
For example, [here](https://github.com/yairm210/Unciv-leader-portrait-mod-example) is mod showing how to add leader portraits, which can complement the base game.
### Adding Unit, Building and Tech Portraits
### Adding Portraits
The base game uses flat icons, colored to fit the civilization's flag colors, to denote units both on the map and in other UI elements. A mod can supply "Portraits" - static images that will remain uncolored - by adding their images to `/Images/UnitPortraits/`, `/Images/BuildingPortraits/` and '/Images/TechPortraits/', which will be used in all UI elements except for the world map. The file name must correspond exactly with the unit/building/tech name as defined in Units.json, Buildings.json or Techs.json or they will be ignored.
The base game uses flat icons, surrounded with colored circles as backgrounds (e.g. for units to fit the civilization's flag colors), to denote entities such as: units, buildings, techs, resources, improvements, religions, promotions, uniques, unit actions and nations in the UI. A mod can supply "Portraits" - static images that will remain uncolored - by adding images to `/Images/<entityType>Portraits/` (e.g. `/Images/BuildingPortraits/`, /Images/ResourcesPortraits/, etc), which will be used in all UI elements (except for unit icons in the world map). The file name must correspond exactly with the unit/building/tech/resource/etc name defined in corresponding JSONs (e.g. Units.json, Buildings.json, TileResources.json, etc) or have the same name as the file they suppose to replace, or they will be ignored.
If mod supplies '/Images/TechPortraits/Background.png' image, it will be used as a background for tech portraits instead of default circle.
If mod supplies '/Images/<entityType>Portraits/Background.png' images, they will be used as a background for corresponding portraits instead of default circle.
Portraits and backgrounds work best if they are full RGB square, between 100x100 and 256x256 pixels, and include some transparent border within that area.