diff --git a/.gitignore b/.gitignore index 81787c9..ef351aa 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,5 @@ GameData/notes/Plugins/notes.dll GameData/notes/Plugins/notesRPM.dll *.zip *.scgdat + +*.userprefs diff --git a/GameData/notes/BasicMFDnotesPatch.cfg b/GameData/notes/BasicMFDnotesPatch.cfg index 8c38b9b..ca78bec 100644 --- a/GameData/notes/BasicMFDnotesPatch.cfg +++ b/GameData/notes/BasicMFDnotesPatch.cfg @@ -31,8 +31,8 @@ infoButton = 2 //Text tint is also modifiable - textTint = [#009900ff] - textTintUnpowered = [#ffffff3e] + textTint = + textTintUnpowered = } } } diff --git a/notes.sln b/notes.sln index f184006..3a1e481 100644 --- a/notes.sln +++ b/notes.sln @@ -29,4 +29,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(MonoDevelopProperties) = preSolution + version = 0.14 + EndGlobalSection EndGlobal diff --git a/notes/Properties/AssemblyInfo.cs b/notes/Properties/AssemblyInfo.cs index c49008a..ffb4312 100644 --- a/notes/Properties/AssemblyInfo.cs +++ b/notes/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Notes plugin for KSP")] -[assembly: AssemblyCopyright("Copyright © 2015 hashashin")] +[assembly: AssemblyCopyright("Copyright © 2016 hashashin")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ // Puede especificar todos los valores o establecer como predeterminados los números de compilación y de revisión // mediante el carácter '*', como se muestra a continuación: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.13.0.0")] -[assembly: AssemblyFileVersion("0.13.0.0")] +[assembly: AssemblyVersion("0.14.0.0")] +[assembly: AssemblyFileVersion("0.14.0.0")] diff --git a/notes/notes.csproj b/notes/notes.csproj index 3d9493f..f3b7b15 100644 --- a/notes/notes.csproj +++ b/notes/notes.csproj @@ -12,6 +12,8 @@ v3.5 512 + 0.14 + false true @@ -24,14 +26,15 @@ false - pdbonly + + true bin\Release\ TRACE prompt 3 false - AnyCPU + anycpu @@ -66,12 +69,14 @@ - - N:\ksp1.1\KSP_x64_Data\Managed\Assembly-CSharp.dll + + False + ..\..\..\Managed\Assembly-CSharp.dll - - N:\ksp1.1\KSP_x64_Data\Managed\UnityEngine.dll + + False + ..\..\..\Managed\UnityEngine.dll diff --git a/notes/toolbarwrapper.cs b/notes/toolbarwrapper.cs index c448313..1ed4e73 100644 --- a/notes/toolbarwrapper.cs +++ b/notes/toolbarwrapper.cs @@ -1,5 +1,5 @@ /* -Copyright (c) 2013-2014, Maik Schreiber +Copyright (c) 2013-2016, Maik Schreiber All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -23,9 +23,8 @@ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; +using System; using System.Collections.Generic; -using System.Linq; using System.Reflection; using UnityEngine; @@ -824,9 +823,15 @@ internal ToolbarTypes() internal static Type getType(string name) { - return AssemblyLoader.loadedAssemblies - .SelectMany(a => a.assembly.GetExportedTypes()) - .SingleOrDefault(t => t.FullName == name); + Type type = null; + AssemblyLoader.loadedAssemblies.TypeOperation(t => + { + if (t.FullName == name) + { + type = t; + } + }); + return type; } internal static PropertyInfo getProperty(Type type, string name) diff --git a/notesRPM/Properties/AssemblyInfo.cs b/notesRPM/Properties/AssemblyInfo.cs index 12546ff..04376c7 100644 --- a/notesRPM/Properties/AssemblyInfo.cs +++ b/notesRPM/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // Puede especificar todos los valores o establecer como predeterminados los números de compilación y de revisión // mediante el carácter '*', como se muestra a continuación: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1")] -[assembly: AssemblyFileVersion("0.1")] +[assembly: AssemblyVersion("0.2")] +[assembly: AssemblyFileVersion("0.2")] diff --git a/notesRPM/notesRPM.cs b/notesRPM/notesRPM.cs index 6bc3ab3..d3c642d 100644 --- a/notesRPM/notesRPM.cs +++ b/notesRPM/notesRPM.cs @@ -31,128 +31,130 @@ namespace notesRPM { - public class notesRPM : InternalModule - { - //Buttons - [KSPField] - public int noteButton = 0; - [KSPField] - public int downButton = 1; - [KSPField] - public int infoButton = 2; + public class notesRPM : InternalModule + { + //Buttons + [KSPField] + public int noteButton = 0; + [KSPField] + public int downButton = 1; + [KSPField] + public int infoButton = 2; - [KSPField] public int nextnoteButton = 7; - [KSPField] public int prevnoteButton = 8; + [KSPField] + public int nextnoteButton = 7; + [KSPField] + public int prevnoteButton = 8; - //kOS Fields - [KSPField] - public string textTint = "[#009900ff]"; - [KSPField] - public string textTintUnpowered = "[#ffffff3e]"; - [KSPField] - public int consoleWidth = 40; - [KSPField] - public int consoleHeight = 20; + //kOS Fields + [KSPField] + public string textTint = ""; + [KSPField] + public string textTintUnpowered = ""; + [KSPField] + public int consoleWidth = 40; + [KSPField] + public int consoleHeight = 20; - //General State Variables - private string response = "Notes terminal"; - private bool started = false; - private Notes notes; + //General State Variables + private string response = "Notes terminal"; + private bool started = false; + private Notes notes; - public string ContentProcessor(int screenWidth, int screenHeight) - { - if (started) - { - return (response); - } - //Check for initialization - notes = FindObjectOfType(); - response = textFormat(notes._text); - started = true; - return response; - } + public string ContentProcessor(int screenWidth, int screenHeight) + { + if (started) + { + return (response); + } + //Check for initialization + notes = FindObjectOfType(); + response = textFormat(notes._text); + started = true; + return response; + } - public void ButtonProcessor(int buttonID) - { - if (buttonID == noteButton) - { - response = - textFormat(notes._text); - } - else if (buttonID == downButton) - { - godowntext(response); - } - else if (buttonID == infoButton) - { - notes.GetLogInfo(); - response = textFormat(notes._vesselInfo); - } - else if (buttonID == nextnoteButton) - { - notes.SelectNote(true); - response = - textFormat(notes._text); - } - else if (buttonID == prevnoteButton) - { - notes.SelectNote(false); - response = - textFormat(notes._text); - } - } + public void ButtonProcessor(int buttonID) + { + if (buttonID == noteButton) + { + response = + textFormat(notes._text); + } + else if (buttonID == downButton) + { + godowntext(response); + } + else if (buttonID == infoButton) + { + notes.GetLogInfo(); + response = textFormat(notes._vesselInfo); + } + else if (buttonID == nextnoteButton) + { + notes.SelectNote(true); + response = + textFormat(notes._text); + } + else if (buttonID == prevnoteButton) + { + notes.SelectNote(false); + response = + textFormat(notes._text); + } + } - private string textFormat(string sentence) - { - var responsetext = string.Empty; - string[] lines = Regex.Split(sentence, "[\r\n]+"); - foreach (var line in lines) - { - string[] words = line.Split(' '); - var parts = new Dictionary(); - string parttext = string.Empty; - int partCounter = 0; - - foreach (var word in words) - { - if (parttext.Length + word.Length < consoleWidth) - { - parttext += string.IsNullOrEmpty(parttext) ? word : " " + word; - } - else - { - parts.Add(partCounter, parttext); - parttext = word; - partCounter++; - } - } - parts.Add(partCounter, parttext); - responsetext = parts.Aggregate(responsetext, - (current, item) => current + (item.Value + Environment.NewLine)); - } - return (responsetext); - } + private string textFormat(string sentence) + { + var responsetext = string.Empty; + string[] lines = Regex.Split(sentence, "[\r\n]+"); + foreach (var line in lines) + { + string[] words = line.Split(' '); + var parts = new Dictionary(); + string parttext = string.Empty; + int partCounter = 0; - private void godowntext(string sentence) - { - string[] lines = Regex.Split(sentence, "[\r\n]+"); - if (lines.Count() > consoleHeight - 1) - { - var responsetext = String.Empty; - var text = lines.Skip(consoleHeight - 1); - foreach (var line in text) - { - responsetext += line + Environment.NewLine; - } - response = textFormat(responsetext); - } - } - } + foreach (var word in words) + { + if (parttext.Length + word.Length < consoleWidth) + { + parttext += string.IsNullOrEmpty(parttext) ? word : " " + word; + } + else + { + parts.Add(partCounter, parttext); + parttext = word; + partCounter++; + } + } + parts.Add(partCounter, parttext); + responsetext = parts.Aggregate(responsetext, + (current, item) => current + (item.Value + Environment.NewLine)); + } + return (responsetext); + } - public class RPMConsole : InternalModule - { - } + private void godowntext(string sentence) + { + string[] lines = Regex.Split(sentence, "[\r\n]+"); + if (lines.Count() > consoleHeight - 1) + { + var responsetext = String.Empty; + var text = lines.Skip(consoleHeight - 1); + foreach (var line in text) + { + responsetext += line + Environment.NewLine; + } + response = textFormat(responsetext); + } + } + } + + public class RPMConsole : InternalModule + { + } } diff --git a/notesRPM/notesRPM.csproj b/notesRPM/notesRPM.csproj index 6921411..023ab9d 100644 --- a/notesRPM/notesRPM.csproj +++ b/notesRPM/notesRPM.csproj @@ -12,6 +12,7 @@ v3.5 512 + 0.14 true @@ -31,13 +32,13 @@ 4 - - N:\ksp1.1\KSP_x64_Data\Managed\Assembly-CSharp.dll - + + ..\..\..\Managed\Assembly-CSharp.dll + - N:\ksp1.1\KSP_x64_Data\Managed\UnityEngine.dll + ..\..\..\Managed\UnityEngine.dll