当前位置: 首页>>代码示例>>C#>>正文


C# Items.BaseBook类代码示例

本文整理汇总了C#中Server.Items.BaseBook的典型用法代码示例。如果您正苦于以下问题:C# BaseBook类的具体用法?C# BaseBook怎么用?C# BaseBook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BaseBook类属于Server.Items命名空间,在下文中一共展示了BaseBook类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PublishedBook

		public PublishedBook(BaseBook book) : base(book.ItemID, book.Title, book.Author, book.PagesCount, book.Writable)
		{
			// copy book
			Weight = book.Weight;
			Name = book.Name;
			Hue = book.Hue;
			for(int i = 0; i < Pages.Length; i++)
				Pages[i] = book.Pages[i];
			RePublish();
			m_LastPublished = m_FirstPublished;
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:11,代码来源:PublishedBook.cs

示例2: IsEmpty

		public static bool IsEmpty( BaseBook book )
		{
			foreach ( BookPageInfo page in book.Pages )
			{
				foreach ( string line in page.Lines )
				{
					if ( line.Trim().Length != 0 )
						return false;
				}
			}
			return true;
		}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:12,代码来源:Inscribe.cs

示例3: Copy

		public static void Copy( BaseBook bookSrc, BaseBook bookDst )
		{
			bookDst.Title = bookSrc.Title;
			bookDst.Author = bookSrc.Author;

			BookPageInfo[] pagesSrc = bookSrc.Pages;
			BookPageInfo[] pagesDst = bookDst.Pages;
			for ( int i = 0; i < pagesSrc.Length && i < pagesDst.Length; i++ )
			{
				BookPageInfo pageSrc = pagesSrc[i];
				BookPageInfo pageDst = pagesDst[i];

				int length = pageSrc.Lines.Length;
				pageDst.Lines = new string[length];

				for ( int j = 0; j < length; j++ )
					pageDst.Lines[j] = pageSrc.Lines[j];
			}
		}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:19,代码来源:Inscribe.cs

示例4: SetUser

		private static void SetUser( BaseBook book, Mobile mob )
		{
			m_UseTable[book] = mob;
		}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:4,代码来源:Inscribe.cs

示例5: BookPageDetails

        public BookPageDetails(BaseBook book)
            : base(0x66)
        {
            this.EnsureCapacity(256);

            this.m_Stream.Write((int)book.Serial);
            this.m_Stream.Write((ushort)book.PagesCount);

            for (int i = 0; i < book.PagesCount; ++i)
            {
                BookPageInfo page = book.Pages[i];

                this.m_Stream.Write((ushort)(i + 1));
                this.m_Stream.Write((ushort)page.Lines.Length);

                for (int j = 0; j < page.Lines.Length; ++j)
                {
                    byte[] buffer = Utility.UTF8.GetBytes(page.Lines[j]);

                    this.m_Stream.Write(buffer, 0, buffer.Length);
                    this.m_Stream.Write((byte)0);
                }
            }
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:24,代码来源:BaseBook.cs

示例6: InternalTargetDst

			public InternalTargetDst( BaseBook bookSrc ) : base ( 3, false, TargetFlags.None )
			{
				m_BookSrc = bookSrc;
			}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:4,代码来源:Inscribe.cs

示例7: BookPageDetailsForTheIlliterate

        public BookPageDetailsForTheIlliterate( BaseBook book )
            : base(0x66)
        {
            EnsureCapacity( 256 );

            m_Stream.Write( (int)    book.Serial );
            m_Stream.Write( (ushort) 1 ); // All burns must fit on one page

            string[] lines = {
                "Hello,",
                "prime",
                "minister"
            };

            m_Stream.Write( (ushort) (1) );
            m_Stream.Write( (ushort) lines.Length );

            for ( int j = 0; j < lines.Length; ++j )
            {
                byte[] buffer = Utility.UTF8.GetBytes( lines[j] );

                m_Stream.Write( buffer, 0, buffer.Length );
                m_Stream.Write( (byte) 0 );
            }
        }
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:25,代码来源:BaseBook.cs

示例8: 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

示例9: CopyFromBook

 public bool CopyFromBook(BaseBook book)
 {
     if (IsFull)
     {
         return false;
     }
     m_Author = book.Author;
     m_Title = book.Title;
     m_Pages = (BookPageInfo[])book.Pages.Clone();
     InvalidateProperties();
     return true;
 }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:12,代码来源:BaseReadBook.cs

示例10: Copy

        public static void Copy( BaseBook bookSrc, BaseBook bookDst, Mobile from )
        {
            bookDst.Title = bookSrc.Title;
            bookDst.Author = bookSrc.Author;

            BookPageInfo[] pagesSrc = bookSrc.Pages;
            BookPageInfo[] pagesDst = bookDst.Pages;
            for ( int i = 0; i < pagesSrc.Length && i < pagesDst.Length; i++ )
            {
                BookPageInfo pageSrc = pagesSrc[i];
                BookPageInfo pageDst = pagesDst[i];

                int length = pageSrc.Lines.Length;
                pageDst.Lines = new string[length];

                for ( int j = 0; j < length; j++ )
                    pageDst.Lines[j] = pageSrc.Lines[j];
            }

            /* mod */
            if ( bookSrc is HTMLBook && bookDst is HTMLBook )
            {
                HTMLBook bookSource = bookSrc as HTMLBook;
                HTMLBook bookDestination = bookDst as HTMLBook;
                if ( bookSource.CharactersPerLineMax == bookDestination.CharactersPerLineMax &&
                    bookSource.MaxLines == bookDestination.MaxLines )
                {
                    if ( bookSource.RequiresFormatting )
                    {
                        bookSource.FixContent();
                        bookSource.RequiresFormatting = false;
                    }
                    /* copy all html style-related data to the target book
                     members are not cloned, but that's irrelevant, because we never modify them anywhere */
                    bookDestination.HTMLContent.WordsTable = new Dictionary<int, List<HTMLTag>>( bookSource.HTMLContent.WordsTable );
                    bookDestination.HTMLContent.LinesTable = new Dictionary<int, List<HTMLTag>>( bookSource.HTMLContent.LinesTable );
                    bookDestination.HTMLContent.PagesTable = new Dictionary<int, List<HTMLTag>>( bookSource.HTMLContent.PagesTable );
                    bookDestination.HTMLContent.Body = new List<HTMLTag>( bookSource.HTMLContent.Body );
                    bookDestination.HTMLContent.HTMLPage = new Dictionary<int, int>( bookSource.HTMLContent.HTMLPage );
                    bookDestination.HTMLContent.HTMLLines = new Dictionary<int, int>( bookSource.HTMLContent.HTMLLines );
                    bookDestination.FixContent();
                    bookDestination.FixStyling();
                    bookDestination.HTMLContent.UpdateCache();
                    bookDestination.RequiresFormatting = false;
                    bookDestination.Writable = bookSource.Writable;
                    if ( bookDestination.Writable == false )
                        bookDestination.SealedBy = from;
                    bookDestination.Cypher = bookSource.Cypher;
                    bookDestination.Language = bookSource.Language;
                }
                else
                {
                    bookDestination.FixContent();
                    from.SendMessage( "Because the books have different page dimensions, you've been able to copy the content, but not the styles." );
                }
            }
            else if ( bookDst is HTMLBook ) // copying from normal -> htmlbook
            {
                ((HTMLBook)bookDst).RequiresFormatting = true;
            }
            /* mod end */
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:62,代码来源:Inscribe.cs

示例11: BookGump

 public BookGump( Mobile from, BaseBook book )
     : base( 150, 200 )
 {
     if ( book != null )
     {
         m_Book = book;
         AddBackground();
         AddTitlePage();
         AddText();
     }
 }
开发者ID:zerodowned,项目名称:angelisland,代码行数:11,代码来源:BookGump.cs

示例12: BaseReadBook

        public BaseReadBook(ReadBookInfo bookInfo, int pageCount, String title, String author, BaseBook sourceBook)
            : base(bookInfo.ItemID)
        {
            m_Background = bookInfo.BackgroundID;
            m_CustomArt = bookInfo.CustomArt;
            m_BigBook = bookInfo.BigBook;
            BookContent content = this.DefaultContent;

            if (sourceBook != null)
            {
                m_Author = sourceBook.Author;
                m_Title = sourceBook.Title;
                m_Pages = (BookPageInfo[])sourceBook.Pages.Clone();
                m_Full = true;
            }
            else
            {
                if (content == null)
                {
                    m_Pages = new BookPageInfo[pageCount];
                    for (int i = 0; i < m_Pages.Length; ++i)
                        m_Pages[i] = new BookPageInfo();
                }
                else
                {
                    m_Title = content.Title;
                    m_Author = content.Author;
                    m_Pages = content.Copy();
                }                
                
            }
            if (author != null)
            {
                m_Author = author;
            }
            if (title != null)
            {
                m_Title = title;
            }
            if ((author != null) && (title != null))
            {
                m_Full = true;
            }
            Weight = BookWeight;
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:45,代码来源:BaseReadBook.cs

示例13: GetUser

		public static Mobile GetUser( BaseBook book )
		{
			Mobile m;
			m_UseTable.TryGetValue( book, out m );
			return m;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:6,代码来源:Inscribe.cs

示例14: StartCS

		private static void StartCS( Mobile from, BaseBook book )
		{
			from.SendMessage( "Writing book to C# file..." );

			try
			{
				string writetitle = String.Format( "Book{0}", book.Serial );

				if ( !Directory.Exists( "CSBooks/" ) )
					Directory.CreateDirectory( "CSBooks/" );

				string filepath = Path.Combine( String.Format( "CSBooks/{0}.cs", writetitle ) );

				if ( File.Exists( filepath ) )
					from.SendMessage( "File already exists for this book.  Dupe this item to change its serial." );
				else
				{
					using ( StreamWriter op = new StreamWriter( filepath ) )
					{
						op.WriteLine("using System;" );
						op.WriteLine("using Server;" );
						op.WriteLine();
						op.WriteLine("namespace Server.Items" );
						op.WriteLine("{" );
						op.WriteLine("	public class {0} : BaseBook", writetitle );
						op.WriteLine("	{" );
						op.WriteLine("		public static readonly BookContent Content = new BookContent" );
						op.WriteLine("			(" );
						op.WriteLine("				\"{0}\", \"{1}\",", book.Title, String.IsNullOrEmpty( book.Author ) ? "unknown" : book.Author );
						BookPageInfo[] pages = book.Pages;
						int lastpage = 0;
						for ( int i = pages.Length-1;i >= 0; i-- )
						{
							if ( pages[i].Lines.Length > 0 ) //This page has something on it
							{
								lastpage = i;
								break;
							}
						}

						for ( int i = 0;i < lastpage; i++ )
						{
							BookPageInfo pageinfo = pages[i];
						op.WriteLine("				new BookPageInfo" );
						op.WriteLine("				(" );
							for ( int j = 0; j < pageinfo.Lines.Length; j++ )
						op.WriteLine("					\"{0}\"{1}", pageinfo.Lines[j], j < pageinfo.Lines.Length-1 ? "," : "" );
						op.WriteLine("				){0}", i < pages.Length-1 ? "," : "" );
						}
						op.WriteLine("			);" );
						op.WriteLine();
						op.WriteLine("		public override BookContent DefaultContent{ get{ return Content; } }" );
						op.WriteLine();
						op.WriteLine("		[Constructable]" );
						op.WriteLine("		public {0}() : base( {1}, false )", writetitle, book.ItemID );
						op.WriteLine("		{" );
						op.WriteLine("			LootType = LootType.Blessed;" );
						op.WriteLine("		{" );
						op.WriteLine("		public {0}( Serial serial ) : base( serial )", writetitle );
						op.WriteLine("		{" );
						op.WriteLine("		}" );
						op.WriteLine();
						op.WriteLine("		public override void Serialize( GenericWriter writer )" );
						op.WriteLine("		{" );
						op.WriteLine("			base.Serialize( writer );");
						op.WriteLine("			writer.WriteEncodedInt( (int)0 ); // version");
						op.WriteLine("		}" );
						op.WriteLine();
						op.WriteLine("		public override void Deserialize( GenericReader reader )" );
						op.WriteLine("		{" );
						op.WriteLine("			base.Deserialize( reader );" );
						op.WriteLine("			int version = reader.ReadEncodedInt();" );
						op.WriteLine("		}" );
						op.WriteLine("	}" );
						op.WriteLine("}" );
					}
					from.SendMessage( "finished." );
				}
			}
			catch ( Exception e )
			{
				from.SendMessage( "failed. {0}", e.ToString() );
			}
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:84,代码来源:Book2CS.cs

示例15: Publish

		private void Publish(Mobile contributor, BaseBook book)
		{
			PublishedBook publishedBook = book as PublishedBook;
			if(publishedBook != null)
			{
				publishedBook.AddContributor(contributor.Name);
				Republish(contributor, publishedBook);
				return;
			}

			// change into published book
			publishedBook = new PublishedBook(book);
			publishedBook.AddContributor(contributor.Name);
			if(!publishedBook.IsPublishable())
			{
				publishedBook.Delete();
				this.SayTo(contributor, "You might want to try writing something of interest first.");
			}
			else if(XmlBook.Save(publishedBook))
			{
                switch (Utility.Random( 3 ) )
                {
                    case 0:
                    {
                        contributor.AddToBackpack(new Gold(1500, 3000));
                        this.SayTo(contributor, "This seems to be a excellent material. Let me see... hm... here - your royalty. You should see the story soon. I am sure it will sell well.");
                        contributor.SendMessage("You receive a good amount of gold.");
                        if (m_Sound)
                            Effects.PlaySound(contributor.Location, contributor.Map, 0x2E5);
                        contributor.AddToBackpack(publishedBook);
                        book.Delete();
                        break;
                    }

                    case 1:
                    {
                        contributor.AddToBackpack(new Gold(1000, 1250));
                        this.SayTo(contributor, "This seems to be decent material. Let me see... hm... here - your royalty. You should see the story soon. I hope it will sell well.");
                        contributor.SendMessage("You receive a decent amount of gold.");
                        if (m_Sound)
                            Effects.PlaySound(contributor.Location, contributor.Map, 0x2E5);
                        contributor.AddToBackpack(publishedBook);
                        book.Delete();
                        break;
                    }

                    case 2: 
                    {
                        contributor.AddToBackpack(new Gold(100, 500));
                        this.SayTo(contributor, "I don't know if this is good enough to be sold, but let me see... hm... here - I can't give you more for this. I am not sure it will sell at all.");
                        contributor.SendMessage("You receive some gold.");
                        if (m_Sound)
                            Effects.PlaySound(contributor.Location, contributor.Map, 0x2E5);
                        contributor.AddToBackpack(publishedBook);
                        book.Delete();
                        break;
                    }

                  
                }


            }
			else
			{
				publishedBook.Delete();
				this.SayTo(contributor, "Our machines are not working right. Check back later.");
			}
		}
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:69,代码来源:Publisher.cs


注:本文中的Server.Items.BaseBook类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。