Forum rules - please read before posting.

document and journal design

Hi, I'm trying to design how to create stuff what I want I don't seem to fully understand the journal concept. Is it so that document is a fixed design and you can't add pages into it? But then again document can have journal elements in it. How free could I be in journal design? Can I just create a template as a prefab and attach it into journal? So the pages would be quite different.
I have already thought of pages like "normal" journal, where there's couple of tasks player should do and a explaining image with it, a page with three notes and player can click and select two similar elements - like date - on two notes and then a fourth note would be created out of the players selections - so select two out of three to verify what you want and a page with some photos with clickable areas for player to select to create conversation choises.
I'm not sure if I could do them all with journal or maybe I should create separate menus and link them with menu changes.
Any ideas?

Comments

  • Think of a Journal like a diary that the Player character writes as they progress - it can have a set of default pages, but can be added to over the course over the game.

    A Document, on the other hand, display a fixed set of text - but the Player can view/collect multiple of them over the course of the game, and (optionally) view all they've collected in a list.

    By themselves, though, Journals/Documents are not interactive - they just display text. You still need to rely on Button elements to add interactivity, and Graphic elements to display images/photos.

    Through scripting, this can be automated - so that e.g. each page has an associated texture that is used to update a Graphic element based on which page is open. For that specific behaviour, see this wiki script.

    A similar technique can be used to hide/show Buttons based on which document or page is open.

    If you make use of Unity UI, you also have the option of using animation to control the layout/display of you Menu - for example, update the Sprite inside an Image component, hide/show a Button, etc. If you made animations for each of the possible "layouts", then you could wire them up to an Integer parameter in your Animator, and then have a script that updates that parameter value based on the index of the currently-open page:

    using UnityEngine;
    using AC;
    
    public class AnimatedJournal : MonoBehaviour
    {
    
        [SerializeField] private Animator _animator;
        [SerializeField] private string pageParameter = "Page";
        [SerializeField] private string journalMenuName = "Journal";
        [SerializeField] private string journalElementName = "PageText";
    
        private void OnEnable ()
        {
            EventManager.OnMenuTurnOn += OnMenuTurnOn;
            EventManager.OnMenuElementShift += OnMenuElementShift;
        }
    
        private void OnDisable ()
        {
            EventManager.OnMenuTurnOn -= OnMenuTurnOn;
            EventManager.OnMenuElementShift -= OnMenuElementShift;
        }
    
        private void OnMenuTurnOn (Menu menu, bool isInstant)
        {
            if (menu.title == journalMenuName)
            {
                UpdatePageTexture ();
            }
        }
    
        private void OnMenuElementShift (MenuElement _element, AC_ShiftInventory shiftType)
        {
            if (_element.title == journalElementName)
            {
                UpdatePageTexture ();
            }
        }
    
        private void UpdatePageTexture ()
        {
            MenuJournal journal = PlayerMenus.GetElementWithName (journalMenuName, journalElementName) as MenuJournal;
            int pageIndex = journal.showPage - 1;
            _animator.SetInteger (pageParameter, pageIndex);
        }
    
    }
    
  • Thanks, I think I'll go with linked documents. Can I change the crossfade target by script or are they fixed? And maybe I should cut images into mosaic pieces, so that I could add buttons where I want and still have the ability to variate the size.

  • Can I change the crossfade target by script or are they fixed?

    From a Button menu element?

    Through script, any Manager field can be changed at runtime. Just click the field's label in the Menu Manager to get an API reference to it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.