public static void Postfix(UniqueFactoryWorldInfoPanel __instance, UIPanel ___m_productStorage) { var m_InstanceID = (InstanceID)typeof(WorldInfoPanel).GetField("m_InstanceID", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); var m_productLabel = (UILabel)typeof(UniqueFactoryWorldInfoPanel).GetField("m_productLabel", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); UniqueFactoryAI uniqueFactoryAI = Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)m_InstanceID.Building].Info.m_buildingAI as UniqueFactoryAI; m_productLabel.text = Locale.Get("WAREHOUSEPANEL_RESOURCE", uniqueFactoryAI.m_outputResource.ToString()); if (!luxuryProductIcon) { luxuryProductIcon = ___m_productStorage.Find <UISprite>("LuxuryProductIcon"); } luxuryProductIcon.spriteName = IndustryWorldInfoPanel.ResourceSpriteName(uniqueFactoryAI.m_outputResource, false); }
public static void Postfix(ref ExtractingFacilityAI ___m_extractingFacilityAI, ref ProcessingFacilityAI ___m_processingFacilityAI, ref InstanceID ___m_InstanceID, ref UIProgressBar ___m_inputBuffer, ref UIPanel ___m_inputSection, ref UIProgressBar ___m_outputBuffer, ref UIPanel ___m_outputSection) { ushort id = ___m_InstanceID.Building; ExtractingFacilityAI ai_ef = ___m_extractingFacilityAI; if (ai_ef != null) { int customBuffer = Convert.ToInt32(Singleton <BuildingManager> .instance.m_buildings.m_buffer[id].m_customBuffer1 * RI_Data.GetFactorCargo(ai_ef.m_outputResource)); int capacity = Convert.ToInt32(ai_ef.GetOutputBufferSize(id, ref Singleton <BuildingManager> .instance.m_buildings.m_buffer[id]) * RI_Data.GetFactorCargo(ai_ef.m_outputResource)); //Debug.Log($"EFAI-OST: {id} - {customBuffer}/{capacity}"); //___m_outputBuffer.value = IndustryWorldInfoPanel.SafelyNormalize(customBuffer, capacity); ___m_outputSection.tooltip = StringUtils.SafeFormat( Locale.Get("INDUSTRYPANEL_BUFFERTOOLTIP"), IndustryWorldInfoPanel.FormatResource((uint)customBuffer), IndustryWorldInfoPanel.FormatResourceWithUnit((uint)capacity, ai_ef.m_outputResource) ); } }
public static void Postfix(CityServiceWorldInfoPanel __instance) { var m_fishFarmAI = (FishFarmAI)typeof(CityServiceWorldInfoPanel).GetField("m_fishFarmAI", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); var m_outputBuffer = (UIProgressBar)typeof(CityServiceWorldInfoPanel).GetField("m_outputBuffer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); var m_outputLabel = (UILabel)typeof(CityServiceWorldInfoPanel).GetField("m_outputLabel", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); var m_arrow3 = (UISprite)typeof(CityServiceWorldInfoPanel).GetField("m_arrow3", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); var m_outputSprite = (UISprite)typeof(CityServiceWorldInfoPanel).GetField("m_outputSprite", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); var m_ShowIndustryInfoButton = (UIButton)typeof(CityServiceWorldInfoPanel).GetField("m_ShowIndustryInfoButton", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); if (m_fishFarmAI != null) { m_outputBuffer.progressColor = IndustryWorldInfoPanel.instance.GetResourceColor(m_fishFarmAI.m_outputResource); string text = Locale.Get("WAREHOUSEPANEL_RESOURCE", m_fishFarmAI.m_outputResource.ToString()); m_outputLabel.text = text; m_arrow3.tooltip = StringUtils.SafeFormat(Locale.Get("INDUSTRYBUILDING_EXTRACTINGTOOLTIP"), text); m_outputSprite.spriteName = IndustryWorldInfoPanel.ResourceSpriteName(m_fishFarmAI.m_outputResource, false); m_ShowIndustryInfoButton.isVisible = false; } }
public static void Postfix(ref InstanceID ___m_InstanceID, ref UILabel ___m_capacityLabel, ref UIPanel ___m_buffer) { ushort id = ___m_InstanceID.Building; Building building = Singleton <BuildingManager> .instance.m_buildings.m_buffer[id]; WarehouseAI ai = (WarehouseAI)building.Info.m_buildingAI; TransferManager.TransferReason cargoType = ai.GetActualTransferReason(id, ref Singleton <BuildingManager> .instance.m_buildings.m_buffer[id]); /*Debug.Log($"id:{id} - {ai.name}: {cargoType} ({RI_Data.GetFactorCargo(cargoType)}x), m_sT={ai.m_storageType}, " + * $"{(ulong)(building.m_customBuffer1 * 100 * RI_Data.GetFactorCargo(cargoType))}/" + * $"{(uint)(ai.m_storageCapacity * RI_Data.GetFactorCargo(cargoType))} (actual {ai.m_storageCapacity})" * );*/ string text = StringUtils.SafeFormat( Locale.Get("INDUSTRYPANEL_BUFFERTOOLTIP"), IndustryWorldInfoPanel.FormatResource((ulong)(building.m_customBuffer1 * 100 * RI_Data.GetFactorCargo(cargoType))), IndustryWorldInfoPanel.FormatResourceWithUnit((uint)(ai.m_storageCapacity * RI_Data.GetFactorCargo(cargoType)), cargoType) ); ___m_buffer.tooltip = text; ___m_capacityLabel.text = text; }
private static void _updateTooltip(int id, int volume, int bufferSize, TransferManager.TransferReason cargo, ref UIPanel panel, ref UIPanel panel2) { //Debug.Log($"uTt-{id}"); int customBuffer = Convert.ToInt32(volume * RI_Data.GetFactorCargo(cargo)); int outputBufferSize = Convert.ToInt32(bufferSize * RI_Data.GetFactorCargo(cargo)); panel2.tooltip = panel.tooltip = StringUtils.SafeFormat(ColossalFramework.Globalization.Locale.Get("INDUSTRYPANEL_BUFFERTOOLTIP"), IndustryWorldInfoPanel.FormatResource((uint)customBuffer), IndustryWorldInfoPanel.FormatResourceWithUnit((uint)outputBufferSize, cargo)); }