public VtsMainWindow([NotNull] VtsPartModule module, Vector2 windowPos = new Vector2()) : base(WINDOW_ID, "Virtual Targeting", windowPos: windowPos) { this.m_module = module; this.m_editorLabelStyle = new GUIStyle(HighLogic.Skin.label) { alignment = TextAnchor.MiddleRight, fixedWidth = EDITOR_COL1_WIDTH, }; Reset(); }
protected override void OnDispose() { RenderingManager.RemoveFromPostDrawQueue(0, OnDraw); if (this.m_mainWindowButton != null) { this.m_mainWindowButton.Destroy(); this.m_mainWindowButton = null; } this.MainModule = null; }
public void Update() { if (this.MainModule != null && !this.MainModule.vessel.isActiveVessel) { this.MainModule = null; } if (this.m_mainWindowButton == null && this.MainModule != null) { if (this.m_mainWindow == null) { this.m_mainWindow = new VtsMainWindow(this.MainModule, windowPos: DEFAULT_WINDOW_POS); } // If toolbar plugin isn't available, make sure we show the main // window only in map view to reduce clutter during the flight. this.m_mainWindow.IsOpen = MapView.MapIsEnabled; } }