本文整理汇总了C#中ContractConfigurator.ConfiguredContract类的典型用法代码示例。如果您正苦于以下问题:C# ConfiguredContract类的具体用法?C# ConfiguredContract怎么用?C# ConfiguredContract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfiguredContract类属于ContractConfigurator命名空间,在下文中一共展示了ConfiguredContract类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:7,代码来源:FacilityRequirement.cs
示例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");
}
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:32,代码来源:ContractPreLoader.cs
示例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();
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:31,代码来源:WaypointGenerator.cs
示例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;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:27,代码来源:ProgressCelestialBodyRequirement.cs
示例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;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:59,代码来源:TechResearchedRequirement.cs
示例6: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
// Late validation
partModuleType.All(Validation.ValidatePartModuleType);
// Actual check
return partModuleType.All(s => ProgressUtilities.HaveModuleTypeTech(s));
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:8,代码来源:PartModuleTypeUnlockedRequirement.cs
示例7: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
foreach (AvailablePart part in parts)
{
if (!ResearchAndDevelopment.PartModelPurchased(part))
{
return false;
}
}
return true;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:11,代码来源:PartUnlockedRequirement.cs
示例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;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:11,代码来源:SCANsatCoverageRequirement.cs
示例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;
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:12,代码来源:TechResearchedRequirement.cs
示例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;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:12,代码来源:All.cs
示例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;
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:12,代码来源:ActiveVesselRangeRequirement.cs
示例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;
}
开发者ID:Amorymeltzer,项目名称:ContractConfigurator,代码行数:14,代码来源:ContractPreLoader.cs
示例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();
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:15,代码来源:PerformOrbitalSurveyRequirement.cs
示例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;
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:48,代码来源:CanResearchTechRequirement.cs
示例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);
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:16,代码来源:SpawnPassengersFactory.cs
示例16: LoadBehaviour
/// <summary>
/// Loads a behaviour from a ConfigNode.
/// </summary>
/// <param name="configNode"></param>
/// <param name="contract"></param>
/// <returns></returns>
public static ContractBehaviour LoadBehaviour(ConfigNode configNode, ConfiguredContract contract)
{
// Determine the type
string typeName = configNode.GetValue("type");
Type type = ContractConfigurator.GetAllTypes<ContractBehaviour>().Where(t => t.FullName == typeName).FirstOrDefault();
if (type == null)
{
throw new Exception("No ContractBehaviour with type = '" + typeName + "'.");
}
// Instantiate and load
ContractBehaviour behaviour = (ContractBehaviour)Activator.CreateInstance(type);
behaviour.contract = contract;
behaviour.Load(configNode);
return behaviour;
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:22,代码来源:ContractBehaviour.cs
示例17: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
IEnumerable<ProtoCrewMember> crew = HighLogic.CurrentGame.CrewRoster.Crew;
// Filter by trait
if (trait != null)
{
crew = crew.Where<ProtoCrewMember>(cm => cm.experienceTrait.TypeName == trait);
}
// Filter by experience
crew = crew.Where<ProtoCrewMember>(cm => cm.experienceLevel >= minExperience && cm.experienceLevel <= maxExperience);
// Check counts
int count = crew.Count();
return count >= minCount && count <= maxCount;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:17,代码来源:HasAstronautRequirement.cs
示例18: 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.GetType(), ": ProgressNode for targetBody " + targetBody.bodyName + " not found.");
return false;
}
return true;
}
开发者ID:ToneStack87,项目名称:ContractConfigurator,代码行数:17,代码来源:ProgressCelestialBodyRequirement.cs
示例19: RequirementMet
public override bool RequirementMet(ConfiguredContract contract)
{
int metCount = 0;
foreach (ContractRequirement requirement in childNodes)
{
if (requirement.enabled)
{
if (requirement.CheckRequirement(contract))
{
metCount++;
}
}
}
return metCount >= count;
}
开发者ID:Kerbas-ad-astra,项目名称:ContractConfigurator,代码行数:17,代码来源:AtLeasRequirement.cs
示例20: 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 (pqsCity != null)
{
latitude = targetBody.GetLatitude(pqsCity.transform.position);
longitude = targetBody.GetLongitude(pqsCity.transform.position);
pqsCity = null;
}
return SCANsatUtil.IsCovered(latitude, longitude, SCANsatUtil.GetSCANtype(scanType), targetBody);
}
开发者ID:linuxgurugamer,项目名称:ContractConfigurator,代码行数:17,代码来源:SCANsatLocationCoverageRequirement.cs
注:本文中的ContractConfigurator.ConfiguredContract类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论