本文整理匯總了C#中System.Drawing.Rectangle.Intersects方法的典型用法代碼示例。如果您正苦於以下問題:C# Rectangle.Intersects方法的具體用法?C# Rectangle.Intersects怎麽用?C# Rectangle.Intersects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Rectangle
的用法示例。
在下文中一共展示了Rectangle.Intersects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ListQuest
public static void ListQuest(CommandArgs args)
{
QPlayer Player = QTools.GetPlayerByID(args.Player.Index);
if (Player.IsLoggedIn)
{
Rectangle ply = new Rectangle((int)args.Player.X / 16, (int)args.Player.Y / 16, 1, 1);
string availquests = "Available Quests: ";
foreach (QuestRegion qr in QMain.QuestRegions)
{
if (ply.Intersects(qr.Area))
{
foreach (Quest q in qr.Quests)
{
QuestPlayerData data = QTools.GetPlayerQuestData(q.Name, Player);
if (QTools.AbleToRunQuest(q) && (q.MinQuestsNeeded == 0 || q.MinQuestsNeeded <= QTools.GetQuestsCompleted(Player.MyDBPlayer.QuestPlayerData)) && (q.MaxAttemps == 0 || data == null || QTools.GetPlayerQuestData(q.Name, Player).Attempts < q.MaxAttemps))
{
availquests = availquests + q.Name + ", ";
}
}
}
}
if (availquests != "Available Quests: ")
{
availquests = availquests.Substring(0, availquests.Length - 2);
Player.TSPlayer.SendMessage(availquests, Color.Magenta);
Player.TSPlayer.SendMessage("Use /startquest [Quest Name], to begin that quest", Color.Magenta);
}
else
Player.TSPlayer.SendMessage("No Available Quests", Color.Red);
}
else
Player.TSPlayer.SendMessage("You are not Logged in", Color.Red);
}
示例2: AtXY
public static bool AtXY(int x, int y, QPlayer Player, int radius = 1)
{
Rectangle rec, playerrec;
rec = new Rectangle(x - radius, y - radius, radius * 2, radius * 2);
playerrec = new Rectangle((int)Player.TSPlayer.X / 16, (int)Player.TSPlayer.Y / 16, 1, 1);
return rec.Intersects(playerrec);
}
示例3: StartQuest
public static void StartQuest(CommandArgs args)
{
QPlayer Player = QTools.GetPlayerByID(args.Player.Index);
if (Player.IsLoggedIn)
{
Rectangle ply = new Rectangle((int)args.Player.X / 16, (int)args.Player.Y / 16, 1, 1);
bool questfound = false;
foreach (QuestRegion qr in QMain.QuestRegions)
{
if (ply.Intersects(qr.Area))
{
foreach (Quest q in qr.Quests)
{
QuestPlayerData data = QTools.GetPlayerQuestData(q.Name, Player);
if (QTools.AbleToRunQuest(q) && (q.MinQuestsNeeded == 0 || q.MinQuestsNeeded <= QTools.GetQuestsCompleted(Player.MyDBPlayer.QuestPlayerData)) && q.Name.ToLower() == args.Parameters[0].ToLower() && (q.MaxAttemps == 0 || data == null || QTools.GetPlayerQuestData(q.Name, Player).Attempts < q.MaxAttemps))
{
questfound = true;
break;
}
}
}
if (questfound)
break;
}
if (questfound)
{
if (!Player.NewQuest(QTools.GetQuestByName(args.Parameters[0])))
Player.TSPlayer.SendMessage("Quest already running.", Color.Red);
}
else
Player.TSPlayer.SendMessage("Quest not found.", Color.Red);
}
else
Player.TSPlayer.SendMessage("You are not Logged in", Color.Red);
}