diff --git a/InfernalRobotics/InfernalRobotics/Command/ServoController.cs b/InfernalRobotics/InfernalRobotics/Command/ServoController.cs index c3ffee1d..0a8dd0ee 100644 --- a/InfernalRobotics/InfernalRobotics/Command/ServoController.cs +++ b/InfernalRobotics/InfernalRobotics/Command/ServoController.cs @@ -286,7 +286,7 @@ private void OnVesselChange(Vessel v) Logger.Log("[ServoController] OnVesselChange finished successfully", Logger.Level.Debug); } - private void OnVesselWasModified(Vessel v) + private void OnVesselPartCountModified(Vessel v) { RebuildServoGroupsFlight (); } @@ -312,7 +312,7 @@ private void Awake() if (scene == GameScenes.FLIGHT) { GameEvents.onVesselChange.Add(OnVesselChange); - GameEvents.onVesselWasModified.Add(OnVesselWasModified); + GameEvents.onVesselPartCountChanged.Add(OnVesselPartCountModified); GameEvents.onVesselLoaded.Add (OnVesselLoaded); GameEvents.onVesselDestroy.Add (OnVesselUnloaded); GameEvents.onVesselGoOnRails.Add (OnVesselUnloaded); @@ -345,7 +345,16 @@ public static void SetWheelAutoStruts(bool value, Vessel v) if (!HighLogic.LoadedSceneIsFlight) return; - var activeVesselWheels = v.FindPartModulesImplementing(); + /*foreach(var p in v.Parts) + { + if(!value) + { + p.autoStrutMode = Part.AutoStrutMode.Off; + p.UpdateAutoStrut (); + } + } +*/ + /*var activeVesselWheels = v.FindPartModulesImplementing(); foreach(var mwb in activeVesselWheels) { if (value) @@ -358,7 +367,7 @@ public static void SetWheelAutoStruts(bool value, Vessel v) mwb.autoStrut = value; - } + }*/ } @@ -407,7 +416,7 @@ private void OnDestroy() GameEvents.onVesselChange.Remove(OnVesselChange); GameEvents.onPartAttach.Remove(OnPartAttach); GameEvents.onPartRemove.Remove(OnPartRemove); - GameEvents.onVesselWasModified.Remove(OnVesselWasModified); + GameEvents.onVesselWasModified.Remove(OnVesselPartCountModified); GameEvents.onEditorShipModified.Remove(OnEditorShipModified); GameEvents.onEditorLoad.Remove(OnEditorLoad); GameEvents.onEditorRestart.Remove(OnEditorRestart); diff --git a/InfernalRobotics/InfernalRobotics/Control/Servo/ServoPreset.cs b/InfernalRobotics/InfernalRobotics/Control/Servo/ServoPreset.cs index 2444e7de..419eeced 100644 --- a/InfernalRobotics/InfernalRobotics/Control/Servo/ServoPreset.cs +++ b/InfernalRobotics/InfernalRobotics/Control/Servo/ServoPreset.cs @@ -66,6 +66,7 @@ public void Save(bool symmetry = false) } module.presetPositionsSerialized = rawServo.presetPositionsSerialized; module.ParsePresetPositions(); + module.defaultPosition = rawServo.defaultPosition; //force sync the default position as well } } } diff --git a/InfernalRobotics/InfernalRobotics/Gui/EditorCategory.cs b/InfernalRobotics/InfernalRobotics/Gui/EditorCategory.cs index 6ff8e4f0..c201ce52 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/EditorCategory.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/EditorCategory.cs @@ -22,7 +22,7 @@ void Awake() private void IRCustomFilter() { const string FILTER_CATEGORY = "Filter by Function"; - const string CUSTOM_CATEGORY_NAME = "Robotic Parts"; + const string CUSTOM_CATEGORY_NAME = "Robotic"; //var texture_on = new Texture2D(36, 36, TextureFormat.RGBA32, false); //var texture_off = new Texture2D(36, 36, TextureFormat.RGBA32, false); diff --git a/InfernalRobotics/InfernalRobotics/Gui/IRBuildAid/IRBuildAidManager.cs b/InfernalRobotics/InfernalRobotics/Gui/IRBuildAid/IRBuildAidManager.cs index fe8d6418..c79dba01 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/IRBuildAid/IRBuildAidManager.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/IRBuildAid/IRBuildAidManager.cs @@ -17,8 +17,8 @@ public class IRBuildAidManager : MonoBehaviour public static Color endPoint1Color = new Color(1f, 1f, 0, 0.5f); public static Color endPoint2Color = new Color(1f, 1f, 0, 0.5f); - public static Color mainLineColor1 = new Color(1f, 0.85f, 0, 0.5f); - public static Color mainLineColor2 = new Color(0.85f, 1f, 0, 0.5f); + public static Color mainLineColor1 = new Color(0.88f, 0.7f, 0.188f, 0.7f); + public static Color mainLineColor2 = new Color(0.7f, 0.5f, 0, 0.5f); public static Color presetPositionsColor = new Color(1f, 1f, 1f, 0.5f); public static Color currentPositionColor = new Color(0f, 1f, 0f, 0.5f); diff --git a/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs b/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs index 23fd1380..8a170a32 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/ServoDropHandler.cs @@ -43,6 +43,7 @@ public void onServoDrop(ServoDragHandler dragHandler) var newGroupIndex = dragHandler.dropZone.parent.GetSiblingIndex(); ServoController.MoveServo(ServoController.Instance.ServoGroups[oldGroupIndex], ServoController.Instance.ServoGroups[newGroupIndex], s); + WindowManager.guiRebuildPending = true; break; } } diff --git a/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs b/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs index 3f3203b8..3e2c020f 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/UIAssetsLoader.cs @@ -162,16 +162,6 @@ private void LoadBundleAssets() } - public void LoadBundleFromDisk(string path) - { - IRAssetBundle = AssetBundle.CreateFromFile(path); - - LoadBundleAssets(); - - //had to move bundle unloading further down in time due to unexplained and unreproducable on my PC issues for some users - //IRAssetBundle.Unload(false); - } - public void Start() { var assemblyFile = Assembly.GetExecutingAssembly().Location; diff --git a/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs b/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs index 28a15878..92d14fe6 100644 --- a/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs +++ b/InfernalRobotics/InfernalRobotics/Gui/WindowManager.cs @@ -406,8 +406,6 @@ private void InitFlightControlWindow(bool startSolid = true) foreach(var pair in _servoGroupUIControls) { pair.Key.Stop(); - pair.Key.MovingNegative = false; - pair.Key.MovingPositive = false; } guiRebuildPending = true; //TODO: we need to reset oll Movement Toggles @@ -415,6 +413,10 @@ private void InitFlightControlWindow(bool startSolid = true) var stopAllTooltip = stopAllButton.gameObject.AddComponent(); stopAllTooltip.tooltipText = "Panic! Stop all servos!"; + + //toggle preset mode if needed + ToggleFlightPresetMode (guiFlightPresetModeOn); + } private void InitFlightGroupControls(GameObject newServoGroupLine, ServoController.ControlGroup g) @@ -452,19 +454,10 @@ private void InitFlightGroupControls(GameObject newServoGroupLine, ServoControll groupMoveLeftToggle.isOn = g.MovingNegative; groupMoveLeftToggle.onValueChanged.AddListener(v => { - if (g.MovingNegative) - { - g.Stop(); - g.MovingNegative = false; - g.MovingPositive = false; - } - else - { - if(g.MovingPositive) - { - hlg.GetChild("ServoGroupMoveRightToggleButton").GetComponent().isOn = false; - } - g.MoveLeft(); + g.Stop (); + if (v) { + hlg.GetChild ("ServoGroupMoveRightToggleButton").GetComponent ().isOn = false; + g.MoveLeft (); g.MovingNegative = true; g.MovingPositive = false; } @@ -500,18 +493,10 @@ private void InitFlightGroupControls(GameObject newServoGroupLine, ServoControll groupMoveRightToggle.isOn = g.MovingPositive; groupMoveRightToggle.onValueChanged.AddListener(v => { - if (g.MovingPositive) - { - g.Stop(); - g.MovingNegative = false; - g.MovingPositive = false; - } - else + g.Stop(); + if (v) { - if (g.MovingNegative) - { - hlg.GetChild("ServoGroupMoveLeftToggleButton").GetComponent().isOn = false; - } + hlg.GetChild ("ServoGroupMoveLeftToggleButton").GetComponent ().isOn = false; g.MoveRight(); g.MovingNegative = false; g.MovingPositive = true; @@ -679,7 +664,7 @@ private void ToggleFlightPresetMode(bool value) } } - public void PresetInputOnEndEdit(string tmp, int i) + public void PresetInputOnEndEdit(string tmp, int i, GameObject buttonRef = null) { if (presetWindowServo == null) return; @@ -694,6 +679,7 @@ public void PresetInputOnEndEdit(string tmp, int i) } presetWindowServo.Preset[i] = tmpValue; presetWindowServo.Preset.Sort(); + TogglePresetEditWindow (presetWindowServo, true, buttonRef); } } @@ -731,7 +717,7 @@ public void TogglePresetEditWindow (IServo servo, bool value, GameObject buttonR //need a better way to tie them to each other _presetsWindow.transform.SetParent(UIMasterController.Instance.appCanvas.transform, false); - if (_presetsWindowPosition == Vector3.zero) + if (_presetsWindowPosition == Vector3.zero && buttonRef != null) _presetsWindow.transform.position = buttonRef.transform.position + new Vector3(30, 0, 0); else _presetsWindow.transform.position = ClampWindowPosition(_presetsWindowPosition); @@ -743,19 +729,33 @@ public void TogglePresetEditWindow (IServo servo, bool value, GameObject buttonR { closeButton.GetComponent