protected void DumpLine(LXFMLGrid grid, int row) { var s = new StringBuilder(); s.Append("<size=22><b>"); for (int x = 0; x < grid.Width; ++x) { var cell = grid.GetCellAt(x, row); if (cell.IsEmpty) { s.Append("<color=grey>[O]</color>"); } else { Color32 color = (Color32)LXFMLHelper.GetBrickColor(cell.Data.Brick.materialId); var colorString = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2"); var str = string.Format("<color=#{0}>[O]</color>", colorString); s.Append(str); } } s.Append("</b></size>"); Debug.Log(s.ToString()); }
public void UpdateColorsList(int[] colors, int selectedColor) { foreach (Transform tr in colorsListUI) { tr.gameObject.GetComponent <Button>().onClick.RemoveAllListeners(); Destroy(tr.gameObject); } for (int i = 0; i < colors.Length; i++) { GameObject btn = Instantiate(colorButtonPrefab) as GameObject; Image img = btn.transform.GetChild(0).GetComponent <Image> (); img.color = LXFMLHelper.GetBrickColor(colors[i]); if (img.color.r + img.color.g + img.color.b < 0.1f) { img.color += new Color(.1f, .1f, .1f, 1); } btn.name = colors[i].ToString(); btn.transform.SetParent(colorsListUI, false); int matId = colors[i]; var button = btn.GetComponent <Button>(); button.onClick.AddListener(() => { _modelEditor.UpdateColorPart(matId); }); ColorBlock colorBlock = button.colors; colorBlock.pressedColor = LXFMLHelper.GetBrickColor(colors[i]); if (colors[i] == selectedColor) { button.interactable = false; colorBlock.disabledColor = LXFMLHelper.GetBrickColor(colors[i]); } button.colors = colorBlock; } }
public void Render(BrickData brick) { Reset(); if (brick.design.type == BrickType.Normal) { RenderNormal(brick); } else { RenderSlope(brick); } _fullImage.color = LXFMLHelper.GetBrickColor(brick.materialId); _slopeImage.color = LXFMLHelper.GetBrickColor(brick.materialId); }