From ef3b86ab44c37f6eb4075d85d6e7d1a515acd2bc Mon Sep 17 00:00:00 2001 From: Marc Riera Date: Fri, 4 Oct 2024 20:43:49 +0200 Subject: [PATCH] Initial commit --- OpenBveFcmbTrainPlugin.cs | 120 ++++++++++++++++++++++++++++++++++ OpenBveFcmbTrainPlugin.csproj | 41 ++++++++++++ OpenBveFcmbTrainPlugin.sln | 17 +++++ Properties/AssemblyInfo.cs | 26 ++++++++ README.md | 1 + 5 files changed, 205 insertions(+) create mode 100644 OpenBveFcmbTrainPlugin.cs create mode 100644 OpenBveFcmbTrainPlugin.csproj create mode 100644 OpenBveFcmbTrainPlugin.sln create mode 100644 Properties/AssemblyInfo.cs create mode 100644 README.md diff --git a/OpenBveFcmbTrainPlugin.cs b/OpenBveFcmbTrainPlugin.cs new file mode 100644 index 0000000..767f5e1 --- /dev/null +++ b/OpenBveFcmbTrainPlugin.cs @@ -0,0 +1,120 @@ +using System; +using OpenBveApi.Runtime; + +namespace OpenbveFcmbTrainPlugin +{ + /// The interface to be implemented by the plugin. + public partial class OpenbveFcmbTrainPlugin : IRuntime + { + + /// Holds the aspect last reported to the plugin in the SetSignal call. + int LastAspect = -1; + + /// Holds the array of panel variables. + /// Be sure to initialize in the Load call. + public static int[] Panel; + + /// Remembers which of the virtual keys are currently pressed down. + public static bool[] KeysPressed = new bool[34]; + + /// Whether the plugin is initializing or reinitializing. + public static bool Initializing; + + /// Is called when the plugin is loaded. + /// The properties supplied to the plugin on loading. + /// Whether the plugin was loaded successfully. + public bool Load(LoadProperties properties) + { + return true; + } + + /// Is called when the plugin is unloaded. + public void Unload() + { + } + + /// Is called after loading to inform the plugin about the specifications of the train. + /// The specifications of the train. + public void SetVehicleSpecs(VehicleSpecs specs) + { + } + + /// Is called when the plugin should initialize or reinitialize. + /// The mode of initialization. + public void Initialize(InitializationModes mode) + { + } + + /// Is called every frame. + /// The data passed to the plugin. + public void Elapse(ElapseData data) + { + } + + /// Is called when the driver changes the reverser. + /// The new reverser position. + public void SetReverser(int reverser) + { + } + + /// Is called when the driver changes the power notch. + /// The new power notch. + public void SetPower(int powerNotch) + { + } + + /// Is called when the driver changes the brake notch. + /// The new brake notch. + public void SetBrake(int brakeNotch) + { + } + + /// Is called when a virtual key is pressed. + /// The virtual key that was pressed. + public void KeyDown(VirtualKeys key) + { + } + + /// Is called when a virtual key is released. + /// The virtual key that was released. + public void KeyUp(VirtualKeys key) + { + } + + /// Is called when a horn is played or when the music horn is stopped. + /// The type of horn. + public void HornBlow(HornTypes type) + { + } + + /// Is called when the state of the doors changes. + /// The old state of the doors. + /// The new state of the doors. + public void DoorChange(DoorStates oldState, DoorStates newState) + { + } + + /// Is called when the aspect in the current or in any of the upcoming sections changes, or when passing section boundaries. + /// The signal array is guaranteed to have at least one element. When accessing elements other than index 0, you must check the bounds of the array first. + public void SetSignal(SignalData[] signal) + { + int aspect = signal[0].Aspect; + if (aspect != LastAspect) + { + } + } + + /// Is called when the train passes a beacon. + /// The beacon data. + public void SetBeacon(BeaconData beacon) + { + } + + /// Is called when the plugin should perform the AI. + /// The AI data. + public void PerformAI(AIData data) + { + } + + } +} diff --git a/OpenBveFcmbTrainPlugin.csproj b/OpenBveFcmbTrainPlugin.csproj new file mode 100644 index 0000000..244f830 --- /dev/null +++ b/OpenBveFcmbTrainPlugin.csproj @@ -0,0 +1,41 @@ + + + + Debug + AnyCPU + {9197FFA4-D95A-410C-A705-4E7CD187546A} + Library + OpenBveFcmbTrainPlugin + OpenBveFcmbTrainPlugin + v4.7 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + true + bin\Release + prompt + 4 + false + + + + + ..\..\..\..\lib\openbve\OpenBveApi.dll + False + + + + + + + + diff --git a/OpenBveFcmbTrainPlugin.sln b/OpenBveFcmbTrainPlugin.sln new file mode 100644 index 0000000..2b1d15a --- /dev/null +++ b/OpenBveFcmbTrainPlugin.sln @@ -0,0 +1,17 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenBveFcmbTrainPlugin", "OpenBveFcmbTrainPlugin.csproj", "{9197FFA4-D95A-410C-A705-4E7CD187546A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9197FFA4-D95A-410C-A705-4E7CD187546A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9197FFA4-D95A-410C-A705-4E7CD187546A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9197FFA4-D95A-410C-A705-4E7CD187546A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9197FFA4-D95A-410C-A705-4E7CD187546A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..606d050 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("OpenBVE FCMB Train Plugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/README.md b/README.md new file mode 100644 index 0000000..4f5ea8c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# OpenBVE FCMB Train Plugin