1 namespace OpenBveApi.Runtime 2 { 3 /// <summary>Represents properties supplied to the plugin on loading.</summary> 4 public class LoadProperties 5 { 6 /// <summary>The absolute path to the plugin folder.</summary> 7 private readonly string MyPluginFolder; 8 9 /// <summary>The absolute path to the train folder.</summary> 10 private readonly string MyTrainFolder; 11 12 /// <summary>The array of panel variables.</summary> 13 private int[] MyPanel; 14 15 /// <summary>The callback function for playing sounds.</summary> 16 /// <exception cref="System.InvalidOperationException">Raised when the host application does not allow the function to be called.</exception> 17 private readonly PlaySoundDelegate MyPlaySound; 18 19 /// <summary>The callback function for playing car-based sounds.</summary> 20 /// <exception cref="System.InvalidOperationException">Raised when the host application does not allow the function to be called.</exception> 21 private readonly PlayCarSoundDelegate MyPlayCarSound; 22 23 /// <summary>The callback function for adding interface messages.</summary> 24 /// <exception cref="System.InvalidOperationException">Raised when the host application does not allow the function to be called.</exception> 25 private readonly AddInterfaceMessageDelegate MyAddInterfaceMessage; 26 27 /// <summary>The callback function for adding or subtracting scores.</summary> 28 /// <exception cref="System.InvalidOperationException">Raised when the host application does not allow the function to be called.</exception> 29 private readonly AddScoreDelegate MyAddScore; 30 31 /// <summary>The extent to which the plugin supports the AI.</summary> 32 private AISupport MyAISupport; 33 34 /// <summary>The reason why the plugin failed loading.</summary> 35 private string MyFailureReason; 36 37 /// <summary>Gets the absolute path to the plugin folder.</summary> 38 public string PluginFolder 39 { 40 get 41 { 42 return this.MyPluginFolder; 43 } 44 } 45 46 /// <summary>Gets the absolute path to the train folder.</summary> 47 public string TrainFolder 48 { 49 get 50 { 51 return this.MyTrainFolder; 52 } 53 } 54 55 /// <summary>Gets or sets the array of panel variables.</summary> 56 public int[] Panel 57 { 58 get 59 { 60 return this.MyPanel; 61 } 62 set 63 { 64 this.MyPanel = value; 65 } 66 } 67 68 /// <summary>Gets the callback function for playing sounds.</summary> 69 public PlaySoundDelegate PlaySound 70 { 71 get 72 { 73 return this.MyPlaySound; 74 } 75 } 76 77 /// <summary>Gets the callback function for playing sounds.</summary> 78 public PlayCarSoundDelegate PlayCarSound 79 { 80 get 81 { 82 return this.MyPlayCarSound; 83 } 84 } 85 86 /// <summary>Gets the callback function for adding interface messages.</summary> 87 public AddInterfaceMessageDelegate AddMessage 88 { 89 get 90 { 91 return this.MyAddInterfaceMessage; 92 } 93 } 94 95 /// <summary>Gets the callback function for adding interface messages.</summary> 96 public AddScoreDelegate AddScore 97 { 98 get 99 { 100 return this.MyAddScore; 101 } 102 } 103 104 /// <summary>Gets or sets the extent to which the plugin supports the AI.</summary> 105 public AISupport AISupport 106 { 107 get 108 { 109 return this.MyAISupport; 110 } 111 set 112 { 113 this.MyAISupport = value; 114 } 115 } 116 117 /// <summary>Gets or sets the reason why the plugin failed loading.</summary> 118 public string FailureReason 119 { 120 get 121 { 122 return this.MyFailureReason; 123 } 124 set 125 { 126 this.MyFailureReason = value; 127 } 128 } 129 130 /// <summary>Creates a new instance of this class.</summary> 131 /// <param name="pluginFolder">The absolute path to the plugin folder.</param> 132 /// <param name="trainFolder">The absolute path to the train folder.</param> 133 /// <param name="playSound">The callback function for playing sounds.</param> 134 /// <param name="playCarSound">The callback function for playing car-based sounds.</param> 135 /// <param name="addMessage">The callback function for adding interface messages.</param> 136 /// <param name="addScore">The callback function for adding scores.</param> LoadProperties(string pluginFolder, string trainFolder, PlaySoundDelegate playSound, PlayCarSoundDelegate playCarSound, AddInterfaceMessageDelegate addMessage, AddScoreDelegate addScore)137 public LoadProperties(string pluginFolder, string trainFolder, PlaySoundDelegate playSound, PlayCarSoundDelegate playCarSound, AddInterfaceMessageDelegate addMessage, AddScoreDelegate addScore) 138 { 139 this.MyPluginFolder = pluginFolder; 140 this.MyTrainFolder = trainFolder; 141 this.MyPlaySound = playSound; 142 this.MyPlayCarSound = playCarSound; 143 this.MyAddInterfaceMessage = addMessage; 144 this.MyAddScore = addScore; 145 this.MyFailureReason = null; 146 } 147 } 148 } 149