protected override bool IsServiceValid(PrefabInfo info) { if (this.isMapEditor) { if (info.GetService() != this.service) { return(info.GetService() == ItemClass.Service.PublicTransport); } return(true); } if (this.isAssetEditor) { BuildingInfo buildingInfo = info as BuildingInfo; if (info.GetService() == this.service && ((Object)buildingInfo == (Object)null || buildingInfo.m_buildingAI.WorksAsNet()) || info.GetService() == ItemClass.Service.PublicTransport && (info.GetSubService() == ItemClass.SubService.PublicTransportTrain || info.GetSubService() == ItemClass.SubService.PublicTransportMetro || info.GetSubService() == ItemClass.SubService.PublicTransportMonorail || info.GetSubService() == ItemClass.SubService.PublicTransportCableCar)) { return(true); } if (info.GetService() == ItemClass.Service.Beautification && info is NetInfo) { return(ToolsModifierControl.toolController.m_editPrefabInfo is NetInfo); } return(false); } NetInfo netInfo = info as NetInfo; if (info.GetService() != this.service) { return(false); } if (!((Object)netInfo == (Object)null)) { return((netInfo.m_vehicleTypes & VehicleInfo.VehicleType.Car) != VehicleInfo.VehicleType.None); } return(true); }
internal bool Matches(PrefabInfo info, int index) { string name = info.name.ToUpperInvariant(); if (byNames[index].Matches(name)) { return(true); } int offset = index << 7; if (byPatterns.TryGetValue(offset - 1, out ByPatterns p) && p.Matches(name)) { return(true); } if (byPatterns.TryGetValue((int)info.GetService() + offset, out p) && p.Matches(name)) { return(true); } int svc = (int)info.GetSubService(); return(svc != 0 && byPatterns.TryGetValue(svc + 40 + offset, out p) && p.Matches(name)); }
/// <summary> /// Initializes the category. /// </summary> /// <param name="prefab">The prefab.</param> private bool InitializeCategory(PrefabInfo prefab) { string category = null; try { ItemClass.SubService subService = prefab.GetSubService(); if (subService != ItemClass.SubService.None && subService != ItemClass.SubService.Unused2) { category = subService.ToString(); if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused") { this.RawCategory = "SubService:" + category; this.Category = InfoHelper.CleanCategory(category); return(true); } } } catch { } try { ItemClass.Service service = prefab.GetService(); if (service != ItemClass.Service.None && service != ItemClass.Service.Unused2) { category = service.ToString(); if (category.Length < 6 || category.Substring(0, 6).ToLowerInvariant() != "unused") { this.RawCategory = "Service:" + category; this.Category = InfoHelper.CleanCategory(category); return(true); } } } catch { } try { category = prefab.category; if (!String.IsNullOrEmpty(category)) { this.RawCategory = "Category:" + prefab.category; this.Category = InfoHelper.CleanCategory(prefab.category); return(true); } } catch { } this.RawCategory = null; this.Category = "Unknown"; return(true); }
public void RefreshRico() { if (FindIt.isRicoEnabled && m_prefab != null && assetType == AssetType.Ploppable) { service = m_prefab.GetService(); subService = m_prefab.GetSubService(); if (service == ItemClass.Service.Residential || service == ItemClass.Service.Industrial || service == ItemClass.Service.Commercial || service == ItemClass.Service.Office) { assetType = AssetType.Rico; } } }