Ejemplo n.º 1
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;
        }