示例#1
0
        public void Start()
        {
            if (!HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().enableInEditor)
            {
                Destroy(this);
                return;
            }

            if (HighLogic.CurrentGame.Mode == Game.Modes.MISSION_BUILDER)
            {
                if (Component.FindObjectOfType <AHUtil> () == null)
                {
                    AHUtil util = gameObject.AddComponent <AHUtil> ();
                    util.Start();
                }

                AHShipList.UpdateLoadedGame();
                AHShipList.ParseFlyingVessel();
            }

            instance = this;

            trackingStationLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation);
            targetPower          = GameVariables.Instance.GetDSNRange(trackingStationLevel);
            targetName           = Localizer.Format("#autoLOC_AH_0015") + " " + (int)(trackingStationLevel * 2 + 1);

            GetShipList();

            GetAntennaPartList();

            CreateAntennaList();
            DoTheMath();

            GameEvents.onGUIApplicationLauncherReady.Add(AddToolbarButton);
            GameEvents.onGUIApplicationLauncherDestroyed.Add(RemoveToolbarButton);

            GameEvents.onEditorLoad.Add(VesselLoad);
            GameEvents.onEditorPartEvent.Add(PartEvent);
            GameEvents.onEditorPodPicked.Add(PodPicked);
            GameEvents.onEditorPodDeleted.Add(PodDeleted);

            GameEvents.onGameSceneSwitchRequested.Add(QuitEditor);
        }