Example #1
0
        protected void DrawHeader()
        {
            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();
            GUILayout.Label(windowTitle, GUIResources.GetStyle("window_header"), GUILayout.MaxHeight(26f), GUILayout.MinHeight(26f), GUILayout.MinWidth(350f));

            GUILayout.FlexibleSpace();

            Rect buttonRect = GUILayoutUtility.GetRect(22f, 22f);

            GUI.color = resources.GetColor("cancel_color");
            if (GUI.Button(buttonRect, "", GUIResources.GetStyle("button_cancel")))
            {
                ToggleWindow();
            }

            GUI.DrawTextureWithTexCoords(buttonRect, GUIResources.GetIcon("cancel").iconAtlas, GUIResources.GetIcon("cancel").iconRect);
            GUI.color = Color.white;
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            DrawControllers();
            DrawTemplateControl();
            DrawExporters();
            GUILayout.EndHorizontal();
        }
Example #2
0
        void DrawMiniWindow(int WindowID)
        {
            float curAM  = (float)(AntimatterFactory.Instance.Antimatter);
            float maxAM  = (float)(AntimatterFactory.Instance.AntimatterMax);
            float rateAM = (float)(AntimatterFactory.Instance.AntimatterRate);

            Rect barAreaRect = new Rect(39f, 0f, 160f, 32f);

            Vector2 barBackgroundSize = new Vector2(150, 20f);
            Vector2 barForegroundSize = new Vector2(Mathf.Max(barBackgroundSize.x * (curAM / maxAM), 8f), 18f);

            Rect barBackgroundRect = new Rect(0f, 10f, barBackgroundSize.x, barBackgroundSize.y);
            Rect barForeroundRect  = new Rect(0f, 11f, barForegroundSize.x, barForegroundSize.y);
            Rect storageTextRect   = new Rect(5f, 10f, 160f, 20f);
            Rect rateTextRect      = new Rect(barBackgroundSize.x - 90f, 10f, 90f, 20f);

            Rect amIconRect        = new Rect(5f, 5f, 32f, 32f);
            Rect factoryButtonRect = new Rect(200f, 5f, 32f, 32f);
            Rect loadoutButtonRect = new Rect(200f, 5f, 32f, 32f);

            GUI.BeginGroup(barAreaRect);
            GUI.Box(barBackgroundRect, "", GUIResources.GetStyle("bar_background"));
            GUI.color = GUIResources.GetColor("bar_blue");
            GUI.Box(barForeroundRect, "", GUIResources.GetStyle("bar_foreground"));
            GUI.color = Color.white;

            GUI.Label(storageTextRect, String.Format("<color=#ffffff>{0:F2} / {1:F0}</color>", curAM, maxAM), GUIResources.GetStyle("text_basic"));
            GUI.Label(rateTextRect, Localizer.Format("#LOC_FFT_AntimatterFactoryUI_MiniWindow_Rate", rateAM.ToString("F2")), GUIResources.GetStyle("text_label"));

            GUI.EndGroup();
            GUI.DrawTextureWithTexCoords(amIconRect, GUIResources.GetIcon("antimatter").iconAtlas, GUIResources.GetIcon("antimatter").iconRect);

            if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
            {
                if (GUI.Button(factoryButtonRect, "", GUIResources.GetStyle("button_overlaid")))
                {
                    ShowFactory();
                }
                GUI.DrawTextureWithTexCoords(factoryButtonRect, GUIResources.GetIcon("factory").iconAtlas, GUIResources.GetIcon("factory").iconRect);
            }

            if (HighLogic.LoadedSceneIsFlight && AntimatterLoader.Instance != null && AntimatterLoader.Instance.loadingAllowed)
            {
                if (GUI.Button(loadoutButtonRect, "", GUIResources.GetStyle("button_overlaid")))
                {
                    ShowLoading();
                }
                GUI.DrawTextureWithTexCoords(loadoutButtonRect, GUIResources.GetIcon("pump").iconAtlas, GUIResources.GetIcon("pump").iconRect);
            }
        }
        /// <summary>
        /// Draw the header area
        /// </summary>
        private void DrawHeaderArea()
        {
            GUILayout.BeginHorizontal();
            modeFlag = GUILayout.SelectionGrid(modeFlag, modeStrings, 2, GUIResources.GetStyle("radio_text_button"));

            GUILayout.FlexibleSpace();
            GUILayout.Label(windowTitle, GUIResources.GetStyle("window_header"), GUILayout.MaxHeight(26f), GUILayout.MinHeight(26f), GUILayout.MinWidth(350f));

            GUILayout.FlexibleSpace();
            Rect buttonRect = GUILayoutUtility.GetRect(22f, 22f);

            GUI.color = resources.GetColor("cancel_color");
            if (GUI.Button(buttonRect, "", GUIResources.GetStyle("button_cancel")))
            {
                ToggleWindow();
            }

            GUI.DrawTextureWithTexCoords(buttonRect, GUIResources.GetIcon("cancel").iconAtlas, GUIResources.GetIcon("cancel").iconRect);
            GUI.color = Color.white;
            GUILayout.EndHorizontal();
        }