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


C# Scene.AddAttribute方法代码示例

本文整理汇总了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"));
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:13,代码来源:SceneTests.cs

示例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"));
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:14,代码来源:SceneTests.cs

示例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;
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:24,代码来源:KglGameStorage.cs

示例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)
            );
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:13,代码来源:CommandTests.cs

示例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);
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:13,代码来源:SceneTests.cs


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