/// <summary> /// Add Find It 2 description: asset type, sub-type, size, height /// </summary> public void SetFindIt2Description() { if (assetType == AssetType.Decal) { findIt2Description = Translations.Translate("FIF_SE_ID"); } else if (assetType == AssetType.Network) { findIt2Description = $"{Translations.Translate("FIF_SE_IN")}, "; if (networkType == Asset.NetworkType.TinyRoads) { findIt2Description += Translations.Translate("FIF_NET_TNR"); } else if (networkType == Asset.NetworkType.SmallRoads) { findIt2Description += Translations.Translate("FIF_NET_SMR"); } else if (networkType == Asset.NetworkType.MediumRoads) { findIt2Description += Translations.Translate("FIF_NET_MDR"); } else if (networkType == Asset.NetworkType.LargeRoads) { findIt2Description += Translations.Translate("FIF_NET_LGR"); } else if (networkType == Asset.NetworkType.Highway) { findIt2Description += Translations.Translate("FIF_NET_HGHW"); } else if (networkType == Asset.NetworkType.Path) { findIt2Description += Translations.Translate("FIF_NET_PATH"); } else if (networkType == Asset.NetworkType.Fence) { findIt2Description += Translations.Translate("FIF_NET_WALL"); } else if (networkType == Asset.NetworkType.WaterStructures) { findIt2Description += Translations.Translate("FIF_NET_WAT"); } else if (networkType == Asset.NetworkType.Utility) { findIt2Description += Translations.Translate("FIF_NET_UTI"); } else if (networkType == Asset.NetworkType.Train) { findIt2Description += Translations.Translate("FIF_NET_TRA"); } else if (networkType == Asset.NetworkType.Unsorted) { findIt2Description += Translations.Translate("FIF_PROP_UNS"); } if (UIFilterNetwork.IsNormalRoads(networkType)) { NetInfo info = prefab as NetInfo; if (UIFilterNetwork.IsOneWay(info)) { findIt2Description += ($", {Translations.Translate("FIF_NET_ONE")}"); } if (UIFilterNetwork.HasParking(info)) { findIt2Description += ($", {Translations.Translate("FIF_NET_PAR")}"); } else { findIt2Description += ($", {Translations.Translate("FIF_NET_NOP")}"); } } } else if (assetType == AssetType.Growable || assetType == AssetType.Rico) { if (assetType == AssetType.Rico) { findIt2Description = $"{Translations.Translate("FIF_SE_IR")}, "; } else { findIt2Description = $"{Translations.Translate("FIF_SE_IG")}, "; } if (subService == ItemClass.SubService.ResidentialLow) { findIt2Description += Translations.Translate("FIF_GR_LDR"); } else if (subService == ItemClass.SubService.ResidentialHigh) { findIt2Description += Translations.Translate("FIF_GR_HDR"); } else if (subService == ItemClass.SubService.ResidentialLowEco) { findIt2Description += Translations.Translate("FIF_GR_LDRE"); } else if (subService == ItemClass.SubService.ResidentialHighEco) { findIt2Description += Translations.Translate("FIF_GR_HDRE"); } else if (subService == ItemClass.SubService.CommercialLow) { findIt2Description += Translations.Translate("FIF_GR_LDC"); } else if (subService == ItemClass.SubService.CommercialHigh) { findIt2Description += Translations.Translate("FIF_GR_HDC"); } else if (subService == ItemClass.SubService.CommercialEco) { findIt2Description += Translations.Translate("FIF_GR_CE"); } else if (subService == ItemClass.SubService.CommercialLeisure) { findIt2Description += Translations.Translate("FIF_GR_LC"); } else if (subService == ItemClass.SubService.CommercialTourist) { findIt2Description += Translations.Translate("FIF_GR_TC"); } else if (subService == ItemClass.SubService.IndustrialGeneric) { findIt2Description += Translations.Translate("FIF_GR_GI"); } else if (subService == ItemClass.SubService.IndustrialFarming) { findIt2Description += Translations.Translate("FIF_GR_FAI"); } else if (subService == ItemClass.SubService.IndustrialForestry) { findIt2Description += Translations.Translate("FIF_GR_FOI"); } else if (subService == ItemClass.SubService.IndustrialOil) { findIt2Description += Translations.Translate("FIF_GR_OII"); } else if (subService == ItemClass.SubService.IndustrialOre) { findIt2Description += Translations.Translate("FIF_GR_ORI"); } else if (subService == ItemClass.SubService.OfficeGeneric) { findIt2Description += Translations.Translate("FIF_GR_O"); } else if (subService == ItemClass.SubService.OfficeHightech) { findIt2Description += Translations.Translate("FIF_GR_ITC"); } else { findIt2Description += Translations.Translate("FIF_PROP_UNS"); } findIt2Description += $", {size.x}x{size.y}, {(int)buildingHeight} {Translations.Translate("FIF_EF_MET")} ({(int)(buildingHeight * 3.28084f)} {Translations.Translate("FIF_EF_FEE")})"; } else if (assetType == AssetType.Prop) { findIt2Description = $"{Translations.Translate("FIF_SE_IPR")}, "; if (propType == Asset.PropType.PropsIndustrial) { findIt2Description += Translations.Translate("FIF_PROP_IND"); } else if (propType == Asset.PropType.PropsParks) { findIt2Description += Translations.Translate("FIF_PROP_PAR"); } else if (propType == Asset.PropType.PropsCommon) { findIt2Description += Translations.Translate("FIF_PROP_COM"); } else if (propType == Asset.PropType.PropsResidential) { findIt2Description += Translations.Translate("FIF_PROP_RES"); } else if (propType == Asset.PropType.PropsBillboards) { findIt2Description += Translations.Translate("FIF_PROP_BIL"); } else if (propType == Asset.PropType.PropsSpecialBillboards) { findIt2Description += Translations.Translate("FIF_PROP_SPE"); } else if (propType == Asset.PropType.PropsLights) { findIt2Description += Translations.Translate("FIF_PROP_LIG"); } else if (propType == Asset.PropType.Natural) { findIt2Description += Translations.Translate("FIF_PROP_NAT"); } else if (propType == Asset.PropType.Unsorted) { findIt2Description += Translations.Translate("FIF_PROP_UNS"); } else if (propType == Asset.PropType.PropsMarker) { findIt2Description += Translations.Translate("FIF_PROP_MAR"); } else if (propType == Asset.PropType.PropsUnsortedVehicle) { findIt2Description += Translations.Translate("FIF_PROP_VEH"); } else if (propType == Asset.PropType.PropsTree) { findIt2Description += Translations.Translate("FIF_PROP_TRE"); } else if (propType == Asset.PropType.PropsMoterVehicle) { findIt2Description += Translations.Translate("FIF_PROP_MOT"); } else if (propType == Asset.PropType.PropsRailwayVehicle) { findIt2Description += Translations.Translate("FIF_PROP_RAI"); } else if (propType == Asset.PropType.PropsAircraft) { findIt2Description += Translations.Translate("FIF_PROP_AIR"); } else if (propType == Asset.PropType.PropsWaterCraft) { findIt2Description += Translations.Translate("FIF_PROP_WAT"); } PropInfo propInfo = m_prefab as PropInfo; // terrain conforming? if (propInfo.m_material?.shader == propFenceShader) { findIt2Description += $", {Translations.Translate("FIF_PROP_TC")}"; } else { findIt2Description += $", {Translations.Translate("FIF_PROP_NTC")}"; } } else if (assetType == AssetType.Tree) { findIt2Description = $"{Translations.Translate("FIF_SE_IT")}, "; if (treeType == Asset.TreeType.SmallTree) { findIt2Description += Translations.Translate("FIF_TREE_SM"); } else if (treeType == Asset.TreeType.MediumTree) { findIt2Description += Translations.Translate("FIF_TREE_MD"); } else if (treeType == Asset.TreeType.LargeTree) { findIt2Description += Translations.Translate("FIF_TREE_LG"); } } else if (assetType == AssetType.Ploppable) { findIt2Description = $"{Translations.Translate("FIF_SE_IP")}, "; if (service == ItemClass.Service.Electricity) { findIt2Description += Translations.Translate("FIF_PLOP_E"); } else if (service == ItemClass.Service.Water) { findIt2Description += Translations.Translate("FIF_PLOP_W"); } else if (service == ItemClass.Service.Garbage) { findIt2Description += Translations.Translate("FIF_PLOP_G"); } else if (service == ItemClass.Service.PlayerIndustry) { findIt2Description += Translations.Translate("FIF_PLOP_I"); } else if (service == ItemClass.Service.Fishing) { findIt2Description += Translations.Translate("FIF_PLOP_FI"); } else if (service == ItemClass.Service.HealthCare) { findIt2Description += Translations.Translate("FIF_PLOP_H"); } else if (service == ItemClass.Service.FireDepartment) { findIt2Description += Translations.Translate("FIF_PLOP_F"); } else if (service == ItemClass.Service.Disaster) { findIt2Description += Translations.Translate("FIF_PLOP_D"); } else if (service == ItemClass.Service.PoliceDepartment) { findIt2Description += Translations.Translate("FIF_PLOP_P"); } else if (service == ItemClass.Service.Education) { findIt2Description += Translations.Translate("FIF_PLOP_ED"); } else if (service == ItemClass.Service.PlayerEducation) { findIt2Description += Translations.Translate("FIF_PLOP_C"); } else if (service == ItemClass.Service.Museums) { findIt2Description += Translations.Translate("FIF_PLOP_C"); } else if (service == ItemClass.Service.VarsitySports) { findIt2Description += Translations.Translate("FIF_PLOP_V"); } else if (service == ItemClass.Service.PublicTransport) { findIt2Description += Translations.Translate("FIF_PLOP_PT"); } else if (service == ItemClass.Service.Tourism) { findIt2Description += Translations.Translate("FIF_PLOP_PT"); } else if (service == ItemClass.Service.Beautification) { findIt2Description += Translations.Translate("FIF_PLOP_PPW"); } else if (service == ItemClass.Service.Monument) { findIt2Description += Translations.Translate("FIF_PLOP_U"); } else { findIt2Description += Translations.Translate("FIF_PROP_UNS"); } findIt2Description += $", {size.x}x{size.y}, {(int)buildingHeight} {Translations.Translate("FIF_EF_MET")} ({(int)(buildingHeight * 3.28084f)} {Translations.Translate("FIF_EF_FEE")})"; } findIt2Description += "\n"; }
private static void Init(UIComponent component, bool b) { component.eventVisibilityChanged -= new PropertyChangedEventHandler <bool>(Init); try { if (component.objectUserData is PrefabInfo prefab) { string name = Asset.GetName(prefab); if (AssetTagList.instance.assets.ContainsKey(name)) { ImageUtils.FixThumbnails(prefab, component as UIButton); Asset asset = AssetTagList.instance.assets[name]; component.eventVisibilityChanged += (c, p) => { if (Settings.unlockAll) { c.isEnabled = true; } else { c.isEnabled = ToolsModifierControl.IsUnlocked(prefab.GetUnlockMilestone()); } }; // Fixing focused texture component.eventClicked += new MouseEventHandler(FixFocusedTexture); // Adding custom tag icon UISprite tagSprite = component.AddUIComponent <UISprite>(); tagSprite.size = new Vector2(20, 16); tagSprite.atlas = FindIt.atlas; tagSprite.spriteName = "Tag"; tagSprite.opacity = 0.5f; tagSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; tagSprite.relativePosition = new Vector3(component.width - tagSprite.width - 5, 5); tagSprite.isVisible = false; if (CustomTagsLibrary.assetTags.ContainsKey(name)) { tagSprite.tooltip = CustomTagsLibrary.assetTags[name]; } else { tagSprite.tooltip = null; } tagSprite.eventMouseEnter += (c, p) => { tagSprite.opacity = 1f; }; tagSprite.eventMouseLeave += (c, p) => { tagSprite.opacity = 0.5f; }; tagSprite.eventClick += (c, p) => { p.Use(); UITagsWindow.ShowAt(asset, tagSprite); }; component.eventMouseEnter += (c, p) => { tagSprite.isVisible = true; }; component.eventMouseLeave += (c, p) => { if (asset.tagsCustom.Count == 0) { tagSprite.isVisible = false; } }; // Adding steam icon if (asset.steamID != 0) { UISprite steamSprite = component.AddUIComponent <UISprite>(); steamSprite.size = new Vector2(26, 16); steamSprite.atlas = SamsamTS.UIUtils.GetAtlas("Ingame"); steamSprite.spriteName = "SteamWorkshop"; steamSprite.opacity = 0.05f; steamSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; steamSprite.relativePosition = new Vector3(component.width - steamSprite.width - 5, component.height - steamSprite.height - 5); if (!asset.author.IsNullOrWhiteSpace()) { steamSprite.tooltip = "By " + asset.author + "\n" + Translations.Translate("FIF_UIS_WS"); } if (PlatformService.IsOverlayEnabled()) { steamSprite.eventMouseUp += (c, p) => { if (!p.used && p.buttons == UIMouseButton.Right) { PublishedFileId publishedFileId = new PublishedFileId(asset.steamID); if (publishedFileId != PublishedFileId.invalid) { PlatformService.ActivateGameOverlayToWorkshopItem(publishedFileId); p.Use(); } } }; } } } } } catch (Exception e) { Debugging.LogException(e); } }