OpenBve.Game.AddMessage C# (CSharp) Method

AddMessage() static private method

Adds a message to the in-game interface render queue
static private AddMessage ( string Text, MessageDependency Depencency, Interface Mode, MessageColor Color, double Timeout ) : void
Text string The text of the message
Depencency MessageDependency
Mode Interface
Color MessageColor The color of the message text
Timeout double The time this message will display for
return void
		internal static void AddMessage(string Text, MessageDependency Depencency, Interface.GameMode Mode, MessageColor Color, double Timeout)
		{
			if (Interface.CurrentOptions.GameMode <= Mode)
			{
				if (Depencency == MessageDependency.RouteLimit | Depencency == MessageDependency.SectionLimit)
				{
					for (int i = 0; i < Messages.Length; i++)
					{
						if (Messages[i].Depencency == Depencency) return;
					}
				}
				int n = Messages.Length;
				Array.Resize<Message>(ref Messages, n + 1);
				Messages[n].InternalText = Text;
				Messages[n].DisplayText = "";
				Messages[n].Depencency = Depencency;
				Messages[n].Timeout = Timeout;
				Messages[n].Color = Color;
				Messages[n].RendererPosition = new Vector2(0.0, 0.0);
				Messages[n].RendererAlpha = 0.0;
			}
		}
		internal static void AddDebugMessage(string text, double duration)

Usage Example

コード例 #1
0
ファイル: Station.cs プロジェクト: piotrulos/OpenBVE
 internal override void Trigger(int Direction, EventTriggerType TriggerType, TrainManager.Train Train, int CarIndex)
 {
     if (TriggerType == EventTriggerType.FrontCarFrontAxle)
     {
         if (Direction < 0)
         {
             Train.StationFrontCar = true;
         }
         else if (Direction > 0)
         {
             Train.StationFrontCar = false;
             if (Train == TrainManager.PlayerTrain)
             {
                 Timetable.UpdateCustomTimetable(Game.Stations[this.StationIndex].TimetableDaytimeTexture, Game.Stations[this.StationIndex].TimetableNighttimeTexture);
             }
         }
     }
     else if (TriggerType == EventTriggerType.RearCarRearAxle)
     {
         if (Direction < 0)
         {
             Train.Station        = this.StationIndex;
             Train.StationRearCar = true;
             if (Train.NextStopSkipped != TrainManager.StopSkipMode.None)
             {
                 Train.LastStation = this.StationIndex;
             }
             Train.NextStopSkipped = TrainManager.StopSkipMode.None;
         }
         else if (Direction > 0)
         {
             if (Train.Station == StationIndex)
             {
                 if (Train == TrainManager.PlayerTrain)
                 {
                     if (Game.PlayerStopsAtStation(StationIndex) & TrainManager.PlayerTrain.StationState == TrainManager.TrainStopState.Pending)
                     {
                         string s = Interface.GetInterfaceString("message_station_passed");
                         s = s.Replace("[name]", Game.Stations[StationIndex].Name);
                         Game.AddMessage(s, MessageManager.MessageDependency.None, Interface.GameMode.Normal, MessageColor.Orange, Game.SecondsSinceMidnight + 10.0, null);
                     }
                     else if (Game.PlayerStopsAtStation(StationIndex) & TrainManager.PlayerTrain.StationState == TrainManager.TrainStopState.Boarding)
                     {
                         string s = Interface.GetInterfaceString("message_station_passed_boarding");
                         s = s.Replace("[name]", Game.Stations[StationIndex].Name);
                         Game.AddMessage(s, MessageManager.MessageDependency.None, Interface.GameMode.Normal, MessageColor.Red, Game.SecondsSinceMidnight + 10.0, null);
                     }
                 }
                 Train.Station        = -1;
                 Train.StationRearCar = false;
                 Train.StationState   = TrainManager.TrainStopState.Pending;
                 int d = Train.DriverCar;
                 Sounds.StopSound(Train.Cars[d].Sounds.Halt.Source);
             }
         }
     }
 }
All Usage Examples Of OpenBve.Game::AddMessage