コード例 #1
0
        void drawFacilityManagerWindow(int windowID)
        {
            DeadButton = new GUIStyle(GUI.skin.button);
            DeadButton.normal.background  = null;
            DeadButton.hover.background   = null;
            DeadButton.active.background  = null;
            DeadButton.focused.background = null;
            DeadButton.normal.textColor   = Color.white;
            DeadButton.hover.textColor    = Color.white;
            DeadButton.active.textColor   = Color.white;
            DeadButton.focused.textColor  = Color.white;
            DeadButton.fontSize           = 14;
            DeadButton.fontStyle          = FontStyle.Bold;

            DeadButtonRed = new GUIStyle(GUI.skin.button);
            DeadButtonRed.normal.background  = null;
            DeadButtonRed.hover.background   = null;
            DeadButtonRed.active.background  = null;
            DeadButtonRed.focused.background = null;
            DeadButtonRed.normal.textColor   = Color.red;
            DeadButtonRed.hover.textColor    = Color.yellow;
            DeadButtonRed.active.textColor   = Color.red;
            DeadButtonRed.focused.textColor  = Color.red;
            DeadButtonRed.fontSize           = 12;
            DeadButtonRed.fontStyle          = FontStyle.Bold;

            BoxNoBorder = new GUIStyle(GUI.skin.box);
            BoxNoBorder.normal.background = null;
            BoxNoBorder.normal.textColor  = Color.white;

            Yellowtext = new GUIStyle(GUI.skin.box);
            Yellowtext.normal.textColor  = Color.yellow;
            Yellowtext.normal.background = null;

            LabelInfo = new GUIStyle(GUI.skin.label);
            LabelInfo.normal.background = null;
            LabelInfo.normal.textColor  = Color.white;
            LabelInfo.fontSize          = 13;
            LabelInfo.fontStyle         = FontStyle.Bold;
            LabelInfo.padding.left      = 3;
            LabelInfo.padding.top       = 0;
            LabelInfo.padding.bottom    = 0;

            ButtonSmallText           = new GUIStyle(GUI.skin.button);
            ButtonSmallText.fontSize  = 12;
            ButtonSmallText.fontStyle = FontStyle.Normal;

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUILayout.Button("Facility Manager", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16)))
                {
                    PersistenceUtils.saveStaticPersistence(selectedFacility);
                    selectedFacility = null;
                    WindowManager.instance.CloseWindow(KerbalKonstructs.instance.GUI_FacilityManager.drawFacilityManager);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            if (selectedFacility != null)
            {
                sFacilityType = (string)selectedFacility.getSetting("FacilityType");

                if (sFacilityType == "TrackingStation")
                {
                    sFacilityName = "Tracking Station";
                    bHalfwindow   = true;
                }
                else
                {
                    sFacilityName = (string)selectedFacility.model.getSetting("title");
                }

                GUILayout.Box("" + sFacilityName, Yellowtext);
                GUILayout.Space(5);

                fAlt = (float)selectedFacility.getSetting("RadiusOffset");

                ObjectPos    = KerbalKonstructs.instance.getCurrentBody().transform.InverseTransformPoint(selectedFacility.gameObject.transform.position);
                dObjectLat   = NavUtils.GetLatitude(ObjectPos);
                dObjectLon   = NavUtils.GetLongitude(ObjectPos);
                disObjectLat = dObjectLat * 180 / Math.PI;
                disObjectLon = dObjectLon * 180 / Math.PI;

                if (disObjectLon < 0)
                {
                    disObjectLon = disObjectLon + 360;
                }

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(5);
                    GUILayout.Label("Alt. " + fAlt.ToString("#0.0") + "m", LabelInfo);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Lat. " + disObjectLat.ToString("#0.000"), LabelInfo);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Lon. " + disObjectLon.ToString("#0.000"), LabelInfo);
                    GUILayout.Space(5);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(5);

                string sPurpose = "";

                if (sFacilityType == "Hangar")
                {
                    sPurpose    = "Craft can be stored in this building for launching from the base at a later date. The building has limited space.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "RocketAssembly")
                {
                    sPurpose    = "This facility can construct craft that have been designed in KSC's VAB and can store a constructed craft for launching from the base at a later date.";
                    bHalfwindow = false;
                }
                else
                if (sFacilityType == "PlaneAssembly")
                {
                    sPurpose    = "This facility can construct craft that have been designed in KSC's SPH and can store a constructed craft for launching from the base at a later date.";
                    bHalfwindow = false;
                }
                else
                if (sFacilityType == "ControlTower")
                {
                    sPurpose = "This facility manages incoming and outgoing air-traffic to and from the base, as well as administrating most other base operations.";
                }
                else
                if (sFacilityType == "Barracks")
                {
                    sPurpose    = "This facility provides a temporary home for base-staff. Other facilities can draw staff from the pool available at this facility.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "RadarStation")
                {
                    sPurpose    = "This facility tracks craft in the planet's atmosphere at a limited range. It provides bonuses for recovery operations by the nearest open base.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "Research")
                {
                    sPurpose    = "This facility carries out research and generates Science.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "Mining")
                {
                    sPurpose = "This facility excavates useful minerals and materials and thus generates Ore.";
                }
                else
                if (sFacilityType == "Refining")
                {
                    sPurpose = "This facility converts Ore into fuels.";
                }
                else
                if (sFacilityType == "Manufacturing")
                {
                    sPurpose = "This facility converts Ore into Processed Ore, for use in manufacturing craft in lieu of Funds, constructing and upgrading facilities.";
                }
                else
                if (sFacilityType == "Business")
                {
                    sPurpose    = "This facility carries out business related to the space program in order to generate Funds.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "Training")
                {
                    sPurpose = "This facility can provide professional skills and experience to rookie Kerbonauts.";
                }
                else
                if (sFacilityType == "Medical")
                {
                    sPurpose = "This facility can aid Kerbonaut recovery after long missions or injury.";
                }
                else
                if (sFacilityType == "TrackingStation")
                {
                    sPurpose    = "This facility can track a variety of off-Kerbin targets, including spacecraft, celestial bodies and asteroids.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "FuelTanks")
                {
                    sPurpose    = "This facility stores fuel for craft.";
                    bHalfwindow = false;
                }
                else
                if (sFacilityType == "Storage")
                {
                    sPurpose = "This facility stores construction materials (Processed Ore).";
                }
                else
                if (sFacilityType == "CraftAssembly")
                {
                    sPurpose    = "This facility can construct craft that have been designed in KSC's VAB or SPH and can store a constructed craft for launching from the base at a later date.";
                    bHalfwindow = false;
                }

                GUILayout.Label(sPurpose, LabelInfo);
                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(3);

                SharedInterfaces.OpenCloseFacility(selectedFacility);

                iFundsOpen2 = (float)selectedFacility.getSetting("OpenCost");
                isOpen2     = ((string)selectedFacility.getSetting("OpenCloseState") == "Open");
                float iFundsDefaultCost = (float)selectedFacility.model.getSetting("cost");
                if (iFundsOpen2 == 0)
                {
                    iFundsOpen2 = iFundsDefaultCost;
                }

                if (iFundsOpen2 == 0)
                {
                    isOpen2 = true;
                }

                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(3);

                GUI.enabled = isOpen2;

                if (sFacilityType == "TrackingStation")
                {
                    TrackingStationGUI.TrackingInterface(selectedFacility);
                }

                if (sFacilityType == "Hangar" || sFacilityType == "RocketAssembly" || sFacilityType == "PlaneAssembly" || sFacilityType == "CraftAssembly")
                {
                    HangarGUI.HangarInterface(selectedFacility);
                }

                // WIP

                /* if (sFacilityType == "RocketAssembly" || sFacilityType == "PlaneAssembly" || sFacilityType == "CraftAssembly")
                 * {
                 *      CraftConstructionGUI.CraftConstructionInterface(selectedFacility);
                 * } */

                if (sFacilityType == "Research" || sFacilityType == "Business" || sFacilityType == "Mining" ||
                    sFacilityType == "RocketAssembly" || sFacilityType == "PlaneAssembly" || sFacilityType == "CraftAssembly")
                {
                    ProductionGUI.ProductionInterface(selectedFacility, sFacilityType);
                }

                fLqFMax = (float)selectedFacility.model.getSetting("LqFMax");
                fOxFMax = (float)selectedFacility.model.getSetting("OxFMax");
                fMoFMax = (float)selectedFacility.model.getSetting("MoFMax");

                if (fLqFMax > 0 || fOxFMax > 0 || fMoFMax > 0 || sFacilityType == "FuelTanks")
                {
                    FuelTanksGUI.FuelTanksInterface(selectedFacility);
                }

                GUI.enabled = true;

                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(2);

                GUI.enabled = isOpen2;
                StaffGUI.StaffingInterface(selectedFacility);
                GUI.enabled = true;
            }

            GUILayout.FlexibleSpace();
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
            GUILayout.Space(3);

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
コード例 #2
0
        void drawFacilityManagerWindow(int windowID)
        {
            if (selectedInstance.hasFacilities == false || selectedInstance.myFacilities.Count == 0)
            {
                selectedInstance = null;
                this.Close();
            }


            if (!layoutInitialized)
            {
                InitializeLayout();
                layoutInitialized = true;
            }

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUILayout.Button("Facility Manager", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16)))
                {
                    selectedInstance = null;
                    this.Close();
                    return;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            if (selectedInstance != null)
            {
                sFacilityType = selectedInstance.FacilityType;

                if (sFacilityType == "GroundStation")
                {
                    sFacilityName = "Ground Station";
                    bHalfwindow   = true;
                }
                else
                {
                    if (selectedInstance.facilityType != KKFacilityType.None)
                    {
                        sFacilityName = selectedInstance.GetFacility(selectedInstance.facilityType).FacilityName;
                    }
                    else
                    {
                        sFacilityName = selectedInstance.model.title;
                    }
                }

                GUILayout.Box("" + sFacilityName, Yellowtext);
                GUILayout.Space(5);

                fAlt = selectedInstance.RadiusOffset;

                objectPos    = KerbalKonstructs.instance.GetCurrentBody().transform.InverseTransformPoint(selectedInstance.position);
                disObjectLat = KKMath.GetLatitudeInDeg(objectPos);
                disObjectLon = KKMath.GetLongitudeInDeg(objectPos);

                if (disObjectLon < 0)
                {
                    disObjectLon = disObjectLon + 360;
                }

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(5);
                    GUILayout.Label("Alt. " + fAlt.ToString("#0.0") + "m", LabelInfo);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Lat. " + disObjectLat.ToString("#0.000"), LabelInfo);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Lon. " + disObjectLon.ToString("#0.000"), LabelInfo);
                    GUILayout.Space(5);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(5);

                sPurpose = "";

                switch (selectedInstance.facilityType)
                {
                case KKFacilityType.Hangar:
                {
                    sPurpose    = "Craft can be stored in this building for launching from the base at a later date. The building has limited space.";
                    bHalfwindow = true;
                    break;
                }

                case KKFacilityType.Barracks:
                {
                    sPurpose    = "This facility provides a temporary home for base-staff. Other facilities can draw staff from the pool available at this facility.";
                    bHalfwindow = true;
                    break;
                }

                case KKFacilityType.Research:
                {
                    sPurpose    = "This facility carries out research and generates Science.";
                    bHalfwindow = true;
                    break;
                }

                case KKFacilityType.Business:
                {
                    sPurpose    = "This facility carries out business related to the space program in order to generate Funds.";
                    bHalfwindow = true;
                    break;
                }

                case KKFacilityType.GroundStation:
                {
                    sPurpose    = "This facility can be a GroundStation for RemoteTech/CommNet";
                    bHalfwindow = true;
                    break;
                }

                case KKFacilityType.Merchant:
                {
                    sPurpose    = "You can buy and sell Resources here";
                    bHalfwindow = false;
                    break;
                }

                case KKFacilityType.Storage:
                {
                    sPurpose    = "You can store Resources here";
                    bHalfwindow = false;
                    break;
                }
                }

                GUILayout.Label(sPurpose, LabelInfo);
                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(3);

                SharedInterfaces.OpenCloseFacility(selectedInstance);

                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(3);

                if (selectedInstance.myFacilities[0].isOpen)
                {
                    switch (selectedInstance.facilityType)
                    {
                    case KKFacilityType.GroundStation:
                        TrackingStationGUI.TrackingInterface(selectedInstance);
                        break;

                    case KKFacilityType.Hangar:
                        HangarGUI.HangarInterface(selectedInstance);
                        break;

                    case KKFacilityType.Research:
                    case KKFacilityType.Business:
                        ProductionGUI.ProductionInterface(selectedInstance, sFacilityType);
                        break;

                    case KKFacilityType.Merchant:
                        MerchantGUI.MerchantInterface(selectedInstance);
                        break;

                    case KKFacilityType.Storage:
                        StorageGUI.StorageInerface(selectedInstance);
                        break;
                    }
                    GUILayout.Space(2);
                    GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                    GUILayout.Space(2);
                    StaffGUI.StaffingInterface(selectedInstance);
                }
            }

            GUILayout.FlexibleSpace();
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
            GUILayout.Space(3);

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }
コード例 #3
0
        void drawFacilityManagerWindow(int windowID)
        {
            DeadButton = new GUIStyle(GUI.skin.button);
            DeadButton.normal.background  = null;
            DeadButton.hover.background   = null;
            DeadButton.active.background  = null;
            DeadButton.focused.background = null;
            DeadButton.normal.textColor   = Color.white;
            DeadButton.hover.textColor    = Color.white;
            DeadButton.active.textColor   = Color.white;
            DeadButton.focused.textColor  = Color.white;
            DeadButton.fontSize           = 14;
            DeadButton.fontStyle          = FontStyle.Bold;

            DeadButtonRed = new GUIStyle(GUI.skin.button);
            DeadButtonRed.normal.background  = null;
            DeadButtonRed.hover.background   = null;
            DeadButtonRed.active.background  = null;
            DeadButtonRed.focused.background = null;
            DeadButtonRed.normal.textColor   = Color.red;
            DeadButtonRed.hover.textColor    = Color.yellow;
            DeadButtonRed.active.textColor   = Color.red;
            DeadButtonRed.focused.textColor  = Color.red;
            DeadButtonRed.fontSize           = 12;
            DeadButtonRed.fontStyle          = FontStyle.Bold;

            BoxNoBorder = new GUIStyle(GUI.skin.box);
            BoxNoBorder.normal.background = null;
            BoxNoBorder.normal.textColor  = Color.white;

            Yellowtext = new GUIStyle(GUI.skin.box);
            Yellowtext.normal.textColor  = Color.yellow;
            Yellowtext.normal.background = null;

            LabelInfo = new GUIStyle(GUI.skin.label);
            LabelInfo.normal.background = null;
            LabelInfo.normal.textColor  = Color.white;
            LabelInfo.fontSize          = 13;
            LabelInfo.fontStyle         = FontStyle.Bold;
            LabelInfo.padding.left      = 3;
            LabelInfo.padding.top       = 0;
            LabelInfo.padding.bottom    = 0;

            ButtonSmallText           = new GUIStyle(GUI.skin.button);
            ButtonSmallText.fontSize  = 12;
            ButtonSmallText.fontStyle = FontStyle.Normal;

            GUILayout.BeginHorizontal();
            {
                GUI.enabled = false;
                GUILayout.Button("-KK-", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUILayout.Button("Facility Manager", DeadButton, GUILayout.Height(16));

                GUILayout.FlexibleSpace();

                GUI.enabled = true;

                if (GUILayout.Button("X", DeadButtonRed, GUILayout.Height(16)))
                {
                    selectedFacility = null;
                    this.Close();
                    return;
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(1);
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));

            GUILayout.Space(2);

            if (selectedFacility != null)
            {
                sFacilityType = (string)selectedFacility.FacilityType;

                if (sFacilityType == "GroundStation")
                {
                    sFacilityName = "Ground Station";
                    bHalfwindow   = true;
                }
                else
                {
                    sFacilityName = selectedFacility.model.title;
                }

                GUILayout.Box("" + sFacilityName, Yellowtext);
                GUILayout.Space(5);

                fAlt = selectedFacility.RadiusOffset;

                objectPos = KerbalKonstructs.instance.getCurrentBody().transform.InverseTransformPoint(selectedFacility.gameObject.transform.position);
                //dObjectLat = NavUtils.GetLatitude(ObjectPos);
                //dObjectLon = NavUtils.GetLongitude(ObjectPos);
                //disObjectLat = dObjectLat * 180 / Math.PI;
                //disObjectLon = dObjectLon * 180 / Math.PI;
                disObjectLat = KKMath.GetLatitudeInDeg(objectPos);
                disObjectLon = KKMath.GetLongitudeInDeg(objectPos);

                if (disObjectLon < 0)
                {
                    disObjectLon = disObjectLon + 360;
                }

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Space(5);
                    GUILayout.Label("Alt. " + fAlt.ToString("#0.0") + "m", LabelInfo);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Lat. " + disObjectLat.ToString("#0.000"), LabelInfo);
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Lon. " + disObjectLon.ToString("#0.000"), LabelInfo);
                    GUILayout.Space(5);
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(5);

                string sPurpose = "";

                if (sFacilityType == "Hangar")
                {
                    sPurpose    = "Craft can be stored in this building for launching from the base at a later date. The building has limited space.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "Barracks")
                {
                    sPurpose    = "This facility provides a temporary home for base-staff. Other facilities can draw staff from the pool available at this facility.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "RadarStation")
                {
                    sPurpose    = "This facility tracks craft in the planet's atmosphere at a limited range. It provides bonuses for recovery operations by the nearest open base.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "Research")
                {
                    sPurpose    = "This facility carries out research and generates Science.";
                    bHalfwindow = true;
                }

                else
                if (sFacilityType == "Business")
                {
                    sPurpose    = "This facility carries out business related to the space program in order to generate Funds.";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "TrackingStation")
                {
                    sPurpose    = "Thís Facility can be a GroundStation for RemoteTech/CommNet";
                    bHalfwindow = true;
                }
                else
                if (sFacilityType == "FuelTanks")
                {
                    sPurpose    = "This facility stores fuel for craft.";
                    bHalfwindow = false;
                }


                GUILayout.Label(sPurpose, LabelInfo);
                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(3);

                SharedInterfaces.OpenCloseFacility(selectedFacility);

                isOpen2 = selectedFacility.myFacilities[0].isOpen;


                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(3);

                GUI.enabled = isOpen2;

                if (sFacilityType == "GroundStation")
                {
                    TrackingStationGUI.TrackingInterface(selectedFacility);
                }

                if (sFacilityType == "Hangar")
                {
                    HangarGUI.HangarInterface(selectedFacility);
                }

                if (sFacilityType == "Research" || sFacilityType == "Business")
                {
                    ProductionGUI.ProductionInterface(selectedFacility, sFacilityType);
                }

                fLqFMax = selectedFacility.model.LqFMax;
                fOxFMax = selectedFacility.model.OxFMax;
                fMoFMax = selectedFacility.model.MoFMax;

                if (fLqFMax > 0 || fOxFMax > 0 || fMoFMax > 0 || sFacilityType == "FuelTanks")
                {
                    FuelTanksGUI.FuelTanksInterface(selectedFacility);
                }

                GUI.enabled = true;

                GUILayout.Space(2);
                GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
                GUILayout.Space(2);

                GUI.enabled = isOpen2;
                StaffGUI.StaffingInterface(selectedFacility);
                GUI.enabled = true;
            }

            GUILayout.FlexibleSpace();
            GUILayout.Box(tHorizontalSep, BoxNoBorder, GUILayout.Height(4));
            GUILayout.Space(3);

            GUI.DragWindow(new Rect(0, 0, 10000, 10000));
        }