TutorialManager dialogue system - WEKIT-ECS/MIRAGE-XR GitHub Wiki

a self-contained tutorial that does not interfere with the working code.

tutor_

To specify which button to select (copy) in the tutorial, use the TutorialItem class id to determine which button to copy interactableObject - link to Button or Toggle isPartOfScrollView - if part of the scroll - so that the scroll will automatically move up image

The tutorial queue can be saved in json if it is long. id to determine which button to copy message to be displayed in the window position - top, mid or bot

    public void ShowHelpView()
    {
        var queue = new Queue<TutorialModel>();
        queue.Enqueue(new TutorialModel { id = "tutorial_1_1", message = "1 message" });
        queue.Enqueue(new TutorialModel { id = "tutorial_1_2", message = "2 message", position = TutorialModel.MessagePosition.Bottom });
        queue.Enqueue(new TutorialModel { id = "tutorial_1_3", message = "3 message", position = TutorialModel.MessagePosition.Top });

        _tutorial.Show(queue);
        //PopupsViewer.Instance.Show(_helpPrefab);
    }

works with situations where there is no button yet. The tutorial will wait for it to appear.

    private async Task<TutorialItem> FindTutorialItem(string id)
    {
        for (int i = 0; i < MAX_TRY_COUNT; i++)
        {
            foreach (var searchRoot in _searchRoots)
            {
                var items = searchRoot.GetComponentsInChildren<TutorialItem>();
                if (items == null)
                {
                    continue;
                }

                var item = items.FirstOrDefault(t => t.id == id);
                if (item)
                {
                    return item;
                }
            }

            await Task.Delay(WAIT_IN_MILLISECONDS);
        }

        return null;
    }

It will also track the movement of the original button.

    private void SetUpCopy(TutorialItem item, TutorialItem copy)
    {
        if (item.button)
        {
            copy.button.onClick.RemoveAllListeners();
            copy.button.onClick.AddListener(() => OnCopyClicked(item, copy));
        }

        if (item.toggle)
        {
            copy.toggle.onValueChanged.RemoveAllListeners();
            copy.toggle.onValueChanged.AddListener(value => OnCopyClicked(item, copy));
        }

        copy.StartTracking(item.transform);
    }