Ejemplo n.º 1
0
        public void Update()
        {
            if (Time.timeSinceLevelLoad < 3.0f || !isRBactive || !loadRBthisscene || isRBloaded) // Check not loading level, or ResearchBodies is not active, or don't need to load RB this scene or it's already loaded.
            {
                return;
            }

            if (isRBactive)
            {
                if (!RBWrapper.APIRBReady)
                {
                    RBWrapper.InitRBWrapper();
                }
                isRBloaded = RBWrapper.APIRBReady;
                if (isRBloaded)
                {
                    RBCelestialBodies = RBWrapper.RBactualAPI.CelestialBodies;
                }
            }
        }
        public void Start()
        {
            Utilities.Log_Debug("Starting Tarsier Progress Tracking");
            Instance    = this;
            isRSSactive = Utilities.IsRSSInstalled;
            isOPMactive = Utilities.IsOPMInstalled;
            isNHactive  = Utilities.IsNHInstalled;
            isRBactive  = Utilities.IsResearchBodiesInstalled;
            bodyNames   = FlightGlobals.Bodies.Where(p => p.Radius > 100).Select(p => p.name).ToList(); //List of CBs where radius > 100m (exclude Sigma Binaries)

            if (isRBactive)
            {
                try
                {
                    if (!RBWrapper.APIRBReady)
                    {
                        RBWrapper.InitRBWrapper();
                    }
                    RBwindowID = Utilities.getnextrandomInt();

                    if (RBWrapper.APIRBReady)
                    {
                        GameEvents.OnScienceRecieved.Add(processScience);
                    }
                    else
                    {
                        Utilities.Log("Initialise of ResearchBodies interface failed unexpectedly. Interface disabled.");
                        isRBactive = false;
                    }
                }
                catch (Exception ex)
                {
                    Utilities.Log("Initialise of ResearchBodies interface failed unexpectedly. Interface disabled. Ex: {0}", ex.Message);
                    isRBactive = false;
                }
            }
        }