예제 #1
0
        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);
        }
예제 #2
0
        internal static List <string> getDepotPrefixesOptions(TLMCW.ConfigIndex transportType)
        {
            transportType &= TLMConfigWarehouse.ConfigIndex.SYSTEM_PART;
            var           m     = (ModoNomenclatura)TLMCW.getCurrentConfigInt(transportType | TLMCW.ConfigIndex.PREFIX);
            List <string> saida = new List <string>(new string[] { Locale.Get("TLM_UNPREFIXED") });

            switch (m)
            {
            case ModoNomenclatura.GregoMaiusculo:
            case ModoNomenclatura.GregoMaiusculoNumero:
                saida.AddRange(gregoMaiusculo);
                break;

            case ModoNomenclatura.GregoMinusculo:
            case ModoNomenclatura.GregoMinusculoNumero:
                saida.AddRange(gregoMinusculo);
                break;

            case ModoNomenclatura.CirilicoMaiusculo:
            case ModoNomenclatura.CirilicoMaiusculoNumero:
                saida.AddRange(cirilicoMaiusculo);
                break;

            case ModoNomenclatura.CirilicoMinusculo:
            case ModoNomenclatura.CirilicoMinusculoNumero:
                saida.AddRange(cirilicoMinusculo);
                break;

            case ModoNomenclatura.LatinoMaiusculo:
            case ModoNomenclatura.LatinoMaiusculoNumero:
                saida.AddRange(latinoMaiusculo);
                break;

            case ModoNomenclatura.LatinoMinusculo:
            case ModoNomenclatura.LatinoMinusculoNumero:
                saida.AddRange(latinoMinusculo);
                break;

            case ModoNomenclatura.Numero:
                for (int i = 1; i <= 64; i++)
                {
                    saida.Add(i.ToString());
                }
                break;

            case ModoNomenclatura.Romano:
                for (ushort i = 1; i <= 64; i++)
                {
                    saida.Add(ToRomanNumeral(i));
                }
                break;
            }
            if (TLMLineUtils.nomenclaturasComNumeros.Contains(m))
            {
                saida.AddRange(numeros.Select(x => x.ToString()));
            }
            return(saida);
        }
예제 #3
0
        public Color AutoColor(ushort i)
        {
            TransportLine t = tm.m_lines.m_buffer[(int)i];

            try
            {
                TLMCW.ConfigIndex transportType = TLMCW.getDefinitionForLine(i).toConfigIndex();
                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);
                ushort num = t.m_lineNumber;
                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 = TLMAutoColorPalettes.getColor(num, pal, randomOnOverflow);
                TLMUtils.setLineColor(i, c);
                return(c);
            }
            catch (Exception e)
            {
                TLMUtils.doErrorLog("ERRO!!!!! " + e.Message);
                TLMCW.setCurrentConfigBool(TLMCW.ConfigIndex.AUTO_COLOR_ENABLED, false);
                return(Color.clear);
            }
        }
예제 #4
0
 internal static ModoNomenclatura GetPrefixModoNomenclatura(TLMCW.ConfigIndex transportType)
 {
     return((ModoNomenclatura)TLMCW.getCurrentConfigInt(transportType | TLMCW.ConfigIndex.PREFIX));
 }
예제 #5
0
        public void openLineInfo(ushort lineID)
        {
            if (lineID <= 0)
            {
                return;
            }
            WorldInfoPanel.HideAllWorldInfoPanels();
            linePrefixDropDown.eventSelectedIndexChanged -= saveLineNumber;
            lineNumberLabel.eventLostFocus -= saveLineNumber;

            m_lineIdSelecionado = default(InstanceID);
            m_lineIdSelecionado.TransportLine = lineID;

            TransportLine t          = m_controller.tm.m_lines.m_buffer[(int)lineID];
            ushort        lineNumber = t.m_lineNumber;

            TLMCW.ConfigIndex transportType = TLMCW.getDefinitionForLine(lineID).toConfigIndex();
            ModoNomenclatura  mnPrefixo     = (ModoNomenclatura)TLMCW.getCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType);

            if (mnPrefixo != ModoNomenclatura.Nenhum)
            {
                lineNumberLabel.text             = (lineNumber % 1000).ToString();
                lineNumberLabel.relativePosition = new Vector3(110f, 3f);
                lineNumberLabel.width            = 55;
                linePrefixDropDown.enabled       = false;

                var temp = TLMUtils.getStringOptionsForPrefix(mnPrefixo);
                for (uint i = 0; i < temp.Length; i++)
                {
                    string prefixName = TLMUtils.getTransportSystemPrefixName(transportType, i);
                    if (prefixName != null && prefixName != string.Empty)
                    {
                        temp[(int)i] += " (" + prefixName + ")";
                    }
                }
                linePrefixDropDown.items         = temp;
                linePrefixDropDown.selectedIndex = lineNumber / 1000;
                linePrefixDropDown.enabled       = true;
                lineNumberLabel.maxLength        = 3;
            }
            else
            {
                lineNumberLabel.text             = (lineNumber).ToString();
                lineNumberLabel.relativePosition = new Vector3(80f, 3f);
                lineNumberLabel.width            = 75;
                lineNumberLabel.maxLength        = 4;
                linePrefixDropDown.enabled       = false;
            }



            lineNumberLabel.color = m_controller.tm.GetLineColor(lineID);
            lineNameField.text    = m_controller.tm.GetLineName(lineID);

            lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f);
            lineTransportIconTypeLabel.height           = 20;
            lineTransportIconTypeLabel.atlas            = linePrefixDropDown.atlas;
            lineTransportIconTypeLabel.backgroundSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(t.Info.m_transportType);

            lineColorPicker.selectedColor = m_controller.tm.GetLineColor(lineID);

            bool day, night, zeroed;

            TLMLineUtils.getLineActive(ref t, out day, out night, out zeroed);
            if (day && night)
            {
                lineTime.selectedIndex = 0;
            }
            else if (day)
            {
                lineTime.selectedIndex = 1;
            }
            else if (night)
            {
                lineTime.selectedIndex = 2;
            }
            else
            {
                lineTime.selectedIndex = 3;
            }

            m_linearMap.redrawLine();
            Show();
            m_controller.defaultListingLinesPanel.Hide();

            m_autoNameLabel.text     = m_linearMap.autoName;
            vehicleQuantitySet.text  = TLMVehiclesLineManager.instance[this.lineIdSelecionado.TransportLine].ToString();
            vehicleQuantitySet.area  = new Vector4(150, 150, 50, 20);
            vehicleQuantitySet.color = Color.gray;
            linePrefixDropDown.eventSelectedIndexChanged += saveLineNumber;
            lineNumberLabel.eventLostFocus += saveLineNumber;
        }