Exemplo n.º 1
0
    void TryOpen()
    {
        ChatInstance instance     = ChatManager.Instance.curExecuteInstance;
        Node         runningNode  = instance.curRunningNode;
        Node         nextReadNode = instance.nextReadNode;
        Node         front        = null;

        if (CanShow(nextReadNode, runningNode))
        {
            front = nextReadNode;
        }
        else if (nextReadNode == null)
        {
            front = instance.curSection.GetLast();
        }
        else
        {
            front = instance.GetFront(nextReadNode, true);
        }
        if (front == null)
        {
            front = instance.curSection.GetLast();
        }
        if (front == null)
        {
            return;
        }
        NodeItemProxy item = GetItem(front.enname == ChatManager.Instance.curName?1:0);

        ChatManager.Instance.curExecuteInstance.ActiveNode(front);
        float itemHeight = item.SetData(front);

        item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemHeight - contextTrans.sizeDelta.y);
        contextTrans.anchoredPosition             = new Vector2(0.0f, contextTrans.sizeDelta.y - viewPortTrans.sizeDelta.y);
        if (front == nextReadNode)
        {
            item.FadeIn();
            instance.ReadNext();
            ChatManager.Instance.curInstance.saveData.totalRectHeight += itemHeight;
            contextTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contextTrans.sizeDelta.y + itemHeight);
            item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemHeight - contextTrans.sizeDelta.y);
        }
        _activeItems.Add(item);
        item.gameObject.SetActive(true);
    }
Exemplo n.º 2
0
 public Node GetFront()
 {
     return(curInstance.GetFront());
 }