示例#1
0
    public void SpawnTutorial()
    {
        if (currentTutorialPanel != null)
        {
            currentTutorialPanel.MakeDisappear();
        }
        if (currentArrow != null)
        {
            currentArrow.MakeDisappear();
        }

        currentTutorialPanel = Instantiate(tutorialPanelPrefab).GetComponent <TutorialPanel>();

        Tutorial current = tutorials[tutorialIndex];

        currentTutorialPanel.Title.text = current.Title;
        currentTutorialPanel.Body.text  = current.Body;
        if (current.Skip != "")
        {
            currentTutorialPanel.Skip.text = current.Skip;
        }

        RectTransform rectTransform = currentTutorialPanel.GetComponent <RectTransform>();

        rectTransform.SetParent(UI.Instance.gameObject.GetComponent <RectTransform>());
        rectTransform.localPosition = tutorialPanelPrefab.transform.localPosition;//Vector3.zero;

        if (current.ArrowPrefab != null)
        {
            currentArrow = Instantiate(current.ArrowPrefab).GetComponent <Arrow>();
            RectTransform arrowRect = currentArrow.GetComponent <RectTransform>();
            arrowRect.SetParent(UI.Instance.gameObject.GetComponent <RectTransform>());
            arrowRect.localPosition = current.ArrowPoint;
        }
        else
        {
            currentArrow = null;
        }

        tutorialActions[tutorialIndex].Invoke();
    }