private void onVesselModified(Vessel v)
        {
            if (v == null)
            {
                return;
            }

            if (v != vessel)
            {
                return;
            }

            maxVesselEC = SEP_Utilities.getMaxTotalVesselEC(v.protoVessel);

            _ectotal = getECString();
        }
        public void Update()
        {
            if (vessel == null)
            {
                return;
            }

            if (vessel.protoVessel == null)
            {
                return;
            }

            if (vessel.loaded)
            {
                currentVesselEC = SEP_Utilities.getTotalVesselEC(vessel);
            }

            _ectotal = getECString();

            _isconnected = true;
        }
Ejemplo n.º 3
0
        private void setupButton()
        {
            if (!ToolbarManager.ToolbarAvailable)
            {
                return;
            }

            toolbarButton = ToolbarManager.Instance.add("SurfaceExperimentPackage", "SEPController");

            if (File.Exists(Path.Combine(new DirectoryInfo(KSPUtil.ApplicationRootPath).FullName, "GameData/SurfaceExperimentPackage/Resources/Blizzy_Icon.png").Replace("\\", "/")))
            {
                toolbarButton.TexturePath = "SurfaceExperimentPackage/Resources/Blizzy_Icon";
            }
            else
            {
                toolbarButton.TexturePath = "000_Toolbar/resize-cursor";
            }

            toolbarButton.ToolTip  = "SEP Controller";
            toolbarButton.OnClick += (e) =>
            {
                if (SEP_AppLauncher.Instance == null)
                {
                    SEP_Utilities.log("SEP App Launcher instance not running...", logLevels.warning);
                }
                else
                {
                    if (SEP_AppLauncher.Instance.IsVisible)
                    {
                        SEP_AppLauncher.Instance.onFalse();
                    }
                    else
                    {
                        SEP_AppLauncher.Instance.onTrue();
                    }
                }
            };
        }
        public SEP_VesselSection(Vessel v)
        {
            if (SEP_Controller.Instance == null)
            {
                return;
            }

            if (v == null)
            {
                return;
            }

            vessel = v;
            _name  = v.vesselName;

            experiments = SEP_Controller.Instance.getHandlers(v);

            _transmitavailable = SEP_Controller.Instance.TransmissionUpdgrade;
            _cantransmit       = experiments.Any(e => e.controllerAutoTransmit);

            currentVesselEC = SEP_Utilities.getTotalVesselEC(v.protoVessel);
            maxVesselEC     = SEP_Utilities.getMaxTotalVesselEC(v.protoVessel);

            _ectotal = getECString();

            _situation = getSituationString();

            experimentSections = new List <SEP_ExperimentSection>();
            addExperimentSections();

            _expcount = getExpCountString();

            GameEvents.onVesselWasModified.Add(onVesselModified);
            GameEvents.onVesselSituationChange.Add(onVesselSituationChange);
            SEP_Utilities.onExperimentActivate.Add(onAddExperiment);
            SEP_Utilities.onExperimentDeactivate.Add(onRemoveExperiment);
        }