Exemplo n.º 1
0
        public void OnSetTarget(Type source)
        {
            ushort lineID = UVMPublicTransportWorldInfoPanel.GetLineID();

            m_firstStopSelect.items         = TLMLineUtils.getAllStopsFromLine(lineID);
            m_firstStopSelect.selectedIndex = 0;
            if (source == GetType())
            {
                return;
            }

            if (lineID != 0)
            {
                m_colorField.selectedColor = Singleton <TransportManager> .instance.GetLineColor(lineID);

                LineType lineType = UVMPublicTransportWorldInfoPanel.GetLineType(lineID);
                m_weeklyPassengersString   = ((lineType != LineType.WalkingTour) ? "TRANSPORT_LINE_PASSENGERS" : "TRANSPORT_LINE_PASSENGERS_WALKINGTOUR");
                m_ageChart.tooltipLocaleID = ((lineType != LineType.WalkingTour) ? "PUBLICTRANSPORT_PASSENGERAGEGROUPS_TOOLTIP" : "PUBLICTRANSPORT_PASSENGERAGEGROUPS_TOOLTIP_WALKINGTOUR");
                m_tripSaved.isVisible      = (lineType == LineType.Default);
                m_pullValuePanel.isVisible = (lineType == LineType.WalkingTour);
                m_lineLengthLabel.text     = StringUtils.SafeFormat(Locale.Get("LINEINFOPANEL_LINELENGTH"), (Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_totalLength / 1000f).ToString("F2", LocaleManager.cultureInfo));

                m_linePrefixDropDown.eventSelectedIndexChanged -= SaveLineNumber;
                m_lineNumberLabel.eventLostFocus -= SaveLineNumber;

                ref TransportLine t          = ref TransportManager.instance.m_lines.m_buffer[lineID];
                ushort            lineNumber = t.m_lineNumber;

                var tsd           = TransportSystemDefinition.GetDefinitionForLine(lineID);
                var transportType = tsd.ToConfigIndex();
                var mnPrefixo     = (ModoNomenclatura)TLMConfigWarehouse.GetCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType);

                if (TLMLineUtils.hasPrefix(lineID))
                {
                    m_lineNumberLabel.maxLength  = 3;
                    m_lineNumberLabel.width      = 40;
                    m_lineNumberLabel.text       = (lineNumber % 1000).ToString();
                    m_linePrefixDropDown.enabled = false;

                    string[] temp = TLMUtils.GetStringOptionsForPrefix(tsd, true, true, false);
                    m_linePrefixDropDown.items         = temp;
                    m_linePrefixDropDown.selectedIndex = lineNumber / 1000;
                    m_linePrefixDropDown.enabled       = true;
                    bool invertPrefixSuffix = TLMConfigWarehouse.GetCurrentConfigBool(TLMConfigWarehouse.ConfigIndex.INVERT_PREFIX_SUFFIX | transportType);
                    if (invertPrefixSuffix)
                    {
                        m_linePrefixDropDown.zOrder = 9999;
                    }
                    else
                    {
                        m_lineNumberLabel.zOrder = 9999;
                    }
                }
                else
                {
                    m_lineNumberLabel.maxLength  = 4;
                    m_lineNumberLabel.width      = 180;
                    m_lineNumberLabel.text       = (lineNumber).ToString();
                    m_linePrefixDropDown.enabled = false;
                }



                m_lineNumberLabel.color = TransportManager.instance.GetLineColor(lineID);



                m_linePrefixDropDown.eventSelectedIndexChanged += SaveLineNumber;
                m_lineNumberLabel.eventLostFocus += SaveLineNumber;
            }