MessageT1, T2, T3, T4, T5 Conversion (String to MessageT1, T2, T3, T4, T5) |
Namespace: KSPDev.GUIUtils
public static implicit operator Message<T1, T2, T3, T4, T5> ( string tag )
public class Message5Demo : PartModule { // The encouraged way of defining a message. static readonly Message<string, int, string, int, float> msg1 = new Message<string, int, string, int, float>( "#myLocalizationTag", defaultTemplate: "<<1>> = <<2>>, <<3>> = <<4>>, avg = <<5>>", description: "A string to present in the KSPDevUtils documentation example. It" + " illustrates how the class can be used to localize a message.", example: "v1 = 1, v2 = 2, avg = 1.5"); // A simple way when no extra details are provided. static readonly Message<string, int, string, int, float> msg2 = "#myLocalizationTag"; public override void OnAwake() { base.OnAwake(); // This will load the localized string and print it into the log. HostedDebugLog.Info(this, msg1.Format("v1", 1, "v2", 2, 1.5f)); // The next example will only work if there is a localizable string defined. Otherwise, it will // print the tag. HostedDebugLog.Info(this, msg2.Format("v1", 1, "v2", 2, 1.5f)); } }