Example #1
0
        public void UpdateSize(int depth)
        {
            var scale = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;

            Width = 0;

            float w1 = 0, w2 = 0;

            for (int i = 0; i < values.Length; i++)
            {
                if (i == 1)
                {
                    w1 = Width;
                }
                else if (i == 2)
                {
                    w2 = Width;
                }

                values[i]?.UpdateSize(0);
                Width += values[i]?.Width ?? CodeUtil.SubWidth;
            }

            text2.anchoredPosition = new Vector2(w1 + 115, 0);
            text3.anchoredPosition = new Vector2(w2 + 171, 0);
            (valueObjects[1] as RectTransform).anchoredPosition = new Vector2(w1 + 143, 0);
            (valueObjects[2] as RectTransform).anchoredPosition = new Vector2(w2 + 196, 0);
            block.sizeDelta = new Vector2(Mathf.Ceil(Width + 198), 76);

            blockImage.color = CodeUtil.ChangeFunctionColor(Colors.ListColor, depth);
        }
Example #2
0
        public void UpdateSize(int depth)
        {
            for (int i = 0; i < values.Length; i++)
            {
                values[i]?.UpdateSize(0);
            }

            for (int i = 1; i < codeConnections.Length; i++)
            {
                codeConnections[i]?.UpdateSize(depth + 1);
            }

            Width = 220;
            ICompilerValue value = values[0];

            if (value == null)
            {
                Width += CodeUtil.SubWidth;
            }
            else
            {
                Width += value.Width;
            }

            block.sizeDelta = new Vector2(Mathf.Ceil(Width), 76);

            blockImage.color = CodeUtil.ChangeFunctionColor(Colors.GeneralPhysics, depth);
        }
Example #3
0
        public void UpdateSize(int depth)
        {
            var scale = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;

            Width = 0;

            float w1 = 0;

            for (int i = 0; i < values.Length; i++)
            {
                if (i == 1)
                {
                    w1 = Width;
                }

                if (values[i] != null)
                {
                    values[i].UpdateSize(0);
                    Width += values[i].Width;
                }
                else
                {
                    Width += CodeUtil.SubWidth;
                }
            }

            text2.anchoredPosition = new Vector2(w1 + 115, 0);
            (valueObjects[1] as RectTransform).anchoredPosition = new Vector2(w1 + 142, 0);
            Width          += 146;
            block.sizeDelta = new Vector2(Mathf.Ceil(Width), 76);

            blockImage.color = CodeUtil.ChangeFunctionColor(Colors.VariableColor, depth);
        }
Example #4
0
        public void UpdateSize(int depth)
        {
            var prefWidth = Mathf.Max(variableName.preferredWidth + 20, 80);

            var rt = (RectTransform)variableName.transform;

            rt.sizeDelta    = new Vector2(prefWidth, 50);
            block.sizeDelta = new Vector2(prefWidth + 120, 76);

            blockImage.color = CodeUtil.ChangeFunctionColor(Colors.VariableValueColor, depth);
        }
Example #5
0
        public void UpdateSize(int depth)
        {
            Width = 0;

            float w1 = 0, w2 = 0;

            for (int i = 0; i < values.Length; i++)
            {
                if (i == 1)
                {
                    w1 = Width;
                }
                else if (i == 2)
                {
                    w2 = Width;
                }

                values[i]?.UpdateSize(0);
                Width += values[i]?.Width ?? CodeUtil.SubWidth;
            }

            text3.anchoredPosition = new Vector2(w2 + 198, 0);
            (valueObjects[1] as RectTransform).anchoredPosition = new Vector2(w1 + 174, 0);
            (valueObjects[2] as RectTransform).anchoredPosition = new Vector2(w2 + 222, 0);

            if (depth >= 0)
            {
                Height = 200;
                ICompilerCode connection = codeConnections[1];
                while (connection != null)
                {
                    connection.UpdateSize(depth + 1);
                    Height    += connection.Height;
                    connection = connection.CodeConnections[0];
                }

                scope.sizeDelta = new Vector2(40, Height - 120);
                endConnection.anchoredPosition = new Vector2(0, -Height);
            }

            Width          += 224;
            block.sizeDelta = new Vector2(Mathf.Ceil(Width), 76);


            var c = CodeUtil.ChangeFunctionColor(Colors.ConditionalColor, depth);

            foreach (var i in blockImages)
            {
                i.color = c;
            }
        }
Example #6
0
        public void UpdateSize(int depth)
        {
            var scale = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;

            Width = 0;

            for (int i = 0; i < values.Length; i++)
            {
                values[i]?.UpdateSize(0);
                Width += values[i]?.Width ?? CodeUtil.SubWidth;
            }

            block.sizeDelta = new Vector2(Mathf.Ceil(Width + 124), 76);

            blockImage.color = CodeUtil.ChangeFunctionColor(Colors.ListColor, depth);
        }
Example #7
0
        public void UpdateSize(int depth)
        {
            Width = 229 - CodeUtil.SubWidth;
            ICompilerValue value = values[0];

            if (value != null)
            {
                value.UpdateSize(0);
                Width += value.Width;
            }
            else
            {
                Width += CodeUtil.SubWidth;
            }


            Height = 200;
            ICompilerCode connection = codeConnections[1];

            while (connection != null)
            {
                connection.UpdateSize(depth + 1);
                Height    += connection.Height;
                connection = connection.CodeConnections[0];
            }

            scope.sizeDelta = new Vector2(40, Height - 120);
            endConnection.anchoredPosition = new Vector2(0, -Height);


            block.sizeDelta = new Vector2(Mathf.Ceil(Width), 76);


            var c = CodeUtil.ChangeFunctionColor(Colors.ConditionalColor, depth);

            foreach (var i in blockImages)
            {
                i.color = c;
            }
        }
Example #8
0
 public void UpdateSize(int depth)
 {
     Width            = 137;
     block.sizeDelta  = new Vector2(Width, 76);
     blockImage.color = CodeUtil.ChangeFunctionColor(Colors.ConditionalColor, depth);
 }