public Color AutoColor(ushort i, bool ignoreRandomIfSet = true, bool ignoreAnyIfSet = false)
        {
            TransportLine t = tm.m_lines.m_buffer[(int)i];

            try
            {
                var tsd = TransportSystemDefinition.getDefinitionForLine(i);
                if (tsd == default(TransportSystemDefinition) || (((t.m_flags & TransportLine.Flags.CustomColor) > 0) && ignoreAnyIfSet))
                {
                    return(Color.clear);
                }
                TLMCW.ConfigIndex transportType = tsd.toConfigIndex();
                Color             c             = TLMUtils.CalculateAutoColor(t.m_lineNumber, transportType, ((t.m_flags & TransportLine.Flags.CustomColor) > 0) && ignoreRandomIfSet, true);
                if (c.a == 1)
                {
                    TLMLineUtils.setLineColor(i, c);
                }
                //TLMUtils.doLog("Colocada a cor {0} na linha {1} ({3} {2})", c, i, t.m_lineNumber, t.Info.m_transportType);
                return(c);
            }
            catch (Exception e)
            {
                TLMUtils.doErrorLog("ERRO!!!!! " + e.Message);
                TLMCW.setCurrentConfigBool(TLMCW.ConfigIndex.AUTO_COLOR_ENABLED, false);
                return(Color.clear);
            }
        }
Esempio n. 2
0
        public Color AutoColor(ushort i)
        {
            TransportLine t = tm.m_lines.m_buffer[(int)i];

            try
            {
                var tsd = TLMCW.getDefinitionForLine(i);
                if (tsd == default(TransportSystemDefinition))
                {
                    return(Color.clear);
                }
                TLMCW.ConfigIndex transportType = tsd.toConfigIndex();
                Color             c             = TLMUtils.CalculateAutoColor(t.m_lineNumber, transportType);
                TLMLineUtils.setLineColor(i, c);
                //TLMUtils.doLog("Colocada a cor {0} na linha {1} ({3} {2})", c, i, t.m_lineNumber, t.Info.m_transportType);
                return(c);
            }
            catch (Exception e)
            {
                TLMUtils.doErrorLog("ERRO!!!!! " + e.Message);
                TLMCW.setCurrentConfigBool(TLMCW.ConfigIndex.AUTO_COLOR_ENABLED, false);
                return(Color.clear);
            }
        }
Esempio n. 3
0
 private void OnColorChanged(UIComponent comp, Color color)
 {
     TLMLineUtils.setLineColor(this.m_LineID, color);
 }