internal static void RemoveSkippedFromStyle(DistrictStyle style) { HashSet <string> skips = instance?.skippedPrefabs[BUILDINGS]; if (skips == null || skips.Count == 0) { return; } try { BuildingInfo[] inStyle = style.GetBuildingInfos(); ((HashSet <BuildingInfo>)Util.Get(style, "m_Infos")).Clear(); ((HashSet <int>)Util.Get(style, "m_AffectedServices")).Clear(); foreach (BuildingInfo info in inStyle) { if (info != null && !skips.Contains(info.name)) { style.Add(info); } } Array.Clear(inStyle, 0, inStyle.Length); } catch (Exception e) { UnityEngine.Debug.LogException(e); } }
static void RemoveSkipped(DistrictStyle style) { HashSet <string> skippedPrefabs = PrefabLoader.instance?.skippedPrefabs; if (skippedPrefabs == null || skippedPrefabs.Count == 0) { return; } try { BuildingInfo[] inStyle = style.GetBuildingInfos(); ((HashSet <BuildingInfo>)Util.Get(style, "m_Infos")).Clear(); ((HashSet <int>)Util.Get(style, "m_AffectedServices")).Clear(); foreach (BuildingInfo info in inStyle) { if (info != null) { GameObject go = info.gameObject; if (go != null && !skippedPrefabs.Contains(go.name)) { style.Add(info); } } } } catch (Exception e) { UnityEngine.Debug.LogException(e); } }
private void AddStyleTheme(DistrictStyle style) { var buildingInfos = style.GetBuildingInfos(); List <Configuration.Building> buildings = null; if (buildingInfos != null) { buildings = buildingInfos.Select(buildingInfo => new Configuration.Building { name = buildingInfo.name, fromStyle = true }).ToList(); } Configuration.Theme theme; AddImportedTheme(buildings, (style.BuiltIn && style.Name == DistrictStyle.kEuropeanStyleName) ? "European" : style.Name, style.PackageName, out theme); Debugger.LogFormat( "Imported style \"{0}\" as theme \"{1}\". Buildings in style: {2}. Buildings in theme: {3} ", style.FullName, theme.name, buildingInfos != null ? buildingInfos.Length : 0, theme.buildings.Count); }
private void AddStyleTheme(DistrictStyle style) { if (style.Name == DistrictStyle.kEuropeanStyleName) { return; //skip builtin style } var buildingInfos = style.GetBuildingInfos(); List <Configuration.Building> buildings = null; if (buildingInfos != null) { buildings = buildingInfos.Select(buildingInfo => new Configuration.Building { name = buildingInfo.name, fromStyle = true }).ToList(); } var theme = AddImportedTheme(buildings, FormatStyleName(style), style.PackageName); Debugger.LogFormat( "Imported style \"{0}\" as theme \"{1}\". Buildings in style: {2}. Buildings in theme: {3} ", style.FullName, theme.name, buildingInfos?.Length ?? 0, theme.buildings.Count); }