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


C# BaseBook.GetWorldLocation方法代碼示例

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


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

示例1: BaseContentChange

		public static void BaseContentChange( BaseBook book, NetState state, PacketReader pvSrc )
		{
			Mobile from = state.Mobile;

			if ( book == null || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) )
				return;

			int pageCount = pvSrc.ReadUInt16();

			if ( pageCount > book.PagesCount )
				return;

			for ( int i = 0; i < pageCount; ++i )
			{
				int index = pvSrc.ReadUInt16();

				if ( index >= 1 && index <= book.PagesCount )
				{
					--index;

					int lineCount = pvSrc.ReadUInt16();

					if ( lineCount <= 8 )
					{
						string[] lines = new string[lineCount];

						for ( int j = 0; j < lineCount; ++j )
							if ( (lines[j] = pvSrc.ReadUTF8StringSafe()).Length >= 80 )
								return;

						book.Pages[index].Lines = lines;
					}
					else
					{
						return;
					}
				}
				else
				{
					return;
				}
			}
		}
開發者ID:cynricthehun,項目名稱:UOLegends,代碼行數:43,代碼來源:XmlTextEntryBook.cs

示例2: BookHeader

        public BookHeader(Mobile from, BaseBook book)
            : base(0xD4)
        {
            string title = book.Title == null ? "" : book.Title;
            string author = book.Author == null ? "" : book.Author;

            byte[] titleBuffer = Utility.UTF8.GetBytes(title);
            byte[] authorBuffer = Utility.UTF8.GetBytes(author);

            this.EnsureCapacity(15 + titleBuffer.Length + authorBuffer.Length);

            this.m_Stream.Write((int)book.Serial);
            this.m_Stream.Write((bool)true);
            this.m_Stream.Write((bool)book.Writable && from.InRange(book.GetWorldLocation(), 1));
            this.m_Stream.Write((ushort)book.PagesCount);

            this.m_Stream.Write((ushort)(titleBuffer.Length + 1));
            this.m_Stream.Write(titleBuffer, 0, titleBuffer.Length);
            this.m_Stream.Write((byte)0); // terminate

            this.m_Stream.Write((ushort)(authorBuffer.Length + 1));
            this.m_Stream.Write(authorBuffer, 0, authorBuffer.Length);
            this.m_Stream.Write((byte)0); // terminate
        }
開發者ID:FreeReign,項目名稱:forkuo,代碼行數:24,代碼來源:BaseBook.cs

示例3: ContentChange

        public static void ContentChange( NetState state, PacketReader pvSrc, BaseBook book )
        {
            Mobile from = state.Mobile;

            // MOD BEGIN
            if ( book is HTMLBook && book.RootParent != from )
                return;
            // MOD END

            if ( book == null || !book.Writable || !from.InRange( book.GetWorldLocation(), 1 ) )
                return;

            int pageCount = pvSrc.ReadUInt16();

            if ( pageCount > book.PagesCount )
                return;

            for ( int i = 0; i < pageCount; ++i )
            {
                int index = pvSrc.ReadUInt16();

                if ( index >= 1 && index <= book.PagesCount )
                {
                    --index;

                    int lineCount = pvSrc.ReadUInt16();

                    if ( lineCount <= 8 )
                    {
                        string[] lines = new string[lineCount];

                        for ( int j = 0; j < lineCount; ++j )
                            if ( (lines[j] = pvSrc.ReadUTF8StringSafe()).Length >= 80 )
                                return;

                        book.Pages[index].Lines = lines;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    return;
                }
            }
            // MOD BEGIN
            if ( book is HTMLBook )
                ((HTMLBook)book).RequiresFormatting = true;
            // MOD END
        }
開發者ID:justdanofficial,項目名稱:khaeros,代碼行數:52,代碼來源:BaseBook.cs


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