Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various enhancements for books #2

Merged
merged 2 commits into from
Dec 27, 2016
Merged

Various enhancements for books #2

merged 2 commits into from
Dec 27, 2016

Conversation

iojw
Copy link
Member

@iojw iojw commented Dec 26, 2016

This add various page and text editing controls to the Books screen:

Most of the controls are self-explanatory, but Copy generates a sample prefab based on the text you have in the book and adds it to your clipboard, similar to StructuralTemplates. No Gson, so I had to make use of some string manipulation for this. To implement the editing controls, I also had to make changes to some parts of the system, such as the page indexing and updating.

For the editing controls to appear, you need to possess an item with an EditBooksComponent in your inventory. I've added a Quill item, which contains this component. In the future, this could be expanded to other types of writing implements - coloured ink, permanent ink, limited ink, invisible ink. The possibilities are endless! 馃槃

Also added the properties readOnly and title to BookComponent. Titles are displayed on the cover of the book, along with a text about the current status (Editing, Reading or Read-only)

I'm not exactly sure about the title and I'm open to any suggestions. Is adding the property to BookComponent redundant? Maybe it would just be better to use the display name instead? Or should we just do away with the title altogether?

And various misc fixes:

  • Buttons only appear when they are usable.
  • Players receive some basic items when they spawn
  • Cleaned up the old prefabs since they were outdated and the icons were not showing in hand

Let me know if there are problems with any of these 馃檪.

Potential ideas to implement

  • Add support for images in books
  • Limit bookcases to books only (seems this was the intended behaviour but just never got implemented after the overhaul). I took a look at this and it seems the relevant code is in InventoryCell. Unlike before, there's no event sent when an item is transferred, so for this to be implemented, InventoryCell might need to be modified.
  • Pagination. I think the problem with this might be the lack of space in the current interface. I was thinking about moving the two arrows to the left and right sides of the book and then adding the page numbers where they currently are.

iojw added 2 commits December 26, 2016 17:51
Add ability to edit books in the book screen, requires an item with EditsBooksComponent
Add Quill, which contains EditBooksComponent
Add readOnly and title to BookComponent
Add ability to copy book as prefab
Rework page turning and button visibility mechanics
Players now receive basic starting items on spawn
Added README and build.gradle
@Cervator Cervator merged commit c35462b into Terasology:master Dec 27, 2016
@Cervator
Copy link
Member

Works wonderfully! Spotted some minor issues, some of which predate your changes, I'm going to submit those as separate issues so they can be fixed whenever :-)

  • You can place the cursor on the front book cover side when you have page one visible. Can't actually edit anything with the cursor there, so really low priority, more of a simple display issue. Maybe it is problematic to fix since on inner pages you need to be able to place the cursor there.
  • The item placement on spawn take out any existing items (clears out the inventory) yet the new items added actually start in slots that were empty to begin with. Unsure if that's actually an inventory bug instead of anything related to Books. I think I'll take out the clearing since then you could enable Books as an additive module and it won't block any other content (like the regular items from Core)
  • The module still ships with its own default font, yet trying to switch our to our standard Noto results in empty pages. Huh.

@iojw
Copy link
Member Author

iojw commented Dec 27, 2016

@Cervator Yeah, the cursor is something I found annoying but it's hard to fix given the all UIText widgets draw the cursor no matter what. We might need to modify UIText to be able to specify no cursor drawn to fix this.

As for the inventory, thanks for the fix, oversight on my part. But now that I think about it, I didn't really notice it since the behaviour wasn't consistent. Most of the times, when I started a new world with the Books module, I still received the Core Gameplay starting items. Hmm, might be because the order in which they're called differs each time.

Will fix the rest soon 馃檪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants