本文整理汇总了C#中ParameterCollection.AddParameterValue方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterCollection.AddParameterValue方法的具体用法?C# ParameterCollection.AddParameterValue怎么用?C# ParameterCollection.AddParameterValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterCollection
的用法示例。
在下文中一共展示了ParameterCollection.AddParameterValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetParameters
protected override IEnumerable<Parameter> GetParameters()
{
// XXX: Here be magic numbers
const int MpBaseParamKey = 8;
var parameters = new ParameterCollection();
var bpSheet = Sheet.Collection.GetSheet<BaseParam>();
if (Maximum > 0)
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueRelativeLimited(ParameterType.Base, Amount / 100.0, Maximum));
else
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueFixed(ParameterType.Base, Amount));
// ReSharper disable once InvertIf
if (MaximumHq != Maximum && AmountHq != Amount) {
if (MaximumHq > 0)
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueRelativeLimited(ParameterType.Hq, AmountHq / 100.0, MaximumHq));
else
parameters.AddParameterValue(bpSheet[MpBaseParamKey],
new ParameterValueFixed(ParameterType.Hq, AmountHq));
}
return parameters;
}
示例2: GetParameters
protected override IEnumerable<Parameter> GetParameters() {
const int GpBaseParamKey = 10; // XXX: Magic number!
var parameters = new ParameterCollection();
var bpSheet = Sheet.Collection.GetSheet<BaseParam>();
parameters.AddParameterValue(bpSheet[GpBaseParamKey], new ParameterValueFixed(ParameterType.Base, Amount));
if (AmountHq != Amount)
parameters.AddParameterValue(bpSheet[GpBaseParamKey],
new ParameterValueFixed(ParameterType.Hq, AmountHq));
return parameters;
}
示例3: BuildPrimaryParameters
/// <summary>
/// Build the <see cref="ParameterCollection" /> containg the primary parameters of the current item.
/// </summary>
/// <returns>The <see cref="ParameterCollection" /> containg the primary parameters of the current item.</returns>
private ParameterCollection BuildPrimaryParameters()
{
var param = new ParameterCollection();
// XXX: Here be magic numbers
const int PhysicalDefenseKey = 21;
const int MagicDefenseKey = 24;
var paramSheet = Sheet.Collection.GetSheet<BaseParam>();
if (PhysicalDefense != 0)
param.AddParameterValue(paramSheet[PhysicalDefenseKey],
new ParameterValueFixed(ParameterType.Primary, PhysicalDefense));
if (MagicDefense != 0)
param.AddParameterValue(paramSheet[MagicDefenseKey],
new ParameterValueFixed(ParameterType.Primary, MagicDefense));
return param;
}
示例4: BuildPrimaryParameters
/// <summary>
/// Build the <see cref="ParameterCollection" /> containg the primary parameters of the current item.
/// </summary>
/// <returns>The <see cref="ParameterCollection" /> containg the primary parameters of the current item.</returns>
private ParameterCollection BuildPrimaryParameters()
{
var param = new ParameterCollection();
// XXX: Here be magic numbers
const int BlockStrengthKey = 17;
const int BlockRateKey = 18;
var paramSheet = Sheet.Collection.GetSheet<BaseParam>();
if (BlockStrength != 0)
param.AddParameterValue(paramSheet[BlockStrengthKey],
new ParameterValueFixed(ParameterType.Primary, BlockStrength));
if (BlockRate != 0)
param.AddParameterValue(paramSheet[BlockRateKey],
new ParameterValueFixed(ParameterType.Primary, BlockRate));
return param;
}
示例5: BuildParameters
/// <summary>
/// Build a <see cref="ParameterCollection" /> for the bonuses granted by the current consumable.
/// </summary>
/// <returns>A <see cref="ParameterCollection" /> for the bonuses granted by the current consumable.</returns>
private ParameterCollection BuildParameters()
{
const int Count = 3;
var parameters = new ParameterCollection();
for (var i = 0; i < Count; ++i) {
var param = As<BaseParam>(i);
if (param.Key == 0)
continue;
var isRel = AsBoolean("IsRelative", i);
var val = AsInt32("Value", i);
var valHq = AsInt32("Value{HQ}", i);
if (isRel) {
var max = AsInt32("Max", i);
var maxHq = AsInt32("Max{HQ}", i);
parameters.AddParameterValue(param,
max == 0
? new ParameterValueRelative(ParameterType.Base, val / 100.0)
: new ParameterValueRelativeLimited(ParameterType.Base, val / 100.0, max));
if (maxHq == max && valHq == val) continue;
parameters.AddParameterValue(param,
maxHq == 0
? new ParameterValueRelative(ParameterType.Hq, valHq / 100.0)
: new ParameterValueRelativeLimited(ParameterType.Hq, valHq / 100.0, maxHq));
} else {
parameters.AddParameterValue(param, new ParameterValueFixed(ParameterType.Base, val));
if (val != valHq)
parameters.AddParameterValue(param, new ParameterValueFixed(ParameterType.Hq, valHq));
}
}
return parameters;
}
示例6: AddParameter
/// <summary>
/// Attempt to add a parameter to a <see cref="ParameterCollection" />.
/// </summary>
/// <param name="parameters"><see cref="ParameterCollection" /> to which to add the parameters.</param>
/// <param name="type"><see cref="ParameterType" /> of the parameter to be added.</param>
/// <param name="baseParam"><see cref="BaseParam" /> for which a parameter should be added.</param>
/// <param name="value">Value of the parameter to be added.</param>
private static void AddParameter(ParameterCollection parameters,
ParameterType type,
BaseParam baseParam,
int value)
{
if (baseParam.Key == 0)
return;
parameters.AddParameterValue(baseParam, new ParameterValueFixed(type, value));
}
示例7: BuildPrimaryParameters
/// <summary>
/// Build the <see cref="ParameterCollection" /> containg the primary parameters of the current item.
/// </summary>
/// <returns>The <see cref="ParameterCollection" /> containg the primary parameters of the current item.</returns>
private ParameterCollection BuildPrimaryParameters()
{
var param = new ParameterCollection();
// XXX: Here be magic numbers
const int PhysicalDamageKey = 12;
const int MagicDamageKey = 13;
const int DelayKey = 14;
var paramSheet = Sheet.Collection.GetSheet<BaseParam>();
if (PhysicalDamage != 0)
param.AddParameterValue(paramSheet[PhysicalDamageKey],
new ParameterValueFixed(ParameterType.Primary, PhysicalDamage));
if (MagicDamage != 0)
param.AddParameterValue(paramSheet[MagicDamageKey],
new ParameterValueFixed(ParameterType.Primary, MagicDamage));
param.AddParameterValue(paramSheet[DelayKey],
new ParameterValueFixed(ParameterType.Primary, Delay.TotalSeconds));
return param;
}
示例8: BuildParameters
private ParameterCollection BuildParameters()
{
var parameters = new ParameterCollection();
var f = ItemFood;
var fHq = ItemFoodHq;
if (f == fHq)
parameters.AddRange(f.Parameters);
else {
foreach (var p in f.Parameters) {
foreach (var v in p.Where(_ => _.Type != ParameterType.Hq))
parameters.AddParameterValue(p.BaseParam, v);
}
foreach (var p in fHq.Parameters) {
foreach (var v in p.Where(_ => _.Type == ParameterType.Hq))
parameters.AddParameterValue(p.BaseParam, v);
}
}
return parameters;
}