コード例 #1
0
    private void UpdateDisplayersFromComments(Comment[] allComments)
    {
        // Remove comment displayers that are no longer tied to comments

        List <CommentDisplayer> copy = new List <CommentDisplayer>(commentDisplayers);

        foreach (CommentDisplayer cd in copy)
        {
            if (!allComments.Contains(cd.Comment))
            {
                Destroy(cd.gameObject);
                commentDisplayers.Remove(cd);
            }
        }

        // Add comment displayers for new comments

        List <Comment> existingComments = commentDisplayers.Select(c => c.Comment).ToList();

        foreach (Comment c in allComments.Except(existingComments))
        {
            GameObject       g  = Instantiate(commentDisplayerPrefab);
            CommentDisplayer cd = g.GetComponent <CommentDisplayer>();

            cd.Initialize(this, worldUI, c);
            cd.interactable = (currentLocation != null && cd.Comment.Location == currentLocation);
            commentDisplayers.Add(cd);
        }
    }
コード例 #2
0
    // Allows the AppCoordinator or ARCoordinator to "teardown" the comments state, preventing the user
    // from viewing any comments or being able to comment. This is used during most state transitions.

    public void CloseCommenting()
    {
        currentLocation        = null;
        activeCommentDisplayer = null;
        commentDisplayConfirmation.Hide();

        foreach (CommentDisplayer cd in commentDisplayers)
        {
            cd.interactable = false;
        }
        commentDisplaySurface.gameObject.SetActive(false);
    }
コード例 #3
0
    // A function called by the CommentDisplaySurface when it is clicked.
    // This represents a click on the "background", which either closes the currently open comment
    // or signifies that the user wants to place a new comment at the given position, showing the
    // CommentDisplayConfirmation where they clicked.

    public void CommentDisplaySurfaceClicked(Vector3 position)
    {
        if (activeCommentDisplayer != null)
        {
            activeCommentDisplayer = null;
        }
        else if (commentDisplayConfirmation.IsShowing())
        {
            commentDisplayConfirmation.Hide();
        }
        else
        {
            commentDisplayConfirmation.ShowAtPosition(position);
            CommentCreator.POSITION = position;
        }
    }
コード例 #4
0
    // A function called by CommentDisplayers when they are clicked.
    // This changes the currently active comment.

    public void CommentDisplayerClicked(CommentDisplayer cd)
    {
        activeCommentDisplayer = cd;
        commentDisplayConfirmation.Hide();
    }