bool TryAddUp() { Node up = _activeItems[0].linkedNode.GetFront(); while (up != null && up is SetParamNode) { up = up.GetFront(); } if (up == null) { return(false); } NodeItemProxy item = GetItem(up.name == ChatManager.Instance.curName?1:0); float itemHeight = item.SetData(up); float itemY = _activeItems [0].cachedRectTransform.anchoredPosition.y + itemHeight; item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemY); _activeItems.Insert(0, item); if (!up.hasCalHeight) { up.hasCalHeight = true; ChatManager.Instance.curInstance.saveData.totalRectHeight += itemHeight; contextTrans.anchoredPosition += new Vector2(0.0f, itemHeight); for (int i = 0; i < _activeItems.Count; i++) { _activeItems [i].cachedRectTransform.anchoredPosition -= new Vector2(0.0f, itemHeight); } contextTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contextTrans.sizeDelta.y + itemHeight); } return(true); }
bool TryAddDown() { Node linkedNode = _activeItems [_activeItems.Count - 1].linkedNode; Node down = linkedNode.GetNext(); while (down != null && down is SetParamNode) { down = down.GetNext(); } if (down == null) { return(false); } if (ChatManager.Instance.curInstance.curRunningNode == down) { return(false); } NodeItemProxy item = GetItem(down.name == ChatManager.Instance.curName?1:0); float itemHeight = item.SetData(down); float itemY = _activeItems [_activeItems.Count - 1].cachedRectTransform.anchoredPosition.y - _activeItems [_activeItems.Count - 1].height; if (!down.hasCalHeight) { down.hasCalHeight = true; ChatManager.Instance.curInstance.saveData.totalRectHeight += itemHeight; contextTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contextTrans.sizeDelta.y + itemHeight); } item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemY); _activeItems.Add(item); return(true); }
void Pool(NodeItemProxy node) { _activeItems.Remove(node); node.gameObject.SetActive(false); _pools [node.prefabId].Push(node); ChatManager.Instance.curExecuteInstance.DeactiveNode(node.linkedNode); }
bool TryAddUp() { Node up = ChatManager.Instance.curExecuteInstance.GetFront(_activeItems[0].linkedNode, true); if (up == null) { return(false); } NodeItemProxy item = GetItem(up.enname == ChatManager.Instance.curName?1:0); float itemHeight = item.SetData(up); float itemY = _activeItems [0].cachedRectTransform.anchoredPosition.y + itemHeight; item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemY); _activeItems.Insert(0, item); ChatManager.Instance.curExecuteInstance.ActiveNode(up); if (ChatManager.Instance.curExecuteInstance.nextReadNode == up) { ChatManager.Instance.curExecuteInstance.ReadNext(); ChatManager.Instance.curInstance.saveData.totalRectHeight += itemHeight; contextTrans.anchoredPosition += new Vector2(0.0f, itemHeight); for (int i = 0; i < _activeItems.Count; i++) { _activeItems [i].cachedRectTransform.anchoredPosition -= new Vector2(0.0f, itemHeight); } contextTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contextTrans.sizeDelta.y + itemHeight); } item.gameObject.SetActive(true); return(true); }
bool NeedCull(NodeItemProxy node) { float buffer = 100.0f; if (_activeItems.IndexOf(node) == 0) { if (node.pos.y - node.height + contextTrans.anchoredPosition.y > 0 + buffer) { return(true); } } if (node.pos.y + contextTrans.anchoredPosition.y < -viewPortTrans.sizeDelta.y - buffer) { return(true); } return(false); }
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); }
void TryOpen() { Node front = ChatManager.Instance.curInstance.curRunningNode.GetFront(); if (front == null) { return; } NodeItemProxy item = GetItem(front.name == ChatManager.Instance.curName?1:0); float itemHeight = item.SetData(front); item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemHeight - contextTrans.sizeDelta.y); if (!front.hasCalHeight) { front.hasCalHeight = true; 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); }
bool TryAddDown() { Node linkedNode = _activeItems [_activeItems.Count - 1].linkedNode; Node down = ChatManager.Instance.curExecuteInstance.GetNext(linkedNode, true); if (down == null) { return(false); } if (ChatManager.Instance.curExecuteInstance.curRunningNode == down) { return(false); } NodeItemProxy item = GetItem(down.enname == ChatManager.Instance.curName?1:0); float itemHeight = item.SetData(down); float itemY = _activeItems [_activeItems.Count - 1].cachedRectTransform.anchoredPosition.y - _activeItems [_activeItems.Count - 1].height; if (ChatManager.Instance.curExecuteInstance.nextReadNode == down) { item.FadeIn(); ChatManager.Instance.curExecuteInstance.ReadNext(); ChatManager.Instance.curInstance.saveData.totalRectHeight += itemHeight; if (ChatManager.Instance.curInstance.saveData.totalRectHeight >= viewPortTrans.sizeDelta.y && ChatManager.Instance.curInstance.saveData.totalRectHeight - itemHeight <= viewPortTrans.sizeDelta.y) { OnPopNewMsg(); } if (redCount > 0) { redCount--; } contextTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, contextTrans.sizeDelta.y + itemHeight); } item.cachedRectTransform.anchoredPosition = new Vector2(0.0f, itemY); ChatManager.Instance.curExecuteInstance.ActiveNode(down); _activeItems.Add(item); item.gameObject.SetActive(true); return(true); }
void Pool(NodeItemProxy node) { _activeItems.Remove(node); node.gameObject.SetActive(false); _pools [node.prefabId].Push(node); }
void PoolDown(NodeItemProxy node) { Pool(node); //contextTrans.sizeDelta = new Vector2 (contextTrans.sizeDelta.x,contextTrans.sizeDelta.y-node.height); }
void PoolUp(NodeItemProxy node) { Pool(node); }