internal static void CreateContent()
 {
     if (useLaunchSite)
     {
         windowMessage = selectedSite.LaunchSiteName + "\n" + "Status: " + selectedSite.OpenCloseState;
     }
     else
     {
         windowMessage = staticInstance.GetFacility(KKFacilityType.RecoveryBase).FacilityName + "\n" + "Status: " + staticInstance.GetFacility(KKFacilityType.RecoveryBase).OpenCloseState;
     }
     instance.message.Text(windowMessage);
 }
        internal static void CreateWPForBase(StaticInstance instance)
        {
            FinePrint.Waypoint lsWP = new FinePrint.Waypoint();
            //lsWP.altitude = selectedSite.staticInstance.surfaceHeight + 20f;
            lsWP.altitude      = 0;
            lsWP.height        = 20f;
            lsWP.isOnSurface   = true;
            lsWP.latitude      = instance.RefLatitude;
            lsWP.longitude     = instance.RefLongitude;
            lsWP.name          = instance.GetFacility(KKFacilityType.RecoveryBase).FacilityName;
            lsWP.celestialName = instance.CelestialBody.name;
            lsWP.isNavigatable = true;

            lsWP.navigationId = Guid.NewGuid();
            lsWP.enableMarker = true;
            lsWP.fadeRange    = instance.CelestialBody.Radius;
            lsWP.seed         = lsWP.name.GetHashCode();
            lsWP.isCustom     = true;

            lsWP.id = "Squad/PartList/SimpleIcons/R&D_node_icon_heavierrocketry";

            FinePrint.WaypointManager.AddWaypoint(lsWP);
        }
예제 #3
0
        internal static void CreateContent()
        {
            if (useLaunchSite)
            {
                windowMessage = selectedSite.LaunchSiteName + "\n" + "Status: " + selectedSite.OpenCloseState;
            }
            else
            {
                windowMessage = staticInstance.GetFacility(KKFacilityType.RecoveryBase).FacilityName + "\n" + "Status: " + staticInstance.GetFacility(KKFacilityType.RecoveryBase).OpenCloseState;
            }

            content = new List <DialogGUIBase>();

            content.Add(new DialogGUIFlexibleSpace());
            content.Add(new DialogGUIVerticalLayout(
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("Create a Waypoint", CreateWayPoint, 140.0f, 30.0f, true),
                            new DialogGUIButton("Open BaseManager", OpenBaseManager, 140.0f, 30.0f, true),
                            new DialogGUIButton("Close", () =>
            {
            }, 140.0f, 30.0f, true)
                            ));
        }
예제 #4
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));
        }
        void UpdateUI()
        {
            if (selectedInstance.hasFacilities == false || selectedInstance.myFacilities.Count == 0)
            {
                selectedInstance = null;
                this.Close();
            }

            string facilityType = selectedInstance.FacilityType;

            if (facilityType == "GroundStation")
            {
                facilityName.Text(KKLocalization.GroundStation);
            }
            else
            {
                if (selectedInstance.facilityType != KKFacilityType.None)
                {
                    facilityName.Text(selectedInstance.GetFacility(selectedInstance.facilityType).FacilityName);
                }
                else
                {
                    facilityName.Text(selectedInstance.model.title);
                }
            }

            Vector3 pos = KerbalKonstructs.instance.GetCurrentBody().transform.InverseTransformPoint(selectedInstance.position);

            facilityPosition.Altitude(selectedInstance.RadiusOffset).Latitude(KKMath.GetLatitudeInDeg(pos)).Longitude(KKMath.GetLongitudeInDeg(pos));

            UpdateOpenClose();

            bool enableTrackingStation = false;
            bool enableHangar          = false;
            bool enableProduction      = false;
            bool enableMerchant        = false;
            bool enableStorage         = false;

            switch (selectedInstance.facilityType)
            {
            case KKFacilityType.Hangar:
                facilityPurpose.Text(KKLocalization.FacilityPurposeHangar);
                enableHangar = true;
                break;

            case KKFacilityType.Barracks:
                facilityPurpose.Text(KKLocalization.FacilityPurposeBarracks);
                break;

            case KKFacilityType.Research:
                facilityPurpose.Text(KKLocalization.FacilityPurposeResearch);
                enableProduction = true;
                break;

            case KKFacilityType.Business:
                facilityPurpose.Text(KKLocalization.FacilityPurposeBusiness);
                enableProduction = true;
                break;

            case KKFacilityType.GroundStation:
                facilityPurpose.Text(KKLocalization.FacilityPurposeGroundStation);
                enableTrackingStation = true;
                break;

            case KKFacilityType.Merchant:
                facilityPurpose.Text(KKLocalization.FacilityPurposeMerchant);
                enableMerchant = true;
                break;

            case KKFacilityType.Storage:
                facilityPurpose.Text(KKLocalization.FacilityPurposeStorage);
                enableStorage = true;
                break;
            }
            bool isOpen = selectedInstance.myFacilities[0].isOpen;

            tractingStation.SetActive(isOpen && enableTrackingStation);
            hangar.SetActive(isOpen && enableHangar);
            production.SetActive(isOpen && enableProduction);
            merchant.SetActive(isOpen && enableMerchant);
            storage.SetActive(isOpen && enableStorage);
            staff.SetActive(isOpen);

            if (isOpen)
            {
                switch (selectedInstance.facilityType)
                {
                case KKFacilityType.GroundStation:
                    tractingStation.UpdateUI(selectedInstance);
                    break;

                case KKFacilityType.Hangar:
                    hangar.UpdateUI(selectedInstance);
                    break;

                case KKFacilityType.Research:
                case KKFacilityType.Business:
                    production.UpdateUI(selectedInstance);
                    break;

                case KKFacilityType.Merchant:
                    merchant.UpdateUI(selectedInstance);
                    break;

                case KKFacilityType.Storage:
                    storage.UpdateUI(selectedInstance);
                    break;
                }
                staff.UpdateUI(selectedInstance);
            }
        }