Click or drag to resize

AngleType Constructor

Constructs an angle type object.

Namespace:  KSPDev.GUIUtils.TypeFormatters
Assembly:  KSPDev_Utils.1.0 (in KSPDev_Utils.1.0.dll) Version: 1.0 for KSP v1.6+
Syntax
C#
public AngleType(
	double value
)
Request Example View Source

Parameters

value
Type: SystemDouble
The numeric value in degrees.
Examples
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°"
  }
}
Examples
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°"
Examples
Debug.Log(AngleType.Format(1234.5678, format: "0.0000"));
// Prints: "1234.5678°"
Debug.Log(AngleType.Format(1234.5678, format: "0.00"));
// Prints: "1234.57°"
See Also