/// <summary> /// Given an array of SwitchableResource, get a long title to describe them. /// </summary> /// <param name="resources"></param> /// <returns></returns> public static string LongTitleOf(SwitchableResource[] resources) { if (resources.Length == 0) { return(LocalizeUtil.GetString("#SimpleFuelSwitch_noResources")); } StringBuilder builder = new StringBuilder(resources[0].definition.displayName); for (int i = 1; i < resources.Length; ++i) { builder.Append(" + "); builder.Append(resources[i].definition.displayName); } return(builder.ToString()); }
/// <summary> /// Formats the information to display in the info pane on the right side of /// the part's pop-up window on the editor. /// </summary> /// <param name="resourcesId"></param> /// <param name="resources"></param> /// <returns></returns> private static string FormatInfo(string resourcesId, SwitchableResource[] resources) { if (resources.Length == 0) { return(LocalizeUtil.GetString("#SimpleFuelSwitch_noResources")); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < resources.Length; ++i) { if (i > 0) { builder.Append("\n"); } builder.Append(LocalizeUtil.Format( "#SimpleFuelSwitch_detailedInfoFormat", resources[i].definition.displayName, ResourceInfoFormatter.Format(resourcesId, resources[i]))); } return(builder.ToString()); }