本文整理汇总了C#中Scene.AddAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Scene.AddAttribute方法的具体用法?C# Scene.AddAttribute怎么用?C# Scene.AddAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scene
的用法示例。
在下文中一共展示了Scene.AddAttribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAttribute
public void AddAttribute()
{
bool collectionChanged = false;
Scene scene = new Scene("Test Scene");
scene.Attributes.CollectionChanged += (sender, e) => collectionChanged = true;
Attribute attribute = new Attribute("test");
scene.AddAttribute(attribute);
Assert.IsTrue(collectionChanged);
Assert.AreEqual(1, scene.Attributes.Count(x => x.Name == "test"));
}
示例2: RemoveAttribute
public void RemoveAttribute()
{
int eventsFired = 0;
Scene scene = new Scene("Test Scene");
scene.Attributes.CollectionChanged += (sender, e) => eventsFired++;
Attribute attribute = new Attribute("test");
scene.AddAttribute(attribute);
scene.RemoveAttribute(attribute);
Assert.AreEqual(2, eventsFired);
Assert.AreEqual(0, scene.Attributes.Count(x => x.Name == "test"));
}
示例3: CreateScene
private Scene CreateScene(ParseTreeNode node)
{
Scene scene = new Scene(grammar.GetName(node));
foreach (Tuple<string, object> attribute in GetProperties(node))
{
ParseTreeNode attributeNode = (ParseTreeNode)attribute.Item2;
scene.AddAttribute(new Attribute(attribute.Item1) { Value = new Value(getStrVal(attributeNode)) });
}
foreach (ParseTreeNode managerNode in grammar.GetOfType(node, grammar.Manager))
{
Manager manager = CreateManager(managerNode);
scene.AddManager(manager);
}
foreach (ParseTreeNode entityNode in grammar.GetOfType(node, grammar.Entity))
{
Entity entity = CreateEntity(entityNode, scene, false);
scene.AddEntity(entity);
}
return scene;
}
示例4: Scene_RemoveAttribute
public void Scene_RemoveAttribute()
{
var scene = new Scene("Test Scene");
var attribute = new Attribute("test");
scene.AddAttribute(attribute);
scene.SelectedAttribute = attribute;
CommandHelper.TestUndoableCommand(
() => Assert.AreEqual(1, scene.Attributes.Count),
() => scene.RemoveAttributeCommand.Execute(null),
() => Assert.AreEqual(0, scene.Attributes.Count)
);
}
示例5: SceneAttributeCannotInherit
public void SceneAttributeCannotInherit()
{
bool collectionChanged = false;
Scene scene = new Scene("Test Scene");
scene.Attributes.CollectionChanged += (o, e) => collectionChanged = true;
Attribute attribute = new Attribute("test");
scene.AddAttribute(attribute);
Assert.IsTrue(collectionChanged);
//Assert.IsFalse(attribute.CanInherit);
}