public void UpdateAssetInstanceCount(Asset asset, bool forceUpdatePO = false) { if (!prefabInstanceCountDictionary.ContainsKey(asset.prefab)) { asset.instanceCount = 0; } else { asset.instanceCount = prefabInstanceCountDictionary[asset.prefab]; } if ((Settings.includePOinstances || forceUpdatePO) && FindIt.isPOEnabled) { asset.poInstanceCount = ProceduralObjectsTool.GetPrefabPOInstanceCount(asset.prefab); } }
private bool CheckExtraFilters(Asset asset) { // filter out sub-builsings if sub-building filter not enabled if (asset.isSubBuilding && UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex != (int)UIFilterExtra.DropDownOptions.SubBuildings) { return(false); } // filter asset by asset creator if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.AssetCreator) { if (asset.author != UISearchBox.instance.extraFiltersPanel.GetAssetCreatorDropDownListKey()) { return(false); } } // filter asset by building height else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.BuildingHeight) { if (asset.assetType == Asset.AssetType.Ploppable || asset.assetType == Asset.AssetType.Rico || asset.assetType == Asset.AssetType.Growable) { if (asset.buildingHeight > UISearchBox.instance.extraFiltersPanel.maxBuildingHeight) { return(false); } if (asset.buildingHeight < UISearchBox.instance.extraFiltersPanel.minBuildingHeight) { return(false); } } else { return(false); } } // filter asset by building level else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.BuildingLevel) { if (!(asset.prefab is BuildingInfo)) { return(false); } BuildingInfo info = asset.prefab as BuildingInfo; ItemClass.Level level = (ItemClass.Level)UISearchBox.instance.extraFiltersPanel.buildingLevelDropDownMenu.selectedIndex; if (info.m_class.m_level != level) { return(false); } } // only show sub-buildings else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.SubBuildings) { if (!asset.isSubBuilding) { return(false); } if (asset.assetType != Asset.AssetType.Invalid) { return(false); } } // only show unused assets else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.UnusedAssets) { if (prefabInstanceCountDictionary.ContainsKey(asset.prefab)) { if (prefabInstanceCountDictionary[asset.prefab] > 0) { return(false); } } if (FindIt.isPOEnabled && Settings.includePOinstances) { if (ProceduralObjectsTool.GetPrefabPOInstanceCount(asset.prefab) > 0) { return(false); } } } // only show used assets else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.UsedAssets) { uint counter = 0; if (prefabInstanceCountDictionary.ContainsKey(asset.prefab)) { counter += prefabInstanceCountDictionary[asset.prefab]; } if (FindIt.isPOEnabled && Settings.includePOinstances) { counter += ProceduralObjectsTool.GetPrefabPOInstanceCount(asset.prefab); } if (counter < 1) { return(false); } } // only show assets with custom tags else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.WithCustomTag) { if (asset.tagsCustom.Count < 1) { return(false); } } // only show assets without custom tags else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.WithoutCustomTag) { if (asset.tagsCustom.Count > 0) { return(false); } } // DLC & CCP filter else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.DLC) { if (!CheckDLCFilters(asset.prefab.m_dlcRequired)) { return(false); } } // local custom filter else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.LocalCustom) { if (!asset.prefab.m_isCustomContent) { return(false); } if (!localWorkshopIDs.Contains(asset.steamID) && asset.steamID != 0) { return(false); } } // workshop subscription assets else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.WorkshopCustom) { if (!asset.prefab.m_isCustomContent) { return(false); } if (localWorkshopIDs.Contains(asset.steamID)) { return(false); } if (asset.steamID == 0) { return(false); } } // Terrain conforming else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.TerrainConforming) { if (!CheckTerrainConforming(asset, true)) { return(false); } } // Non-Terrain conforming else if (UISearchBox.instance.extraFiltersPanel.optionDropDownMenu.selectedIndex == (int)UIFilterExtra.DropDownOptions.NonTerrainConforming) { if (!CheckTerrainConforming(asset, false)) { return(false); } } return(true); }