private Configuration.Theme AddImportedTheme(List <Configuration.Building> builtInBuildings, string themeName, string stylePackage) { var theme = Configuration.getTheme(themeName); if (theme == null) { theme = new Configuration.Theme { name = themeName, stylePackage = stylePackage }; Configuration.themes.Add(theme); } theme.isBuiltIn = true; if (builtInBuildings != null) { foreach (var builtInBuilding in builtInBuildings) { var building = theme.getBuilding(builtInBuilding.name); if (building == null) { building = new Configuration.Building(builtInBuilding); theme.buildings.Add(building); } else if (building.builtInBuilding == null) { building.builtInBuilding = builtInBuilding; } building.fromStyle = builtInBuilding.fromStyle; } } return(theme); }
private void AddModTheme(Configuration.Theme theme, string modName) { if (theme == null) { return; } var existingTheme = _configuration.getTheme(theme.name); if (existingTheme == null) { existingTheme = new Configuration.Theme(theme.name); _configuration.themes.Add(existingTheme); } existingTheme.isBuiltIn = true; foreach (var builtInBuilding in theme.buildings) { Configuration.Building existingBuilding = existingTheme.getBuilding(builtInBuilding.name); if (existingBuilding == null) { var building = new Configuration.Building(builtInBuilding); existingTheme.buildings.Add(building); } else if (existingBuilding.builtInBuilding == null) { existingBuilding.builtInBuilding = builtInBuilding; } } Debugger.LogFormat("Building Themes: Theme {0} added by mod {1}", theme.name, modName); }