コード例 #1
0
ファイル: StationManager.cs プロジェクト: TMarkos/MKS
        private void DrawResource(string resourceName)
        {
            _scrollResourcesPosition = GUILayout.BeginScrollView(_scrollResourcesPosition, false, true, GUILayout.MaxHeight(300));
            GUILayout.BeginVertical();
            foreach (var converter in _model.GetConverters())
            {
                var inputRatio  = converter.inputResourceList.Find(res => res.resource.name == resourceName);
                var outputRatio = converter.outputResourceList.Find(res => res.resource.name == resourceName);

                if (inputRatio == null && outputRatio == null)
                {
                    continue;
                }
                string production = "";
                var    mksmodule  = converter.part.FindModuleImplementing <MKSModule>();


                if (inputRatio != null)
                {
                    production = " consumes " + inputRatio.ratio * Utilities.SECONDS_PER_DAY * mksmodule.GetEfficiencyRate();
                }
                else
                {
                    production = " produces " + outputRatio.ratio * Utilities.SECONDS_PER_DAY * mksmodule.GetEfficiencyRate();
                }
                GUILayout.BeginHorizontal();
                GUILayout.Label(converter.converterName + " status: " + converter.converterStatus + production);
                var bounds = GUILayoutUtility.GetLastRect();
                if (bounds.Contains(Event.current.mousePosition))
                {
                    if (_highlight != converter.part)
                    {
                        if (_highlight != null)
                        {
                            _highlight.SetHighlight(false);
                        }

                        _highlight = converter.part;
                    }
                    _highlightStart = Planetarium.GetUniversalTime();
                }

                if (GUIButton.LayoutButton("toggle"))
                {
                    if (converter.converterEnabled)
                    {
                        converter.DeactivateConverter();
                    }
                    else
                    {
                        converter.ActivateConverter();
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndScrollView();
        }
コード例 #2
0
        public int Show()
        {
            if (forceToUnShow)
            {
                forceToUnShow        = false;
                isClickedComboButton = false;
            }

            done = false;
            int controlID = GUIUtility.GetControlID(FocusType.Passive);

            switch (Event.current.GetTypeForControl(controlID))
            {
            case EventType.mouseUp:
            {
                if (isClickedComboButton)
                {
                    done = true;
                }
            }
            break;
            }

            if (GUIButton.LayoutButton(buttonContent, buttonStyle, GUILayout.Height(20)))
            {
                if (useControlID == -1)
                {
                    useControlID         = controlID;
                    isClickedComboButton = false;
                }

                if (useControlID != controlID)
                {
                    forceToUnShow = true;
                    useControlID  = controlID;
                }
                isClickedComboButton = true;
            }
            if (Event.current.type == EventType.Repaint)
            {
                rect = GUILayoutUtility.GetLastRect();
            }

            return(0);
        }
コード例 #3
0
ファイル: StationManager.cs プロジェクト: Luskhen/MKS
        private void DrawResources(List <MKSLresource> balance)
        {
            var maxAmounts = _model.GetStorage();
            var resDistri  = _model.GetResourceAmounts()
                             .Join(maxAmounts, lResource => lResource.resourceName, rResource => rResource.resourceName,
                                   (lResource, rResource) =>
                                   new
            {
                lResource.resourceName,
                lResource.amount,
                max     = rResource.amount,
                full    = (Math.Round((lResource.amount / rResource.amount) * 100) > 99),
                percent = Math.Round((lResource.amount / rResource.amount) * 100)
            }
                                   ).GroupJoin(balance, outer => outer.resourceName, inner => inner.resourceName,
                                               (outer, innerList) => new { outer.resourceName, outer.amount, outer.max, outer.full, outer.percent, innerList })
                             .SelectMany(x => x.innerList.DefaultIfEmpty(new MKSLresource()), (x, y) => new { x.amount, x.full, x.max, x.resourceName, x.percent, balance = y.amount })
                             .OrderByDescending(x => x.percent);

            foreach (var res in resDistri)
            {
                GUILayout.BeginVertical();
                GUILayout.BeginHorizontal();
                string fullstring;
                double timeTillFull = (res.max - res.amount) / res.balance;
                var    barTextStyle = new GUIStyle(MKSGui.barTextStyle);
                if (timeTillFull > 0)
                {
                    fullstring = " until full: " + Utilities.FormatTime(timeTillFull);
                }
                else
                {
                    fullstring = " until empty: " + Utilities.FormatTime(Math.Abs(timeTillFull));
                }
                if (res.balance < 0)
                {
                    barTextStyle.normal.textColor = new Color(220, 50, 50);
                }
                if (res.balance > 0)
                {
                    barTextStyle.normal.textColor = new Color(50, 220, 50);
                }
                if (res.full || res.percent < 0.1 || Math.Abs(res.balance * Utilities.SECONDS_PER_DAY) < 0.0001)
                {
                    fullstring = "";
                }
                if (GUIButton.LayoutButton("", MKSGui.backgroundLabelStyle))
                {
                    _activeRes = _activeRes == res.resourceName ? null : res.resourceName;
                }
                var backRect  = GUILayoutUtility.GetLastRect();
                var frontRect = new Rect(backRect)
                {
                    width = (float)(backRect.width * res.percent / 100)
                };
                MKSGui.frontBarStyle.Draw(frontRect, "", false, false, false, false);
                GUI.Label(backRect, res.resourceName + " amount:" + Math.Round(res.amount, 4) + " of " + Math.Round(res.max, 2) + "(" + res.percent + "%)" + " producing " + Math.Round(res.balance * Utilities.SECONDS_PER_DAY, 4)
                          + fullstring, barTextStyle);
                GUILayout.EndHorizontal();
                if (_activeRes == res.resourceName)
                {
                    DrawResource(res.resourceName);
                }

                GUILayout.EndVertical();
            }
        }
コード例 #4
0
ファイル: StationManager.cs プロジェクト: Luskhen/MKS
        protected override void DrawWindowContents(int windowId)
        {
            if (_highlight != null)
            {
                _highlight.SetHighlight(_highlightStart + 1 > Planetarium.GetUniversalTime(), false);
            }
            GUILayout.BeginHorizontal();
            if (GUIButton.LayoutButton("Parts"))
            {
                _tab = OpenTab.Parts;
            }
            if (GUIButton.LayoutButton("Production"))
            {
                _tab = OpenTab.Production;
            }
            if (GUIButton.LayoutButton("Consumption"))
            {
                _tab = OpenTab.Consumption;
            }
            if (GUIButton.LayoutButton("Balance"))
            {
                _tab = OpenTab.Balance;
            }
            if (GUIButton.LayoutButton("Resources"))
            {
                _tab = OpenTab.Resources;
            }
            if (GUIButton.LayoutButton("Base Site"))
            {
                _tab = OpenTab.LocalBase;
            }
            GUILayout.EndHorizontal();

            var prod    = _model.GetProduction().ToList();
            var cons    = _model.GetProduction(false).ToList();
            var balance = MKSLExtensions.CalcBalance(cons, prod).ToList();

            GUILayout.BeginVertical();
            if (_tab == OpenTab.Parts)
            {
                GUILayout.BeginVertical();
                _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, true);
                foreach (var converterPart in _model.GetConverterParts())
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical();
                    GUILayout.Label(converterPart.partInfo.title);
                    GUILayout.Label(""); //converterPart.FindModuleImplementing<MKSModule>().Efficiency);
                    if (GUIButton.LayoutButton("highlight"))
                    {
                        converterPart.SetHighlight(true, false);
                    }
                    if (GUIButton.LayoutButton("unhighlight"))
                    {
                        converterPart.SetHighlight(false, false);
                    }
                    GUILayout.EndVertical();
                    foreach (var converter in converterPart.FindModulesImplementing <ModuleResourceConverter>())
                    {
                        GUILayout.BeginVertical();
                        GUILayout.Label(converter.ConverterName);
                        GUILayout.Label(converter.status);
                        if (converter.IsActivated)
                        {
                            if (GUIButton.LayoutButton("deactivate"))
                            {
                                converter.IsActivated = false;
                            }
                        }
                        else
                        {
                            if (GUIButton.LayoutButton("activate"))
                            {
                                converter.IsActivated = true;
                            }
                        }
                        GUILayout.EndVertical();
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
                GUILayout.EndVertical();
            }

            if (_tab == OpenTab.Production)
            {
                GUILayout.BeginVertical();
                GUILayout.Label("Production");
                foreach (var product in prod)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(product.resourceName);
                    GUILayout.Label(Math.Round(product.amount * Utilities.SECONDS_PER_DAY, 4) + " per day");
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }

            if (_tab == OpenTab.Consumption)
            {
                GUILayout.BeginVertical();
                GUILayout.Label("Consumption");
                foreach (var product in cons)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(product.resourceName);
                    GUILayout.Label(Math.Round(product.amount * Utilities.SECONDS_PER_DAY, 4) + " per day");
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }

            if (_tab == OpenTab.Balance)
            {
                GUILayout.BeginVertical();
                GUILayout.Label("Balance");
                foreach (var product in balance)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(product.resourceName);
                    GUILayout.Label(Math.Round(product.amount * Utilities.SECONDS_PER_DAY, 4) + " per day");
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }

            if (_tab == OpenTab.Resources)
            {
                GUILayout.BeginVertical();

                DrawResources(balance);
                GUILayout.EndVertical();
            }
            if (_tab == OpenTab.LocalBase)
            {
                GUILayout.BeginVertical();

                DrawLogistics();
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
        }
コード例 #5
0
        protected override void DrawWindowContents(int windowId)
        {
            Func <TransferCostPaymentModes> getSelectedMode = () =>
            {
                return((this._costPayModes.First(kv => kv.Value)).Key);
            };

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("<<", MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                previousBodyVesselList(ref vesselFrom);
                _model.VesselFrom = _central.bodyVesselList[vesselFrom];
                fromVesselComboBox.SelectedItemIndex = vesselFrom;
                _model.calcResources();
            }
            GUILayout.Label("From:", MKSGui.labelStyle, GUILayout.Width(60));
            fromVesselComboBox.Show();
            //GUILayout.Label(_model.VesselFrom.vesselName, MKSGui.labelStyle, GUILayout.Width(160));
            if (GUIButton.LayoutButton(new GUIContent(">>"), MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                nextBodyVesselList(ref vesselFrom);
                _model.VesselFrom = _central.bodyVesselList[vesselFrom];
                fromVesselComboBox.SelectedItemIndex = vesselFrom;
                _model.calcResources();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("<<", MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                previousBodyVesselList(ref vesselTo);
                _model.VesselTo = _central.bodyVesselList[vesselTo];
                toVesselComboBox.SelectedItemIndex = vesselTo;
                _model.calcResources();
            }
            GUILayout.Label("To:", MKSGui.labelStyle, GUILayout.Width(60));
            toVesselComboBox.Show();
            //GUILayout.Label(_model.VesselTo.vesselName, MKSGui.labelStyle, GUILayout.Width(160));
            if (GUIButton.LayoutButton(new GUIContent(">>"), MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                nextBodyVesselList(ref vesselTo);
                _model.VesselTo = _central.bodyVesselList[vesselTo];
                toVesselComboBox.SelectedItemIndex = vesselTo;
                _model.calcResources();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            scrollPositionEditGUIResources = GUILayout.BeginScrollView(scrollPositionEditGUIResources, GUILayout.Width(300), GUILayout.Height(150));
            foreach (MKSLresource res in _model.transferList)
            {
                GUILayout.BeginHorizontal();
                if (GUIButton.LayoutButton(new GUIContent(res.resourceName + ": " + Math.Round(res.amount, 2) + " of " +
                                                          Math.Round(_model.resourceAmount.Find(x => x.resourceName == res.resourceName).amount))))
                {
                    editGUIResource      = res;
                    StrAmount            = Math.Round(res.amount, 2).ToString();
                    currentAvailable     = readResource(_model.VesselFrom, editGUIResource.resourceName)[0];
                    currentTargetAmounts = this.readResource(_model.VesselTo, editGUIResource.resourceName);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();

            GUILayout.BeginVertical();

            if (editGUIResource != null)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Resource:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(editGUIResource.resourceName, MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Amount:", MKSGui.labelStyle, GUILayout.Width(80));
                StrAmount = GUILayout.TextField(StrAmount, 10, MKSGui.textFieldStyle, GUILayout.Width(60));
                Action <double> setAmount = (a) =>
                {
                    if (a < currentAvailable)
                    {
                        editGUIResource.amount = a;
                    }
                    else
                    {
                        editGUIResource.amount = currentAvailable;
                        StrAmount = editGUIResource.amount.ToString("F2");
                    }
                };
                if (GUILayout.Button("Set", MKSGui.buttonStyle, GUILayout.Width(30)))
                {
                    double number;
                    if (Double.TryParse(StrAmount, out number))
                    {
                        setAmount(number);
                    }
                    else
                    {
                        StrAmount = "0";
                        editGUIResource.amount = 0;
                    }
                    updateCostList(_model);
                    validateTransfer(_model, getSelectedMode(), ref StrValidationMessage);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Mass:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(Math.Round(editGUIResource.mass(), 2).ToString(), MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Available:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(Math.Round(currentAvailable, 2).ToString(), MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Target:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(string.Format("{0:F2}/{1:F2}", currentTargetAmounts[0], currentTargetAmounts[1]), MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Fill Up", MKSGui.buttonStyle, GUILayout.Width(100)))
                {
                    var diff = Math.Round(currentTargetAmounts[1] - currentTargetAmounts[0], 2);
                    if (diff >= 0)
                    {
                        setAmount(diff);
                        StrAmount = diff.ToString("F2");
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.BeginVertical();
            GUILayout.Label("Tranfer Mass: " + Math.Round(_model.totalMass(), 2) + " (maximum: " + _central.maxTransferMass + ")", MKSGui.labelStyle, GUILayout.Width(300));


            GUILayout.BeginHorizontal();
            GUILayout.Label("");
            if (_central.Mix1CostName != "")
            {
                if (GUILayout.Button(_central.Mix1CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix1CostResources);
                    updateCostList(_model);
                }
            }
            if (_central.Mix2CostName != "")
            {
                if (GUILayout.Button(_central.Mix2CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix2CostResources);
                    updateCostList(_model);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (_central.Mix3CostName != "")
            {
                if (GUILayout.Button(_central.Mix3CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix3CostResources);
                    updateCostList(_model);
                }
            }
            if (_central.Mix4CostName != "")
            {
                if (GUILayout.Button(_central.Mix4CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix4CostResources);
                    updateCostList(_model);
                }
            }
            GUILayout.EndHorizontal();

            foreach (MKSLresource resCost in _model.costList)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(resCost.resourceName + ":", MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.Label(Math.Round(resCost.amount, 2).ToString(), MKSGui.labelStyle, GUILayout.Width(200));
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("Transfer cost paid by: ", MKSGui.labelStyle, GUILayout.Width(170));
            if (this._checkTransferAmounts(this._model, TransferCostPaymentModes.Both).EnoughRes)
            {
                var oldVal = this._costPayModes[TransferCostPaymentModes.Both];
                this._costPayModes[TransferCostPaymentModes.Both] = GUILayout.Toggle(this._costPayModes[TransferCostPaymentModes.Both], "Both", MKSGui.buttonStyle);
                if (oldVal != this._costPayModes[TransferCostPaymentModes.Both])
                {
                    this._costPayModes[TransferCostPaymentModes.Source] = this._costPayModes[TransferCostPaymentModes.Target] = false;
                }
            }
            if (this._checkTransferAmounts(this._model, TransferCostPaymentModes.Source).EnoughRes)
            {
                var oldVal = this._costPayModes[TransferCostPaymentModes.Source];
                this._costPayModes[TransferCostPaymentModes.Source] = GUILayout.Toggle(this._costPayModes[TransferCostPaymentModes.Source], "Source", MKSGui.buttonStyle);
                if (oldVal != this._costPayModes[TransferCostPaymentModes.Source])
                {
                    this._costPayModes[TransferCostPaymentModes.Both] = this._costPayModes[TransferCostPaymentModes.Target] = false;
                }
            }
            if (this._checkTransferAmounts(this._model, TransferCostPaymentModes.Target).EnoughRes)
            {
                var oldVal = this._costPayModes[TransferCostPaymentModes.Target];
                this._costPayModes[TransferCostPaymentModes.Target] = GUILayout.Toggle(this._costPayModes[TransferCostPaymentModes.Target], "Target", MKSGui.buttonStyle);
                if (oldVal != this._costPayModes[TransferCostPaymentModes.Target])
                {
                    this._costPayModes[TransferCostPaymentModes.Both] = this._costPayModes[TransferCostPaymentModes.Source] = false;
                }
            }
            if (!(this._costPayModes[TransferCostPaymentModes.Both] || this._costPayModes[TransferCostPaymentModes.Source] || this._costPayModes[TransferCostPaymentModes.Target]))
            {
                this._costPayModes[TransferCostPaymentModes.Both] = true;
            }
            GUILayout.EndHorizontal();

            updateArrivalTime(_model);
            GUILayout.Label("Transfer time: " + Utilities.DeliveryTimeString(_model.arrivaltime, Planetarium.GetUniversalTime()));

            GUILayout.Label(StrValidationMessage, MKSGui.redlabelStyle);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Initiate Transfer", MKSGui.buttonStyle, GUILayout.Width(200)))
            {
                updateCostList(_model);
                var selMode = getSelectedMode();
                if (validateTransfer(_model, selMode, ref StrValidationMessage))
                {
                    createTransfer(_model, selMode);
                }
            }
            if (GUILayout.Button("Cancel", MKSGui.buttonStyle, GUILayout.Width(100)))
            {
                SetVisible(false);
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            fromVesselComboBox.ShowRest();
            toVesselComboBox.ShowRest();
        }
コード例 #6
0
ファイル: OrbitalLogistics.cs プロジェクト: Cyrik/MKS
        protected override void DrawWindowContents(int windowId)
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("<<", MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                previousBodyVesselList(ref vesselFrom);
                _model.VesselFrom = _central.bodyVesselList[vesselFrom];
                fromVesselComboBox.SelectedItemIndex = vesselFrom;
                _model.calcResources();
            }
            GUILayout.Label("From:", MKSGui.labelStyle, GUILayout.Width(60));
            fromVesselComboBox.Show();
            //GUILayout.Label(_model.VesselFrom.vesselName, MKSGui.labelStyle, GUILayout.Width(160));
            if (GUIButton.LayoutButton(new GUIContent(">>"), MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                nextBodyVesselList(ref vesselFrom);
                _model.VesselFrom = _central.bodyVesselList[vesselFrom];
                fromVesselComboBox.SelectedItemIndex = vesselFrom;
                _model.calcResources();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("<<", MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                previousBodyVesselList(ref vesselTo);
                _model.VesselTo = _central.bodyVesselList[vesselTo];
                toVesselComboBox.SelectedItemIndex = vesselTo;
                _model.calcResources();
            }
            GUILayout.Label("To:", MKSGui.labelStyle, GUILayout.Width(60));
            toVesselComboBox.Show();
            //GUILayout.Label(_model.VesselTo.vesselName, MKSGui.labelStyle, GUILayout.Width(160));
            if (GUIButton.LayoutButton(new GUIContent(">>"), MKSGui.buttonStyle, GUILayout.Width(40)))
            {
                nextBodyVesselList(ref vesselTo);
                _model.VesselTo = _central.bodyVesselList[vesselTo];
                toVesselComboBox.SelectedItemIndex = vesselTo;
                _model.calcResources();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            scrollPositionEditGUIResources = GUILayout.BeginScrollView(scrollPositionEditGUIResources, GUILayout.Width(300), GUILayout.Height(150));
            foreach (MKSLresource res in _model.transferList)
            {
                GUILayout.BeginHorizontal();
                if (GUIButton.LayoutButton(new GUIContent(res.resourceName + ": " + Math.Round(res.amount, 2) + " of " +
                                                          Math.Round(_model.resourceAmount.Find(x => x.resourceName == res.resourceName).amount))))
                {
                    editGUIResource  = res;
                    StrAmount        = Math.Round(res.amount, 2).ToString();
                    currentAvailable = readResource(_model.VesselFrom, editGUIResource.resourceName);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();

            GUILayout.BeginVertical();

            if (editGUIResource != null)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Resource:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(editGUIResource.resourceName, MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Amount:", MKSGui.labelStyle, GUILayout.Width(80));
                StrAmount = GUILayout.TextField(StrAmount, 10, MKSGui.textFieldStyle, GUILayout.Width(60));
                if (GUILayout.Button("Set", MKSGui.buttonStyle, GUILayout.Width(30)))
                {
                    double number;
                    if (Double.TryParse(StrAmount, out number))
                    {
                        if (number < currentAvailable)
                        {
                            editGUIResource.amount = number;
                        }
                        else
                        {
                            editGUIResource.amount = currentAvailable;
                        }
                        StrAmount = Math.Round(editGUIResource.amount, 2).ToString();
                    }
                    else
                    {
                        StrAmount = "0";
                        editGUIResource.amount = 0;
                    }
                    updateCostList(_model);
                    validateTransfer(_model, ref StrValidationMessage);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Mass:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(Math.Round(editGUIResource.mass(), 2).ToString(), MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("Available:", MKSGui.labelStyle, GUILayout.Width(80));
                GUILayout.Label(Math.Round(currentAvailable, 2).ToString(), MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.BeginVertical();
            GUILayout.Label("Tranfer Mass: " + Math.Round(_model.totalMass(), 2) + " (maximum: " + _central.maxTransferMass + ")", MKSGui.labelStyle, GUILayout.Width(300));


            GUILayout.BeginHorizontal();
            GUILayout.Label("");
            if (_central.Mix1CostName != "")
            {
                if (GUILayout.Button(_central.Mix1CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix1CostResources);
                    updateCostList(_model);
                }
            }
            if (_central.Mix2CostName != "")
            {
                if (GUILayout.Button(_central.Mix2CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix2CostResources);
                    updateCostList(_model);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (_central.Mix3CostName != "")
            {
                if (GUILayout.Button(_central.Mix3CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix3CostResources);
                    updateCostList(_model);
                }
            }
            if (_central.Mix4CostName != "")
            {
                if (GUILayout.Button(_central.Mix4CostName, MKSGui.buttonStyle, GUILayout.Width(170)))
                {
                    _model.initCostList(_central.Mix4CostResources);
                    updateCostList(_model);
                }
            }
            GUILayout.EndHorizontal();

            foreach (MKSLresource resCost in _model.costList)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(resCost.resourceName + ":", MKSGui.labelStyle, GUILayout.Width(100));
                GUILayout.Label(Math.Round(resCost.amount, 2).ToString(), MKSGui.labelStyle, GUILayout.Width(200));
                GUILayout.EndHorizontal();
            }


            GUILayout.Label(StrValidationMessage, MKSGui.redlabelStyle);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Initiate Transfer", MKSGui.buttonStyle, GUILayout.Width(200)))
            {
                updateCostList(_model);
                if (validateTransfer(_model, ref StrValidationMessage))
                {
                    createTransfer(_model);
                }
            }
            if (GUILayout.Button("Cancel", MKSGui.buttonStyle, GUILayout.Width(100)))
            {
                SetVisible(false);
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            fromVesselComboBox.ShowRest();
            toVesselComboBox.ShowRest();
        }