當前位置: 首頁>>代碼示例>>C#>>正文


C# Runebook.Delete方法代碼示例

本文整理匯總了C#中Server.Items.Runebook.Delete方法的典型用法代碼示例。如果您正苦於以下問題:C# Runebook.Delete方法的具體用法?C# Runebook.Delete怎麽用?C# Runebook.Delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Items.Runebook的用法示例。


在下文中一共展示了Runebook.Delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddRunebook

		public bool AddRunebook(Mobile m, Runebook book, bool message)
		{
			if (m == null || m.Deleted || book == null || book.Deleted)
			{
				return false;
			}

			bool mrb = Insensitive.Equals(book.GetType().Name, "InternalRunebook");

			if (book.Entries.Count == 0)
			{
				if (!mrb && message)
				{
					m.SendMessage("That rune book is empty.");
				}

				return false;
			}

			if (Entries.Count >= Entries.Capacity)
			{
				if (!mrb && message)
				{
					m.SendMessage("The category \"{0}\" can't hold more runes.", _Name);
				}

				return false;
			}

			if (Entries.Count + book.Entries.Count > Entries.Capacity)
			{
				if (!mrb && message)
				{
					m.SendMessage("That rune book won't fit in the category \"{0}\".", _Name);
				}

				return false;
			}

			var bEntries = new Queue<RunebookEntry>(book.Entries);

			Entries.ForEach(
				(e, x, y) =>
				{
					if (e != null || bEntries.Count <= 0)
					{
						return;
					}

					var be = bEntries.Dequeue();

					Entries.SetContent(x, y, new RuneCodexEntry(book.Name, be.Description, be.Location.ToMapPoint(be.Map)));
				});

			if (mrb)
			{
				book.Entries.Clear();
				return true;
			}

			book.Delete();

			if (message)
			{
				m.SendMessage("You add the rune book to the category \"{0}\".", _Name);
			}

			return true;
		}
開發者ID:greeduomacro,項目名稱:UO-Forever,代碼行數:69,代碼來源:RuneCodexCategory.cs


注:本文中的Server.Items.Runebook.Delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。