Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #3
0
        public void UpdateSize(int depth)
        {
            Width = 193;

            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);
            }

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


            var c = CodeUtil.ChangeControlColor(Colors.ControlColor, depth);

            foreach (var i in blockImages)
            {
                i.color = c;
            }
        }
Beispiel #4
0
        public void UpdateSize(int depth)
        {
            var scale     = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;
            var selfSize  = 76 * scale;
            var valueSize = selfSize * 0.9f;

            Width = 130 * scale;

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

            Height = selfSize;

            var w1 = 76 * 0.9f;

            if (values[0] != null)
            {
                w1 = values[0].Width / scale;
            }

            block.sizeDelta = new Vector2(Width / scale, 76);

            blockImage.color = CodeUtil.ChangeValueColor(Colors.VariableValueColor, depth);
        }
Beispiel #5
0
        public void UpdateSize(int depth)
        {
            var scale     = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;
            var selfSize  = 76 * scale;
            var valueSize = selfSize * 0.9f;

            Width = 240 * scale;

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

            Height = selfSize;

            var w1 = 76 * 0.9f;

            if (values[0] != null)
            {
                w1 = values[0].Width / scale;
            }

            text.anchoredPosition = new Vector2(w1 + 191, 0);
            val2.anchoredPosition = new Vector2(w1 + 236, 0);
            block.sizeDelta       = new Vector2(Width / scale, 76);

            theme.color = CodeUtil.ChangeValueColor(Colors.OperatorColor, depth);
        }
Beispiel #6
0
        public void UpdateSize(int depth)
        {
            var scale     = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;
            var selfSize  = 76 * scale;
            var valueSize = selfSize * 0.9f;

            Width = 59 * scale;

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

            Height = selfSize;

            block.sizeDelta = new Vector2(Width / scale, 76);

            blockImage.color = CodeUtil.ChangeValueColor(Colors.VariableValueColor, depth);

            switch (component)
            {
            case VectorComponent.X:
                mainText.text = "x";
                break;

            case VectorComponent.Y:
                mainText.text = "y";
                break;

            case VectorComponent.Z:
                mainText.text = "z";
                break;
            }
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public void RescaleText(int depth)
        {
            var scale    = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;
            var selfSize = 76 * scale;

            Height = selfSize;

            var prefWidth = Mathf.Max(dropdownText.preferredWidth + 27, 60);

            var w1 = values[0]?.Width ?? selfSize * 0.9f;

            Width = w1;

            (valueObjects[0] as RectTransform).anchoredPosition = new Vector2(prefWidth + 3, 0);

            //var rt = (RectTransform)dropdownText.transform;
            //rt.sizeDelta = new Vector2(prefWidth, 60);
            //rt.anchoredPosition = Vector2.zero;
            var len = prefWidth + 7;

            length.sizeDelta = new Vector2(w1 / scale + len, 76);
            (dropdown.transform as RectTransform).sizeDelta = new Vector2(prefWidth - 11, 60);
            //length.localScale = Vector3.one;
            Width += len * scale;

            blockImage.color = CodeUtil.ChangeValueColor(Colors.NotColor, depth);
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public void UpdateSize(int depth)
        {
            var scale    = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;
            var selfSize = 76 * scale;

            Width  = selfSize;
            Height = selfSize;

            length.sizeDelta  = new Vector2(76, 76);
            length.localScale = Vector3.one;

            blockImage.color = CodeUtil.ChangeValueColor(Colors.VariableValueColor, depth);
        }
Beispiel #11
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;
            }
        }
Beispiel #12
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);
        }
Beispiel #13
0
        public void UpdateSize(int depth)
        {
            var scale    = transform.lossyScale.x / CodeView.Instance.rectTransform.lossyScale.x;
            var selfSize = 76 * scale;

            Height = selfSize;

            var prefWidth = Mathf.Max(variableName.preferredWidth + 20, 60);

            var rt = (RectTransform)variableName.transform;

            rt.sizeDelta        = new Vector2(prefWidth, 60);
            rt.anchoredPosition = Vector2.zero;
            length.sizeDelta    = new Vector2(prefWidth + 16, 76);
            length.localScale   = Vector3.one;

            Width = (prefWidth + 16) * scale;

            blockImage.color = CodeUtil.ChangeValueColor(Colors.VariableValueColor, depth);
        }
Beispiel #14
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;
            }
        }
Beispiel #15
0
 public void UpdateSize(int depth)
 {
     Width            = 137;
     block.sizeDelta  = new Vector2(Width, 76);
     blockImage.color = CodeUtil.ChangeFunctionColor(Colors.ConditionalColor, depth);
 }
Beispiel #16
0
        public void UpdateSize(int depth)
        {
            /*for (int i = 0; i < values.Length; i++)
             * {
             *  values[i]?.UpdateSize();
             * }
             *
             * for (int i = 1; i < codeConnections.Length; i++)
             * {
             *  codeConnections[i]?.UpdateSize();
             * }*/

            for (int i = 0; i < codeConnections.Length; i++)
            {
                codeTest2[i] = codeConnections[i]?.Transform;
            }

            Width = 260 - CodeUtil.SubWidth;
            ICompilerValue value = values[0];

            if (value != null)
            {
                value.UpdateSize(0);
                Width += value.Width;
                //value = value.Values?.Length > 0 ? value.Values?[0] : null;
            }
            else
            {
                Width += CodeUtil.SubWidth;
            }

            if (depth >= 0)
            {
                var c1 = 0f;
                var c2 = 0f;

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

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

                scope1.sizeDelta         = new Vector2(40, codeConnections[1] != null ? c1 + 80 : 80);
                scope2.anchoredPosition  = new Vector2(0, codeConnections[1] != null ? -c1 - 240 : -240);
                scope2.sizeDelta         = new Vector2(40, codeConnections[2] != null ? c2 + 40 : 40);
                nextCon.anchoredPosition = new Vector2(0, -Height);
            }

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

            var c = CodeUtil.ChangeControlColor(Colors.ControlColor, depth);

            foreach (var i in blockImages)
            {
                i.color = c;
            }
        }