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


C# Contract.GetParameter方法代码示例

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


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

示例1: contractContainer


//.........这里部分代码省略.........
				return;
			}

			try
			{
				title = root.Title;
			}
			catch (Exception e)
			{
				Debug.LogError("[Contract Parser] Contract Title not set, using type name...\n" + e);
				title = root.GetType().Name;
			}

			try
			{
				notes = root.Notes;
			}
			catch (Exception e)
			{
				Debug.LogError("[Contract Parser] Contract Notes not set, blank notes used...\n" + e);
				notes = "";
			}

			try
			{
				briefing = root.Description;
			}
			catch (Exception e)
			{
				Debug.LogError("[Contract Parser] Contract Briefing not set, blank briefing used...\n" + e);
				briefing = "";
			}

			try
			{
				canBeDeclined = root.CanBeDeclined();
			}
			catch (Exception e)
			{
				Debug.LogError("[Contract Parser] Contract Decline state not set, using true...\n" + e);
				canBeDeclined = true;
			}

			try
			{
				canBeCancelled = root.CanBeCancelled();
			}
			catch (Exception e)
			{
				Debug.LogError("[Contract Parser] Contract Cancel state not set, using true...\n" + e);
				canBeCancelled = true;
			}

			if (root.Agent != null)
				agent = root.Agent;
			else
				agent = AgentList.Instance.GetAgentRandom();

			if (c.DateDeadline <= 0)
			{
				duration = double.MaxValue;
				daysToExpire = "----";
			}
			else
			{
				duration = root.DateDeadline - Planetarium.GetUniversalTime();
				//Calculate time in day values using Kerbin or Earth days
				daysToExpire = timeInDays(duration);
			}

			updateTimeValues();

			contractRewards();
			contractPenalties();
			contractAdvance();

			decPen = HighLogic.CurrentGame.Parameters.Career.RepLossDeclined;
			decPenString = decPen.ToString("F0");

			totalFundsReward = rewards();
			totalFundsPenalty = penalties();
			totalRepReward = repRewards();
			totalSciReward = sciRewards();
			totalRepPenalty = repPenalties();

			//Generate four layers of parameters
			for (int i = 0; i < c.ParameterCount; i++)
			{
				ContractParameter param = c.GetParameter(i);

				if (param == null)
					continue;

				addContractParam(param, 0);
			}

			CelestialBody t = getTargetBody();

			targetPlanet = t == null ? "" : t.name;
		}
开发者ID:DMagic1,项目名称:KSP_Contract_Parser,代码行数:101,代码来源:contractContainer.cs

示例2: contractContainer

        //Store info on contracts
        internal contractContainer(Contract c)
        {
            contract = c;
            showNote = false;
            title = c.Title;
            notes = c.Notes;

            if (c.DateDeadline <= 0)
            {
                duration = double.MaxValue;
                daysToExpire = "----";
            }
            else
            {
                duration = contract.DateDeadline - Planetarium.GetUniversalTime();
                //Calculate time in day values using Kerbin or Earth days
                daysToExpire = contractScenario.timeInDays(duration);
            }

            contractRewards(c);
            contractPenalties(c);

            totalReward = c.FundsCompletion;
            foreach (ContractParameter param in c.AllParameters)
                totalReward += param.FundsCompletion;

            //Generate four layers of parameters, check if each is an altitude parameter
            for (int i = 0; i < c.ParameterCount; i++)
            {
                ContractParameter param = c.GetParameter(i);
                addContractParam(param, 0);
            }

            CelestialBody t = getTargetBody();

            targetPlanet = t == null ? "" : t.name;
        }
开发者ID:sopindm,项目名称:KSP_Contract_Window,代码行数:38,代码来源:contractContainer.cs


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