Cjfidler Cjfidler - 1 year ago 74
C# Question

Adding Ebook Support to a Game

I'm looking to add ebook support (.pdf .txt .epub .mobi .rtf Support) to a game I'm making in Unity using C#. Thing is I really do not know where to start when it comes to this and most of my google searches have gotten me nothing but Ebooks about programming or game development. So I'm hoping someone here would have a good idea where I could start and/or information that would help set me in the right direction.

Answer Source

So just to summarize my comments on the OP:

With the least amount of work, embedding a web browser control like Webkit is probably the best option. It should properly read all the common filetypes you mentioned, save for .epub and .mobi. A separate library or control will need to be obtained or coded for those to work. Additionally, if the user already has a default program set up to open those filetypes, you can open them outside of the game with Process.Start(...) which is part of the System.Diagnostics namespace.

If it comes down to you having to code this yourself, a PDF is just drawn graphics on a canvas, txt is just raw text data, and an rtf is text data with some markup to get the formatting right. Coding a component that opens those for you should not be abnormally difficult.