本文整理汇总了C#中ShipConstruct类的典型用法代码示例。如果您正苦于以下问题:C# ShipConstruct类的具体用法?C# ShipConstruct怎么用?C# ShipConstruct使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ShipConstruct类属于命名空间,在下文中一共展示了ShipConstruct类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HackStrutCData
private static void HackStrutCData(ShipConstruct ship, Part p,
int part_base)
{
//Debug.Log (String.Format ("[EL] before {0}", p.customPartData));
string[] Params = p.customPartData.Split (';');
for (int i = 0; i < Params.Length; i++) {
string[] keyval = Params[i].Split (':');
string Key = keyval[0].Trim ();
string Value = keyval[1].Trim ();
if (Key == "tgt") {
string[] pnameval = Value.Split ('_');
string pname = pnameval[0];
int val = int.Parse (pnameval[1]);
if (val == -1) {
Strut strut = new Strut (p, Params);
if (strut.target != null) {
val = ship.parts.IndexOf (strut.target);
}
}
if (val != -1) {
val += part_base;
}
Params[i] = "tgt: " + pname + "_" + val.ToString ();
break;
}
}
p.customPartData = String.Join ("; ", Params);
//Debug.Log (String.Format ("[EL] after {0}", p.customPartData));
}
开发者ID:GlassFragments,项目名称:Extraplanetary-Launchpads,代码行数:29,代码来源:StrutFixer.cs
示例2: KCT_BuildListVessel
public KCT_BuildListVessel(ShipConstruct s, String ls, double bP, String flagURL)
{
ship = s;
shipNode = s.SaveShip();
shipName = s.shipName;
//Get total ship cost
float dry, fuel;
s.GetShipCosts(out dry, out fuel);
cost = dry + fuel;
TotalMass = 0;
foreach (Part p in s.Parts)
{
TotalMass += p.mass;
TotalMass += p.GetResourceMass();
}
launchSite = ls;
buildPoints = bP;
progress = 0;
flag = flagURL;
if (launchSite == "LaunchPad")
type = ListType.VAB;
else
type = ListType.SPH;
InventoryParts = new Dictionary<string, int>();
id = Guid.NewGuid();
cannotEarnScience = false;
}
开发者ID:fingerboxes,项目名称:KCT,代码行数:28,代码来源:KCT_BuildListVessel.cs
示例3: CaptureThumbnail
public static void CaptureThumbnail(ShipConstruct ship, int resolution,
float elevation, float azimuth, float pitch, float heading, float fov, string saveFolder, string craftName)
{
Log.Info ("CaptureThumbnail elevation: " + elevation.ToString () + " azimuth: " + azimuth.ToString () + "pitch: " + pitch.ToString () +
" heading: " + heading.ToString () + " fov: " + fov.ToString ());
CraftThumbnail.TakeSnaphot(ship, resolution, saveFolder, craftName, elevation, azimuth, pitch, heading, fov);
}
开发者ID:linuxgurugamer,项目名称:CraftImport,代码行数:7,代码来源:ThumbnailHelper.cs
示例4: CheckVessel
public void CheckVessel(ShipConstruct ship)
{
if (!MainInstance.checklistSelected)
return;
if (EditorLogic.RootPart == null || (MainInstance.partSelection == null && MainInstance.checkSelected))
{
ActiveChecklist.items.ForEach(i => i.state = false);
return;
}
if (MainInstance.checkSelected && MainInstance.partSelection != null)
partsToCheck = MainInstance.partSelection.selectedParts.Intersect(ship.Parts).ToList();
else
partsToCheck = ship.Parts;
for (int j = 0; j < activeChecklist.items.Count; j++)
//foreach (ChecklistItem item in activeChecklist.items)
{
ChecklistItem item = activeChecklist.items[j];
if (item.isManual)
continue;
item.state = true;
for (int i = 0; i < item.criteria.Count; i++)
//foreach(Criterion crton in item.criteria)
{
Criterion crton = item.criteria[i];
switch (crton.type)
{
case CriterionType.Module:
crton.met = CheckForModules(crton);
break;
case CriterionType.Part:
crton.met = CheckForParts(crton);
break;
case CriterionType.MinResourceLevel:
crton.met = CheckForResourceLevel(crton);
break;
case CriterionType.MinResourceCapacity:
crton.met = CheckForResourceCapacity(crton);
break;
case CriterionType.CrewMember:
crton.met = CheckForCrewMember(crton);
break;
}
item.criteria[i] = crton;
}
if (!item.allRequired)
{
if (item.criteria.TrueForAll(c => !c.met))
item.state = false;
}
else if (item.criteria.Any(c => !c.met))
item.state = false;
activeChecklist.items[j] = item;
continue;
}
}
开发者ID:Kerbas-ad-astra,项目名称:WernherChecker,代码行数:59,代码来源:ChecklistSystem.cs
示例5: OnLoad
private void OnLoad(ShipConstruct data0, CraftBrowser.LoadType data1)
{
if(data1 == CraftBrowser.LoadType.Normal)
{
ShipConcerns.Clear();
SectionConcerns.Clear();
}
}
开发者ID:jkoritzinsky,项目名称:Extensive-Engineer-Report,代码行数:8,代码来源:ConcernRunner.cs
示例6: EditorLoad
private void EditorLoad(ShipConstruct data0, CraftBrowser.LoadType data1)
{
switch (data1)
{
case CraftBrowser.LoadType.Merge:
RenameSections(data0);
break;
}
}
开发者ID:jkoritzinsky,项目名称:ShipSections,代码行数:9,代码来源:ShipSectionsEditorAssist.cs
示例7: LoadConstruct
public bool LoadConstruct()
{
UnloadConstruct();
construct = new ShipConstruct();
if(!construct.LoadShip(vessel_node))
{
UnloadConstruct();
return false;
}
return true;
}
开发者ID:pjslauta,项目名称:hangar,代码行数:11,代码来源:VesselWrappers.cs
示例8: HackStruts
public static void HackStruts(ShipConstruct ship, int part_base)
{
var all_struts = ship.parts.OfType<StrutConnector>();
var struts = all_struts.Where (p => p.customPartData != "");
foreach (Part part in struts) {
HackStrutCData (ship, part, part_base);
}
var all_fuelLines = ship.parts.OfType<FuelLine>();
var fuelLines = all_fuelLines.Where (p => p.customPartData != "");
foreach (Part part in fuelLines) {
HackStrutCData (ship, part, part_base);
}
}
开发者ID:GlassFragments,项目名称:Extraplanetary-Launchpads,代码行数:13,代码来源:StrutFixer.cs
示例9: KCT_BuildListVessel
public KCT_BuildListVessel(String name, String ls, double bP, String flagURL, float spentFunds)
{
ship = new ShipConstruct();
launchSite = ls;
shipName = name;
buildPoints = bP;
progress = 0;
flag = flagURL;
if (launchSite == "LaunchPad")
type = ListType.VAB;
else
type = ListType.SPH;
InventoryParts = new List<string>();
cannotEarnScience = false;
cost = spentFunds;
}
开发者ID:ntwest,项目名称:KCT,代码行数:16,代码来源:KCT_BuildListVessel.cs
示例10: GetAABB
// Thanks to taniwha's Extraplanetary launchpads!
public Bounds GetAABB(ShipConstruct a_Ship)
{
PartHeightQuery partHeight = null;
Bounds aabb = new Bounds();
bool initialize = true;
for (int i = 0; i < a_Ship.parts.Count; i++)
{
Part currentPart = a_Ship[i];
Collider[] colliders = currentPart.transform.FindChild("model").GetComponentsInChildren<Collider>();
for (int j = 0; j < colliders.Length; j++)
{
Collider currentCollider = colliders[j];
if (currentCollider.gameObject.layer != 21 && currentCollider.enabled) // Not sure where the 21 is coming from, have to ask taniwha
{
if (initialize)
{
initialize = false;
aabb = currentCollider.bounds;
}
else
{
aabb.Add(currentCollider.bounds);
}
float lowest = currentCollider.bounds.min.y;
if(partHeight == null)
{
partHeight = new PartHeightQuery(lowest);
}
partHeight.lowestPoint = Mathf.Min(partHeight.lowestPoint, lowest);
if(partHeight.lowestOnParts.ContainsKey(currentPart))
{
partHeight.lowestOnParts[currentPart] = Mathf.Min(partHeight.lowestOnParts[currentPart], lowest);
}
}
}
}
for(int i = 0; i < a_Ship.parts.Count; i++)
{
a_Ship[i].SendMessage("OnPutToGround", partHeight, SendMessageOptions.DontRequireReceiver);
}
return new Bounds();
}
开发者ID:MauriceH1,项目名称:KSP_MobileConstruction,代码行数:48,代码来源:VesselWrapper.cs
示例11: PlaceShip
public Transform PlaceShip(ShipConstruct a_Ship, Bounds a_Bounds)
{
Transform launchTransform = GetLaunchTransform();
float angle;
Vector3 axis;
launchTransform.rotation.ToAngleAxis(out angle, out axis);
Part rootPart = a_Ship.parts[0].localRoot;
Vector3 pos = rootPart.transform.position;
Vector3 shift = new Vector3(-pos.x, -a_Bounds.min.y, -pos.z);
shift += launchTransform.position;
rootPart.transform.Translate(shift, Space.World);
rootPart.transform.RotateAround(launchTransform.position, axis, angle);
return launchTransform;
}
开发者ID:MauriceH1,项目名称:KSP_MobileConstruction,代码行数:19,代码来源:MobileConstructionPort.cs
示例12: OnEditorShipModified
private void OnEditorShipModified(ShipConstruct shipConstruct)
{
if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || ResearchAndDevelopment.Instance == null)
return;
int maxParts = maxPartCount();
if (shipConstruct.Parts.Count > maxParts)
{
warningMsg = "This vessel has too many parts to be built and launched at the current tech level.\nCurrent maximum is " + maxParts + ", this vessel has " + shipConstruct.Parts.Count + " parts.";
//ScreenMessages.PostScreenMessage(warningMsg, 15F, ScreenMessageStyle.UPPER_CENTER);
lockLaunchButton = true;
} else {
warningMsg = "";
if (shipConstruct.Parts.Count > 0)
lockLaunchButton = false;
else
lockLaunchButton = true;
}
}
开发者ID:GrJo,项目名称:KSPTinkerTech2,代码行数:21,代码来源:PartCountLaunchLimiter.cs
示例13: KCT_BuildListVessel
public KCT_BuildListVessel(ShipConstruct s, String ls, double bP, String flagURL)
{
ship = s;
shipNode = s.SaveShip();
shipName = s.shipName;
//Get total ship cost
float fuel;
cost = s.GetShipCosts(out emptyCost, out fuel);
TotalMass = s.GetShipMass(out emptyMass, out fuel);
launchSite = ls;
buildPoints = bP;
progress = 0;
flag = flagURL;
if (s.shipFacility == EditorFacility.VAB)
type = ListType.VAB;
else if (s.shipFacility == EditorFacility.SPH)
type = ListType.SPH;
else
type = ListType.None;
InventoryParts = new Dictionary<string, int>();
id = Guid.NewGuid();
cannotEarnScience = false;
}
开发者ID:Kerbas-ad-astra,项目名称:KCT,代码行数:24,代码来源:KCT_BuildListVessel.cs
示例14: WaitAndRebuildList
private IEnumerator WaitAndRebuildList (ShipConstruct ship)
{
yield return null;
buildCost = null;
parts_count = 0;
if (ship == null || ship.parts == null || ship.parts.Count < 1
|| ship.parts[0] == null) {
yield break;
}
if (ship.parts.Count > 0) {
Part root = ship.parts[0].localRoot;
buildCost = new BuildCost ();
addPart (root);
foreach (Part p in root.GetComponentsInChildren<Part>()) {
if (p != root) {
addPart (p);
}
}
}
}
开发者ID:tfischer4765,项目名称:Extraplanetary-Launchpads,代码行数:24,代码来源:ShipInfo.cs
示例15: onEditorVesselModified
/// <summary>
/// Event callback for when vessel is modified in the editor. Used to know when the gui-fields for this module have been updated.
/// </summary>
/// <param name="ship"></param>
public void onEditorVesselModified(ShipConstruct ship)
{
if (!HighLogic.LoadedSceneIsEditor) { return; }
bool updated = false;
if (prevEditorTankHeightAdjust != editorTankHeightAdjust)
{
prevEditorTankHeightAdjust = editorTankHeightAdjust;
float newHeight = editorTankHeight + (tankHeightIncrement * editorTankHeightAdjust);
newHeight *= (currentTankDiameter / defaultTankDiameter);
updateTankHeightFromEditor(newHeight, true);
updated = true;
}
if (prevEditorTankDiameterAdjust != editorTankDiameterAdjust)
{
prevEditorTankDiameterAdjust = editorTankDiameterAdjust;
float newDiameter = editorTankDiameter + (editorTankDiameterAdjust * tankDiameterIncrement);
setTankDiameterFromEditor(newDiameter, true);
updated = true;
}
if (!updated)
{
updateNodePositions(true);
}
}
开发者ID:Joshg213,项目名称:SSTULabs,代码行数:28,代码来源:SSTUCustomUpperStage.cs
示例16: EditorShipModified
private void EditorShipModified(ShipConstruct construct)
{
SetupGUI();
UpdateFields();
}
开发者ID:blowfishpro,项目名称:B9PartSwitch,代码行数:5,代码来源:ModuleB9PartInfo.cs
示例17: ResetEditorEvent
private void ResetEditorEvent(ShipConstruct construct)
{
if (EditorLogic.RootPart != null)
{
List<Part> partsList = EditorLogic.SortedShipList;
for (int i = 0; i < partsList.Count; i++)
UpdateGeometryModule(partsList[i]);
}
RequestUpdateVoxel();
}
开发者ID:Nitebomber,项目名称:Ferram-Aerospace-Research-x64-hack,代码行数:12,代码来源:EditorGUI.cs
示例18: onEditorShipModified
void onEditorShipModified(ShipConstruct ship)
{
StartCoroutine (WaitAndUpdate ());
}
开发者ID:taniwha,项目名称:DynamicIVA,代码行数:4,代码来源:PartModelSwitch.cs
示例19: onEditorVesselModified
/// <summary>
/// Event callback for when vessel is modified in the editor. Used to know when the gui-fields for this module have been updated.
/// </summary>
/// <param name="ship"></param>
public void onEditorVesselModified(ShipConstruct ship)
{
if (!HighLogic.LoadedSceneIsEditor) { return; }
if (editorPrevTankDiameterAdjust != editorTankDiameterAdjust)
{
editorPrevTankDiameterAdjust = editorTankDiameterAdjust;
float newDiameter = editorTankWholeDiameter + (editorTankDiameterAdjust * tankDiameterIncrement);
setTankDiameterFromEditor(newDiameter, true);
}
else
{
updateAttachNodes(true);
}
}
开发者ID:SixDasher,项目名称:SSTULabs,代码行数:18,代码来源:SSTUModularFuelTank.cs
示例20: CreatePart
public static Part CreatePart(AvailablePart avPart, Vector3 position, Quaternion rotation, Part flagFromPart)
{
UnityEngine.Object obj = UnityEngine.Object.Instantiate(avPart.partPrefab);
if (!obj)
{
KAS_Shared.DebugError("CreatePart(Crate) Failed to instantiate " + avPart.partPrefab.name);
return null;
}
Part newPart = (Part)obj;
newPart.gameObject.SetActive(true);
newPart.gameObject.name = avPart.name;
newPart.partInfo = avPart;
newPart.highlightRecurse = true;
newPart.SetMirror(Vector3.one);
ShipConstruct newShip = new ShipConstruct();
newShip.Add(newPart);
newShip.SaveShip();
newShip.shipName = avPart.title;
newShip.shipType = 1;
VesselCrewManifest vessCrewManifest = new VesselCrewManifest();
Vessel currentVessel = FlightGlobals.ActiveVessel;
Vessel v = newShip.parts[0].localRoot.gameObject.AddComponent<Vessel>();
v.id = Guid.NewGuid();
v.vesselName = newShip.shipName;
v.Initialize(false);
v.Landed = true;
v.rootPart.flightID = ShipConstruction.GetUniqueFlightID(HighLogic.CurrentGame.flightState);
v.rootPart.missionID = flagFromPart.missionID;
v.rootPart.flagURL = flagFromPart.flagURL;
//v.rootPart.collider.isTrigger = true;
//v.landedAt = "somewhere";
Staging.beginFlight();
newShip.parts[0].vessel.ResumeStaging();
Staging.GenerateStagingSequence(newShip.parts[0].localRoot);
Staging.RecalculateVesselStaging(newShip.parts[0].vessel);
FlightGlobals.SetActiveVessel(currentVessel);
v.SetPosition(position);
v.SetRotation(rotation);
// Solar panels from containers don't work otherwise
for (int i = 0; i < newPart.Modules.Count; i++)
{
ConfigNode node = new ConfigNode();
node.AddValue("name", newPart.Modules[i].moduleName);
newPart.LoadModule(node, ref i);
}
return newPart;
}
开发者ID:ACCBizon,项目名称:KAS,代码行数:58,代码来源:KAS_Shared.cs
注:本文中的ShipConstruct类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论