public static PartIcon GetPartIcon(AvailablePart part) { if (cache.ContainsKey(part)) { return(cache[part]); } PartIcon icon = new PartIcon(part, 48); cache.Add(part, icon); return(icon); }
private GUI.WindowFunction OnGUI(List <AvailablePart> parts) { return((id) => { scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar); GUILayout.BeginVertical(); parts.ForEach((part) => { GUILayout.BeginHorizontal(boxStyle); GUILayout.Box(PartIcon.GetPartIcon(part).texture, GUILayout.ExpandWidth(false)); GUILayout.BeginVertical(); GUILayout.Label(part.title, partNameLabelStyle); GUILayout.Label("Estimated Time: " + PartFactoryCalculator.parse(part), buildingTimeLabelStyle); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }); GUILayout.EndVertical(); GUILayout.EndScrollView(); }); }