From b4b9b230c64e0f58d043b31d162f2603cdf14777 Mon Sep 17 00:00:00 2001 From: Stepan Andreev Date: Sun, 17 Apr 2016 16:50:58 +0100 Subject: [PATCH] More Bugfixes. --- .../InfernalRobotics/Command/ServoController.cs | 7 ++++--- InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs | 4 +--- InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs | 3 ++- InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/InfernalRobotics/InfernalRobotics/Command/ServoController.cs b/InfernalRobotics/InfernalRobotics/Command/ServoController.cs index 60e7b8cf..168526d7 100644 --- a/InfernalRobotics/InfernalRobotics/Command/ServoController.cs +++ b/InfernalRobotics/InfernalRobotics/Command/ServoController.cs @@ -169,9 +169,10 @@ private void OnPartRemove(GameEvents.HostTargetAction hostTarget) Logger.Log("[ServoController] OnPartRemove finished successfully", Logger.Level.Debug); } - private void RebuildServoGroupsEditor() + private void RebuildServoGroupsEditor(ShipConstruct ship = null) { - ShipConstruct ship = EditorLogic.fetch.ship; + if(ship==null) + ship = EditorLogic.fetch.ship; ServoGroups = null; @@ -201,7 +202,7 @@ private void RebuildServoGroupsEditor() private void OnEditorShipModified(ShipConstruct ship) { - RebuildServoGroupsEditor(); + RebuildServoGroupsEditor(ship); Gui.WindowManager.guiRebuildPending = true; //this should force an UI rebuild on first update diff --git a/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs b/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs index 1e378146..51acb156 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs @@ -39,9 +39,7 @@ public void OnDrop(PointerEventData eventData) } var newGroupIndex = dragHandler.dropZone.parent.GetSiblingIndex(); - - ServoController.Instance.ServoGroups[oldGroupIndex].Servos.Remove(s); - ServoController.Instance.ServoGroups[newGroupIndex].Servos.Insert(insertAt, s); + ServoController.MoveServo(ServoController.Instance.ServoGroups[oldGroupIndex], ServoController.Instance.ServoGroups[newGroupIndex], s); break; } } diff --git a/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs b/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs index ba45499c..a4ec1025 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs @@ -151,7 +151,8 @@ public IEnumerator LoadBundle(string location) } - + IRAssetBundle.Unload(false); + www.Dispose(); } } diff --git a/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs b/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs index a4b94986..3f5a28fb 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs @@ -1598,7 +1598,7 @@ public void Update() if (!ServoController.APIReady || !UIAssetsLoader.controlWindowPrefabReady) { GUIEnabled = false; - appLauncherButton.SetFalse(); + appLauncherButton?.SetFalse(); return; }