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; } }
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; } }
void CodeConnect(ICompilerCode code) { if (code != null) { code.UpdateSize(-1); code.Offset.Connect(); foreach (var v in code.Values) { if (v != null) { RecursiveValueConnect(v, true); } } } }
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; } }