Click or drag to resize

ResourceShortType Constructor (Int32)

Constructs an object from a resource ID.

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 ResourceShortType(
	int resourceId
)
Request Example View Source

Parameters

resourceId
Type: SystemInt32
The resource ID.
Examples
public class ResourceShortTypeDemo1 : PartModule {
  static readonly Message<ResourceShortType> msg1 = new Message<ResourceShortType>(
      "#TypeDemo_msg1", defaultTemplate: "Resource is: <<1>>");

  void Show() {
    Debug.Log(msg1.Format(StockResourceNames.ElectricCharge));
    // Prints: "Resource is: EC"
    Debug.Log(msg1.Format(PartResourceLibrary.ElectricityHashcode));
    // Prints: "Resource is: EC"
  }
}
Examples
Debug.Log(ResourceShortType.Format(StockResourceNames.ElectricCharge));
// Prints: "Resource is: EC"
Debug.Log(ResourceShortType.Format(PartResourceLibrary.ElectricityHashcode));
// Prints: "Resource is: EC"
See Also