• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Dom.ChildInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Sce.Atf.Dom.ChildInfo的典型用法代码示例。如果您正苦于以下问题:C# ChildInfo类的具体用法?C# ChildInfo怎么用?C# ChildInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChildInfo类属于Sce.Atf.Dom命名空间,在下文中一共展示了ChildInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestValidate

        public void TestValidate()
        {
            DomNodeType childType = new DomNodeType("child");
            DomNodeType parentType = new DomNodeType("parent");
            ChildInfo childInfo = new ChildInfo("child", childType, true);
            parentType.Define(childInfo);
            DomNode parent = new DomNode(parentType);
            IList<DomNode> childList = parent.GetChildList(childInfo);
            DomNode child1 = new DomNode(childType);
            DomNode child2 = new DomNode(childType);
            DomNode child3 = new DomNode(childType);

            ChildCountRule test = new ChildCountRule(1, 2);
            
            // 0 children. Not valid.
            Assert.False(test.Validate(parent, null, childInfo));

            // 1 child. Valid.
            childList.Add(child1);
            Assert.True(test.Validate(parent, null, childInfo));
            
            // 2 children. Valid.
            childList.Add(child2);
            Assert.True(test.Validate(parent, null, childInfo));

            // 3 children. Not valid.
            childList.Add(child3);
            Assert.False(test.Validate(parent, null, childInfo));

            // 0 children. Not valid.
            childList.Clear();
            Assert.False(test.Validate(parent, null, childInfo));
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:33,代码来源:TestChildCountRule.cs


示例2: TestConstructor

 public void TestConstructor()
 {
     DomNodeType type = new DomNodeType("child");
     ChildInfo info = new ChildInfo("test", type);
     DomNode test = new DomNode(type, info);
     Assert.AreSame(test.Type, type);
     Assert.AreSame(test.ChildInfo, info);
 }
开发者ID:cococo111111,项目名称:ATF,代码行数:8,代码来源:TestDomNode.cs


示例3: Slot

        public Slot(DomNode owner, ChildInfo childInfo)
        {
            if (owner == null || childInfo == null)
                throw new ArgumentNullException();

            m_owner = owner;
            m_childInfo = childInfo;
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:8,代码来源:Slot.cs


示例4: TestListConstructor

 public void TestListConstructor()
 {
     DomNodeType type = new DomNodeType("child");
     ChildInfo test = new ChildInfo("test", type, true);
     Assert.AreEqual(test.Name, "test");
     Assert.AreEqual(test.Type, type);
     Assert.True(test.IsList);
 }
开发者ID:Joxx0r,项目名称:ATF,代码行数:8,代码来源:TestChildInfo.cs


示例5: ChildPropertyDescriptor

        /// <summary>
        /// Constructor</summary>
        /// <param name="name">Property's display name</param>
        /// <param name="childInfo">ChildInfo identifying child</param>
        /// <param name="category">Category of property</param>
        /// <param name="description">Description of property</param>
        /// <param name="isReadOnly">Whether or not property is read-only</param>
        public ChildPropertyDescriptor(
            string name,
            ChildInfo childInfo,
            string category,
            string description,
            bool isReadOnly)

            : this(name, childInfo, category, description, isReadOnly, null, null)
        {
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:17,代码来源:ChildPropertyDescriptor.cs


示例6: TestEquality

        public void TestEquality()
        {
            var attrType1 = new AttributeType("xkcd", typeof(string));
            var attrInfo1 = new AttributeInfo("xkcd", attrType1);
            var domNodeType = new DomNodeType("WebComic", DomNodeType.BaseOfAllTypes);
            var childInfo1 = new ChildInfo("xkcd", domNodeType);
            attrInfo1.DefaultValue = "Firefly";
            var desc1 = new ChildAttributePropertyDescriptor(
                "xkcd", attrInfo1, childInfo1, "Category 1", "A commonly used word or phrase in the xkcd comic", true);
            int originalHashCode = desc1.GetHashCode();

            // test if two identically created property descriptors compare as being equal
            var desc2 = new ChildAttributePropertyDescriptor(
                "xkcd", attrInfo1, childInfo1, "Category 1", "A commonly used word or phrase in the xkcd comic", true);
            Assert.AreEqual(desc1, desc2);
            Assert.AreEqual(desc1.GetHashCode(), desc2.GetHashCode());

            // test category being different; oddly, although I think they should not be considered equal,
            //  the .Net PropertyDescriptor ignores the difference in category name. So, I'm guessing that
            //  the AttributePropertyDescriptor should behave the same as PropertyDescriptor.
            var desc3 = new ChildAttributePropertyDescriptor(
                "xkcd", attrInfo1, childInfo1, "Category 2", "A commonly used word or phrase in the xkcd comic", true);
            Assert.AreEqual(desc1, desc3);
            Assert.AreEqual(desc1.GetHashCode(), desc3.GetHashCode());

            // test description being different; similarly here, the .Net PropertyDescriptor doesn't care.
            var desc4 = new ChildAttributePropertyDescriptor(
                "xkcd", attrInfo1, childInfo1, "Category 1", "slightly different description", true);
            Assert.AreEqual(desc1, desc4);
            Assert.AreEqual(desc1.GetHashCode(), desc4.GetHashCode());

            // test readOnly being different; ditto for read-only flag!
            var desc5 = new ChildAttributePropertyDescriptor(
                "xkcd", attrInfo1, childInfo1, "Category 1", "A commonly used word or phrase in the xkcd comic", false);
            Assert.AreEqual(desc1, desc5);
            Assert.AreEqual(desc1.GetHashCode(), desc5.GetHashCode());

            // test that the hash code hasn't changed after using the AttributeInfo
            var attrInfo2 = new AttributeInfo("xkcd", attrType1);
            domNodeType.Define(attrInfo2);
            Assert.AreEqual(desc1.GetHashCode(), originalHashCode);

            // test that the hash code hasn't changed after creating a derived DomNodeType
            var derivedDomNodeType = new DomNodeType("ScientificWebComic", domNodeType);
            var derivedAttrInfo = new AttributeInfo("xkcd", attrType1);
            var derivedChildInfo = new ChildInfo("xkcd", derivedDomNodeType);
            derivedDomNodeType.Define(derivedAttrInfo);
            Assert.AreEqual(desc1.GetHashCode(), originalHashCode);

            // test that an AttributeInfo used in a derived DomNodeType doesn't change equality or hash code
            var desc6 = new ChildAttributePropertyDescriptor(
                "xkcd", derivedAttrInfo, derivedChildInfo, "Category 1", "A commonly used word or phrase in the xkcd comic", true);
            Assert.AreEqual(desc1, desc6);
            Assert.AreEqual(desc1.GetHashCode(), desc6.GetHashCode());
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:55,代码来源:TestChildAttributePropertyDescriptor.cs


示例7: ChildEventArgs

 /// <summary>
 /// Constructor</summary>
 /// <param name="parent">Node's parent</param>
 /// <param name="childInfo">Metadata for child</param>
 /// <param name="child">Child node</param>
 /// <param name="index">Node's index in parent</param>
 public ChildEventArgs(
     DomNode parent,
     ChildInfo childInfo,
     DomNode child,
     int index)
 {
     Parent = parent;
     ChildInfo = childInfo;
     Child = child;
     Index = index;
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:17,代码来源:ChildEventArgs.cs


示例8: ChildAttributeCollectionPropertyDescriptor

        /// <summary>
        /// Constructor</summary>
        /// <param name="name">Value's display name</param>
        /// <param name="attributeInfos">An array of meta attributes in the collection</param>
        /// <param name="childInfo">Meta element identifying child that owns the attributes</param>
        /// <param name="category">Category of property</param>
        /// <param name="description">Description of property</param>
        /// <param name="isReadOnly">Whether or not property is read-only</param>
        public ChildAttributeCollectionPropertyDescriptor(
            string name,
            AttributeInfo[] attributeInfos,
            ChildInfo childInfo,
            string category,
            string description,
            bool isReadOnly)

            : this(name, attributeInfos, childInfo, category, description, isReadOnly, null, null)
        {
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:19,代码来源:ChildAttributeCollectionPropertyDescriptor.cs


示例9: TestChildParent

        public void TestChildParent()
        {
            DomNodeType type = new DomNodeType("type");
            ChildInfo childInfo = new ChildInfo("child", type, true);
            type.Define(childInfo);

            DomNode child = new DomNode(type);
            DomNode parent = new DomNode(type);
            parent.GetChildList(childInfo).Add(child);
            Assert.AreSame(child.Parent, parent);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:11,代码来源:TestDomNode.cs


示例10: Add2DPointProperty

        /// <summary>
        /// Adds OSC addresses (one for the x-coordinate and one for the y-coordinate) for a list
        /// of DOM children that have attributes that are arrays of floats. Each array of floats
        /// represents a 2D point where the first float is the x coordinate and the second float
        /// is the y coordinate.</summary>
        /// <param name="childInfo">The child info which defines the list of children of a selected DomNode</param>
        /// <param name="childAttributeDesc">The attribute on each child that defines the array of floats</param>
        /// <param name="oscAddress">The base OSC address to use. "/x" and "/y" will be appended for
        /// the x-coordinate array and the y-coordinate array, which is how Lemur sends and receives
        /// 2-D point arrays.</param>
        /// <returns>The base OSC address, with possible changes to make it legal.</returns>
        public string Add2DPointProperty(ChildInfo childInfo, AttributePropertyDescriptor childAttributeDesc, string oscAddress)
        {
            oscAddress = OscServices.FixPropertyAddress(oscAddress);

            var xCoordDesc = new ChildListFloatingPointArrayDesc(childInfo, childAttributeDesc, 0);
            AddPropertyAddress(xCoordDesc, oscAddress + "/x");

            var yCoordDesc = new ChildListFloatingPointArrayDesc(childInfo, childAttributeDesc, 1);
            AddPropertyAddress(yCoordDesc, oscAddress + "/y");

            return oscAddress;
        }
开发者ID:vincenthamm,项目名称:ATF,代码行数:23,代码来源:LemurOscService.cs


示例11: ChildAttributePropertyDescriptor

        /// <summary>
        /// Constructor</summary>
        /// <param name="name">Value's display name</param>
        /// <param name="attributeInfo">Attribute metadata</param>
        /// <param name="childInfo">ChildInfo identifying child</param>
        /// <param name="category">Category of property</param>
        /// <param name="description">Description of property</param>
        /// <param name="isReadOnly">Whether or not property is read-only</param>
        /// <param name="editor">The editor used to edit the property</param>
        public ChildAttributePropertyDescriptor(
            string name,
            AttributeInfo attributeInfo,
            ChildInfo childInfo,
            string category,
            string description,
            bool isReadOnly,
            object editor)

            : this(name, attributeInfo, childInfo, category, description, isReadOnly, editor, null)
        {
        }
开发者ID:vincenthamm,项目名称:ATF,代码行数:21,代码来源:ChildAttributePropertyDescriptor.cs


示例12: Validate

 /// <summary>
 /// Checks that the parent DomNode has the correct # of children of the given type</summary>
 /// <param name="parent">Parent DOM node</param>
 /// <param name="child">Child DOM node; ignored</param>
 /// <param name="childInfo">Child relationship info</param>
 /// <returns>True, iff 'parent' has a valid number of children of the type associated
 /// with 'childInfo'</returns>
 public override bool Validate(DomNode parent, DomNode child, ChildInfo childInfo)
 {
     if (childInfo.IsList)
     {
         IList<DomNode> childList = parent.GetChildList(childInfo);
         int count = childList.Count;
         return
             count >= m_min &&
             count <= m_max;
     }
     // singleton child references can always be set
     return true;
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:20,代码来源:ChildCountRule.cs


示例13: TestDescendantGetRoot

        public void TestDescendantGetRoot()
        {
            DomNodeType type = new DomNodeType("type");
            ChildInfo childInfo = new ChildInfo("child", type, true);
            type.Define(childInfo);

            DomNode child = new DomNode(type);
            DomNode parent = new DomNode(type);
            DomNode grandparent = new DomNode(type);
            parent.GetChildList(childInfo).Add(child);
            grandparent.GetChildList(childInfo).Add(parent);
            Assert.AreSame(child.GetRoot(), grandparent);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:13,代码来源:TestDomNode.cs


示例14: TestValidation

        public void TestValidation()
        {
            DomNodeType type = new DomNodeType("child");
            ChildInfo test = new ChildInfo("test", type);
            CollectionAssert.IsEmpty(test.Rules);

            var rule = new SimpleChildRule();
            test.AddRule(rule);

            Utilities.TestSequenceEqual(test.Rules, rule);

            Assert.True(test.Validate(null, null));
            Assert.True(rule.Validated);
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:14,代码来源:TestChildInfo.cs


示例15: TestGetPath

        public void TestGetPath()
        {
            DomNodeType type = new DomNodeType("type");
            ChildInfo childInfo = new ChildInfo("child", type, true);
            type.Define(childInfo);

            DomNode child = new DomNode(type);
            DomNode parent = new DomNode(type);
            DomNode grandparent = new DomNode(type);
            parent.GetChildList(childInfo).Add(child);
            grandparent.GetChildList(childInfo).Add(parent);

            Utilities.TestSequenceEqual(child.GetPath(), grandparent, parent, child);
            Utilities.TestSequenceEqual(parent.GetPath(), grandparent, parent);
            Utilities.TestSequenceEqual(grandparent.GetPath(), grandparent);
        }
开发者ID:cococo111111,项目名称:ATF,代码行数:16,代码来源:TestDomNode.cs


示例16: TestValidator

        public TestValidator()
        {
            // define a tree of validation contexts
            m_childType = new DomNodeType("test");
            m_stringAttrInfo = GetStringAttribute("string");
            m_childType.Define(m_stringAttrInfo);
            m_refAttrInfo = GetRefAttribute("ref");
            m_childType.Define(m_refAttrInfo);
            m_childInfo = new ChildInfo("child", m_childType);
            m_childType.Define(m_childInfo);
            m_childType.Define(new ExtensionInfo<ValidationContext>());

            // define a distinct root type with the validator
            m_rootType = new DomNodeType("root");
            m_rootType.BaseType = m_childType;
            m_rootType.Define(new ExtensionInfo<Validator>());

            IEnumerable<AttributeInfo> attributes = m_rootType.Attributes; // freezes the types
        }
开发者ID:vincenthamm,项目名称:ATF,代码行数:19,代码来源:TestValidator.cs


示例17: Remove

        public void Remove(DomNode parent, DomNode child, ChildInfo chInfo)
        {
            NativeObjectAdapter childObject = child.As<NativeObjectAdapter>();
            NativeObjectAdapter parentObject = parent.As<NativeObjectAdapter>();

            object listIdObj = chInfo.GetTag(NativeAnnotations.NativeElement);

            if (childObject == null || parentObject == null || listIdObj == null)
                return;

            uint listId = (uint)listIdObj;
            uint typeId = (uint)chInfo.DefiningType.GetTag(NativeAnnotations.NativeType);
            ulong parentId = parentObject.InstanceId;
            ulong childId = childObject.InstanceId;
            GameEngine.ObjectRemoveChild(typeId, listId, parentId, childId);
            if (ManageNativeObjectLifeTime)
            {                
                GameEngine.DestroyObject(childObject);
            }
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:20,代码来源:NativeGameWorldAdapter.cs


示例18: TestValidator

        protected DomNodeType RootType;//derives from ChildType

        public TestValidator()
        {
            // define a tree of validation contexts
            ChildType = new DomNodeType("test");
            StringAttrInfo = GetStringAttribute("string");
            ChildType.Define(StringAttrInfo);
            RefAttrInfo = GetRefAttribute("ref");
            ChildType.Define(RefAttrInfo);
            ChildInfo = new ChildInfo("child", ChildType);
            ChildType.Define(ChildInfo);
            ChildType.Define(new ExtensionInfo<ValidationContext>());

            // define a distinct root type with the validator
            RootType = new DomNodeType("root");
            RootType.BaseType = ChildType;
            RootType.Define(new ExtensionInfo<Validator>());
            AttributeInfo overriddenInfo = GetStringAttribute("string");
            RootType.Define(overriddenInfo);

            IEnumerable<AttributeInfo> attributes = RootType.Attributes; // freezes the types
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:23,代码来源:TestValidator.cs


示例19: Insert

        public void Insert(DomNode parent, DomNode child, ChildInfo chInfo, int index)
        {
            NativeObjectAdapter childObject = child.As<NativeObjectAdapter>();
            NativeObjectAdapter parentObject = parent.As<NativeObjectAdapter>();

            object listIdObj = chInfo.GetTag(NativeAnnotations.NativeElement);

            if (childObject == null || parentObject == null || listIdObj == null)
                return;

            if (chInfo.IsList && index >= (parent.GetChildList(chInfo).Count - 1))
                index = -1;

            if (ManageNativeObjectLifeTime)
            {
                GameEngine.CreateObject(childObject);
                childObject.UpdateNativeOjbect();
            }
            System.Diagnostics.Debug.Assert(childObject.InstanceId != 0);

            uint listId = (uint)listIdObj;
            uint typeId = (uint)chInfo.DefiningType.GetTag(NativeAnnotations.NativeType);
            ulong parentId = parentObject.InstanceId;
            ulong childId = childObject.InstanceId;

            if (index >= 0)
            {
                GameEngine.ObjectInsertChild(typeId, listId, parentId, childId, index);
            }
            else
            {
                GameEngine.ObjectAddChild(typeId, listId, parentId, childId);
            }

            foreach (var node in child.Children)
            {
                Insert(child, node, node.ChildInfo, -1); // use -1 for index to indicate an append operation.
            }
        }    
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:39,代码来源:NativeGameWorldAdapter.cs


示例20: TestDataValidator

        public TestDataValidator()
        {
            m_childType = new DomNodeType("child");
            m_parentType = new DomNodeType("parent");
            m_parentType.Define(new ExtensionInfo<ValidationContext>());
            m_parentType.Define(new ExtensionInfo<DataValidator>());

            m_childCountRule = new ChildCountRule(2, 3);
            m_childInfo = new ChildInfo("child", m_childType, true);
            m_parentType.Define(m_childInfo);
            m_childInfo.AddRule(m_childCountRule);

            m_parent = new DomNode(m_parentType);
            m_parent.InitializeExtensions();

            m_validationContext = m_parent.As<ValidationContext>();

            m_child1 = new DomNode(m_childType);
            m_child2 = new DomNode(m_childType);
            m_child3 = new DomNode(m_childType);
            m_child4 = new DomNode(m_childType);
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:22,代码来源:TestDataValidator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SceneKitSessionWWDC2013.PresentationViewController类代码示例发布时间:2022-05-26
下一篇:
C# Dom.ChildEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap