本文整理汇总了C#中ContractConfigurator.ConfiguredContract类的典型用法代码示例。如果您正苦于以下问题:C# ConfiguredContract类的具体用法?C# ConfiguredContract怎么用?C# ConfiguredContract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfiguredContract类属于ContractConfigurator命名空间,在下文中一共展示了ConfiguredContract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
int level = (int)Math.Round(ScenarioUpgradeableFacilities.GetFacilityLevel(facility) *
ScenarioUpgradeableFacilities.GetFacilityLevelCount(facility)) + 1;
return level == 0 && contract != null && contract.ContractState == Contracts.Contract.State.Active ||
level >= minLevel && level <= maxLevel;
}
示例2: OnLoad
public override void OnLoad(ConfigNode node)
{
try
{
foreach (ConfigNode child in node.GetNodes("CONTRACT"))
{
ConfiguredContract contract = null;
try
{
contract = new ConfiguredContract();
Contract.Load(contract, child);
}
catch (Exception e)
{
LoggingUtil.LogWarning(this, "Ignored an exception while trying to load a pre-loaded contract:");
LoggingUtil.LogException(e);
}
if (contract != null && contract.contractType != null)
{
contract.preLoaded = true;
contracts.Add(contract);
}
}
}
catch (Exception e)
{
LoggingUtil.LogError(this, "Error loading ContractPreLoader from persistance file!");
LoggingUtil.LogException(e);
ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "ContractPreLoader");
}
}
示例3: WaypointGenerator
/// <summary>
/// Copy constructor.
/// </summary>
public WaypointGenerator(WaypointGenerator orig, ConfiguredContract contract)
: base()
{
foreach (WaypointData old in orig.waypoints)
{
// Copy waypoint data
for (int i = 0; i < old.count; i++)
{
WaypointData wpData = new WaypointData(old, contract);
waypoints.Add(wpData);
// Set the name
if (old.names.Any())
{
wpData.waypoint.name = (old.names.Count() == 1 ? old.names.First() : old.names.ElementAtOrDefault(i));
}
if (string.IsNullOrEmpty(wpData.waypoint.name) || wpData.waypoint.name.ToLower() == "site")
{
wpData.waypoint.name = StringUtilities.GenerateSiteName(random.Next(), wpData.waypoint.celestialBody, !wpData.waterAllowed);
}
}
}
initialized = orig.initialized;
orig.initialized = false;
this.contract = contract;
Initialize();
}
示例4: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
// Perform another validation of the target body to catch late validation issues due to expressions
if (!ValidateTargetBody())
{
return false;
}
// Validate the CelestialBodySubtree exists
CelestialBodySubtree cbProgress = GetCelestialBodySubtree();
if (cbProgress == null)
{
LoggingUtil.LogError(this, ": ProgressNode for targetBody " + targetBody.bodyName + " not found.");
return false;
}
if (checkType == CheckType.MANNED)
{
return cbProgress.IsReached && cbProgress.IsCompleteManned;
}
else if (checkType == CheckType.UNMANNED)
{
return cbProgress.IsReached && cbProgress.IsCompleteUnmanned;
}
return true;
}
示例5: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
foreach (string tech in techs)
{
ProtoTechNode techNode = ResearchAndDevelopment.Instance.GetTechState(tech);
if (techNode == null || techNode.state != RDTech.State.Available)
{
return false;
}
}
foreach (string partModule in partModules)
{
bool hasModule = false;
foreach (AvailablePart part in PartLoader.LoadedPartsList)
{
if (part.partPrefab == null || part.partPrefab.Modules == null)
{
continue;
}
if (ResearchAndDevelopment.PartTechAvailable(part))
{
hasModule = true;
break;
}
}
if (!hasModule)
{
return false;
}
}
foreach (string partModuleType in partModuleTypes)
{
bool hasType = false;
foreach (AvailablePart part in PartLoader.LoadedPartsList)
{
if (part.partPrefab == null || part.partPrefab.Modules == null)
{
continue;
}
if (part.partPrefab.HasValidContractObjective(partModuleType) && ResearchAndDevelopment.PartTechAvailable(part))
{
hasType = true;
break;
}
}
if (!hasType)
{
return false;
}
}
return true;
}
示例6: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
// Late validation
partModuleType.All(Validation.ValidatePartModuleType);
// Actual check
return partModuleType.All(s => ProgressUtilities.HaveModuleTypeTech(s));
}
示例7: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
foreach (AvailablePart part in parts)
{
if (!ResearchAndDevelopment.PartModelPurchased(part))
{
return false;
}
}
return true;
}
示例8: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
// Perform another validation of the target body to catch late validation issues due to expressions
if (!ValidateTargetBody())
{
return false;
}
double coverageInPercentage = SCANsatUtil.GetCoverage(SCANsatUtil.GetSCANtype(scanType), targetBody);
return coverageInPercentage >= minCoverage && coverageInPercentage <= maxCoverage;
}
示例9: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
foreach (string tech in techs)
{
ProtoTechNode techNode = ResearchAndDevelopment.Instance.GetTechState(tech);
if (techNode == null || techNode.state != RDTech.State.Available)
{
return false;
}
}
return true;
}
示例10: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
bool requirementMet = true;
foreach (ContractRequirement requirement in childNodes)
{
if (requirement.enabled)
{
requirementMet &= requirement.CheckRequirement(contract);
}
}
return requirementMet;
}
示例11: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
LoggingUtil.LogVerbose(this, "Checking requirement");
// Perform another validation of the target body to catch late validation issues due to expressions
if (!ValidateTargetBody())
{
return false;
}
return RemoteTechProgressTracker.Instance.ActiveRange(targetBody) > range;
}
示例12: GenerateContract
public bool GenerateContract(ConfiguredContract contract)
{
LoggingUtil.LogVerbose(this, "Request to generate contract of prestige level " + contract.Prestige);
ConfiguredContract templateContract = GetNextContract(contract.Prestige, HighLogic.LoadedScene == GameScenes.FLIGHT);
if (templateContract == null)
{
return false;
}
// Copy the contract details
contract.CopyFrom(templateContract);
return true;
}
示例13: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
// Perform another validation of the target body to catch late validation issues due to expressions
if (!ValidateTargetBody())
{
return false;
}
if (ResourceScenario.Instance == null)
{
return false;
}
return ResourceScenario.Instance.gameSettings.GetPlanetScanInfo().Where(psd => psd.PlanetId == targetBody.flightGlobalsIndex).Any();
}
示例14: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
// Cache the tech tree
if (techTree == null)
{
ConfigNode techTreeRoot = ConfigNode.Load(HighLogic.CurrentGame.Parameters.Career.TechTreeUrl);
if (techTreeRoot != null)
{
techTree = techTreeRoot.GetNode("TechTree");
}
if (techTreeRoot == null || techTree == null)
{
LoggingUtil.LogError(this, "Couldn't load tech tree from " + HighLogic.CurrentGame.Parameters.Career.TechTreeUrl);
return false;
}
}
foreach (string tech in techs)
{
ConfigNode techNode = techTree.GetNodes("RDNode").Where(n => n.GetValue("id") == tech).FirstOrDefault();
if (techNode == null)
{
LoggingUtil.LogWarning(this, "No tech node found with id '" + tech + "'");
return false;
}
// Get the state of the parents, as well as the anyToUnlock flag
bool anyToUnlock = ConfigNodeUtil.ParseValue<bool>(techNode, "anyToUnlock");
IEnumerable<bool> parentsUnlocked = techNode.GetNodes("Parent").
Select(n => ResearchAndDevelopment.Instance.GetTechState(n.GetValue("parentID"))).
Select(p => p != null && p.state == RDTech.State.Available);
// Check if the parents have met the unlock criteria
if (anyToUnlock && parentsUnlocked.Any(unlocked => unlocked) ||
!anyToUnlock && parentsUnlocked.All(unlocked => unlocked))
{
continue;
}
else
{
return false;
}
}
return true;
}
示例15: Generate
public override ContractBehaviour Generate(ConfiguredContract contract)
{
// Set legacy values
if (legacy)
{
kerbals = passengerName.Select(name => new Kerbal(gender, name, experienceTrait)).ToList();
}
// Set the kerbal type
foreach (Kerbal kerbal in kerbals)
{
kerbal.kerbalType = kerbalType;
}
return new SpawnPassengers(kerbals, count);
}