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


C# IBlock.GetType方法代码示例

本文整理汇总了C#中IBlock.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IBlock.GetType方法的具体用法?C# IBlock.GetType怎么用?C# IBlock.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IBlock的用法示例。


在下文中一共展示了IBlock.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Invoke

        public override void Invoke(IBlock block)
        {
            Block = block;

            if (DateTime.Now > _readyTime)
            {
                PerformRandomAction();

                if (_actionWasPerformed)
                {
                    try
                    {
                        VerifyState();
                    }
                    catch
                    {
                        Logs.Add("Monkey Verification failed at " + Block.GetType());
                        throw;
                    }
                    Probability = _baseProbability;
                    _readyTime = DateTime.Now + _interval;
                }
                else
                {
                    Probability += _baseProbability < 0.1 ? 0 : (1 - Probability) / 3;
                }
            }
        }
开发者ID:Hammertime38,项目名称:BumblebeeIOS,代码行数:28,代码来源:IOSMonkey.cs

示例2: AddFaceIfSolid

        private void AddFaceIfSolid(IBlock block, IntVector3 direction)
        {
            if (block.GetType() == typeof(AirBlock)) return;

            if (!block.GetAdjacentBlockIn(direction).Info.IsSolidIn(-direction))
            {
                var offsets = block.Info.GetFaceVertexOffsets(direction);

                if (offsets != null)
                {
                    AddFaceVertices(block, offsets);
                    AddFaceTriangles();
                    AddFaceUvs(block, direction);
                }
            }
        }
开发者ID:Synestry,项目名称:Procedural,代码行数:16,代码来源:MeshData.cs

示例3: GetServices

        internal static Dictionary<string, MethodBase> GetServices(IBlock instance, string name)
        {
            Dictionary<string, MethodBase> serviceMethods = new Dictionary<string, MethodBase>();

            foreach (MethodBase method in instance.GetType().GetMethods())
            {
                object[] attrs = method.GetCustomAttributes(typeof(BlockServiceAttribute), true);

                if (attrs.Length == 1 && (method.Name == name || name == null))
                {
                    if ( serviceMethods.ContainsKey(method.Name) ) throw new Exception("Invalid Service: Repeated name: "+method.Name);

                    serviceMethods.Add(method.Name, method);
                }
            }

            return serviceMethods;
        }
开发者ID:mm-binary,项目名称:DARF,代码行数:18,代码来源:BlockHelper.cs

示例4: GetBlockInfo

        internal static string GetBlockInfo(IBlock blockBase)
        {
            //[BlockComments("Some comments")]
            //[BlockCompany("mahdix")]
            //[BlockFriendlyName("Friend")]
            //[BlockReleaseDate("121212")]

            object[] attributes = blockBase.GetType().GetCustomAttributes(true);
            BlockHandle blockId = null;
            string comments = null;
            string company = null;
            string friendlyName = null;
            string releaseDate = null;

            foreach (object item in attributes)
            {
                if (item is BlockHandleAttribute) blockId = (item as BlockHandleAttribute).BlockId;
                if (item is BlockCommentsAttribute) comments = (item as BlockCommentsAttribute).Text;
                if (item is BlockCompanyAttribute) company = (item as BlockCompanyAttribute).Text;
                if (item is BlockFriendlyNameAttribute) friendlyName = (item as BlockFriendlyNameAttribute).Text;
                if (item is BlockReleaseDateAttribute) releaseDate = (item as BlockReleaseDateAttribute).Date;
            }

            StringBuilder sb = new StringBuilder();
            sb.Append("Unique Handle: ");
            sb.Append(blockBase.Id);
            sb.Append("\r\n");

            sb.Append("Identifier: ");
            if(blockId != null ) sb.Append(blockId.ToString());
            sb.Append("\r\n");

            sb.Append("Friendly Name: ");
            if (friendlyName != null) sb.Append(friendlyName);
            sb.Append("\r\n");

            sb.Append("Comments: ");
            if (comments != null) sb.Append(comments);
            sb.Append("\r\n");

            sb.Append("Company: ");
            if (company != null) sb.Append(company);
            sb.Append("\r\n");

            sb.Append("Release Date: ");
            if (releaseDate != null) sb.Append(releaseDate);
            sb.Append("\r\n");

            return sb.ToString();
        }
开发者ID:mm-binary,项目名称:DARF,代码行数:50,代码来源:DCRFHelper.cs

示例5: getBlockId

        private BlockHandle getBlockId(IBlock block)
        {
            object[] result = block.GetType().GetCustomAttributes(typeof(BlockHandleAttribute), true);

            if (result.Length == 1)
            {
                return (result[0] as BlockHandleAttribute).BlockId;
            }

            throw new Exception("BlockId has problem");
        }
开发者ID:mm-binary,项目名称:DARF,代码行数:11,代码来源:SimpleBlockBroker.cs


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