protected override void DrawWindowContents(int windowId) { GUILayout.BeginVertical(); if (GUILayout.Button("New Transfer", MKSGui.buttonStyle, GUILayout.Width(150))) { _model.makeBodyVesselList(); editGUITransfer = new MKSLGuiTransfer(); System.Random rnd = new System.Random(); editGUITransfer.transferName = rnd.Next(100000, 999999).ToString(); editGUITransfer.initTransferList(_model.ManagedResources); editGUITransfer.initCostList(_model.Mix1CostResources); editGUITransfer.VesselFrom = _model.vessel; editGUITransfer.VesselTo = _model.vessel; editGUITransfer.calcResources(); } GUILayout.Label("Current transfers", MKSGui.labelStyle, GUILayout.Width(150)); scrollPositionGUICurrentTransfers = GUILayout.BeginScrollView(scrollPositionGUICurrentTransfers, false, true, GUILayout.MinWidth(160), GUILayout.MaxHeight(180)); foreach (MKSLtransfer trans in _model.saveCurrentTransfersList) { if (GUILayout.Button(trans.transferName + " (" + Utilities.DeliveryTimeString(trans.arrivaltime, Planetarium.GetUniversalTime()) + ")", MKSGui.buttonStyle, GUILayout.Width(135), GUILayout.Height(22))) { if (_transferView == null) { _transferView = new MKSTransferView(trans, this); } else { _transferView.Transfer = trans; } } } GUILayout.EndScrollView(); GUILayout.Label("Previous tranfers", MKSGui.labelStyle, GUILayout.Width(150)); scrollPositionGUIPreviousTransfers = GUILayout.BeginScrollView(scrollPositionGUIPreviousTransfers, false, true, GUILayout.MinWidth(160), GUILayout.MaxHeight(120)); foreach (MKSLtransfer trans in _model.savePreviousTransfersList) { if (GUILayout.Button(trans.transferName + " " + (trans.delivered ? "succes" : "failure"), MKSGui.buttonStyle, GUILayout.Width(135), GUILayout.Height(22))) { if (_transferView == null) { _transferView = new MKSTransferView(trans, this); } else { _transferView.Transfer = trans; } } } GUILayout.EndScrollView(); GUILayout.Label("", MKSGui.labelStyle, GUILayout.Width(150)); if (GUILayout.Button("Close", MKSGui.buttonStyle, GUILayout.Width(150))) { SetVisible(false); } GUILayout.EndVertical(); }
protected override void DrawWindowContents(int windowId) { if (_showIncoming) { currenTranferList = _model.KnownTransfers.Where(x => x.VesselTo.id == FlightGlobals.ActiveVessel.id); } else { currenTranferList = _model.KnownTransfers; } GUILayout.BeginVertical(); string incomingButtonText = (_showIncoming) ? "Show All" : "Show Incoming"; if (GUILayout.Button(incomingButtonText, MKSGui.buttonStyle, GUILayout.Width(150))) { _showIncoming = !_showIncoming; } GUILayout.Label("Current transfers", MKSGui.labelStyle, GUILayout.Width(150)); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, true, GUILayout.MaxHeight(300)); foreach (MKSLtransfer trans in currenTranferList) { if (GUILayout.Button(trans.transferName + " (" + Utilities.FormatTime(trans.arrivaltime - Planetarium.GetUniversalTime()) + ")", MKSGui.buttonStyle, GUILayout.Width(135), GUILayout.Height(22))) { _selectedTransfer = trans; if (_transferView == null) { _transferView = new MKSTransferView(_selectedTransfer, this); } else { _transferView.Transfer = _selectedTransfer; } } } GUILayout.EndScrollView(); if (GUILayout.Button("Close", MKSGui.buttonStyle, GUILayout.Width(150))) { SetVisible(false); } GUILayout.EndVertical(); }