/// <summary> /// Build text zone from data /// </summary> /// <param name="tz">TextZoneElement</param> public void RebuildTextZone(TextZoneElement tz) { Destroy(tz.associated2DObject); Destroy(tz.associated3DObject); tz.associated2DObject = Instantiate(textZonePrefab); tz.associated2DObject.SetLayerRecursively((int)ErgoLayers.Top); tz.associated2DObject.transform.position = VectorFunctions.Switch3D2D(tz.Position); tz.associated2DObject.GetComponent <TextZoneScript>().SetSize(VectorFunctions.Switch3D2D(tz.Size)); tz.associated2DObject.GetComponent <TextZoneScript>().bg.color = tz.BackgroundColor; tz.associated2DObject.GetComponent <TextZoneScript>().tm.color = tz.TextColor; tz.associated2DObject.GetComponent <TextZoneScript>().tm.text = tz.Text; tz.associated2DObject.GetComponent <TextZoneScript>().textSize = tz.TextSize; tz.associated3DObject = Instantiate(textZonePrefab); tz.associated3DObject.SetLayerRecursively((int)ErgoLayers.ThreeD); tz.associated3DObject.transform.position = tz.Position; tz.associated3DObject.GetComponent <TextZoneScript>().SetSize(VectorFunctions.Switch3D2D(tz.Size)); tz.associated3DObject.GetComponent <TextZoneScript>().bg.color = tz.BackgroundColor; tz.associated3DObject.GetComponent <TextZoneScript>().tm.color = tz.TextColor; tz.associated3DObject.GetComponent <TextZoneScript>().tm.text = tz.Text; tz.associated3DObject.GetComponent <TextZoneScript>().textSize = tz.TextSize; }
private bool CheckPropertiesBindings(TextZoneElement tz) { textPropertiesPanel.SetActive(tz != null); if (textPropertiesPanel.activeInHierarchy) { // FURNITURE PROPERTIES if (needsUpdate) { textField.text = tz.Text; if (moveToggle != null) { moveToggle.isOn = tz.IsLocked; } colorPicker.Color = new Color(tz.TextColor.r, tz.TextColor.g, tz.TextColor.b); colorPickerBG.Color = new Color(tz.BackgroundColor.r, tz.BackgroundColor.g, tz.BackgroundColor.b); imageToggleBG.color = new Color(colorPickerBG.Color.r, colorPickerBG.Color.g, colorPickerBG.Color.b, 0.5f); imageToggle.color = colorPicker.Color; imageToggleBG.color = colorPickerBG.Color; needsUpdate = false; } imageToggle.color = new Color(colorPicker.Color.r, colorPicker.Color.g, colorPicker.Color.b); imageToggleBG.color = new Color(colorPickerBG.Color.r, colorPickerBG.Color.g, colorPickerBG.Color.b); tz.TextColor = imageToggle.color; tz.BackgroundColor = imageToggleBG.color; tz.associated2DObject.GetComponent <TextZoneScript>().tm.color = tz.TextColor; tz.associated2DObject.GetComponent <TextZoneScript>().bg.color = tz.BackgroundColor; tz.associated2DObject.GetComponent <TextZoneScript>().textSize = tz.TextSize; tz.associated3DObject.GetComponent <TextZoneScript>().tm.color = tz.TextColor; tz.associated3DObject.GetComponent <TextZoneScript>().bg.color = tz.BackgroundColor; tz.associated3DObject.GetComponent <TextZoneScript>().textSize = tz.TextSize; } return(textPropertiesPanel.activeInHierarchy); }