Add observation towers, add override capabilities
This commit is contained in:
parent
6db3ce3ab6
commit
550a2030ad
5 changed files with 42 additions and 20 deletions
|
@ -2,18 +2,20 @@ import * as questions from "../assets/tagRenderings/questions.json";
|
|||
import * as icons from "../assets/tagRenderings/icons.json";
|
||||
import {Utils} from "../Utils";
|
||||
import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig";
|
||||
import {TagRenderingConfigJson} from "../Models/ThemeConfig/Json/TagRenderingConfigJson";
|
||||
|
||||
export default class SharedTagRenderings {
|
||||
|
||||
public static SharedTagRendering: Map<string, TagRenderingConfig> = SharedTagRenderings.generatedSharedFields();
|
||||
public static SharedTagRenderingJson: Map<string, TagRenderingConfigJson> = SharedTagRenderings.generatedSharedFieldsJsons();
|
||||
public static SharedIcons: Map<string, TagRenderingConfig> = SharedTagRenderings.generatedSharedFields(true);
|
||||
|
||||
private static generatedSharedFields(iconsOnly = false): Map<string, TagRenderingConfig> {
|
||||
const dict = new Map<string, TagRenderingConfig>();
|
||||
|
||||
function add(key, store) {
|
||||
const configJsons = SharedTagRenderings.generatedSharedFieldsJsons(iconsOnly)
|
||||
const d = new Map<string, TagRenderingConfig>()
|
||||
for (const key of Array.from(configJsons.keys())) {
|
||||
try {
|
||||
dict.set(key, new TagRenderingConfig(store[key], undefined, `SharedTagRenderings.${key}`))
|
||||
d.set(key, new TagRenderingConfig(configJsons.get(key), undefined, `SharedTagRenderings.${key}`))
|
||||
} catch (e) {
|
||||
if (!Utils.runningFromConsole) {
|
||||
console.error("BUG: could not parse", key, " from questions.json or icons.json - this error happened during the build step of the SharedTagRenderings", e)
|
||||
|
@ -21,14 +23,19 @@ export default class SharedTagRenderings {
|
|||
}
|
||||
}
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
private static generatedSharedFieldsJsons(iconsOnly = false): Map<string, TagRenderingConfigJson> {
|
||||
const dict = new Map<string, TagRenderingConfigJson>();
|
||||
|
||||
if (!iconsOnly) {
|
||||
for (const key in questions) {
|
||||
add(key, questions);
|
||||
dict.set(key, <TagRenderingConfigJson>questions[key])
|
||||
}
|
||||
}
|
||||
for (const key in icons) {
|
||||
add(key, icons);
|
||||
dict.set(key, <TagRenderingConfigJson>icons[key])
|
||||
}
|
||||
|
||||
return dict;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue