Jump to content

damien667

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by damien667

  1. I was able to take the master branch of the Telemachus github code, load it into monodevelop... applied the following patch: diff --git a/Servers/Servers/Properties/Resources.resx b/Servers/Servers/Properties/Resources.resx index e3d34b6..2f2faa2 100644 --- a/Servers/Servers/Properties/Resources.resx +++ b/Servers/Servers/Properties/Resources.resx @@ -119,6 +119,6 @@ </resheader> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <data name="ResponseCodePageTemplate" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\resources\responsecodepagetemplate.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value> + <value>..\Resources\ResponseCodePageTemplate.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value> </data> </root> \ No newline at end of file diff --git a/Telemachus/src/IOPageResponsibility.cs b/Telemachus/src/IOPageResponsibility.cs index f190b1d..285073a 100644 --- a/Telemachus/src/IOPageResponsibility.cs +++ b/Telemachus/src/IOPageResponsibility.cs @@ -1,5 +1,5 @@ <U+FEFF>//Author: Richard Bunt -#define SYSTEMIO +#define KSPIO using System; using System.Collections.Generic; compiled it, installed it, and it ran just fine with KSP 0.90 under linux x64.... It refused to work with SYSTEMIO defined... and I can't test in Windows so I don't know if this breaks it there or not... I just wanted to mention this in case it helps. I'm wanting to write an Android client for the API Thanks for the hard work! Thanks,
  2. After adding the missing Resources file for nuclearFuel, my PowerPlant still had broken solar panels... so I fixed them with this edit to the part.cfg for the PowerPlant: MODULE { name = ModuleDeployableSolarPanel animationName = generator_solar_geploy raycastTransformName = solar_panel_panel resourceName = ElectricCharge chargeRate = 100 powerCurve { key = 206000000000 0 0 0 key = 13599840256 1 0 0 key = 68773560320 0.5 0 0 key = 0 10 0 0 } }
  3. Yeah... MonoDevelop auto-format did its miracle on whitespace... Sorry about the inconsistency with original code. Glad it works for you too :-)
  4. I made my own patch that uses relative position instead of absolute for the icon (on my screen it gets places immediately to the left of Part editor toggle button), and I also fixed the subdirectory/category loading/saving features since they weren't working for me in linux (tested only in linux as well). Here is the diff: --- Source/subassemblyLoader.cs 2013-06-02 03:30:48.409197029 -0500 +++ SubassemblyLoader/SubassemblyLoader/SubAssemlyLoader.cs 2013-06-02 03:31:39.285196251 -0500 @@ -1,30 +1,32 @@ -//v0.2 +//v0.2 using System; using KSP.IO; using UnityEngine; using System.Collections; using System.Collections.Generic; +[KSPAddon(KSPAddon.Startup.EditorAny, false)] public class subassemblyLoader : MonoBehaviour { public static GameObject GameObjectInstance; - private static PluginConfiguration config = PluginConfiguration.CreateForType<subassemblyLoader> (); private static string root = KSPUtil.ApplicationRootPath.Replace ("\\", "/"); - private static string subassemblyFolder = "PluginData/subassemblyLoader/subassemblies"; + private static string subassemblyFolder = "GameData/SubassemblyLoader/PluginData/subassemblies"; + private static string iconsFolder = "GameData/SubassemblyLoader/PluginData/icons"; private string subassemblyFilename = "Untitled"; private string subassemblyType = ""; private string subassemblyFolderName = root + subassemblyFolder; + private static string iconsFolderName = root + iconsFolder; private bool showFilenamePrompt; private bool isAttachable = true; private FileBrowser fileBrowser; private GUIStyle buttonStyle = new GUIStyle (); // Load static button images - private WWW img1 = new WWW ("file://" + root + "PluginData/subassemblyLoader/icons/buttonDisabled.png"); - private WWW img2 = new WWW ("file://" + root + "PluginData/subassemblyLoader/icons/buttonInactive.png"); - private WWW img3 = new WWW ("file://" + root + "PluginData/subassemblyLoader/icons/buttonHover.png"); - private WWW img4 = new WWW ("file://" + root + "PluginData/subassemblyLoader/icons/file.png"); - private WWW img5 = new WWW ("file://" + root + "PluginData/subassemblyLoader/icons/folder.png"); + private WWW img1 = new WWW ("file://" + iconsFolderName + "/buttonDisabled.png"); + private WWW img2 = new WWW ("file://" + iconsFolderName + "/buttonInactive.png"); + private WWW img3 = new WWW ("file://" + iconsFolderName + "/buttonHover.png"); + private WWW img4 = new WWW ("file://" + iconsFolderName + "/file.png"); + private WWW img5 = new WWW ("file://" + iconsFolderName + "/folder.png"); private Texture2D buttonDisabled = new Texture2D (0, 0); private Texture2D buttonInactive = new Texture2D (0, 0); private Texture2D buttonHover = new Texture2D (0, 0); @@ -33,7 +35,7 @@ private Texture2D button; public void Awake () - { + { DontDestroyOnLoad (this); // Save static button images to textures @@ -70,15 +72,28 @@ public void loadSubassembly (string filename) { + Debug.Log ("loadSubassembly"); + EditorLogic editor = EditorLogic.fetch; - + + if (filename == null) { + //Close Subassembly Browser + fileBrowser = null; + editor.Unlock (); + return; + } + + if (!filename.Substring (filename.LastIndexOf ("/"), (filename.Length - filename.LastIndexOf ("/"))).Contains (".craft")) { + subassemblyFolderName = filename; + subassemblyType = subassemblyFolderName.Substring (subassemblyFolderName.LastIndexOf ('/'), (subassemblyFolderName.Length - subassemblyFolderName.LastIndexOf ('/'))); + fileBrowser.CurrentDirectory = subassemblyFolderName; + return; + } + //Close Subassembly Browser fileBrowser = null; - editor.Unlock (); + editor.Unlock (); - if (filename == null) - return; - // Get current root, load subassembly construct, reset root Part shipRoot = EditorLogic.startPod; ShipConstruct subassemblyConstruct = ShipConstruction.LoadShip (filename); @@ -92,6 +107,15 @@ // Check new construct is attachable checkAttachable (editor.PartSelected); } + + public void changeCategory (string category) + { + if (category != null) { + subassemblyFolderName = category; + subassemblyType = subassemblyFolderName.Substring (subassemblyFolderName.LastIndexOf ('/'), (subassemblyFolderName.Length - subassemblyFolderName.LastIndexOf ('/'))); + } + fileBrowser = null; + } // Check if part is attachable private bool checkAttachable (Part part) @@ -129,7 +153,7 @@ // Draw top menu button - if (GUI.Button (new Rect (Screen.width - 300, 1, 48, 36), new GUIContent (button, "Subassembly"), buttonStyle) && !EditorLogic.softLock) + if (GUI.Button (new Rect (Screen.width - 800, 1, 48, 36), new GUIContent (button, "Subassembly"), buttonStyle) && !EditorLogic.softLock) if (EditorLogic.SelectedPart) { if (checkAttachable (EditorLogic.SelectedPart)) showFilenamePrompt = true; @@ -163,10 +187,15 @@ fileBrowser.OnGUI (); // Draw "Up" button (if applicable) - if (current != root + subassemblyFolder) - if (GUI.Button (new Rect (Screen.width / 2 + 190, 562, 40, 30), "/..")) - fileBrowser.CurrentDirectory = current.Substring (0, current.LastIndexOf ('/')); - + if (current != root + subassemblyFolder) { + fileBrowser.BrowserType = FileBrowserType.File; + if (GUI.Button (new Rect (Screen.width / 2 + 190, 562, 40, 30), "/..")) { + fileBrowser.CurrentDirectory = current.Substring (0, current.LastIndexOf ('/')); + } + } + else { + fileBrowser.BrowserType = FileBrowserType.Directory; + } // Reset Skin list.normal.textColor = new Color (.739f, 0.739f, 0.739f); list.contentOffset = new Vector2 (1, 42.4f); @@ -198,10 +227,9 @@ // Category button GUILayout.BeginHorizontal (); GUILayout.Label ("Category:", GUILayout.Width (75)); - if (GUILayout.Button (subassemblyType == "" ? "Miscellaneous" : subassemblyType)) - createFileBrowser ("Select subassembly category", true, (string filename) => { - subassemblyFolderName = fileBrowser.CurrentDirectory; - fileBrowser = null; }); + if (GUILayout.Button (subassemblyType == "" ? "Miscellaneous" : subassemblyType)) { + createFileBrowser ("Select subassembly category", true, changeCategory); + } GUILayout.EndHorizontal (); // Ok / Cancel buttons @@ -237,21 +265,19 @@ private void createFileBrowser (string title, bool isDir, FileBrowser.FinishedCallback callback) { fileBrowser = new FileBrowser (new Rect (Screen.width / 2, 100, 350, 500), title, callback, true); - fileBrowser.BrowserType = isDir ? FileBrowserType.Directory : FileBrowserType.File; + fileBrowser.BrowserType = FileBrowserType.Directory;//isDir ? FileBrowserType.Directory : FileBrowserType.File; fileBrowser.CurrentDirectory = root + subassemblyFolder; fileBrowser.FileImage = fileIcon; fileBrowser.DirectoryImage = folderIcon; fileBrowser.disallowDirectoryChange = true; - if (!isDir) - fileBrowser.SelectionPattern = "*.craft"; } } -public class subassemblyLoaderInit : KSP.Testing.UnitTest +public class subassemblyLoaderInit { public subassemblyLoaderInit () { var gameobject = new GameObject ("subassemblyLoader", typeof(subassemblyLoader)); UnityEngine.Object.DontDestroyOnLoad (gameobject); } -} +} My directory structure for the plugin is now: KSP/GameData/SubassemblyLoader PluginData icons buttonDisabled.png buttonHover.png buttonInactive.png file.png folder.png subassemblies Landers 2 Stage.craft Lifters Example.craft Probes Small Probe.craft Plugins SubassemblyLoader.dll If anyone wants the .dll I can upload it on a share site somewhere I'm sure... I used MonoDevelop on Ubuntu 12.04 x86_64, and it works like a charm for me now :-)
×
×
  • Create New...