本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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");
}
}
示例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;
}
}
示例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 ());
}
示例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;
}
示例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;
}
示例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
//.........这里部分代码省略.........
示例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());
}