コード例 #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;
                m_customLineCodeInput.eventTextSubmitted -= SaveLineCode;

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

                var tsd       = TransportSystemDefinition.GetDefinitionForLine(lineID);
                var config    = tsd.GetConfig();
                var mnPrefixo = config.Prefix;

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

                    string[] temp = TLMPrefixesUtils.GetStringOptionsForPrefix(tsd, true, true, false);
                    m_linePrefixDropDown.items         = temp;
                    m_linePrefixDropDown.selectedIndex = lineNumber / 1000;
                    m_linePrefixDropDown.enabled       = true;
                    bool invertPrefixSuffix = config.InvertPrefixSuffix;
                    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_customLineCodeInput.text = TLMTransportLineExtension.Instance.SafeGet(lineID).CustomCode ?? "";


                m_linePrefixDropDown.eventSelectedIndexChanged += SaveLineNumber;
                m_lineNumberLabel.eventLostFocus         += SaveLineNumber;
                m_customLineCodeInput.eventTextSubmitted += SaveLineCode;
            }