Exemple #1
0
 public void Awake()
 {
     Instance         = this;
     resources        = new UIResources();
     profileColors    = new Color[6];
     profileColors[0] = GUIResources.GetColor("profile_0");
     profileColors[1] = GUIResources.GetColor("profile_1");
     profileColors[2] = GUIResources.GetColor("profile_2");
     profileColors[3] = GUIResources.GetColor("profile_3");
     profileColors[4] = GUIResources.GetColor("profile_4");
     profileColors[5] = GUIResources.GetColor("profile_5");
 }
Exemple #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);
            }
        }
Exemple #3
0
        void GenerateAxes()
        {
            Dictionary <float, float> xAxis1 = new Dictionary <float, float>();
            Dictionary <float, float> xAxis2 = new Dictionary <float, float>();

            xAxis1.Add(0f, 1f);
            xAxis1.Add(plotTextureSize.x, 0f);

            xAxis2.Add(0f, plotTextureSize.y - 2);
            xAxis2.Add(plotTextureSize.x, plotTextureSize.y - 2);

            CreateLine(graphTexture, xAxis1, GUIResources.GetColor("profile_axis"), 1f, 1f);
            CreateLine(graphTexture, xAxis2, GUIResources.GetColor("profile_axis"), 1f, 1f);
        }
Exemple #4
0
        void DrawFactoryMode()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(String.Format("{0}", Localizer.Format("#LOC_FFT_AntimatterFactoryUI_LoadoutWindow_Title")));
            GUILayout.EndHorizontal();
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal(GUIResources.GetStyle("block_background"));
            GUILayout.Label(Localizer.Format("#LOC_FFT_AntimatterFactoryUI_FactoryWindow_Description"), GUIResources.GetStyle("text_basic"));

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            GUILayout.Label(Localizer.Format("#LOC_FFT_AntimatterFactoryUI_FactoryWindow_Level", AntimatterFactory.Instance.FactoryLevel + 1), GUIResources.GetStyle("text_basic"));
            GUILayout.Label(Localizer.Format("#LOC_FFT_AntimatterFactoryUI_FactoryWindow_Status", AntimatterFactory.Instance.GetStatusString()), GUIResources.GetStyle("text_basic"));
            GUILayout.EndVertical();
            if (!AntimatterFactory.Instance.IsMaxLevel())
            {
                if (GUILayout.Button(Localizer.Format("#LOC_FFT_AntimatterFactoryUI_FactoryWindow_Upgrade", FormatPrice(AntimatterFactory.Instance.GetNextLevelCost())), GUIResources.GetStyle("button_basic")))
                {
                    TryUpgradeFactory(AntimatterFactory.Instance.GetNextLevelCost());
                }
            }
            else
            {
                GUILayout.Space(100f);
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(GUIResources.GetStyle("block_background"));

            float curAM  = (float)(AntimatterFactory.Instance.Antimatter);
            float maxAM  = (float)(AntimatterFactory.Instance.AntimatterMax);
            float rateAM = (float)(AntimatterFactory.Instance.AntimatterRate);

            Rect barAreaRect = GUILayoutUtility.GetRect(280, 68f);

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

            Rect barBackgroundRect = new Rect(10f, 10f, barBackgroundSize.x, barBackgroundSize.y);
            Rect barForeroundRect  = new Rect(10f, 11f, barForegroundSize.x, barForegroundSize.y);

            Rect storageTextRect = new Rect(barBackgroundSize.x - 80f, 33f, 80f, 40f);

            Rect rateTextRect = new Rect(0f, 29f, 80f, 20f);

            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, Localizer.Format("#LOC_FFT_AntimatterFactoryUI_FactoryWindow_Storage", curAM.ToString("F2"), maxAM.ToString("F2")),
                      GUIResources.GetStyle("text_label"));
            GUI.Label(rateTextRect, Localizer.Format("#LOC_FFT_AntimatterFactoryUI_FactoryWindow_Rate", rateAM.ToString("F2")), GUIResources.GetStyle("text_label"));


            GUI.EndGroup();

            GUILayout.EndHorizontal();
            if (GUILayout.Button("Close", GUIResources.GetStyle("button_basic"), GUILayout.Width(60f)))
            {
                showMainWindow = false;
            }

            GUILayout.EndVertical();
        }