Beispiel #1
0
        protected void drawVesselInfo(EditorBayItem editorBayItem)
        {
            //Vessel name
            GUILayout.Label("<color=lightBlue><b>" + editorBayItem.vesselName + "</b></color>");

            //Vessel thumbnail
            if (editorBayItem.vesselThumbnail != null)
            {
                GUILayout.Label(editorBayItem.vesselThumbnail, new GUILayoutOption[] { GUILayout.Width(175), GUILayout.Height(175) });
            }

            //Generate the image from the thumbnail file if it exists.
            else if (File.Exists(editorBayItem.thumbnailPath))
            {
                byte[] fileData = File.ReadAllBytes(editorBayItem.thumbnailPath);
                editorBayItem.vesselThumbnail = new Texture2D(2, 2);
                editorBayItem.vesselThumbnail.LoadImage(fileData);
                GUILayout.Label(editorBayItem.vesselThumbnail, new GUILayoutOption[] { GUILayout.Width(175), GUILayout.Height(175) });
            }

            //Thumbnail doesn't exist, use a default image.
            else
            {
            }
        }
        public static string GetIntegrationStatusLabel(EditorBayItem editorBayItem)
        {
            //Build Time
            if (editorBayItem.totalIntegrationToAdd > 0 && editorBayItem.workerCount > 0)
            {
                int buildTime = editorBayItem.totalIntegrationToAdd / BARISScenario.Instance.GetWorkerProductivity(editorBayItem.workerCount, editorBayItem.isVAB);
                if (buildTime > 1)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + buildTime + Localizer.Format(BARISScenario.BuildTimeLabelDays) + "</color>");
                }
                else if (buildTime == 1)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + buildTime + Localizer.Format(BARISScenario.BuildTimeLabelOneDay) + "</color>");
                }
                else
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelLessDay) + "</color>");
                }
            }

            //Vessel is completed.
            else if (editorBayItem.totalIntegrationToAdd == 0)
            {
                return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabelStatus) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelDone) + "</color>");
            }

            //No workers.
            else
            {
                return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabelStatus) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelNeedsWorkers) + "</color>");
            }
        }
Beispiel #3
0
        protected void calculateReliability(EditorBayItem editorBayItem, ShipConstruct ship)
        {
            Part[] shipParts = ship.parts.ToArray();
            ModuleQualityControl qualityControl;
            int integrationCap = BARISScenario.Instance.GetIntegrationCap(isVAB);
            int flightExperienceBonus;

            //Zero out the stats
            editorBayItem.breakablePartCount    = 0;
            editorBayItem.totalQuality          = 0;
            editorBayItem.totalIntegrationToAdd = 0;

            //Now sum up the stats we need
            foreach (Part part in shipParts)
            {
                qualityControl = part.FindModuleImplementing <ModuleQualityControl>();
                if (qualityControl != null)
                {
                    flightExperienceBonus = BARISScenario.Instance.GetFlightBonus(part);

                    editorBayItem.breakablePartCount    += 1;
                    editorBayItem.totalQuality          += qualityControl.quality + flightExperienceBonus;
                    editorBayItem.totalIntegrationToAdd += integrationCap;

                    //Add part data. We'll need this if flight experience changes while a vehicle is going through integration.
                    editorBayItem.AddPartQualityData(part.partInfo.title, qualityControl.quality, flightExperienceBonus);
                }
            }
        }
Beispiel #4
0
        protected string completeIntegration()
        {
            List <EditorBayItem> bayItems = null;
            EditorBayItem        bayItem  = null;

            bayItems = BARISScenario.Instance.GetBuildsInProgress(isVAB);
            if (bayItems.Count > 0)
            {
                int index = UnityEngine.Random.Range(0, bayItems.Count - 1);
                bayItem = bayItems[index];

                bayItem.totalQuality          += bayItem.totalIntegrationToAdd;
                bayItem.totalIntegrationAdded += bayItem.totalIntegrationToAdd;
                bayItem.totalIntegrationToAdd  = 0;

                //With KAC installed, clear the alarm.
                if (KACWrapper.AssemblyExists && KACWrapper.APIReady)
                {
                    KACWrapper.KAC.DeleteAlarm(bayItem.KACAlarmID);
                }

                //Inform player
                string message = bayItem.vesselName + Localizer.Format(BARISScenario.VesselBuildCompleteMsg);
                return(message);
            }

            return(string.Empty);
        }
Beispiel #5
0
 protected void drawTooltip(EditorBayItem editorBayItem)
 {
     //Tooltip
     GUILayout.FlexibleSpace();
     if (string.IsNullOrEmpty(exitToolTip) == false)
     {
         GUILayout.Label(exitToolTip);
     }
     else if (string.IsNullOrEmpty(loadToolTip) == false)
     {
         GUILayout.Label(loadToolTip);
     }
     else if (string.IsNullOrEmpty(newToolTip) == false)
     {
         GUILayout.Label(newToolTip);
     }
     else if (string.IsNullOrEmpty(fundsToolTip) == false)
     {
         GUILayout.Label(fundsToolTip);
     }
     else
     {
         GUILayout.Label(" ");
     }
 }
Beispiel #6
0
        protected void loadVessel(EditorBayItem editorBayItem, bool closeDialog = true)
        {
            if (string.IsNullOrEmpty(editorBayItem.vesselName))
            {
                getEditorBayItem();
            }
            debugLog("loadVessel called, attempting to load " + editorBayItem.vesselName);

            //Return workers
            BARISScenario.Instance.ReturnWorkers(editorBayItem);

            //Set the launch button manager's editor bay item.
            BARISLaunchButtonManager.bypassPartMismatch = true;
            BARISLaunchButtonManager.editorBayItem      = editorBayItem;

            //Load the ship from the editor bay
            debugLog("Vessel file: " + editorBayItem.vesselFilePath);
            EditorLogic.LoadShipFromFile(editorBayItem.vesselFilePath);

            //Close the view.
            if (closeView != null && closeDialog)
            {
                closeView();
            }
        }
        protected void drawReliability(EditorBayItem editorBayItem)
        {
            //Reliability
            GUILayout.Label("<color=white><b>" + Localizer.Format(BARISScenario.ReliabilityLabel) + "</b>" + editorBayItem.baseReliability + "/" + editorBayItem.maxReliability + "</color>");

            //Build Time Status
            GUILayout.Label(GetIntegrationStatusLabel(editorBayItem));
        }
Beispiel #8
0
        protected void drawRushJobButton(EditorBayItem editorBayItem)
        {
            //Rush jobs only apply to Career games.
            if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER)
            {
                return;
            }

            Color         oldColor            = GUI.backgroundColor;
            ShipConstruct ship                = EditorLogic.fetch.ship;
            int           totalMaxReliability = 100 * editorBayItem.breakablePartCount;
            int           baseQuality         = editorBayItem.totalQuality + editorBayItem.totalIntegrationAdded;
            int           maxQuality          = editorBayItem.totalQuality + editorBayItem.totalIntegrationAdded + editorBayItem.totalIntegrationToAdd;
            float         rushJobCost         = editorBayItem.rushJobCost * (1.0f - ((float)baseQuality / (float)maxQuality));

            //Rush Job button (Career only?)
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = XKCDColors.ColorTranslator.FromHtml("#c3fa70");
            if (GUILayout.Button(fundsIcon, buttonOptions))
            {
                //Can we afford it?
                if (Funding.CanAfford(rushJobCost))
                {
                    if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER && !BARISScenario.showDebug)
                    {
                        Funding.Instance.AddFunds(-rushJobCost, TransactionReasons.Any);
                    }

                    //Add the integration cap to the base quality, and clear the cap.
                    if (editorBayItem.totalIntegrationToAdd > 0)
                    {
                        editorBayItem.totalIntegrationAdded = editorBayItem.totalIntegrationToAdd;
                        editorBayItem.totalIntegrationToAdd = 0;
                    }

                    //Delete the KAC alarm if any
                    if (KACWrapper.AssemblyExists && KACWrapper.APIReady && !string.IsNullOrEmpty(editorBayItem.KACAlarmID))
                    {
                        KACWrapper.KAC.DeleteAlarm(editorBayItem.KACAlarmID);
                    }

                    //Load the vessel
                    loadVessel(editorBayItem, false);
                }
                else //Inform user
                {
                    BARISScenario.Instance.LogPlayerMessage(Localizer.Format(BARISScenario.CannotAffordRushMsg));
                }
            }
            GUI.backgroundColor = oldColor;
            fundsIcon           = selectFundsIcon();

            //Rush job cost
            GUILayout.Label("<color=white><b>" + Localizer.Format(BARISScenario.CostLabel) + "</b>" + string.Format("{0:n0}", rushJobCost) + "</color>");
            GUILayout.EndHorizontal();
        }
Beispiel #9
0
        protected void drawLoadAndCancelButtons(EditorBayItem editorBayItem)
        {
            Color         oldColor = GUI.backgroundColor;
            ShipConstruct ship     = EditorLogic.fetch.ship;

            //Load button
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = XKCDColors.LemonYellow;
            if (GUILayout.Button(launchIcon, buttonOptions))
            {
                loadVessel(editorBayItem);

                /*
                 * //Launch the vessel. This will fill the ship with a default crew, which isn't what we want.
                 * if (isVAB)
                 *  HighLogic.CurrentGame.editorFacility = EditorFacility.VAB;
                 * else
                 *  HighLogic.CurrentGame.editorFacility = EditorFacility.SPH;
                 *
                 * VesselCrewManifest manifest = KSP.UI.CrewAssignmentDialog.Instance.GetManifest();
                 * if (manifest == null)
                 *  manifest = HighLogic.CurrentGame.CrewRoster.DefaultCrewForVessel(EditorLogic.fetch.ship.SaveShip(), null, true);
                 *
                 * FlightDriver.StartWithNewLaunch(editorBayItem.vesselFilePath, EditorLogic.FlagURL, EditorLogic.fetch.launchSiteName, manifest);
                 */
            }
            launchIcon          = selectLoadIcon();
            GUI.backgroundColor = oldColor;

            //Cancel Integration button
            GUI.backgroundColor = XKCDColors.ColorTranslator.FromHtml("#fe7e56");
            if (GUILayout.Button(exitIcon, buttonOptions))
            {
                //Return workers
                BARISScenario.Instance.ReturnWorkers(editorBayItem);

                //Clear the bay
                editorBayItem.Clear();
                BARISLaunchButtonManager.editorBayItem = null;

                //Delete the vessel file
                editorBayItem.DeleteSnapshot();

                BARISScenario.Instance.SetEditorBay(editorBayItem);

                //Save the game
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
            exitIcon            = selectExitIcon();
            GUI.backgroundColor = oldColor;
            GUILayout.EndHorizontal();
        }
Beispiel #10
0
        protected void drawWorkersButtons(EditorBayItem editorBayItem)
        {
            Color         oldColor = GUI.backgroundColor;
            ShipConstruct ship     = EditorLogic.fetch.ship;

            //Add/remove workers
            GUILayout.BeginHorizontal();

            GUILayout.Label("<color=white><b>" + Localizer.Format(BARISScenario.WorkersLabel) + "</b>" + editorBayItem.workerCount + "/" + BARISScenario.MaxWorkersPerBay + "</color>");

            //Remove workers button
            if (GUILayout.RepeatButton("-"))
            {
                workerRequest += 0.1f;
                if (workerRequest >= 1.0f)
                {
                    workerRequest = 0f;
                    if (removeWorker != null)
                    {
                        if (removeWorker(editorBayItem.workerCount))
                        {
                            editorBayItem.workerCount -= 1;
                            BARISScenario.Instance.SetEditorBay(editorBayItem);
                            setKACAlarm(editorBayItem);
                        }
                    }
                }
            }

            //Add workers button
            if (GUILayout.RepeatButton("+"))
            {
                workerRequest += 0.1f;
                if (workerRequest >= 1.0f)
                {
                    workerRequest = 0f;
                    if (addWorker != null)
                    {
                        if (addWorker(editorBayItem.workerCount))
                        {
                            editorBayItem.workerCount += 1;
                            BARISScenario.Instance.SetEditorBay(editorBayItem);
                            setKACAlarm(editorBayItem);
                        }
                    }
                }
            }

            GUILayout.EndHorizontal();
        }
Beispiel #11
0
        protected void drawLoadAndCancelButtons(EditorBayItem editorBayItem)
        {
            Color         oldColor = GUI.backgroundColor;
            ShipConstruct ship     = EditorLogic.fetch.ship;

            //Load button
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = XKCDColors.LemonYellow;
            if (KACWrapper.InstanceExists && KACWrapper.APIReady && editorBayItem.isCompleted)
            {
                if (GUILayout.Button(launchIcon, buttonOptions))
                {
                    loadVessel(editorBayItem);
                }
                launchIcon = selectLoadIcon();
            }
            else if (!KACWrapper.AssemblyExists || !KACWrapper.APIReady)
            {
                if (GUILayout.Button(launchIcon, buttonOptions))
                {
                    loadVessel(editorBayItem);
                }
                launchIcon = selectLoadIcon();
            }
            GUI.backgroundColor = oldColor;

            //Cancel Integration button
            GUI.backgroundColor = XKCDColors.ColorTranslator.FromHtml("#fe7e56");
            if (GUILayout.Button(exitIcon, buttonOptions))
            {
                //Return workers
                BARISScenario.Instance.ReturnWorkers(editorBayItem);

                //Clear the bay
                editorBayItem.Clear();
                BARISLaunchButtonManager.editorBayItem = null;

                //Delete the vessel file
                editorBayItem.DeleteSnapshot();

                BARISScenario.Instance.SetEditorBay(editorBayItem);

                //Save the game
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
            exitIcon            = selectExitIcon();
            GUI.backgroundColor = oldColor;
            GUILayout.EndHorizontal();
        }
        protected override void DrawWindowContents(int windowId)
        {
            if (editorBayItems == null || editorBayItems.Length == 0)
            {
                GUILayout.Label("<color=yellow><b>" + Localizer.Format(BARISScenario.NoBaysMsg) + "</b></color>");
                return;
            }

            scrollPos = GUILayout.BeginScrollView(scrollPos, scrollViewOptions);

            EditorBayItem bayItem   = null;
            int           highBayID = 0;

            for (int index = 0; index < editorBayItems.Length; index++)
            {
                bayItem   = editorBayItems[index];
                highBayID = bayItem.editorBayID + 1;

                GUILayout.BeginScrollView(originPoint, infoPanelOptions);
                //Bay ID
                if (bayItem.isVAB)
                {
                    GUILayout.Label("<color=white><b>VAB " + BARISScenario.HighBayLabel + " " + highBayID + "</b></color>");
                }
                else
                {
                    GUILayout.Label("<color=white><b>SPH " + BARISScenario.HangarBayLabel + " " + highBayID + "</b></color>");
                }

                //If there's a vessel, show integration days remaining.
                if (!string.IsNullOrEmpty(bayItem.vesselName))
                {
                    //Vessel name
                    GUILayout.Label("<color=white>" + bayItem.vesselName + "</color>");

                    //Reliability & build time
                    drawReliability(bayItem);
                }

                //Report that there's no vessel in the bay.
                else
                {
                    GUILayout.Label(Localizer.Format(BARISScenario.BayEmptyMsg));
                }
                GUILayout.EndScrollView();
            }

            GUILayout.EndScrollView();
        }
Beispiel #13
0
        protected void drawReliability(EditorBayItem editorBayItem)
        {
            //Reliability
            if (KACWrapper.InstanceExists && KACWrapper.APIReady)
            {
                GUILayout.Label("<color=white><b>" + Localizer.Format(BARISScenario.IntegratedReliabilityLabel) + "</b>" + editorBayItem.maxReliability + "</color>");
            }
            else
            {
                GUILayout.Label("<color=white><b>" + Localizer.Format(BARISScenario.ReliabilityLabel) + "</b>" + editorBayItem.baseReliability + "/" + editorBayItem.maxReliability + "</color>");
            }

            //Build Time Status
            GUILayout.Label(VehicleIntegrationStatusView.GetIntegrationStatusLabel(editorBayItem));
        }
Beispiel #14
0
        protected void getEditorBayItem()
        {
            editorBayItem = BARISScenario.Instance.GetEditorBay(isVAB, bayID);
            if (editorBayItem != null)
            {
                debugLog("Bay " + bayID + " exists.");
                debugLog(editorBayItem.ToString());
            }

            else
            {
                debugLog("Bay " + bayID + " does not exist, creating.");
                editorBayItem = new EditorBayItem();
                editorBayItem = BARISScenario.Instance.AddEditorBay(isVAB, bayID);
            }
        }
Beispiel #15
0
 protected void drawEditorBayItem(EditorBayItem editorBayItem)
 {
     drawVesselInfo(editorBayItem);
     drawReliability(editorBayItem);
     if (BARISScenario.Instance.workPausedDays <= 0)
     {
         drawRushJobButton(editorBayItem);
     }
     else
     {
         drawWorkPaused();
     }
     drawWorkersButtons(editorBayItem);
     drawLoadAndCancelButtons(editorBayItem);
     drawTooltip(editorBayItem);
 }
Beispiel #16
0
        public void launchVessel()
        {
            debugLog("launchVessel called");

            //If we have an editor bay item to process then transfer it to the revert list.
            //That way, if the player reverts the flight, we can rebuild the list.
            if (editorBayItem != null)
            {
                BARISScenario.Instance.TranferBayToRevertList(editorBayItem);
                BARISScenario.launchedVesselBay = editorBayItem;
            }

            //We're not launching a vessel from an editor bay, so clear the revert list.
            else if (BARISSettings.PartsCanBreak && BARISSettingsLaunch.VesselsNeedIntegration)
            {
                //Check for vehicle integration
                ShipConstruct        ship      = EditorLogic.fetch.ship;
                Part[]               shipParts = ship.parts.ToArray();
                ModuleQualityControl qualityControl;

                foreach (Part part in shipParts)
                {
                    qualityControl = part.FindModuleImplementing <ModuleQualityControl>();
                    if (qualityControl != null)
                    {
                        //If the vessel hasn't been integrated then set the warning flag.
                        if (qualityControl.integrationBonus == 0)
                        {
                            BARISLaunchFailManager.vehicleNotIntegrated = true;
                            break;
                        }
                    }
                }

                BARISScenario.Instance.ClearRevertList();
            }

            else
            {
                BARISScenario.Instance.ClearRevertList();
            }

            //Cleanup
            GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.BACKUP);
            editorBayItem = null;
        }
Beispiel #17
0
        /*
         * protected void destroyFacility()
         * {
         *  List<EditorBayItem> bayItems = null;
         *
         *  //Set the facility as destroyed.
         *
         *  //If the facility is the VAB or SPH, then clear the bays as well.
         *  bayItems = BARISScenario.Instance.GetBuildsInProgress(isVAB);
         *  foreach (EditorBayItem doomed in bayItems)
         *      doomed.Clear();
         *
         *  //Inform player
         *  string message = Localizer.Format(BARISScenario.BuildingDestroyedMsg);
         *  BARISScenario.Instance.LogPlayerMessage(message);
         * }
         */

        protected void applyIntegrationLost()
        {
            List <EditorBayItem> bayItems = null;
            EditorBayItem        bayItem  = null;
            string message = string.Empty;

            bayItems = BARISScenario.Instance.GetBuildsInProgress(isVAB);
            if (bayItems.Count > 0)
            {
                int index = UnityEngine.Random.Range(0, bayItems.Count - 1);
                bayItem = bayItems[index];
                message = bayItem.vesselName + Localizer.Format(BARISScenario.VesselBuildFailedMsg);
                bayItem.Clear();

                //Inform player
                BARISScenario.Instance.LogPlayerMessage(message);
            }
        }
Beispiel #18
0
        protected void setKACAlarm(EditorBayItem editorBayItem)
        {
            if (!KACWrapper.AssemblyExists)
            {
                return;
            }
            if (!KACWrapper.APIReady)
            {
                return;
            }

            //Delete the alarm if it exists
            if (!string.IsNullOrEmpty(editorBayItem.KACAlarmID))
            {
                KACWrapper.KAC.DeleteAlarm(editorBayItem.KACAlarmID);
            }

            //Calculate the alarm time in seconds
            double secondsPerDay = GameSettings.KERBIN_TIME == true ? 21600 : 86400;
            double alarmTime     = (editorBayItem.totalIntegrationToAdd / editorBayItem.workerCount) * secondsPerDay;

            alarmTime += Planetarium.GetUniversalTime();
            editorBayItem.KACAlarmID = KACWrapper.KAC.CreateAlarm(KACWrapper.KACAPI.AlarmTypeEnum.Raw, editorBayItem.vesselName + BARISScenario.IntegrationCompletedKACAlarm, alarmTime);
        }
        public static string GetIntegrationStatusLabel(EditorBayItem editorBayItem)
        {
            //Defer to KAC alarm time remaining if available
            if (KACWrapper.InstanceExists && KACWrapper.APIReady && !string.IsNullOrEmpty(editorBayItem.KACAlarmID))
            {
                if (editorBayItem.isCompleted)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabelStatus) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelDone) + "</color>");
                }

                //Get the alarm we need
                KACWrapper.KACAPI.KACAlarm kacAlarm = null;
                int totalAlarms = KACWrapper.KAC.Alarms.Count;
                for (int index = 0; index < totalAlarms; index++)
                {
                    kacAlarm = KACWrapper.KAC.Alarms[index];
                    if (KACWrapper.KAC.Alarms[index].ID == editorBayItem.KACAlarmID)
                    {
                        break;
                    }
                }
                if (kacAlarm == null)
                {
                    return("N/A");
                }

                //Calculate time remaining
                double secondsPerDay = GameSettings.KERBIN_TIME == true ? 21600 : 86400;
                double timeRemaining = kacAlarm.AlarmTime - Planetarium.GetUniversalTime();
                double daysRemaining = timeRemaining / secondsPerDay;
                if (daysRemaining > 1)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + string.Format("{0:f1}", daysRemaining) + Localizer.Format(BARISScenario.BuildTimeLabelDays) + "</color>");
                }
                else if (daysRemaining == 1)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>1" + Localizer.Format(BARISScenario.BuildTimeLabelOneDay) + "</color>");
                }
                else
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelLessDay) + "</color>");
                }
            }

            //Build Time
            if (editorBayItem.totalIntegrationToAdd > 0 && editorBayItem.workerCount > 0)
            {
                int buildTime = editorBayItem.totalIntegrationToAdd / BARISScenario.Instance.GetWorkerProductivity(editorBayItem.workerCount, editorBayItem.isVAB);
                if (buildTime > 1)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + buildTime + Localizer.Format(BARISScenario.BuildTimeLabelDays) + "</color>");
                }
                else if (buildTime == 1)
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + buildTime + Localizer.Format(BARISScenario.BuildTimeLabelOneDay) + "</color>");
                }
                else
                {
                    return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabel) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelLessDay) + "</color>");
                }
            }

            //Vessel is completed.
            else if (editorBayItem.totalIntegrationToAdd == 0)
            {
                return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabelStatus) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelDone) + "</color>");
            }

            //No workers.
            else
            {
                return("<color=white><b>" + Localizer.Format(BARISScenario.BuildTimeLabelStatus) + "</b>" + Localizer.Format(BARISScenario.BuildTimeLabelNeedsWorkers) + "</color>");
            }
        }
Beispiel #20
0
        public EditorBayView(int editorBayID, bool isVABBay)
        {
            bayID         = editorBayID;
            isVAB         = isVABBay;
            editorBayItem = BARISScenario.Instance.GetEditorBay(isVAB, bayID);
            if (editorBayItem != null)
            {
                debugLog("Bay " + bayID + " exists.");
                debugLog(editorBayItem.ToString());
            }

            else
            {
                debugLog("Bay " + bayID + " does not exist, creating.");
                editorBayItem = new EditorBayItem();
                editorBayItem = BARISScenario.Instance.AddEditorBay(isVAB, bayID);
            }

            //Get the thumbnails folder.
            // See: http://stackoverflow.com/questions/52797/how-do-i-get-the-path-of-the-assembly-the-code-is-in/283917#283917
            DirectoryInfo directoryInfo = Directory.GetParent(Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).Path))).Parent.Parent;
            string        codeBase      = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
            UriBuilder    uri           = new UriBuilder(codeBase);
            string        path          = Uri.UnescapeDataString(uri.Path);

            thumbnailFullPath = Path.GetDirectoryName(path);

            //Setup the root folder and thumbs folder.
            if (thumbnailFullPath.Contains("GameData"))
            {
                thumbnailBaseFileName = HighLogic.SaveFolder;
                if (isVAB)
                {
                    thumbnailBaseFileName = thumbnailBaseFileName + "_VAB_";
                }
                else
                {
                    thumbnailBaseFileName = thumbnailBaseFileName + "_SPH_";
                }

                int index = thumbnailFullPath.IndexOf("GameData");
                thumbnailFullPath  = thumbnailFullPath.Substring(0, index);
                savesFolder        = thumbnailFullPath + "saves/" + HighLogic.SaveFolder + "/";
                thumbnailFullPath += "thumbs/" + thumbnailBaseFileName;
            }

            //Icons
            if (exitIconBlack == null)
            {
                exitIconBlack = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/Exit", false);
            }
            if (exitIconWhite == null)
            {
                exitIconWhite = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/ExitWhite", false);
            }
            exitIcon = exitIconBlack;

            if (newIconBlack == null)
            {
                newIconBlack = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/NewIconBlack", false);
            }
            if (newIconWhite == null)
            {
                newIconWhite = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/NewIconWhite", false);
            }
            newIcon = newIconBlack;

            if (loadIconBlack == null)
            {
                loadIconBlack = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/loadIconBlack", false);
            }
            if (loadIconWhite == null)
            {
                loadIconWhite = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/loadIconWhite", false);
            }
            launchIcon = loadIconBlack;

            if (fundsIconBlack == null)
            {
                fundsIconBlack = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/FundsIconBlack", false);
            }
            if (fundsIconWhite == null)
            {
                fundsIconWhite = GameDatabase.Instance.GetTexture("WildBlueIndustries/000BARIS/Icons/FundsIconWhite", false);
            }
            fundsIcon = fundsIconBlack;
        }
Beispiel #21
0
 protected void onNewVessel()
 {
     debugLog("New vessel being created, clearing the editor bay");
     editorBayItem = null;
 }