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