当前位置: 首页>>代码示例>>C#>>正文


C# ShipConstruct.LoadShip方法代码示例

本文整理汇总了C#中ShipConstruct.LoadShip方法的典型用法代码示例。如果您正苦于以下问题:C# ShipConstruct.LoadShip方法的具体用法?C# ShipConstruct.LoadShip怎么用?C# ShipConstruct.LoadShip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShipConstruct的用法示例。


在下文中一共展示了ShipConstruct.LoadShip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadConstruct

 public bool LoadConstruct()
 {
     UnloadConstruct();
     construct = new ShipConstruct();
     if(!construct.LoadShip(vessel_node))
     {
         UnloadConstruct();
         return false;
     }
     return true;
 }
开发者ID:pjslauta,项目名称:hangar,代码行数:11,代码来源:VesselWrappers.cs

示例2: getBuildCost

		public CostReport getBuildCost (ConfigNode craft)
		{
			lockedParts = false;
			ShipConstruct ship = new ShipConstruct ();
			if (!ship.LoadShip (craft)) {
				return null;
			}
			if (!ship.shipPartsUnlocked) {
				lockedParts = true;
			}
			GameObject ro = ship.parts[0].localRoot.gameObject;
			Vessel craftVessel = ro.AddComponent<Vessel>();
			craftVessel.Initialize (true);
			if (ExSettings.B9Wings_Present) {
				if (!InitializeB9Wings (craftVessel)
					&& ExSettings.FAR_Present) {
					InitializeFARSurfaces (craftVessel);
				}
			} else if (ExSettings.FAR_Present) {
				InitializeFARSurfaces (craftVessel);
			}

			// needed for displaying optional resources during the planning
			// stage.
			craftResources = new VesselResources (craftVessel);

			BuildCost resources = new BuildCost ();

			foreach (Part p in craftVessel.parts) {
				resources.addPart (p);
			}
			craftVessel.Die ();

			return resources.cost;
		}
开发者ID:tfischer4765,项目名称:Extraplanetary-Launchpads,代码行数:35,代码来源:BuildControl.cs

示例3: BuildAndLaunchCraft

		internal void BuildAndLaunchCraft ()
		{
			// build craft
			ShipConstruct nship = new ShipConstruct ();
			nship.LoadShip (craftConfig);

			int numParts = builder.vessel.parts.Count;
			if (craftType != CraftType.SubAss)
				numParts = 0;

			string landedAt = "External Launchpad";
			string flag = flagname;
			Game game = FlightDriver.FlightStateCache;
			VesselCrewManifest crew = new VesselCrewManifest ();

			Box vessel_bounds = GetVesselBox (nship);
			launchTransform = builder.PlaceShip (nship, vessel_bounds);

			EnableExtendingLaunchClamps (nship);
			ShipConstruction.AssembleForLaunch (nship, landedAt, flag, game,
												crew);
			var FlightVessels = FlightGlobals.Vessels;
			craftVessel = FlightVessels[FlightVessels.Count - 1];

			FlightGlobals.ForceSetActiveVessel (craftVessel);
			if (builder.capture) {
				craftVessel.Splashed = craftVessel.Landed = false;
			} else {
				bool loaded = craftVessel.loaded;
				bool packed = craftVessel.packed;
				craftVessel.loaded = true;
				craftVessel.packed = false;
				craftVessel.GetHeightFromTerrain ();
				Debug.Log (String.Format ("[EL] hft {0}", craftVessel.heightFromTerrain));
				craftVessel.loaded = loaded;
				craftVessel.packed = packed;
			}

			Vector3 offset = craftVessel.transform.position - launchTransform.position;
			craftOffset = launchTransform.InverseTransformDirection (offset);
			SetupCraftResources (craftVessel);

			Staging.beginFlight ();

			if (builder.capture) {
				FlightGlobals.overrideOrbit = true;
				(builder as PartModule).StartCoroutine (CaptureCraft ());
			} else {
				state = State.Idle;
			}
		}
开发者ID:tfischer4765,项目名称:Extraplanetary-Launchpads,代码行数:51,代码来源:BuildControl.cs

示例4: MultiplayerVessel

        public MultiplayerVessel(String name)
        {
            // Save state to reload into because the stupid methods below changes them. Who the fuck changes global methods inside class methods anyway.
            Vessel activeVessel = FlightGlobals.ActiveVessel;
            List<Part> activeParts = activeVessel.parts;
            Part activeRootPart = activeVessel.rootPart;

            // ShipConstruct nship = ShipConstruction.LoadShip(name);

            ConfigNode root = ConfigNode.Load(name);
            if (root != null)
            {
                if (root.nodes.Count > 0)
                {
                    ship = new ShipConstruct();
                    ship.LoadShip(root);

                    ShipConstruction.PutShipToGround(ship, activeVessel.transform);

                    //foreach (Part p in activeVessel.parts) p.gameObject.SetActive(false);
                    Staging.SetStageCount(activeParts);

                    EditorLogic.startPod = activeRootPart;

                    activeRootPart.gameObject.SetActive(true);

                    initializeVessel();

                    isLoaded = true;
                }
            }
            else
            {
                KSPMulti.KSPMultiplayer.print("ROOT IS NULL");
            }
        }
开发者ID:TomCaserta,项目名称:KSPMulti,代码行数:36,代码来源:Main.cs

示例5: RecoverActiveVesselToStorage

        public static bool RecoverActiveVesselToStorage(KCT_BuildListVessel.ListType listType)
        {
            ShipConstruct test = new ShipConstruct();
            try
            {
                KCTDebug.Log("Attempting to recover active vessel to storage.");
                GamePersistence.SaveGame("KCT_Backup", HighLogic.SaveFolder, SaveMode.OVERWRITE);
                KCT_GameStates.recoveredVessel = new KCT_BuildListVessel(FlightGlobals.ActiveVessel);
                KCT_GameStates.recoveredVessel.type = listType;
                if (listType == KCT_BuildListVessel.ListType.VAB)
                    KCT_GameStates.recoveredVessel.launchSite = "LaunchPad";
                else
                    KCT_GameStates.recoveredVessel.launchSite = "Runway";

                //check for symmetry parts and remove those references if they can't be found
                RemoveMissingSymmetry(KCT_GameStates.recoveredVessel.shipNode);

                //test if we can actually convert it
                bool success = test.LoadShip(KCT_GameStates.recoveredVessel.shipNode);
                if (success)
                    ShipConstruction.CreateBackup(test);
                KCTDebug.Log("Load test reported success = " + success);
                if (!success)
                {
                    KCT_GameStates.recoveredVessel = null;
                    return false;
                }

                GameEvents.OnVesselRecoveryRequested.Fire(FlightGlobals.ActiveVessel);
                return true;
            }
            catch
            {
                Debug.LogError("[KCT] Error while recovering craft into inventory.");
                KCT_GameStates.recoveredVessel = null;
                ShipConstruction.ClearBackups();
                return false;
            }
        }
开发者ID:Kerbas-ad-astra,项目名称:KCT,代码行数:39,代码来源:KCT_Utilities.cs

示例6: BuildAndLaunchCraft

        internal void BuildAndLaunchCraft()
        {
            // build craft
            ShipConstruct nship = new ShipConstruct ();
            nship.LoadShip (craftConfig);

            int numParts = vessel.parts.Count;
            if (craftType != CraftType.SubAss)
                numParts = 0;

            ShipConstruction.CreateBackup (nship);

            StrutFixer.HackStruts (nship, numParts);

            Vector3 offset = nship.Parts[0].transform.localPosition;
            nship.Parts[0].transform.Translate (-offset);
            string landedAt = "External Launchpad";
            string flag = flagname;
            Game state = FlightDriver.FlightStateCache;
            VesselCrewManifest crew = new VesselCrewManifest ();

            GetLanchTransform ();
            ShipConstruction.PutShipToGround (nship, launchTransform);
            ShipConstruction.AssembleForLaunch (nship, landedAt, flag, state,
                                                crew);
            var FlightVessels = FlightGlobals.Vessels;
            craftVessel = FlightVessels[FlightVessels.Count - 1];
            offset = craftVessel.transform.position - launchTransform.position;
            craftOffset = launchTransform.InverseTransformDirection (offset);
            craftVessel.Splashed = craftVessel.Landed = false;
            SetupCraftResources (craftVessel);

            FlightGlobals.ForceSetActiveVessel (craftVessel);

            Staging.beginFlight ();

            FlightGlobals.overrideOrbit = true;
            StartCoroutine (CaptureCraft ());
        }
开发者ID:GlassFragments,项目名称:Extraplanetary-Launchpads,代码行数:39,代码来源:ExLaunchPad.cs

示例7: getBuildCost

        public BuildCost.CostReport getBuildCost(ConfigNode craft)
        {
            ShipConstruct ship = new ShipConstruct ();
            ship.LoadShip (craft);
            GameObject ro = ship.parts[0].localRoot.gameObject;
            Vessel dummy = ro.AddComponent<Vessel>();
            dummy.Initialize (true);

            craftResources = new VesselResources (dummy);

            BuildCost resources = new BuildCost ();

            foreach (Part p in ship.parts) {
                resources.addPart (p);
            }
            dummy.Die ();

            return resources.cost;
        }
开发者ID:GlassFragments,项目名称:Extraplanetary-Launchpads,代码行数:19,代码来源:ExLaunchPad.cs

示例8: getBuildCost

        public CostReport getBuildCost(ConfigNode craft)
        {
            lockedParts = false;
            ShipConstruct ship = new ShipConstruct ();
            if (!ship.LoadShip (craft)) {
                return null;
            }
            if (!ship.shipPartsUnlocked) {
                lockedParts = true;
            }
            GameObject ro = ship.parts[0].localRoot.gameObject;
            Vessel dummy = ro.AddComponent<Vessel>();
            dummy.Initialize (true);
            if (ExSettings.B9Wings_Present) {
                if (!InitializeB9Wings (dummy) && ExSettings.FAR_Present) {
                    InitializeFARSurfaces (dummy);
                }
            } else if (ExSettings.FAR_Present) {
                InitializeFARSurfaces (dummy);
            }
            if (ExSettings.KAS_Present) {
                InitializeKASContainers (dummy);
            }

            craftResources = new VesselResources (dummy);

            BuildCost resources = new BuildCost ();

            foreach (Part p in ship.parts) {
                resources.addPart (p);
            }
            dummy.Die ();

            return resources.cost;
        }
开发者ID:Alewx,项目名称:Extraplanetary-Launchpads,代码行数:35,代码来源:BuildControl.cs

示例9: drawWindow

        public override void drawWindow(int windowID)
        {
            GUIStyle mySty = new GUIStyle(GUI.skin.window);
            mySty.normal.textColor = mySty.focused.textColor = Color.white;
            mySty.hover.textColor = mySty.active.textColor = Color.yellow;
            mySty.onNormal.textColor = mySty.onFocused.textColor = mySty.onHover.textColor = mySty.onActive.textColor = Color.green;
            mySty.padding = new RectOffset(8, 8, 8, 8);

            GUILayout.BeginVertical();

            GUILayout.Label("Select an assembly");

            if (GUILayout.Button("StorePart") && EditorLogic.SelectedPart != null)
            {
                EditorLogic editor = EditorLogic.fetch;
                ShipConstruct ship = new ShipConstruct();

                Utils.addPartToShipRecursive(ship, EditorLogic.SelectedPart);

                ship.SaveShip().Save("D:/rusty.cfg");
                ShipConstruction.CaptureThumbnail(ship, "rusty_thumbs", "rusty");

                // store thumb
                KSP_rusty.Inventory.Add(ship.SaveShip());

                // root or not?
                if (EditorLogic.SelectedPart == EditorLogic.RootPart)
                {
                    KerbalGUIManager.print("[rusty] GUIInventory:StorePart: is root");
                    EditorLogic.DeletePart(EditorLogic.SelectedPart);
                }
                else
                {
                    KerbalGUIManager.print("[rusty] GUIInventory:StorePart: is not root");
                    EditorLogic.DeletePart(EditorLogic.SelectedPart);
                }
            }

            /*
            if (GUILayout.Button("Store"))
            {
                try
                {
                    EditorLogic editor = EditorLogic.fetch;
                    ShipConstruct ship = new ShipConstruct(editor.ship.shipName, editor.ship.shipFacility, editor.getSortedShipList());

                    KerbalGUIManager.print("[rusty] GUIInventory: storing");

                    try
                    {
                        inv = new ShipConstruct();
                        if (inv.LoadShip(ship.SaveShip()))
                        {
                            KerbalGUIManager.print("[rusty] GUIInventory: load OK");
                        }
                        else
                        {
                            KerbalGUIManager.print("[rusty] GUIInventory: load failed");
                        }
                    }
                    catch (Exception e)
                    {
                        KerbalGUIManager.print("Exception GUIInventory:drawWindow():Store;saveShip: " + e.Message + "\n" + e.StackTrace);
                    }

                    KerbalGUIManager.print("[rusty] GUIInventory: deleting old");
                }
                catch (Exception e)
                {
                    KerbalGUIManager.print("Exception GUIInventory:drawWindow():Store: " + e.Message + "\n" + e.StackTrace);
                }
            }
             */

            if (GUILayout.Button("Load rusty.cfg"))
            {
                ConfigNode rusty2 = ConfigNode.Load("D:/rusty.cfg");

                EditorLogic editor = null;
                ShipConstruct ship = null;

                editor = EditorLogic.fetch;
                //editor.SpawnPart(PartLoader.getPartInfoByName("mk1pod"));
                //editor.SpawnConstruct(inv);

                // fix type
                rusty2.SetValue("type", "VAB", true);
                rusty2.Save("D:/rusty2.cfg");

                ship = new ShipConstruct();
                ship.LoadShip(rusty2);
            }

            if (KSP_rusty.Inventory != null)
            {
                foreach (ConfigNode inventoryItem in KSP_rusty.Inventory) {
                    string title = "";
                    int nrOfParts = 0;

                    try
//.........这里部分代码省略.........
开发者ID:MartynasStropa,项目名称:KSP_rusty,代码行数:101,代码来源:GUIInventory.cs

示例10: LaunchShip

        public void LaunchShip()
        {
            ShipConstruct vehicle = new ShipConstruct();
            if (!vehicle.LoadShip(m_VehicleConfig)) return;

            Game fsc = FlightDriver.FlightStateCache;
            VesselCrewManifest vesselCrew = new VesselCrewManifest();

            Bounds aabb = GetAABB(vehicle);
            if (aabb.min == null) Application.Quit();
            launchData = m_ConstructionPort.PlaceShip(vehicle, aabb);

            ShipConstruction.AssembleForLaunch(vehicle, "BANAAN", null, fsc, vesselCrew);
            m_Vessel = FlightGlobals.Vessels[FlightGlobals.Vessels.Count - 1];

            FlightGlobals.ForceSetActiveVessel(m_Vessel);

            Vector3 offset = m_Vessel.transform.position - launchData.position;
            craftOffset = launchData.InverseTransformDirection(offset);

            m_Vessel.SetPosition(craftOffset, true);

            Staging.beginFlight();

            FlightGlobals.overrideOrbit = true;
            m_ConstructionPort.StartCoroutine(CaptureCraft());
        }
开发者ID:MauriceH1,项目名称:KSP_MobileConstruction,代码行数:27,代码来源:VesselWrapper.cs


注:本文中的ShipConstruct.LoadShip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。