Exemplo n.º 1
0
        protected void drawTransmitButtons()
        {
            string message = "";

            GUILayout.BeginHorizontal();

            if (GUILayout.Button(scienceIcon, new GUILayoutOption[] { GUILayout.Width(64), GUILayout.Height(64) }))
            {
                converter.TransmitResearch();
            }

            if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
            {
                scienceIcon        = scienceIconWhite;
                scienceHighlighted = true;
                message            = kTransmitResearch;
            }
            else if (scienceHighlighted)
            {
                scienceIcon        = scienceIconWhite;
                scienceHighlighted = false;
                message            = kTransmitResearch;
            }
            else
            {
                scienceIcon = scienceIconBlack;
            }

            if (GUILayout.Button(publishIcon, new GUILayoutOption[] { GUILayout.Width(64), GUILayout.Height(64) }))
            {
                converter.PublishResearch();
            }

            if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
            {
                publishIcon        = publishIconWhite;
                publishHighlighted = true;
                message            = kPublishResearch;
            }
            else if (publishHighlighted)
            {
                publishIcon        = publishIconWhite;
                publishHighlighted = false;
                message            = kPublishResearch;
            }
            else
            {
                publishIcon = publishIconBlack;
            }

            if (GUILayout.Button(sellIcon, new GUILayoutOption[] { GUILayout.Width(64), GUILayout.Height(64) }))
            {
                converter.SellResearch();
            }

            if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
            {
                sellIcon        = sellIconWhite;
                sellHighlighted = true;
                message         = kSellResearch;
            }
            else if (sellHighlighted)
            {
                sellIcon        = sellIconWhite;
                sellHighlighted = false;
                message         = kSellResearch;
            }
            else
            {
                sellIcon = sellIconBlack;
            }

            GUILayout.BeginScrollView(new Vector2(0, 0));
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.Label(message);
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            GUILayout.EndHorizontal();
        }
Exemplo n.º 2
0
        protected void drawTransmitButtons()
        {
            string message = "";

            GUILayout.BeginHorizontal();

            //Transmit button
            if (GUILayout.Button(scienceIcon, buttonOptions))
            {
                converter.TransmitResearch();
            }

            if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
            {
                scienceIcon        = scienceIconWhite;
                scienceHighlighted = true;
                message            = kTransmitResearch;
            }
            else if (scienceHighlighted)
            {
                scienceIcon        = scienceIconWhite;
                scienceHighlighted = false;
                message            = kTransmitResearch;
            }
            else
            {
                scienceIcon = scienceIconBlack;
            }

            if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
            {
                //Publish button
                if (GUILayout.Button(publishIcon, buttonOptions))
                {
                    converter.PublishResearch();
                }

                if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
                {
                    publishIcon        = publishIconWhite;
                    publishHighlighted = true;
                    message            = kPublishResearch;
                }
                else if (publishHighlighted)
                {
                    publishIcon        = publishIconWhite;
                    publishHighlighted = false;
                    message            = kPublishResearch;
                }
                else
                {
                    publishIcon = publishIconBlack;
                }

                //Sell button
                if (GUILayout.Button(sellIcon, buttonOptions))
                {
                    converter.SellResearch();
                }

                if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
                {
                    sellIcon        = sellIconWhite;
                    sellHighlighted = true;
                    message         = kSellResearch;
                }
                else if (sellHighlighted)
                {
                    sellIcon        = sellIconWhite;
                    sellHighlighted = false;
                    message         = kSellResearch;
                }
                else
                {
                    sellIcon = sellIconBlack;
                }
            }

            //Distribute button
            if (sciLab != null)
            {
                if (GUILayout.Button(distributeIcon, buttonOptions))
                {
                    float amount = converter.Lab.dataStored;
                    converter.Lab.dataStored = 0f;
                    float amountDistributed = WBIPathfinderScenario.Instance.DistributeData(amount, this.part.vessel, true);
                    if (amountDistributed < amount)
                    {
                        converter.Lab.dataStored += (amount - amountDistributed);
                    }
                }

                if (Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
                {
                    distributeIcon        = distributeIconWhite;
                    distributeHighlighted = true;
                    message = kDistributeResearch;
                }
                else if (distributeHighlighted)
                {
                    distributeIcon        = distributeIconWhite;
                    distributeHighlighted = false;
                    message = kDistributeResearch;
                }
                else
                {
                    distributeIcon = distributeIconBlack;
                }
            }

            GUILayout.BeginScrollView(panelPosition);
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.Label(message);
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndScrollView();

            GUILayout.EndHorizontal();
        }