當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。