AngleType Class |
Namespace: KSPDev.GUIUtils.TypeFormatters
The AngleType type exposes the following members.
Name | Description | |
---|---|---|
Format | Formats the value into a human friendly string with a unit specification. | |
ToString | Returns a string formatted as a human friendly angle specification. (Overrides ObjectToString.) |
Name | Description | |
---|---|---|
(Double to AngleType) | Coverts a numeric value into a type object. | |
(AngleType to Double) | Converts an angle type object into a numeric value. |
public class AngleTypeDemo1 : PartModule { static readonly Message<AngleType> msg1 = new Message<AngleType>( "#TypeDemo_msg1", defaultTemplate: "Angle is: <<1>>"); // Depending on the current language in the system, this method will present different unit names. void Show() { Debug.Log(msg1.Format(0.4)); // Prints: "Angle is: 0.4°" Debug.Log(msg1.Format(0.41)); // Prints: "Angle is: 0.41°" Debug.Log(msg1.Format(1.0)); // Prints: "Angle is: 1°" Debug.Log(msg1.Format(1.41)); // Prints: "Angle is: 1.4°" Debug.Log(msg1.Format(12.555)); // Prints: "Angle is: 13°" } }
Debug.Log(AngleType.Format(0.4)); // Prints: "0.4°" Debug.Log(AngleType.Format(0.41)); // Prints: "0.41°" Debug.Log(AngleType.Format(1.0)); // Prints: "1°" Debug.Log(AngleType.Format(1.41)); // Prints: "1.4°" Debug.Log(AngleType.Format(12.555)); // Prints: "13°"
Debug.Log(AngleType.Format(1234.5678, format: "0.0000")); // Prints: "1234.5678°" Debug.Log(AngleType.Format(1234.5678, format: "0.00")); // Prints: "1234.57°"