Exemplo n.º 1
0
        private static RadialCell CreateChildCell(uGUI_CraftNode node, RadialCell parent)
        {
            int   childCount       = ((TreeNode)node).get_parent().get_childCount();
            float newSize          = RadialCell.ComputeNewSize(parent);
            float newRadius        = RadialCell.ComputeNewRadius(parent, newSize);
            float polygonLineCount = RadialCell.GetPolygonLineCount(newRadius, newSize);
            int   index            = uGUI_CraftNodeReflector.GetIndex(node);

            if ((double)childCount > (double)polygonLineCount)
            {
                float polygonLineSize = RadialCell.GetPolygonLineSize(newRadius, (float)childCount);
                float angle           = 6.283185f / (float)childCount * (float)index + RadialCell.GetExtraAngleOffset(childCount);
                return(new RadialCell(newRadius, angle, polygonLineSize, float.NaN, childCount, parent));
            }
            float num1 = 6.283185f / polygonLineCount;
            float num2 = childCount > parent.siblings ? parent.groupAngle : parent.angle;

            if (float.IsNaN(num2))
            {
                num2 = parent.angle;
            }
            float angle1 = num2 + num1 * ((float)index - (float)(childCount - 1) / 2f);

            return(new RadialCell(newRadius, angle1, newSize, num2, childCount, parent));
        }
Exemplo n.º 2
0
        private static RadialCell CreateChildCellWithOneElementAtRoot(
            uGUI_CraftNode node,
            RadialCell parent)
        {
            int   childCount       = ((TreeNode)node).get_parent().get_childCount();
            float num              = RadialCell.ComputeNewSize(parent);
            float newRadius        = RadialCell.ComputeNewRadius(parent, num);
            int   index            = uGUI_CraftNodeReflector.GetIndex(node);
            float polygonLineCount = RadialCell.GetPolygonLineCount(newRadius, num);

            if ((double)childCount > (double)polygonLineCount)
            {
                num = RadialCell.GetPolygonLineSize(newRadius, (float)childCount);
            }
            float angle = 6.283185f / (float)childCount * (float)index + RadialCell.GetExtraAngleOffset(childCount);

            return(new RadialCell(newRadius, angle, num, float.NaN, childCount, parent));
        }