private void updateUI(bool syncFromInput = false) { TransportSystemDefinition tsd = TransportSystemDefinition.from(transportTool.m_prefab); TLMLineUtils.GetNamingRulesFromTSD(out ModoNomenclatura prefixo, out Separador sep, out ModoNomenclatura sufixo, out ModoNomenclatura nonPrefix, out bool zeros, out bool invertPrefixSuffix, tsd); if (syncFromInput) { String value = "0" + lineNumberTxtBox.text; int valPrefixo = linePrefixDropDown.selectedIndex; ushort num = ushort.Parse(value); if (prefixo != ModoNomenclatura.Nenhum) { num = (ushort)(valPrefixo * 1000 + (num % 1000)); } if (nextLineNumber + 1 != num) { nextLineNumber = (ushort)(num - 1); } } var configIdx = tsd.toConfigIndex(); Color color; if (TLMConfigWarehouse.getCurrentConfigBool(TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED)) { color = TLMUtils.CalculateAutoColor((ushort)(nextLineNumber + 1), TLMConfigWarehouse.getConfigIndexForTransportInfo(transportTool.m_prefab), true); } else { color = TLMConfigWarehouse.getColorForTransportType(configIdx); } lineNumberTxtBox.color = color; lineFormat.color = color; lineFormat.backgroundSprite = TLMLineUtils.GetIconForIndex(configIdx); lineNumber.text = TLMUtils.getString(prefixo, sep, sufixo, nonPrefix, (nextLineNumber + 1) & 0xFFFF, zeros, invertPrefixSuffix); lineNumber.textColor = TLMUtils.contrastColor(color); int txtLen = lineNumber.text.Length; switch (txtLen) { case 1: lineNumber.textScale = 4; break; case 2: lineNumber.textScale = 3; break; case 3: lineNumber.textScale = 2.25f; break; case 4: lineNumber.textScale = 1.75f; break; case 5: lineNumber.textScale = 1.5f; break; case 6: lineNumber.textScale = 1.35f; break; case 7: lineNumber.textScale = 1.2f; break; case 8: lineNumber.textScale = 1.1f; break; default: lineNumber.textScale = 1f; break; } }
public void setLinearMapColor(Color c) { linearMapLineNumberFormat.color = c; linearMapLineNumber.textColor = TLMUtils.contrastColor(c); lineStationsPanel.color = c; }