From 854c9e03d407e6777e36f873352a7071c3f284cd Mon Sep 17 00:00:00 2001 From: tcfshcrw <48719709+tcfshcrw@users.noreply.github.com> Date: Fri, 9 Aug 2024 06:37:54 +0800 Subject: [PATCH] Plugin rudder function improvement 1. Add property of rudder status 2. change rudder checkbox to button 3. Add simhub-action for rudder --- SimHubPlugin/DataPluginDemo.cs | 15 ++++++++++--- SimHubPlugin/SettingsControlDemo.xaml | 6 ++--- SimHubPlugin/SettingsControlDemo.xaml.cs | 28 ++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/SimHubPlugin/DataPluginDemo.cs b/SimHubPlugin/DataPluginDemo.cs index 22c949c5..c133f2ab 100644 --- a/SimHubPlugin/DataPluginDemo.cs +++ b/SimHubPlugin/DataPluginDemo.cs @@ -861,7 +861,8 @@ unsafe public void DataUpdate(PluginManager pluginManager, ref GameData data) } Rudder_enable_flag = false; System.Threading.Thread.Sleep(50); - } + } + SystemSounds.Beep.Play(); } @@ -965,7 +966,8 @@ unsafe public void DataUpdate(PluginManager pluginManager, ref GameData data) pluginManager.SetPropertyValue("Theme_color", this.GetType(), simhub_theme_color); pluginManager.SetPropertyValue("ProfileIndex", this.GetType(), profile_index); pluginManager.SetPropertyValue("debugvalue", this.GetType(), debug_value); - + pluginManager.SetPropertyValue("rudder_status", this.GetType(), Rudder_status); + @@ -1371,6 +1373,7 @@ public void Init(PluginManager pluginManager) pluginManager.AddProperty("Overlay_display", this.GetType(), overlay_display); pluginManager.AddProperty("Theme_color", this.GetType(), simhub_theme_color); pluginManager.AddProperty("debugvalue", this.GetType(), debug_value); + pluginManager.AddProperty("rudder_status", this.GetType(), Rudder_status); // Declare an event //this.AddEvent("SpeedWarning"); @@ -1607,10 +1610,16 @@ public void Init(PluginManager pluginManager) }); this.AddAction("Rudder Brake", (a, b) => { - Rudder_brake_enable_flag = true; SimHub.Logging.Current.Info("Rudder Brake"); + }); + this.AddAction("Rudder", (a, b) => + { + + Rudder_enable_flag=true; + SimHub.Logging.Current.Info("Rudder action"); + }); //Settings.selectedJsonIndexLast[0] diff --git a/SimHubPlugin/SettingsControlDemo.xaml b/SimHubPlugin/SettingsControlDemo.xaml index dfb099c0..57b6dcf3 100644 --- a/SimHubPlugin/SettingsControlDemo.xaml +++ b/SimHubPlugin/SettingsControlDemo.xaml @@ -856,14 +856,12 @@