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


C# Rectangle2D.Contains方法代码示例

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


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

示例1: CheckSoulForge

        public static bool CheckSoulForge(Mobile from, int range, bool message)
        {
            PlayerMobile m = from as PlayerMobile;

            ImbuingContext context = Imbuing.GetContext(m);
            context.Imbue_SFBonus = 0;
            Map map = from.Map;

            if (map == null)
                return false;

            bool isQueenForge = false;
            bool isForge = false;
            bool isMiniForge = false;

            IPooledEnumerable eable = map.GetItemsInRange(from.Location, range);

            foreach (Item item in eable)
            {
                if (!isQueenForge)
                    isQueenForge = (item.ItemID >= 0x4263 && item.ItemID <= 0x4272); // Queens SoulForge (+5% bonus & easier unravels)

                if (!isForge)
                    isForge = (item.ItemID >= 0x4277 && item.ItemID <= 0x4286); // Standard SoulForge

                if (!isMiniForge)
                    isMiniForge = (item.ItemID >= 17607 && item.ItemID <= 17610); // Gargoyle Mini SoulForge
            }

            eable.Free();
            Rectangle2D rec = new Rectangle2D(792, 3472, 9, 9);

            if (isForge && from.Region != null && from.Region.IsPartOf("Royal City") && rec.Contains(from.Location))
                context.Imbue_SFBonus = 5;

            if (from is PlayerMobile && isQueenForge)
            {
                int level = ((PlayerMobile)from).Level;

                if (level < PlayerMobile.Noble)
                {
                    if (message)
                        from.SendMessage("You must be of Noble loyalty to the Queen in order to use this forge.");
                    return false;
                }
                else
                    context.Imbue_SFBonus = 10;
            }

            if (!isQueenForge && !isForge && !isMiniForge)
            {
                if (message)
                    from.SendLocalizedMessage(1079787); // You must be near a soulforge to imbue an item.
                return false;
            }

            return true;
        }
开发者ID:Ziden,项目名称:ServUO-EC-Test-Fork,代码行数:58,代码来源:Imbuing.cs

示例2: IsValidLocation

        public static bool IsValidLocation(Point3D p)
        {
            /*foreach (Rectangle2D rec in m_MagGrowBounds)
            {
                if (rec.Contains(p))
                    return true;
            }*/
            foreach (Rectangle2D rec in m_NoGrowZones)
            {
                if (rec.Contains(p))
                    return false;
            }

            foreach (Rectangle2D rec in MaginciaLottoSystem.MagHousingZones)
            {
                Rectangle2D newRec = new Rectangle2D(rec.X - 2, rec.Y - 2, rec.Width + 4, rec.Height + 7);

                if (newRec.Contains(p))
                    return false;
            }

            return true;
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:23,代码来源:MaginciaPlantSystem.cs


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