internal static Color CalculateAutoColor(ushort num, TLMCW.ConfigIndex transportType, bool avoidRandom = false, bool allowClear = false) { if (transportType == TLMCW.ConfigIndex.EVAC_BUS_CONFIG) { return(TLMCW.getColorForTransportType(transportType)); } bool prefixBased = TLMCW.getCurrentConfigBool(transportType | TLMCW.ConfigIndex.PALETTE_PREFIX_BASED); bool randomOnOverflow = TLMCW.getCurrentConfigBool(transportType | TLMCW.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW); string pal = TLMCW.getCurrentConfigString(transportType | TLMCW.ConfigIndex.PALETTE_SUBLINE); if (num >= 1000 && TLMCW.getCurrentConfigInt(transportType | TLMCW.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { pal = TLMCW.getCurrentConfigString(transportType | TLMCW.ConfigIndex.PALETTE_MAIN); if (prefixBased) { num /= 1000; } else { num %= 1000; } } Color c; c = TLMAutoColorPalettes.getColor(num, pal, randomOnOverflow, avoidRandom); if (c == Color.clear && !allowClear) { c = TLMCW.getColorForTransportType(transportType); } return(c); }
public void openDepotInfo(ushort buildingID, bool secondary) { isLoading = true; WorldInfoPanel.HideAllWorldInfoPanels(); m_buildingIdSelecionado = default(InstanceID); m_buildingIdSelecionado.Building = buildingID; DepotAI depotAI = Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID].Info.GetAI() as DepotAI; if (depotAI == null) { return; } depotNameField.text = Singleton <BuildingManager> .instance.GetBuildingName(buildingID, default(InstanceID)); bool hasPrimary = depotAI.m_transportInfo != null && depotAI.m_maxVehicleCount > 0; bool hasSecondary = depotAI.m_secondaryTransportInfo != null && depotAI.m_maxVehicleCount2 > 0; if (!hasPrimary && !hasSecondary) { closeDepotInfo(null, null); return; } m_secondary = !hasPrimary || (secondary && hasSecondary); TransportInfo currentTransportInfo = m_secondary ? depotAI.m_secondaryTransportInfo : depotAI.m_transportInfo; TransportInfo otherInfo = !m_secondary && depotAI.m_secondaryTransportInfo != null ? depotAI.m_secondaryTransportInfo : depotAI.m_transportInfo; var tsd = TransportSystemDefinition.from(currentTransportInfo); depotInfoPanel.color = Color.Lerp(TLMCW.getColorForTransportType(tsd.toConfigIndex()), Color.white, 0.5f); lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f); lineTransportIconTypeLabel.height = 20; lineTransportIconTypeLabel.normalBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(currentTransportInfo.m_transportType); lineTransportIconTypeLabel.disabledBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(currentTransportInfo.m_transportType); lineTransportIconTypeLabel.focusedBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(currentTransportInfo.m_transportType); lineTransportIconTypeLabel.hoveredBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(otherInfo.m_transportType); if (depotAI.m_secondaryTransportInfo != null) { lineTransportIconTypeLabel.tooltip = string.Format(Locale.Get("TLM_SEE_OTHER_DEPOT"), TLMConfigWarehouse.getNameForTransportType(TransportSystemDefinition.from(otherInfo).toConfigIndex())); } else { lineTransportIconTypeLabel.tooltip = ""; } Show(); m_controller.defaultListingLinesPanel.Hide(); updateCheckboxes(); isLoading = false; }
internal static Color CalculateAutoColor(ushort num, TLMCW.ConfigIndex transportType, ref TransportSystemDefinition tsdRef, bool avoidRandom = false, bool allowClear = false) { if (transportType == TLMCW.ConfigIndex.EVAC_BUS_CONFIG) { return(TLMCW.getColorForTransportType(transportType)); } bool prefixBased = TLMCW.GetCurrentConfigBool(transportType | TLMCW.ConfigIndex.PALETTE_PREFIX_BASED); bool randomOnOverflow = TLMCW.GetCurrentConfigBool(transportType | TLMCW.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW); var pal = new List <string>(); if (num >= 0 && TLMCW.GetCurrentConfigInt(transportType | TLMCW.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { uint prefix = num / 1000u; ITLMTransportTypeExtension ext = tsdRef.GetTransportExtension(); string tempPal = ext.GetCustomPalette(prefix) ?? string.Empty; if (tempPal != string.Empty) { pal.Add(tempPal); num %= 1000; } else { if (prefixBased) { num /= 1000; } else { num %= 1000; } } pal.Add(TLMCW.GetCurrentConfigString(transportType | TLMCW.ConfigIndex.PALETTE_MAIN)); } else { pal.Add(TLMCW.GetCurrentConfigString(transportType | TLMCW.ConfigIndex.PALETTE_MAIN)); } Color c; c = TLMAutoColorPalettes.getColor(num, pal.ToArray(), randomOnOverflow, avoidRandom); if (c == Color.clear && !allowClear) { c = TLMCW.getColorForTransportType(transportType); } return(c); }