Example #1
0
        private void UpdateNode()
        {
            if (!this.m_NodeStatic)
            {
                this.CheckActiveNode();
            }
            else
            {
                List <ContentNode> nodeChilds = this.GetNodeChilds();
                if (nodeChilds.Count != this.m_NodeUsed.Count)
                {
                    this.Resize(nodeChilds.Count);
                    this.CreateStaticNode(nodeChilds);
                }
            }
            RectTransform viewport = this.m_Scroller.get_viewport();

            if (!Object.op_Inequality((Object)viewport, (Object)null))
            {
                return;
            }
            Rect rect = viewport.get_rect();
            IDictionaryEnumerator enumerator = (IDictionaryEnumerator)this.m_NodeUsed.GetEnumerator();

            while (enumerator.MoveNext())
            {
                ContentNode contentNode = (ContentNode)enumerator.Value;
                if (Object.op_Inequality((Object)contentNode, (Object)null))
                {
                    Vector2 vector2 = Vector2.op_Implicit(((Transform)viewport).InverseTransformPoint(((Transform)contentNode.rectTransform).get_position()));
                    vector2 = contentNode.GetPivotAnchoredPosition(vector2);
                    float num1 = (float)(vector2.x - (double)contentNode.sizeX * 0.5 + 2.5);
                    float num2 = (float)(vector2.x + (double)contentNode.sizeX * 0.5 - 2.5);
                    float num3 = (float)(vector2.y + (double)contentNode.sizeY * 0.5 - 2.5);
                    float num4 = (float)(vector2.y - (double)contentNode.sizeY * 0.5 + 2.5);
                    // ISSUE: explicit reference operation
                    // ISSUE: explicit reference operation
                    // ISSUE: explicit reference operation
                    // ISSUE: explicit reference operation
                    // ISSUE: explicit reference operation
                    // ISSUE: explicit reference operation
                    if ((double)num2 > (double)((Rect)@rect).get_x() && (double)num1 < (double)((Rect)@rect).get_x() + (double)((Rect)@rect).get_width() && ((double)num3 > (double)((Rect)@rect).get_y() && (double)num4 < (double)((Rect)@rect).get_y() + (double)((Rect)@rect).get_height()))
                    {
                        contentNode.OnViewIn(vector2);
                    }
                    else
                    {
                        contentNode.OnViewOut(vector2);
                    }
                    if (contentNode.index == this.m_SelectNode)
                    {
                        contentNode.OnSelectOn();
                    }
                    else
                    {
                        contentNode.OnSelectOff();
                    }
                }
            }
        }
Example #2
0
        private void CheckActiveNode()
        {
            ContentGrid           grid            = this.GetGrid();
            List <ContentNode>    contentNodeList = new List <ContentNode>();
            IDictionaryEnumerator enumerator      = (IDictionaryEnumerator)this.m_NodeUsed.GetEnumerator();

            while (enumerator.MoveNext())
            {
                ContentNode contentNode = (ContentNode)enumerator.Value;
                if (Object.op_Inequality((Object)contentNode, (Object)null) && (contentNode.IsReMake() || !contentNode.IsValid() || (contentNode.gridX < grid.x - 1 || contentNode.gridX > grid.x + this.m_NodeWidthNum) || (contentNode.gridY < grid.y - 1 || contentNode.gridY > grid.y + this.m_NodeHeightNum)))
                {
                    contentNodeList.Add(contentNode);
                }
            }
            for (int index = 0; index < contentNodeList.Count; ++index)
            {
                ContentNode contentNode = contentNodeList[index];
                if (Object.op_Inequality((Object)contentNode, (Object)null))
                {
                    contentNode.OnSelectOff();
                    contentNode.SetActive(false);
                    this.m_NodeUsed.Remove(this.GetNodeKey(contentNode.gridX, contentNode.gridY));
                    this.m_NodeEmpty.Add(contentNode);
                }
            }
            int x1   = grid.x;
            int y1   = grid.y;
            int num1 = grid.x + this.m_NodeWidthNum;
            int num2 = grid.y + this.m_NodeHeightNum;

            if (this.isScrollHorizontal)
            {
                --x1;
                ++num1;
            }
            if (this.isScrollVertical)
            {
                --y1;
                ++num2;
            }
            for (int y2 = y1; y2 < num2; ++y2)
            {
                for (int x2 = x1; x2 < num1; ++x2)
                {
                    if ((this.m_WidthLoop || x2 >= 0 && x2 < this.m_ViewWidthNum) && (this.m_HeightLoop || y2 >= 0 && y2 < this.m_ViewHeightNum) && Object.op_Equality((Object)this.GetNodeUsed(x2, y2), (Object)null))
                    {
                        int paramIndex          = this.GetParamIndex(x2, y2);
                        ContentSource.Param obj = this.GetParam(paramIndex);
                        if (obj != null)
                        {
                            ContentNode nodeEmpty = this.GetNodeEmpty();
                            if (Object.op_Inequality((Object)nodeEmpty, (Object)null))
                            {
                                nodeEmpty.Setup(paramIndex, x2, y2, obj);
                                nodeEmpty.SetActive(true);
                                this.m_NodeUsed.Add(this.GetNodeKey(x2, y2), nodeEmpty);
                            }
                            else
                            {
                                Debug.LogError((object)"ノードが不足しています");
                            }
                        }
                    }
                }
            }
        }