public void Update() { if (drive == null) { return; } if (Lib.IsFlight()) { // show DATA UI button, with size info Events["ToggleUI"].guiName = Lib.StatusToggle("Data", drive.Empty() ? "empty" : drive.Size()); Events["ToggleUI"].active = !IsPrivate(); // show TakeData eva action button, if there is something to take Events["TakeData"].active = !drive.Empty(); // show StoreData eva action button, if active vessel is an eva kerbal and there is something to store from it Vessel v = FlightGlobals.ActiveVessel; Events["StoreData"].active = !IsPrivate() && v != null && v.isEVA && !EVA.IsDead(v); // hide TransferLocation button var transferVisible = !IsPrivate(); if (transferVisible) { transferVisible = Drive.GetDrives(vessel, true).Count > 1; } Events["TransferData"].active = transferVisible; Events["TransferData"].guiActive = transferVisible; } }
public void Update() { UpdateCapacity(); if (Lib.IsFlight()) { // show DATA UI button, with size info Events["ToggleUI"].guiName = Lib.StatusToggle("Data", drive.Empty() ? "empty" : drive.Size()); Events["ToggleUI"].active = true; // show TakeData eva action button, if there is something to take Events["TakeData"].active = !drive.Empty(); // show StoreData eva action button, if active vessel is an eva kerbal and there is something to store from it Vessel v = FlightGlobals.ActiveVessel; Events["StoreData"].active = v != null && v.isEVA && !EVA.IsDead(v) && drive.FilesSize() > double.Epsilon; // hide TransferLocation button Events["TransferData"].active = true; } }
public void Update() { if (drive == null) { return; } if (Lib.IsEditor()) { bool update = false; if (dataCapacities != null) { foreach (var c in dataCapacities) { if (c.Key == dataCapacityUI) { update |= effectiveDataCapacity != c.Value; effectiveDataCapacity = c.Value; } } } if (sampleCapacities != null) { foreach (var c in sampleCapacities) { if (c.Key == sampleCapacityUI) { update |= effectiveSampleCapacity != c.Value; effectiveSampleCapacity = c.Value; } } } drive.dataCapacity = effectiveDataCapacity; drive.sampleCapacity = effectiveSampleCapacity; Fields["sampleCapacityUI"].guiActiveEditor = sampleCapacity > 0; Fields["dataCapacityUI"].guiActiveEditor = dataCapacity > 0; if (update) { GameEvents.onEditorShipModified.Fire(EditorLogic.fetch.ship); UpdateCapacity(); } } if (Lib.IsFlight()) { // show DATA UI button, with size info Events["ToggleUI"].guiName = Lib.StatusToggle("Data", drive.Empty() ? "empty" : drive.Size()); Events["ToggleUI"].active = !IsPrivate(); // show TakeData eva action button, if there is something to take Events["TakeData"].active = !drive.Empty(); // show StoreData eva action button, if active vessel is an eva kerbal and there is something to store from it Vessel v = FlightGlobals.ActiveVessel; Events["StoreData"].active = !IsPrivate() && v != null && v.isEVA && !EVA.IsDead(v); // hide TransferLocation button var transferVisible = !IsPrivate(); if (transferVisible) { transferVisible = Drive.GetDrives(vessel, true).Count > 1; } Events["TransferData"].active = transferVisible; Events["TransferData"].guiActive = transferVisible; } }