protected override List <Item> BuildItems(ref Item defaultItem) { if (!(Prefab.m_netAI is TrainTrackBaseAI || Prefab.m_netAI is RoadBaseAI)) { return(new List <Item>()); } var defaultCatenaries = GetDefaultCatenaries(); if (defaultCatenaries.Count == 0) { return(new List <Item>()); } var items = new List <Item>() { new SimpleItem("#NONE#", null) }; PropInfo singleDefaultCatenary = null; var uniqueDefaultCatenaries = new HashSet <PropInfo>(defaultCatenaries.Values); if (uniqueDefaultCatenaries.Count == 1) { singleDefaultCatenary = uniqueDefaultCatenaries.First(); } else { defaultItem = new DefaultVariantItem(); items.Add(defaultItem); } var catenaryType = GetCatenaryType(uniqueDefaultCatenaries); var catenaries = GetAvailableCatenaries(catenaryType); foreach (var catenary in catenaries) { var item = new SimpleItem(catenary.name, catenary); items.Add(item); if (catenary == singleDefaultCatenary) { defaultItem = item; } } //Debug.Log($"Built {items.Count} catenary items with default {singleDefaultCatenary}"); return(items); }
protected override List <Item> BuildItems(ref Item defaultItem) { var defaultStreetLights = GetDefaultStreetLights(); if (defaultStreetLights.Count == 0) { return(new List <Item>()); } var items = new List <Item> { new SimpleItem("#NONE#", null) }; PropInfo singleDefaultStreetLight = null; var uniqueDefaultStreetLights = new HashSet <PropInfo>(defaultStreetLights.Values); if (uniqueDefaultStreetLights.Count == 1) { singleDefaultStreetLight = uniqueDefaultStreetLights.First(); } else { defaultItem = new DefaultVariantItem(); items.Add(defaultItem); } var streetLights = StreetLightUtils.GetAvailableStreetLights(); foreach (var streetLight in streetLights) { var item = new SimpleItem(streetLight.name, streetLight); items.Add(item); if (streetLight == singleDefaultStreetLight) { defaultItem = item; } } //Debug.Log($"Built {items.Count} street light items with default {singleDefaultStreetLight}"); return(items); }