1 // ╔══════════════════════════════════════════════════════════════╗
2 // ║ Interface.cs and TrainManager.cs for the Structure Viewer    ║
3 // ╠══════════════════════════════════════════════════════════════╣
4 // ║ This file cannot be used in the openBVE main program.        ║
5 // ║ The files from the openBVE main program cannot be used here. ║
6 // ╚══════════════════════════════════════════════════════════════╝
7 
8 using System.Collections.Generic;
9 using ObjectViewer.Graphics;
10 using OpenBveApi;
11 using OpenBveApi.Interface;
12 using OpenBveApi.Objects;
13 using TrainManager.Trains;
14 
15 namespace ObjectViewer {
16 	// --- PluginManager.cs ---
17 	internal static class PluginManager {
18 		internal static class CurrentPlugin {
19 			internal static int[] Panel = new int[] { };
20 		}
21 	}
22 
23 	// --- Game.cs ---
24 	internal static class Game {
25 		internal static double SecondsSinceMidnight = 0.0;
26 
Reset()27 		internal static void Reset()
28 		{
29 			Program.TrainManager.Trains = new TrainBase[] { };
30 			TrainManager.PlayerTrain = null;
31 			Interface.LogMessages.Clear();
32 			Program.CurrentHost.MissingFiles.Clear();
33 			Program.Renderer.Reset();
34 			Program.Renderer.InitializeVisibility();
35 			ObjectManager.AnimatedWorldObjects = new WorldObject[4];
36 			ObjectManager.AnimatedWorldObjectsUsed = 0;
37 		}
38 	}
39 
40 	// --- Interface.cs ---
41 	internal static class Interface {
42 
43 		internal static readonly List<LogMessage> LogMessages = new List<LogMessage>();
AddMessage(MessageType Type, bool FileNotFound, string Text)44 		internal static void AddMessage(MessageType Type, bool FileNotFound, string Text) {
45 			LogMessages.Add(new LogMessage(Type, FileNotFound, Text));
46 		}
47 		/// <summary>Holds the program specific options</summary>
48 		internal class Options : BaseOptions
49 		{
50 			private ObjectOptimizationMode objectOptimizationMode;
51 
52 			/// <summary>
53 			/// The mode of optimization to be performed on an object
54 			/// </summary>
55 			internal ObjectOptimizationMode ObjectOptimizationMode
56 			{
57 				get
58 				{
59 					return objectOptimizationMode;
60 				}
61 				set
62 				{
63 					objectOptimizationMode = value;
64 
65 					switch (value)
66 					{
67 						case ObjectOptimizationMode.None:
68 							ObjectOptimizationBasicThreshold = 0;
69 							ObjectOptimizationFullThreshold = 0;
70 							break;
71 						case ObjectOptimizationMode.Low:
72 							ObjectOptimizationBasicThreshold = 1000;
73 							ObjectOptimizationFullThreshold = 250;
74 							break;
75 						case ObjectOptimizationMode.High:
76 							ObjectOptimizationBasicThreshold = 10000;
77 							ObjectOptimizationFullThreshold = 1000;
78 							break;
79 					}
80 				}
81 			}
82 
Options()83 			internal Options()
84 			{
85 				ObjectOptimizationMode = ObjectOptimizationMode.Low;
86 			}
87 		}
88 
89 		/// <summary>The current options in use</summary>
90 		internal static Options CurrentOptions;
91 	}
92 }
93