Esempio n. 1
0
        protected void registerRepairProject(UnloadedQualitySummary qualitySummary)
        {
            //Show tooltip: The repair attempt might not suceed!
            if (!BARISScenario.showedRepairProjectTip && BARISScenario.partsCanBreak)
            {
                BARISScenario.showedRepairProjectTip = true;
                BARISEventCardView cardView = new BARISEventCardView();

                cardView.WindowTitle = BARISScenario.RepairProjectTitle;
                cardView.description = BARISScenario.RepairProjectMsg;
                cardView.imagePath   = BARISScenario.RepairProjectImagePath;

                cardView.SetVisible(true);
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }

            //Create repair project
            BARISRepairProject repairProject = new BARISRepairProject();

            repairProject.vesselID          = qualitySummary.vessel.id.ToString();
            repairProject.repairCostFunds   = qualitySummary.repairCostFunds;
            repairProject.repairCostScience = qualitySummary.repairCostScience;
            repairProject.repairCostTime    = qualitySummary.repairCostTime;
            repairProject.startTime         = Planetarium.GetUniversalTime();

            //Register the project
            BARISScenario.Instance.RegisterRepairProject(repairProject);
        }
Esempio n. 2
0
        protected void onStageActivate(int stageID)
        {
            if (!BARISSettings.PartsCanBreak)
            {
                debugLog("Parts can't break");
                return;
            }
            if (!BARISSettingsLaunch.LaunchesCanFail)
            {
                debugLog("Launches can't fail");
                return;
            }
            if (stageCheckInProgress)
            {
                debugLog("Staging check in progress");
                return;
            }

            //Static fire testing hint
            if (!BARISScenario.showedStaticFireTooltip && BARISScenario.partsCanBreak)
            {
                BARISScenario.showedStaticFireTooltip = true;
                BARISEventCardView cardView = new BARISEventCardView();

                cardView.WindowTitle = BARISScenario.ToolTipStaticFireTitle;
                cardView.description = BARISScenario.ToolTipStaticFireMsg;
                cardView.imagePath   = BARISScenario.StaticFireToolTipImagePath;

                cardView.SetVisible(true);
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
            disableTestModeIfNeeded();

            debugLog("onStageActivate: stageID: " + stageID);
            stageCheckInProgress = true;

            //Record staging ID
            stagingID = stageID;

            //Get start time
            stagingStartTime = Planetarium.GetUniversalTime();

            //Determine how long to wait until we do a staging reliability check
            stagingCheckSeconds = UnityEngine.Random.Range(1, MaxStagingCheckTime);
            debugLog("Staging check in " + stagingCheckSeconds + " seconds");

            //Subscribe to the timetick event
            BARISScenario.Instance.onTimeTickEvent += stagingTimeTick;

            //Chutes need to be checked at staging event
            CheckChutes();
        }
Esempio n. 3
0
        private void ToggleGUI()
        {
            testBenchView.SetVisible(!testBenchView.IsVisible());

            //Pay with Science tip
            if (!BARISScenario.showedBuyExperienceWithScienceTip)
            {
                BARISScenario.showedBuyExperienceWithScienceTip = true;
                BARISEventCardView cardView = new BARISEventCardView();

                cardView.WindowTitle = BARISScenario.BuyExpWithScienceTitle;
                cardView.description = BARISScenario.BuyExpWithScienceMsg;
                cardView.imagePath   = BARISScenario.BuyExpWithScienceToolTipImagePath;

                cardView.SetVisible(true);
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
        }
Esempio n. 4
0
        public void Awake()
        {
            if (BARISScenario.isKCTInstalled)
            {
                return;
            }
            debugLog("Awake called");
            Instance = this;

            //Create views
            messageView = new BARISGenericMessageView();

            //Are we in VAB or SPH?
            if (EditorLogic.fetch.ship.shipFacility == EditorFacility.VAB)
            {
                isVAB = true;
            }
            else
            {
                isVAB = false;
            }

            //Intercept the launch button events
            EditorLogic.fetch.launchBtn.onClick.RemoveListener(new UnityEngine.Events.UnityAction(EditorLogic.fetch.launchVessel));
            EditorLogic.fetch.launchBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(BARISLaunchButtonManager.Instance.launchVessel));
            EditorLogic.fetch.newBtn.onClick.AddListener(new UnityEngine.Events.UnityAction(BARISLaunchButtonManager.Instance.onNewVessel));

            //Game Events
            GameEvents.onEditorShipModified.Add(onEditorShipModified);

            //Load before fire hint
            if (!BARISScenario.showedLoadBeforeFlightTip && BARISScenario.partsCanBreak)
            {
                BARISScenario.showedLoadBeforeFlightTip = true;
                BARISEventCardView cardView = new BARISEventCardView();

                cardView.WindowTitle = BARISScenario.LoadBeforeFlightTitle;
                cardView.description = BARISScenario.LoadBeforeFlightMsg;

                cardView.SetVisible(true);
                GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
            }
        }
Esempio n. 5
0
        public override void SetVisible(bool newValue)
        {
            base.SetVisible(newValue);

            if (newValue)
            {
                if (imgInstructions1 == null)
                {
                    string filePath = "WildBlueIndustries/000BARIS/Images/";

                    imgInstructions1 = GameDatabase.Instance.GetTexture(filePath + "Instructions1", false);
                    imgInstructions2 = GameDatabase.Instance.GetTexture(filePath + "Instructions2", false);
                    imgInstructions3 = GameDatabase.Instance.GetTexture(filePath + "Instructions3", false);
                    imgInstructions4 = GameDatabase.Instance.GetTexture(filePath + "Instructions4", false);
                    kspediaIcon      = GameDatabase.Instance.GetTexture(filePath + "kspediaIcon", false);
                    imgBarisIsOff    = GameDatabase.Instance.GetTexture(filePath + "BARISIsOff", false);

                    BARISScenario.Instance.PlayProblemSound();
                    BARISScenario.Instance.PlayThemeSong();
                }
            }

            else
            {
                if (BARISScenario.themeSong.isPlaying)
                {
                    BARISScenario.themeSong.Stop();
                }

                //RTFM Hint
                BARISEventCardView cardView = new BARISEventCardView();

                cardView.WindowTitle = BARISScenario.RTFMTitle;
                cardView.description = BARISScenario.RTFMMsg;
                cardView.imagePath   = BARISScenario.RTFMToolTipImagePath;

                cardView.SetVisible(true);
            }
        }