diff --git a/Assets/Plugins/KerbalEngineer.Unity.dll b/Assets/Plugins/KerbalEngineer.Unity.dll index 462969c1..32be3d09 100644 Binary files a/Assets/Plugins/KerbalEngineer.Unity.dll and b/Assets/Plugins/KerbalEngineer.Unity.dll differ diff --git a/Documents/CHANGES.txt b/Documents/CHANGES.txt index 68f50d67..0bd9ed28 100644 --- a/Documents/CHANGES.txt +++ b/Documents/CHANGES.txt @@ -1,3 +1,9 @@ +1.1.7.0, 2019-10-16, KSP 1.8.0 #2686 + - Update to KSP 1.8, target .NET 4. + - Fix readout colors reverting to default on GUI size change. + - Improve handling of invalid or outdated xml settings. + - Removed MiniAVC.dll for now. + 1.1.6.0, 2019-4-10, KSP 1.7.0 #2483 - Version bump for 1.7.0 - Show localized biome name diff --git a/KerbalEngineer.Editor.csproj b/KerbalEngineer.Editor.csproj index 0541ad1a..96927d40 100644 --- a/KerbalEngineer.Editor.csproj +++ b/KerbalEngineer.Editor.csproj @@ -44,10 +44,7 @@ - - - Library\UnityAssemblies\UnityEngine.dll False diff --git a/KerbalEngineer.Unity/Properties/AssemblyInfo.cs b/KerbalEngineer.Unity/Properties/AssemblyInfo.cs index 825bcdb7..5294e720 100644 --- a/KerbalEngineer.Unity/Properties/AssemblyInfo.cs +++ b/KerbalEngineer.Unity/Properties/AssemblyInfo.cs @@ -3,7 +3,7 @@ [assembly: AssemblyTitle("KerbalEngineer.Unity")] [assembly: AssemblyProduct("KerbalEngineer.Unity")] -[assembly: AssemblyCopyright("Copyright © CYBUTEK 2016")] +[assembly: AssemblyCopyright("Copyright © CYBUTEK/jrbudda 2019")] [assembly: ComVisible(false)] [assembly: Guid("5387bb1e-32b1-4bac-b03f-100570b9554c")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/KerbalEngineer/EngineerGlobals.cs b/KerbalEngineer/EngineerGlobals.cs index affad423..0a9cc181 100644 --- a/KerbalEngineer/EngineerGlobals.cs +++ b/KerbalEngineer/EngineerGlobals.cs @@ -21,7 +21,7 @@ public static class EngineerGlobals /// /// Current version of the Kerbal Engineer assembly. /// - public const string ASSEMBLY_VERSION = "1.1.6.0"; + public const string ASSEMBLY_VERSION = "1.1.7.0"; private static string assemblyFile; private static string assemblyName; diff --git a/KerbalEngineer/Flight/FlightAppLauncher.cs b/KerbalEngineer/Flight/FlightAppLauncher.cs index 8fdac792..62caba8c 100644 --- a/KerbalEngineer/Flight/FlightAppLauncher.cs +++ b/KerbalEngineer/Flight/FlightAppLauncher.cs @@ -129,7 +129,13 @@ public static bool IsHoverActivated { get { - return GeneralSettings.Handler.Get("FlightAppLauncher_IsHoverActivated", true); + try + { + return GeneralSettings.Handler.Get("FlightAppLauncher_IsHoverActivated", true); + } catch + { + return true; + } } set diff --git a/KerbalEngineer/Flight/Readouts/Miscellaneous/Separator.cs b/KerbalEngineer/Flight/Readouts/Miscellaneous/Separator.cs index a3fb0883..c5de6019 100644 --- a/KerbalEngineer/Flight/Readouts/Miscellaneous/Separator.cs +++ b/KerbalEngineer/Flight/Readouts/Miscellaneous/Separator.cs @@ -60,23 +60,32 @@ public Separator() public override void Draw(Unity.Flight.ISectionModule section) { - GUILayout.Box(String.Empty, section.IsHud ? this.boxStyleHud : this.boxStyle); + GUILayout.Box("WHY THO", section.IsHud ? this.boxStyleHud : this.boxStyle); } #endregion #region Methods: private + private static readonly Texture2D tex = TextureHelper.CreateTextureFromColour(new Color(1.0f, 1.0f, 1.0f, 0.5f)); + private void InitialiseStyles() { this.boxStyle = new GUIStyle { normal = { - background = TextureHelper.CreateTextureFromColour(new Color(1.0f, 1.0f, 1.0f, 0.5f)) + background = tex, + textColor = new Color(1,1,1,0.5f) + }, + active = + { + background = tex }, - fixedHeight = 1.0f, - stretchWidth = true + border = new RectOffset(0,0,0,1), + fixedHeight = 0.0f, + stretchWidth = true, + imagePosition = ImagePosition.ImageOnly }; this.boxStyleHud = new GUIStyle(this.boxStyle) diff --git a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs index f4cd2b67..704868c7 100644 --- a/KerbalEngineer/Flight/Readouts/ReadoutModule.cs +++ b/KerbalEngineer/Flight/Readouts/ReadoutModule.cs @@ -22,7 +22,7 @@ using System; using KerbalEngineer.Flight.Sections; - +using KerbalEngineer.Settings; using UnityEngine; #endregion @@ -243,6 +243,11 @@ private void InitialiseStyles(bool force) { if (NameStyle != null && !force) return; + ReadoutModule existing = ReadoutLibrary.GetReadout(this.Name); + Color c = HighLogic.Skin.label.normal.textColor; + if (existing != null) + c = existing.ValueStyle.normal.textColor; + NameStyle = new GUIStyle(HighLogic.Skin.label) { normal = { @@ -309,6 +314,11 @@ private void InitialiseStyles(bool force) { fontSize = (int)(11 * GuiDisplaySize.Offset), fixedHeight = 18.0f * GuiDisplaySize.Offset }; + + + this.ValueStyle.normal.textColor = c; + + } private void OnSizeChanged() { diff --git a/KerbalEngineer/Flight/Sections/SectionEditor.cs b/KerbalEngineer/Flight/Sections/SectionEditor.cs index 0cccc30d..6a206da0 100644 --- a/KerbalEngineer/Flight/Sections/SectionEditor.cs +++ b/KerbalEngineer/Flight/Sections/SectionEditor.cs @@ -191,7 +191,7 @@ private void DrawCategories() { /// private void DrawCategorySelector() { this.categoryList.enabled = GUILayout.Toggle(this.categoryList.enabled, "▼ SELECTED CATEGORY: " + ReadoutCategory.Selected.ToString().ToUpper() + " ▼", this.categoryTitleButtonStyle); - if (Event.current.type == EventType.repaint) { + if (Event.current.type == EventType.Repaint) { this.categoryList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect()); } } @@ -276,7 +276,7 @@ private void DrawInstalledReadouts() { colorPicker.enabled = true; } - if (Event.current.type == EventType.repaint && editingReadout == readout) { + if (Event.current.type == EventType.Repaint && editingReadout == readout) { colorPicker.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position).Translate(new Rect(8, scrollRectInstalled.y - scrollPositionInstalled.y, 8, 8)), new Rect(0, 0, 180, 20)); } @@ -300,7 +300,7 @@ private void DrawInstalledReadouts() { GUILayout.EndScrollView(); - if (Event.current.type == EventType.repaint) { + if (Event.current.type == EventType.Repaint) { scrollRectInstalled = GUILayoutUtility.GetLastRect(); } @@ -332,7 +332,7 @@ private void DrawPresetSaveButton() { /// private void DrawPresetSelector() { this.presetList.enabled = GUILayout.Toggle(this.presetList.enabled, "▼ PRESETS ▼", this.categoryTitleButtonStyle, GUILayout.Width(150.0f)); - if (Event.current.type == EventType.repaint) { + if (Event.current.type == EventType.Repaint) { this.presetList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect()); } } diff --git a/KerbalEngineer/Flight/Sections/SectionModule.cs b/KerbalEngineer/Flight/Sections/SectionModule.cs index 67005603..3b87a7b2 100644 --- a/KerbalEngineer/Flight/Sections/SectionModule.cs +++ b/KerbalEngineer/Flight/Sections/SectionModule.cs @@ -167,7 +167,7 @@ public bool IsHud { /// /// Gets the number of drawn readout lines. /// - public int LineCount { get; private set; } + public int LineCount { get; set; } /// /// Gets and sets the name of the section. diff --git a/KerbalEngineer/GuiDisplaySize.cs b/KerbalEngineer/GuiDisplaySize.cs index b4b51819..c95e8155 100644 --- a/KerbalEngineer/GuiDisplaySize.cs +++ b/KerbalEngineer/GuiDisplaySize.cs @@ -20,7 +20,7 @@ #region Using Directives using System; - +using System.Diagnostics; using KerbalEngineer.Settings; #endregion @@ -51,46 +51,46 @@ static GuiDisplaySize() try { var handler = SettingHandler.Load("GuiDisplaySize.xml"); - handler.GetSet("multiplier", ref multiplier); - handler.GetSet("increment", ref increment); + handler.Set("multiplier", 1.1); + increment = handler.GetSet("increment", increment); handler.Save("GuiDisplaySize.xml"); - offset = 1 + (increment * multiplier) - increment; } catch (Exception ex) { MyLogger.Exception(ex, "GuiDisplaySize->GuiDisplaySize"); } + offset = 1 + (increment * multiplier) - increment; } #endregion #region Properties - public static float Multiplier - { - get { return multiplier; } - set - { - try - { - if (multiplier == value) - { - return; - } - - multiplier = value; - var handler = SettingHandler.Load("GuiDisplaySize.xml"); - handler.Set("multiplier", multiplier); - handler.Save("GuiDisplaySize.xml"); - offset = 1 + (increment * multiplier) - increment; - OnSizeChanged(); - } - catch (Exception ex) - { - MyLogger.Exception(ex, "GuiDisplaySize->Multiplier"); - } - } - } + //public static float Multiplier + //{ + // get { return multiplier; } + // set + // { + // try + // { + // if (multiplier == value) + // { + // return; + // } + + // multiplier = value; + // var handler = SettingHandler.Load("GuiDisplaySize.xml"); + // handler.Set("multiplier", multiplier); + // handler.Save("GuiDisplaySize.xml"); + // offset = 1 + (increment * multiplier) - increment; + // OnSizeChanged(); + // } + // catch (Exception ex) + // { + // MyLogger.Exception(ex, "GuiDisplaySize->Multiplier"); + // } + // } + //} public static int Increment { diff --git a/KerbalEngineer/KerbalEngineer.csproj b/KerbalEngineer/KerbalEngineer.csproj index c05e77d8..c81256c9 100644 --- a/KerbalEngineer/KerbalEngineer.csproj +++ b/KerbalEngineer/KerbalEngineer.csproj @@ -9,8 +9,9 @@ Properties KerbalEngineer KerbalEngineer - v3.5 + v4.0 512 + false @@ -21,6 +22,7 @@ prompt 4 false + false none @@ -32,6 +34,7 @@ 4 false false + false @@ -291,10 +294,6 @@ X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp.dll False - - X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll - False - ..\Game\KSP_Data\Managed\System.dll False @@ -307,19 +306,49 @@ X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.dll False + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.AnimationModule.dll + False + + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.AssetBundleModule.dll + False + + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.CoreModule.dll + False + + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.IMGUIModule.dll + False + + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.InputLegacyModule.dll + False + + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.PhysicsModule.dll + False + + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.TextRenderingModule.dll + False + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UI.dll False + + X:\Steam\steamapps\common\Kerbal Space Program\KSP_x64_Data\Managed\UnityEngine.UIModule.dll + False + {5387bb1e-32b1-4bac-b03f-100570b9554c} KerbalEngineer.Unity - False - diff --git a/KerbalEngineer/Properties/AssemblyInfo.cs b/KerbalEngineer/Properties/AssemblyInfo.cs index bbcd62a0..1fffb5e9 100644 --- a/KerbalEngineer/Properties/AssemblyInfo.cs +++ b/KerbalEngineer/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CYBUTEK")] [assembly: AssemblyProduct("KerbalEngineer")] -[assembly: AssemblyCopyright("Copyright © CYBUTEK 2013")] +[assembly: AssemblyCopyright("Copyright © CYBUTEK/jrbudda 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/KerbalEngineer/Settings/SettingHandler.cs b/KerbalEngineer/Settings/SettingHandler.cs index c1d5bee0..737290b1 100644 --- a/KerbalEngineer/Settings/SettingHandler.cs +++ b/KerbalEngineer/Settings/SettingHandler.cs @@ -100,7 +100,15 @@ public T Get(string name, T defaultObject) { if (item.Name == name) { - return (T)Convert.ChangeType(item.Value, typeof(T)); + try + { + return (T)Convert.ChangeType(item.Value, typeof(T)); + } + catch + { + item.Value = defaultObject; + return (T)Convert.ChangeType(item.Value, typeof(T)); + } } } return defaultObject; @@ -132,15 +140,20 @@ public bool Get(string name, ref T outputObject) /// public void Set(string name, object value) { + int i=-1; + foreach (var item in this.Items) { if (item.Name == name) { - item.Value = value; - return; + i = Items.IndexOf(item); } } - this.Items.Add(new SettingItem(name, value)); + + if (i>=0) + Items.RemoveAt(i); + + this.Items.Insert(i >=0? i: Items.Count, new SettingItem(name, value)); } #endregion @@ -156,9 +169,18 @@ public T GetSet(string name, T defaultObject) { if (item.Name == name) { - return (T)Convert.ChangeType(item.Value, typeof(T)); + try + { + return (T)Convert.ChangeType(item.Value, typeof(T)); + } + catch + { + //invalid xml or something + item.Value = defaultObject; + } } } + if (defaultObject != null) { this.Items.Add(new SettingItem(name, defaultObject)); @@ -166,27 +188,6 @@ public T GetSet(string name, T defaultObject) return defaultObject; } - /// - /// Gets a setting from its name and inputs it into the output object. Will add the object to the handler if it does - /// not exist. - /// - public bool GetSet(string name, ref T outputObject) - { - foreach (var item in this.Items) - { - if (item.Name == name) - { - outputObject = (T)Convert.ChangeType(item.Value, typeof(T)); - return true; - } - } - if (outputObject != null) - { - this.Items.Add(new SettingItem(name, outputObject)); - } - return false; - } - #endregion #region Saving diff --git a/KerbalEngineer/TrackingStation/SectionEditorTS.cs b/KerbalEngineer/TrackingStation/SectionEditorTS.cs index e6b71e5e..3722ef93 100644 --- a/KerbalEngineer/TrackingStation/SectionEditorTS.cs +++ b/KerbalEngineer/TrackingStation/SectionEditorTS.cs @@ -188,7 +188,7 @@ private void DrawCategories() { /// private void DrawCategorySelector() { this.categoryList.enabled = GUILayout.Toggle(this.categoryList.enabled, "▼ SELECTED CATEGORY: " + ReadoutCategory.Selected.ToString().ToUpper() + " ▼", this.categoryTitleButtonStyle); - if (Event.current.type == EventType.repaint) { + if (Event.current.type == EventType.Repaint) { this.categoryList.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position), GUILayoutUtility.GetLastRect()); } } @@ -266,7 +266,7 @@ private void DrawInstalledReadouts() { colorPicker.enabled = true; } - if (Event.current.type == EventType.repaint && editingReadout == readout) { + if (Event.current.type == EventType.Repaint && editingReadout == readout) { colorPicker.SetPosition(GUILayoutUtility.GetLastRect().Translate(this.position).Translate(new Rect(8, scrollRectInstalled.y - scrollPositionInstalled.y, 8, 8)), new Rect(0, 0, 180, 20)); } @@ -289,7 +289,7 @@ private void DrawInstalledReadouts() { GUILayout.EndScrollView(); - if (Event.current.type == EventType.repaint) { + if (Event.current.type == EventType.Repaint) { scrollRectInstalled = GUILayoutUtility.GetLastRect(); } diff --git a/KerbalEngineer/TrackingStation/SectionModuleTS.cs b/KerbalEngineer/TrackingStation/SectionModuleTS.cs index 4c9416b8..b7aa438b 100644 --- a/KerbalEngineer/TrackingStation/SectionModuleTS.cs +++ b/KerbalEngineer/TrackingStation/SectionModuleTS.cs @@ -173,7 +173,7 @@ public bool IsHud { /// /// Gets the number of drawn readout lines. /// - public int LineCount { get; private set; } + public int LineCount { get; set; } /// /// Gets and sets the name of the section. diff --git a/Output/KerbalEngineer/MiniAVC.dll b/MiniAVC.dll similarity index 100% rename from Output/KerbalEngineer/MiniAVC.dll rename to MiniAVC.dll diff --git a/Output/KerbalEngineer/KerbalEngineer.Unity.dll b/Output/KerbalEngineer/KerbalEngineer.Unity.dll index 462969c1..32be3d09 100644 Binary files a/Output/KerbalEngineer/KerbalEngineer.Unity.dll and b/Output/KerbalEngineer/KerbalEngineer.Unity.dll differ diff --git a/Output/KerbalEngineer/KerbalEngineer.dll b/Output/KerbalEngineer/KerbalEngineer.dll index b80ec51c..154239cb 100644 Binary files a/Output/KerbalEngineer/KerbalEngineer.dll and b/Output/KerbalEngineer/KerbalEngineer.dll differ diff --git a/Output/KerbalEngineer/KerbalEngineer.version b/Output/KerbalEngineer/KerbalEngineer.version index 14aa3e61..eafb604b 100644 --- a/Output/KerbalEngineer/KerbalEngineer.version +++ b/Output/KerbalEngineer/KerbalEngineer.version @@ -6,25 +6,25 @@ { "MAJOR":1, "MINOR":1, - "PATCH":6, + "PATCH":7, "BUILD":0 }, "KSP_VERSION": { "MAJOR":1, - "MINOR":7, + "MINOR":8, "PATCH":0 }, "KSP_VERSION_MIN": { "MAJOR":1, - "MINOR":7, + "MINOR":8, "PATCH":0 }, "KSP_VERSION_MAX": { "MAJOR":1, - "MINOR":7, + "MINOR":8, "PATCH":9 } }