public static AutoColorPalette parseFromString(string data) { string[] parts = data.Split(SERIALIZER_SEPARATOR); if (parts.Length <= 1) { return(null); } string name = parts[0]; List <Color32> colors = new List <Color32>(parts.Length - 1); for (int i = 1; i < parts.Length; i++) { string thisColor = parts[i]; string[] thisColorCompounds = thisColor.Split(COLOR_COMP_SEPARATOR); if (thisColorCompounds.Length != 3) { TLMUtils.doErrorLog("[TLM Palette '" + name + "'] Corrupted serialized color: " + thisColor); return(null); } bool success = byte.TryParse(thisColorCompounds[0], out byte r); success &= byte.TryParse(thisColorCompounds[1], out byte g); success &= byte.TryParse(thisColorCompounds[2], out byte b); if (!success) { TLMUtils.doErrorLog("[TLM Palette '" + name + "'] Corrupted serialized color: invalid number in " + thisColor); return(null); } colors.Add(new Color32(r, g, b, 255)); } return(new AutoColorPalette(name, colors)); }
public void Awake() { #region Automation Hooks MethodInfo onEnable = typeof(TransportToolOverrides).GetMethod("OnEnable", allFlags); MethodInfo onDisable = typeof(TransportToolOverrides).GetMethod("OnDisable", allFlags); MethodInfo AfterEveryAction = typeof(TransportToolOverrides).GetMethod("AfterEveryAction", allFlags); MethodInfo AfterEveryActionZeroable = typeof(TransportToolOverrides).GetMethod("AfterEveryActionZeroable", allFlags); TLMUtils.doLog($"Loading TransportToolOverrides Hook"); try { var tt = new TransportTool(); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("OnEnable", allFlags), onEnable); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("OnDisable", allFlags), onDisable); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("NewLine", allFlags).Invoke(tt, new object[0]).GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), AfterEveryAction); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("AddStop", allFlags).Invoke(tt, new object[0]).GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), AfterEveryAction); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("RemoveStop", allFlags).Invoke(tt, new object[0]).GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), AfterEveryActionZeroable); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("CancelPrevStop", allFlags).Invoke(tt, new object[0]).GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), AfterEveryActionZeroable); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("CancelMoveStop", allFlags).Invoke(tt, new object[0]).GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), AfterEveryActionZeroable); RedirectorInstance.AddRedirect(typeof(TransportTool).GetMethod("MoveStop", allFlags).Invoke(tt, new object[] { false }).GetType().GetMethod("MoveNext", RedirectorUtils.allFlags), AfterEveryAction); Destroy(tt); } catch (Exception e) { TLMUtils.doErrorLog("ERRO AO CARREGAR HOOKS: {0}\n{1}", e.Message, e.StackTrace); } #endregion }
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); } }
private static List <Vector2> pathParallel(Vector2 dirS1, Vector2 dirS2, Vector2 currentPos, Vector2 targetPos) { List <Vector2> saida = new List <Vector2>(); float Δx = (int)Math.Abs(currentPos.x - targetPos.x); float Δy = (int)Math.Abs(currentPos.y - targetPos.y); var sigx = Math.Sign(targetPos.x - currentPos.x); var sigy = Math.Sign(targetPos.y - currentPos.y); bool midTargetReachableX = dirS2.x / dirS1.x < 0 || dirS1.x == 0; bool midTargetReachableY = dirS2.y / dirS1.y < 0 || dirS1.y == 0; if (midTargetReachableX && midTargetReachableY) { if (Δx < Δy) { saida.Add(currentPos + new Vector2(Δx / 2 * sigx, Δx / 2 * sigy)); saida.Add(targetPos - new Vector2(Δx / 2 * sigx, Δx / 2 * sigy)); } else { saida.Add(currentPos + new Vector2(Δy / 2 * sigx, Δy / 2 * sigy)); saida.Add(targetPos - new Vector2(Δy / 2 * sigx, Δy / 2 * sigy)); } } else { TLMUtils.doErrorLog("WORST CASE (midTargetReachableX = {0}, midTargetReachableY= {1})", midTargetReachableX, midTargetReachableY); } return(saida); }
public void Update() { if (!GameObject.FindGameObjectWithTag("GameController") || ((GameObject.FindGameObjectWithTag("GameController")?.GetComponent <ToolController>())?.m_mode & ItemClass.Availability.Game) == ItemClass.Availability.None) { TLMUtils.doErrorLog("GameController NOT FOUND!"); return; } if (!initialized) { Awake(); } if (m_lineInfoPanel?.isVisible ?? false) { m_lineInfoPanel?.updateBidings(); } if (m_depotInfoPanel?.isVisible ?? false) { m_depotInfoPanel?.updateBidings(); } lastLineCount = tm.m_lineCount; m_lineInfoPanel?.assetSelectorWindow?.RotateCamera(); }
private void saveSubcategoryList(bool global) { if (global == globalLoaded) { TLMConfigWarehouse loadedConfig; if (global) { loadedConfig = TLMConfigWarehouse.getConfig(TLMConfigWarehouse.GLOBAL_CONFIG_INDEX, TLMConfigWarehouse.GLOBAL_CONFIG_INDEX); } else { loadedConfig = TransportLinesManagerMod.instance.currentLoadedCityConfig; } var value = string.Join(PREFIX_COMMA, cached_prefixConfigList.Select(x => x.Key.ToString() + PREFIX_SEPARATOR + string.Join(PROPERTY_COMMA, x.Value.Select(y => y.Key.ToString() + PROPERTY_SEPARATOR + y.Value).ToArray())).ToArray()); if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("NEW VALUE ({0}): {1}", definition.ToString(), value); } loadedConfig.setString(configKeyForAssets, value); if (global) { cached_prefixConfigListGlobal = cached_prefixConfigList; } else { cached_prefixConfigListNonGlobal = cached_prefixConfigList; } } else { TLMUtils.doErrorLog("Trying to save a different global file subcategory list!!!"); } }
private List <Vector2> getMidPointsD1D2(Vector2 p1, Vector2 p2, Vector2 dirP1, Vector2 dirP2, int indexSumP1, int indexSubP2) { List <Vector2> saida = new List <Vector2>(); Vector2 intersection = getIntersectionPoint(indexSumP1, indexSubP2); int currentMidx = (int)(indexSumP1 - intersection.y); int targetMidx = (int)(indexSubP2 + intersection.y); bool currentReachble = currentMidx / dirP1.x > 0; bool targetReachble = targetMidx / dirP2.x > 0; if (currentReachble && targetReachble) { if (p2.x != p1.x && p2.y != p1.y) { var Δx = (int)Math.Abs(p1.x - p2.x); var Δy = (int)Math.Abs(p1.y - p2.y); var sigx = Math.Sign(p2.x - p1.x); var sigy = Math.Sign(p2.y - p1.y); if (Δx < Δy) { saida.Add(p1 + new Vector2(Δx * sigx, Δx * sigy)); } else { saida.Add(p1 + new Vector2(Δy * sigx, Δy * sigy)); } } } else { TLMUtils.doErrorLog("WORST CASE (currentReachble= {0}; targetReachble={1})", currentReachble, targetReachble); } return(saida); }
private void updateVehiclePosition(UILabel vehicleLabel) { try { DraggableVehicleInfo dvi = vehicleLabel.GetComponentInChildren <DraggableVehicleInfo>(); if (dvi.isDragging) { return; } ushort vehicleId = dvi.vehicleId; ushort stopId = Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_targetBuilding; var labelStation = residentCounters[Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_targetBuilding]; float destX = stationOffsetX[stopId] - labelStation.width; if (Singleton <TransportManager> .instance.m_lines.m_buffer[Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_transportLine].GetStop(0) == stopId && (Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_flags & Vehicle.Flags.Stopped) != 0) { destX = stationOffsetX[TransportLine.GetPrevStop(stopId)]; } float yOffset = vehicleYbaseOffset; int busesOnStation = vehiclesOnStation.ContainsKey(stopId) ? vehiclesOnStation[stopId] : 0; if ((Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_flags & Vehicle.Flags.Stopped) != 0) { ushort prevStop = TransportLine.GetPrevStop(stopId); destX -= labelStation.width / 2; busesOnStation = Math.Max(busesOnStation, vehiclesOnStation.ContainsKey(prevStop) ? vehiclesOnStation[prevStop] : 0); vehiclesOnStation[prevStop] = busesOnStation + 1; } else if ((Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_flags & Vehicle.Flags.Arriving) != 0) { destX += labelStation.width / 4; ushort nextStop = TransportLine.GetNextStop(stopId); busesOnStation = Math.Max(busesOnStation, vehiclesOnStation.ContainsKey(nextStop) ? vehiclesOnStation[nextStop] : 0); vehiclesOnStation[nextStop] = busesOnStation + 1; } else if ((Singleton <VehicleManager> .instance.m_vehicles.m_buffer[vehicleId].m_flags & Vehicle.Flags.Leaving) != 0) { destX -= labelStation.width / 4; ushort prevStop = TransportLine.GetPrevStop(stopId); busesOnStation = Math.Max(busesOnStation, vehiclesOnStation.ContainsKey(prevStop) ? vehiclesOnStation[prevStop] : 0); vehiclesOnStation[prevStop] = busesOnStation + 1; } else { ushort prevStop = TransportLine.GetPrevStop(stopId); busesOnStation = Math.Max(busesOnStation, vehiclesOnStation.ContainsKey(prevStop) ? vehiclesOnStation[prevStop] : 0); } yOffset = vehicleYbaseOffset + busesOnStation * vehicleYoffsetIncrement; vehiclesOnStation[stopId] = busesOnStation + 1; vehicleLabel.position = new Vector3(destX, yOffset); } catch (Exception e) { TLMUtils.doLog("ERROR UPDATING VEHICLE!!!"); TLMUtils.doErrorLog(e.ToString()); //redrawLine(); } }
public static TransportSystemDefinition from(ItemClass.SubService subService, VehicleInfo.VehicleType vehicleType) { var item = availableDefinitions.FirstOrDefault(x => x.subService == subService && x.vehicleType == vehicleType); if (item == default(TransportSystemDefinition)) { TLMUtils.doErrorLog("TSD NOT FOUND!!! {0}-{1}", subService, vehicleType); } return(item); }
public void update() { if (!GameObject.FindGameObjectWithTag("GameController") || ((GameObject.FindGameObjectWithTag("GameController").GetComponent <ToolController>()).m_mode & ItemClass.Availability.Game) == ItemClass.Availability.None) { TLMUtils.doErrorLog("GameController NOT FOUND!"); return; } if (!initialized) { TransportLinesManagerMod.instance.loadTLMLocale(false); uiView = GameObject.FindObjectOfType <UIView>(); if (!uiView) { return; } mainRef = uiView.FindUIComponent <UIPanel>("InfoPanel").Find <UITabContainer>("InfoViewsContainer").Find <UIPanel>("InfoViewsPanel"); if (!mainRef) { return; } mainRef.eventVisibilityChanged += delegate(UIComponent component, bool b) { if (b) { TransportLinesManagerMod.instance.showVersionInfoPopup(); } }; tm = Singleton <TransportManager> .instance; im = Singleton <InfoManager> .instance; createViews(); mainRef.clipChildren = false; initialized = true; } initNearLinesOnWorldInfoPanel(); if (m_lineInfoPanel.isVisible) { m_lineInfoPanel.updateBidings(); } if (m_depotInfoPanel.isVisible) { m_depotInfoPanel.updateBidings(); } lastLineCount = tm.m_lineCount; TLMPublicTransportDetailPanelHooks.instance.update(); return; }
private void readVehicles(bool global, bool force = false) { if (TransportLinesManagerMod.instance != null && TransportLinesManagerMod.debugMode) { TLMUtils.doLog("PrefabCount: {0} ({1})", PrefabCollection <VehicleInfo> .PrefabCount(), PrefabCollection <VehicleInfo> .LoadedCount()); } if (PrefabCollection <VehicleInfo> .LoadedCount() == 0) { TLMUtils.doErrorLog("Prefabs not loaded!"); return; } loadPrefixConfigList(global); }
public static TransportSystemDefinition from(TransportInfo info) { if (info == null) { return(default(TransportSystemDefinition)); } var result = availableDefinitions.Keys.FirstOrDefault(x => x.subService == info.m_class.m_subService && x.vehicleType == info.m_vehicleType && x.transportType == info.m_transportType); if (result == default(TransportSystemDefinition)) { TLMUtils.doErrorLog($"TSD NOT FOUND FOR TRANSPORT INFO: info.m_class.m_subService={info.m_class.m_subService}, info.m_vehicleType={info.m_vehicleType}, info.m_transportType={info.m_transportType}"); } return(result); }
public void forceReload() { basicAssetsList = null; try { readVehicles(globalLoaded, true); if (needReload) { return; } } catch (Exception e) { TLMUtils.doErrorLog(e.Message); basicAssetsList = new List <string>(); } }
private static bool calcIntersecHV(Vector2 pV, Vector2 pH, Vector2 Δy, Vector2 Δx, int targetX, int targetY, ref List <Vector2> saida) { Vector2 midTarget = new Vector2(targetX, targetY); bool midTargetReachableS1 = (midTarget.y - pV.y) / Δy.y > 0; bool midTargetReachableS2 = (midTarget.x - pH.x) / Δx.x > 0; if (midTargetReachableS1 && midTargetReachableS2) { saida.Add(midTarget); return(true); } else { TLMUtils.doErrorLog("WORST CASE (midTargetReachableS1={0};midTargetReachableS2={1})", midTargetReachableS1, midTargetReachableS2); return(false); } }
public static bool SimulationStepPre(ushort lineID) { try { TransportLine t = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID]; bool activeDayNightManagedByTLM = TLMLineUtils.isPerHourBudget(lineID); if (t.m_lineNumber != 0 && t.m_stops != 0) { Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_budget = (ushort)(TLMLineUtils.getBudgetMultiplierLine(lineID) * 100); } unchecked { TLMLineUtils.getLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[lineID], out bool day, out bool night); bool isNight = Singleton <SimulationManager> .instance.m_isNightTime; bool zeroed = false; if ((activeDayNightManagedByTLM || (isNight && night) || (!isNight && day)) && Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_budget == 0) { Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags |= (TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_CURRENT; zeroed = true; } else { Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags &= ~(TransportLine.Flags)TLMTransportLineFlags.ZERO_BUDGET_CURRENT; } TLMUtils.doLog("activeDayNightManagedByTLM = {0}; zeroed = {1}", activeDayNightManagedByTLM, zeroed); if (activeDayNightManagedByTLM) { if (zeroed) { TLMLineUtils.setLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[lineID], false, false); } else { TLMLineUtils.setLineActive(ref Singleton <TransportManager> .instance.m_lines.m_buffer[lineID], true, true); } } } } catch (Exception e) { TLMUtils.doErrorLog("Error processing budget for line: {0}\n{1}", lineID, e); } return(true); }
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); } }
public Color AutoColor(ushort i) { TransportLine t = tm.m_lines.m_buffer[(int)i]; try { TLMCW.ConfigIndex transportType = TLMCW.getDefinitionForLine(i).toConfigIndex(); bool prefixBased = TLMCW.getCurrentConfigBool(transportType | TLMCW.ConfigIndex.PALETTE_PREFIX_BASED); bool randomOnOverflow = TLMCW.getCurrentConfigBool(transportType | TLMCW.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW); string pal = TLMCW.getCurrentConfigString(transportType | TLMCW.ConfigIndex.PALETTE_SUBLINE); ushort num = t.m_lineNumber; if (num >= 1000 && TLMCW.getCurrentConfigInt(transportType | TLMCW.ConfigIndex.PREFIX) != (int)ModoNomenclatura.Nenhum) { pal = TLMCW.getCurrentConfigString(transportType | TLMCW.ConfigIndex.PALETTE_MAIN); if (prefixBased) { num /= 1000; } else { num %= 1000; } } Color c = TLMAutoColorPalettes.getColor(num, pal, randomOnOverflow); TLMUtils.setLineColor(i, c); return(c); } catch (Exception e) { TLMUtils.doErrorLog("ERRO!!!!! " + e.Message); TLMCW.setCurrentConfigBool(TLMCW.ConfigIndex.AUTO_COLOR_ENABLED, false); return(Color.clear); } }
public override void AwakeBody() { MethodInfo preventDefault = typeof(TransportToolOverrides).GetMethod("preventDefault", allFlags); #region Automation Hooks MethodInfo onEnable = typeof(TransportToolOverrides).GetMethod("OnEnable", allFlags); MethodInfo onDisable = typeof(TransportToolOverrides).GetMethod("OnDisable", allFlags); MethodInfo OnToolGUIPos = typeof(TransportToolOverrides).GetMethod("OnToolGUIPos", allFlags); MethodInfo SimulationStepPos = typeof(TransportToolOverrides).GetMethod("SimulationStepPos", allFlags); TLMUtils.doLog("Loading TransportToolOverrides Hook"); try { AddRedirect(typeof(TransportTool).GetMethod("OnEnable", allFlags), onEnable); AddRedirect(typeof(TransportTool).GetMethod("OnDisable", allFlags), onDisable); AddRedirect(typeof(TransportTool).GetMethod("OnToolGUI", allFlags), null, OnToolGUIPos); AddRedirect(typeof(TransportTool).GetMethod("SimulationStep", allFlags), null, SimulationStepPos); } catch (Exception e) { TLMUtils.doErrorLog("ERRO AO CARREGAR HOOKS: {0}", e.StackTrace); } #endregion }
private static void loadLocaleIntern(string localeId, bool setLocale = false) { string load = ResourceLoader.loadResourceString("UI.i18n." + localeId + ".properties"); if (load == null) { load = ResourceLoader.loadResourceString("UI.i18n.en.properties"); if (load == null) { TLMUtils.doErrorLog("LOCALE NOT LOADED!!!!"); return; } localeId = "en"; } var locale = TLMUtils.GetPrivateField <Locale>(LocaleManager.instance, "m_Locale"); Locale.Key k; foreach (var myString in load.Split(new string[] { lineSeparator }, StringSplitOptions.RemoveEmptyEntries)) { if (myString.StartsWith(commentChar)) { continue; } if (!myString.Contains(kvSeparator)) { continue; } var array = myString.Split(kvSeparator.ToCharArray(), 2); string value = array[1]; int idx = 0; string localeKey = null; if (array[0].Contains(idxSeparator)) { var arrayIdx = array[0].Split(idxSeparator.ToCharArray()); if (!int.TryParse(arrayIdx[1], out idx)) { continue; } array[0] = arrayIdx[0]; } if (array[0].Contains(localeKeySeparator)) { array = array[0].Split(localeKeySeparator.ToCharArray()); localeKey = array[1]; } k = new Locale.Key() { m_Identifier = "TLM_" + array[0], m_Key = localeKey, m_Index = idx }; if (!locale.Exists(k)) { locale.AddLocalizedString(k, value.Replace("\\n", "\n")); } } if (localeId != "en") { loadLocaleIntern("en"); } if (setLocale) { language = localeId; } }
public void OnSetTarget(Type source) { if (source == GetType()) { return; } TransportSystemDefinition tsd = TransportSystem; if (!tsd.HasVehicles()) { MainPanel.isVisible = false; return; } m_isLoading = true; TLMUtils.doLog("tsd = {0}", tsd); IBasicExtension config = TLMLineUtils.GetEffectiveExtensionForLine(GetLineID()); if (TransportSystem != m_lastSystem) { m_defaultAssets = tsd.GetTransportExtension().GetAllBasicAssetsForLine(0); UIPanel[] depotChecks = m_checkboxTemplateList.SetItemCount(m_defaultAssets.Count); TLMUtils.doLog("m_defaultAssets Size = {0} ({1})", m_defaultAssets?.Count, string.Join(",", m_defaultAssets.Keys?.ToArray() ?? new string[0])); for (int i = 0; i < m_defaultAssets.Count; i++) { string assetName = m_defaultAssets.Keys.ElementAt(i); UICheckBox checkbox = depotChecks[i].GetComponentInChildren <UICheckBox>(); checkbox.objectUserData = assetName; UITextField capacityEditor = depotChecks[i].GetComponentInChildren <UITextField>(); capacityEditor.text = VehicleUtils.GetCapacity(PrefabCollection <VehicleInfo> .FindLoaded(assetName)).ToString("0"); if (checkbox.label.objectUserData == null) { checkbox.eventCheckChanged += (x, y) => { if (m_isLoading) { return; } ushort lineId = GetLineID(); IBasicExtension extension = TLMLineUtils.GetEffectiveExtensionForLine(lineId); TLMUtils.doErrorLog($"checkbox event: {x.objectUserData} => {y} at {extension}[{lineId}]"); if (y) { extension.AddAssetToLine(lineId, x.objectUserData.ToString()); } else { extension.RemoveAssetFromLine(lineId, x.objectUserData.ToString()); } }; CreateModelCheckBox(checkbox); KlyteMonoUtils.LimitWidthAndBox(checkbox.label, 280); capacityEditor.eventTextSubmitted += CapacityEditor_eventTextSubmitted;; capacityEditor.eventMouseEnter += (x, y) => { m_lastInfo = PrefabCollection <VehicleInfo> .FindLoaded(checkbox.objectUserData.ToString()); RedrawModel(); }; checkbox.label.objectUserData = true; } checkbox.text = m_defaultAssets[assetName]; } m_lastSystem = TransportSystem; } else { List <string> allowedAssets = config.GetAssetListForLine(GetLineID()); for (int i = 0; i < m_checkboxTemplateList.items.Count; i++) { UICheckBox checkbox = m_checkboxTemplateList.items[i].GetComponentInChildren <UICheckBox>(); checkbox.isChecked = allowedAssets.Contains(checkbox.objectUserData.ToString()); } } if (TransportLinesManagerMod.DebugMode) { List <string> allowedAssets = config.GetAssetListForLine(GetLineID()); TLMUtils.doLog($"selectedAssets Size = {allowedAssets?.Count} ({ string.Join(",", allowedAssets?.ToArray() ?? new string[0])}) {config?.GetType()}"); } if (config is TLMTransportLineConfiguration) { m_title.text = string.Format(Locale.Get("K45_TLM_ASSET_SELECT_WINDOW_TITLE"), TLMLineUtils.getLineStringId(GetLineID())); } else { int prefix = (int)TLMLineUtils.getPrefix(GetLineID()); m_title.text = string.Format(Locale.Get("K45_TLM_ASSET_SELECT_WINDOW_TITLE_PREFIX"), prefix > 0 ? NumberingUtils.GetStringFromNumber(TLMUtils.GetStringOptionsForPrefix(tsd), prefix + 1) : Locale.Get("K45_TLM_UNPREFIXED"), TLMConfigWarehouse.getNameForTransportType(tsd.ToConfigIndex())); } m_isLoading = false; }