1 using OpenBveApi;
2 using OpenBveApi.Colors;
3 using OpenBveApi.Math;
4 
5 namespace RouteManager2.MessageManager
6 {
7 	/// <summary>Defines an abstract textual message</summary>
8 	public abstract class AbstractMessage
9 	{
10 		/// <summary>The object to be rendered</summary>
11 		/// NOTE: May be either a textual string, or a texture depending on the type
12 		public object MessageToDisplay;
13 
14 		/// <summary>The highest game mode in which this message will display</summary>
15 		public GameMode Mode = GameMode.Expert;
16 
17 		/// <summary>The track position at which this message is placed</summary>
18 		public double TrackPosition;
19 
20 		/// <summary>The timeout in seconds for this message</summary>
21 		public double Timeout;
22 
23 		/// <summary>Whether this message will trigger once, or repeatedly (If reversed over etc.)</summary>
24 		public bool TriggerOnce;
25 
26 		/// <summary>Whether this message has triggered</summary>
27 		public bool Triggered;
28 
29 		/// <summary>The on-screen message width</summary>
30 		public double Width;
31 
32 		/// <summary>The on-screen message height</summary>
33 		public double Height;
34 
35 		/// <summary>The direction(s) which this message triggers for</summary>
36 		public MessageDirection Direction;
37 
38 		/// <summary>A textual key by which this message is referred to in-route</summary>
39 		public string Key;
40 
41 		/// <summary>The trains for which this message displays</summary>
42 		public string[] Trains;
43 
44 		/// <summary>The color which this message is displayed in</summary>
45 		public MessageColor Color;
46 
47 		/// <summary>The on-screen position at which this message is displayed</summary>
48 		public Vector2 RendererPosition;
49 
50 		/// <summary>The level of alpha used by the renderer whilst fading out the message</summary>
51 		public double RendererAlpha;
52 
53 		/// <summary>Whether this message is queued for removal</summary>
54 		/// NOTE: May be called either by a track based beacon or by timeout
55 		public bool QueueForRemoval;
56 
57 		/// <summary>The function called when the message is added</summary>
58 		/// <param name="currentTime">The current in-game time</param>
AddMessage(double currentTime)59 		public abstract void AddMessage(double currentTime);
60 
61 		/// <summary>Called once a frame to update the message</summary>
Update()62 		public virtual void Update()
63 		{
64 		}
65 	}
66 }
67