本文整理汇总了C#中System.Item.AddAttributeRange方法的典型用法代码示例。如果您正苦于以下问题:C# Item.AddAttributeRange方法的具体用法?C# Item.AddAttributeRange怎么用?C# Item.AddAttributeRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Item
的用法示例。
在下文中一共展示了Item.AddAttributeRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestGetItemAttributeExpression
public void TestGetItemAttributeExpression()
{
var item = new Item("test", 14, 1, 2, 3, 4);
const int ATTRIBUTE_ID = 1;
const double ATTRIBUTE_VALUE = 15.0;
var attribute = new Attribute(item, ATTRIBUTE_ID, "testAttribute", true , true, ATTRIBUTE_VALUE);
item.AddAttributeRange(new[] {attribute});
var e = new GetItemAttributeExpression(new ConstantExpression(item), new ConstantExpression(ATTRIBUTE_ID));
e.Execute(_context, _stack);
Assert.IsTrue(attribute == ((IEnumerable<IAttribute>)_stack.Pop()).Single());
Assert.IsFalse(_stack.Any());
}
示例2: TestGetItemAttributeValueExpression
public void TestGetItemAttributeValueExpression()
{
var item = new Item("test", 14, 1, 2,3, 4);
const int ATTRIBUTE_ID = 1;
const double ATTRIBUTE_VALUE = 15.0;
item.AddAttributeRange(new[] {new Attribute(item, ATTRIBUTE_ID, "testAttribute", true, true, ATTRIBUTE_VALUE)});
var e = new GetItemAttributeValueExpression(new ConstantExpression(item), new ConstantExpression(ATTRIBUTE_ID));
e.Execute(_context, _stack);
Assert.AreEqual(ATTRIBUTE_VALUE, _stack.Pop());
Assert.IsFalse(_stack.Any());
}
示例3: TestLocationAndSkillRequirementInternal
private void TestLocationAndSkillRequirementInternal(int attributeId)
{
int skillType = 3000 + attributeId;
var item = new Item();
item.AddAttributeRange(new[] { new Attribute(item, attributeId, "requiredSkill", true , true, skillType), });
var item2 = new Item();
item2.AddAttributeRange(new[] { new Attribute(item2, 0, "invalid", true, true, skillType), });
var item3 = new Item();
item3.AddAttributeRange(new[] { new Attribute(item3, attributeId, "requiredSkill", true, true, skillType), });
_ship.InstalledItems.Add(item);
_ship.InstalledItems.Add(item2);
_ship.InstalledItems.Add(item3);
var e = new LocationAndSkillRequirementSelectorExpression(new ConstantExpression(_ship), new ConstantExpression(skillType));
e.Execute(_context, _stack);
var items = ((IEnumerable<Item>) _stack.Pop()).ToArray();
Assert.IsFalse(_stack.Any());
Assert.AreEqual(2, items.Count());
Assert.AreSame(item, items.First());
Assert.AreSame(item3, items.Skip(1).First());
}