internal static Color CalculateAutoColor(ushort num, TransportSystemDefinition tsdRef, bool avoidRandom = false, bool allowClear = false)
        {
            var config = tsdRef.GetConfig();

            if (tsdRef.TransportType == TransportInfo.TransportType.EvacuationBus)
            {
                return(tsdRef.Color);
            }

            bool prefixBased = config.PalettePrefixBased;

            bool randomOnOverflow = config.PaletteRandomOnOverflow;

            var pal = new List <string>();

            if (num >= 0 && config.Prefix != NamingMode.None)
            {
                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 (prefix > 0 && prefixBased)
                    {
                        num /= 1000;
                    }
                    else
                    {
                        num %= 1000;
                    }
                }
                pal.Add(config.Palette);
            }
            else
            {
                pal.Add(config.Palette);
            }
            Color c;

            c = TLMAutoColorPaletteContainer.GetColor(num, pal.ToArray(), randomOnOverflow, avoidRandom);
            if (c == Color.clear && !allowClear)
            {
                c = tsdRef.Color;
            }
            return(c);
        }
Example #2
0
 internal static LineIconSpriteNames GetLineIcon(ushort num, TLMCW.ConfigIndex transportType, ref TransportSystemDefinition tsdRef)
 {
     if (num > 0 && TLMCW.GetCurrentConfigInt(transportType | TLMCW.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum)
     {
         uint prefix = num / 1000u;
         ITLMTransportTypeExtension ext    = tsdRef.GetTransportExtension();
         LineIconSpriteNames        format = ext.GetCustomFormat(prefix);
         if (format != default)
         {
             return(format);
         }
     }
     return(TLMCW.getBgIconForIndex(transportType));
 }
Example #3
0
        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);
        }
        internal static LineIconSpriteNames GetLineIcon(ushort num, TransportSystemDefinition tsdRef)
        {
            var config = tsdRef.GetConfig();

            if (num > 0 && config.Prefix != NamingMode.None)
            {
                uint prefix = num / 1000u;
                ITLMTransportTypeExtension ext    = tsdRef.GetTransportExtension();
                LineIconSpriteNames        format = ext.GetCustomFormat(prefix);
                if (format != default)
                {
                    return(format);
                }
            }
            return(tsdRef.GetBgIcon());
        }