示例#1
0
        private void CommNetInit()
        {
            // create the vessel list now but wait for the real signal

            //			Debug.Log ("[AH][ShipListener] Commnet is initialized");
            AHShipList.ParseFlyingVessel();
        }
示例#2
0
        public void Start()
        {
            AHShipList.UpdateLoadedGame();


            GameEvents.CommNet.OnNetworkInitialized.Add(CommNetInit);
        }
示例#3
0
        private void GetGUIShipList()
        {
            List <Dictionary <string, string> > guiExternListShipEditor = AHShipList.GetShipListAsList(true);

            guiExternListShipEditorVabAll   = AHShipList.GetShipListAsList(true, false, "VAB");
            guiExternListShipEditorVabRelay = AHShipList.GetShipListAsList(true, true, "VAB");
            guiExternListShipEditorSphAll   = AHShipList.GetShipListAsList(true, false, "SPH");
            guiExternListShipEditorSphRelay = AHShipList.GetShipListAsList(true, true, "SPH");

            guiExternListShipFlight = AHShipList.GetShipListAsList(false);
        }
示例#4
0
        public void Start()
        {
            if (HighLogic.CurrentGame.Mode == Game.Modes.MISSION_BUILDER)
            {
                Destroy(this);
            }

            if (!HighLogic.CurrentGame.Parameters.CustomParams <AntennaHelperSettings> ().enableInTrackingStation)
            {
                Destroy(this);
                return;
            }

            targetPid = "";

            trackingStationLvl = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation);
            dsnPower           = GameVariables.Instance.GetDSNRange(trackingStationLvl);

            waitFor = new WaitForSeconds(.1f);

            GameEvents.onPlanetariumTargetChanged.Add(NewTarget);
            GameEvents.OnMapFocusChange.Add(NewTarget);
            GameEvents.CommNet.OnCommStatusChange.Add(CommNetUpdate);

//			if (AHShipList.visitFlightOnce) {
//				GetListsShip ();
//				CreateMarkers ();
//			}

            // GUI
            rectMainWindow          = new Rect(0, 0, 150, 245);
            rectMainWindow.position = AHSettings.posTrackingStationMainWindow;
            mainWindowOn            = false;

            rectEditorShipWindow          = new Rect(0, 0, 350, 200);
            rectEditorShipWindow.position = AHSettings.posTrackingStationShipWindow;
            editorShipWindowOn            = false;

            circleTypeSelected = GUICircleSelection.ACTIVE;

            editorShipVab   = true;
            editorShipRelay = false;

            guiListEditorShipVabAll   = AHShipList.GetShipListAsList(true, false, "VAB");
            guiListEditorShipSphAll   = AHShipList.GetShipListAsList(true, false, "SPH");
            guiListEditorShipVabRelay = AHShipList.GetShipListAsList(true, true, "VAB");
            guiListEditorShipSphRelay = AHShipList.GetShipListAsList(true, true, "SPH");

            guiListEditorShipDisplay = guiListEditorShipVabAll;

            GameEvents.onGUIApplicationLauncherReady.Add(AddToolbarButton);
            GameEvents.onGUIApplicationLauncherDestroyed.Add(RemoveToolbarButton);
        }
示例#5
0
        private void GetGUIShipList()
        {
            List <Dictionary <string, string> > guiExternListShipEditor = AHShipList.GetShipListAsList(true);

            guiExternListShipEditorVabAll   = AHShipList.GetShipListAsList(true, false, "VAB");
            guiExternListShipEditorVabRelay = AHShipList.GetShipListAsList(true, true, "VAB");
            guiExternListShipEditorSphAll   = AHShipList.GetShipListAsList(true, false, "SPH");
            guiExternListShipEditorSphRelay = AHShipList.GetShipListAsList(true, true, "SPH");

            if (HighLogic.CurrentGame.Mode != Game.Modes.MISSION_BUILDER)
            {
                guiExternListShipFlight = AHShipList.GetShipListAsList(false);
            }
        }
示例#6
0
        private void GetShipList()
        {
            externListShipEditor = AHShipList.GetShipList(true, false);
            if (HighLogic.CurrentGame.Mode != Game.Modes.MISSION_BUILDER)
            {
                externListShipFlight = AHShipList.GetShipList(false, true);
            }
            else
            {
                externListShipFlight = new Dictionary <string, Dictionary <string, string> > ();
            }

            GetGUIShipList();
        }
示例#7
0
        public static void AddShipToShipList()
        {
            string type;

            if (EditorDriver.editorFacility == EditorFacility.SPH)
            {
                type = "SPH";
            }
            else
            {
                type = "VAB";
            }
            AHShipList.SaveShip(EditorLogic.fetch.ship.shipName, type, instance.rawDirectBetterPower.ToString(), instance.rawRelayBetterPower.ToString());
            instance.GetShipList();
        }
示例#8
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);
        }
示例#9
0
        private IEnumerator ParseOneVesselConnection(Vessel v)
        {
            isReady = false;
            AHShipList.shipListReady = false;

            yield return(new WaitForSeconds(.2f));

            MapObject originalTarget   = PlanetariumCamera.fetch.target;
            float     originalDistance = PlanetariumCamera.fetch.Distance;

            PlanetariumCamera.fetch.SetTarget(v.mapObject);
            PlanetariumCamera.fetch.SetTarget(originalTarget);
            PlanetariumCamera.fetch.SetDistance(originalDistance);

            yield return(new WaitForSeconds(.2f));

            AHShipList.ComputeRealSignal(v);

            AHShipList.shipListReady = true;
            isReady = true;
        }
示例#10
0
        private IEnumerator ParseVesselsConnection()
        {
            Dictionary <string, Dictionary <string, string> > ahShipList = AHShipList.GetShipList(false, true);
            List <Vessel> vesselList = FlightGlobals.Vessels.FindAll(v => ahShipList.ContainsKey(v.id.ToString()));

            //			WaitForSeconds timer = new WaitForSeconds (.2f);

            yield return(new WaitForSeconds(.6f));

            MapObject originalTarget   = PlanetariumCamera.fetch.target;
            float     originalDistance = PlanetariumCamera.fetch.Distance;

            foreach (Vessel v in vesselList)
            {
                PlanetariumCamera.fetch.SetTarget(v.mapObject);
            }
            PlanetariumCamera.fetch.SetTarget(originalTarget);
            PlanetariumCamera.fetch.SetDistance(originalDistance);

            yield return(new WaitForSeconds(.2f));

            foreach (Vessel v in vesselList)
            {
                //				Debug.Log ("[AH] Computing real signal for : " + v.GetName ());
                AHShipList.ComputeRealSignal(v);
            }

            isReady = true;
            AHShipList.shipListReady = true;
            //			Debug.Log ("[AH] shipList is now ready");
            //			foreach (KeyValuePair<string, Dictionary<string, string>> kvp in AHShipList.GetShipList (false, true)) {
            //				Debug.Log ("[AH]");
            //				foreach (KeyValuePair<string, string> kvp2 in kvp.Value) {
            //					Debug.Log ("[AH] " + kvp2.Key + " : " + kvp2.Value);
            //				}
            //				Debug.Log ("[AH]");
            //			}
        }
示例#11
0
        private IEnumerator CommNetUpdateCoroutine()
        {
            inCoroutine = true;

            yield return(waitFor);

            while (!AHShipList.shipListReady)
            {
                yield return(waitFor);
            }

//			Debug.Log ("[AH] ship list is ready");

            if (listMarkers != null)
            {
                DestroyMarkers();
            }

            AHShipList.ParseFlyingVessel(true);
            GetListsShip();
            CreateMarkers();

            inCoroutine = false;
        }
示例#12
0
 private void GetListShipTransmitter()
 {
     listShipTransmitter = new Dictionary <string, Dictionary <string, string> > (AHShipList.GetShipList(true, true));
 }
示例#13
0
 private void GetShipList()
 {
     externListShipEditor = AHShipList.GetShipList(true, false);
     externListShipFlight = AHShipList.GetShipList(false, true);
     GetGUIShipList();
 }
示例#14
0
        public static void RemoveShipFromShipList(string pid)
        {
            AHShipList.RemoveShip(pid);

            instance.GetShipList();
        }