コード例 #1
0
    /// <summary>
    /// Pushs new content.
    /// </summary>
    /// <param name="pushedContent">Pushed content.</param>
    public void PushContent(UINavigationContent pushedContent)
    {
        if (pushedContent != null)
        {
            //if there is at least one content then hide content
            if (_navigatableContents.Count > 0)
            {
                GetCurrentContent.gameObject.SetActive(false);
                GetCurrentContent.OnContentHide();
            }

            //push new content
            _navigatableContents.Push(pushedContent);

            pushedContent.OnContentPushed();

            pushedContent.OnContentBeginDisplay();

            //set content to display
            pushedContent.gameObject.SetActive(true);

            pushedContent.OnContentDisplay();

            UpdateTitle();

            ShouldDisplayBackButton();
        }
        else
        {
            Debug.LogError(gameObject.name + " " + this.GetType().Name + " content param is null");
        }
    }
コード例 #2
0
    /// <summary>
    /// Pop current content.
    /// </summary>
    public void PopContent()
    {
        //if current content is root don't pop
        if (GetCurrentContent == rootContent)
        {
            Debug.LogError(gameObject.name + " " + this.GetType().Name + " can not pop root content");
            return;
        }

        UINavigationContent content = GetCurrentContent;

        //pop current content
        _navigatableContents.Pop();

        content.OnContentPoped();

        content.OnContentBeginHide();

        //set current content not to display
        content.gameObject.SetActive(false);

        content.OnContentHide();

        //get previous content and set it to display
        GetCurrentContent.gameObject.SetActive(true);
        GetCurrentContent.OnContentDisplay();

        UpdateTitle();

        ShouldDisplayBackButton();
    }
コード例 #3
0
    /// <summary>
    /// Register the new content.
    /// </summary>
    /// <param name="content">Content.</param>
    public void RegisterContent(UINavigationContent content)
    {
        if (DesignedContents == null)
        {
            DesignedContents = new List <UINavigationContent>();
        }

        DesignedContents.Add(content);

        content.InitContent(this);
    }