当前位置: 首页>>代码示例>>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;未经允许,请勿转载。