/// <summary> /// Styles the text with the given style. /// </summary> /// <param name="textMesh">The text to style.</param> /// <param name="style">The styles to apply.</param> protected virtual void ApplyTextStyle(TextMeshPro textMesh, SpatialButtonFacade.ButtonStyle style) { if (textMesh == null) { return; } textMesh.text = style.ButtonText; textMesh.color = style.FontColor; textMesh.fontSize = style.FontSize; }
/// <summary> /// Configures the appearance of a <see cref="ButtonElement"/> button. /// </summary> /// <param name="button">The button to style.</param> /// <param name="style">The styles to apply.</param> protected virtual void ApplyButtonStyle(ButtonElement button, SpatialButtonFacade.ButtonStyle style) { if (!style.IsApplied) { return; } ApplyMeshStyle(button.ButtonMeshFilter, style); ApplyTextStyle(button.Text, style); RescaleButton(button.TextRect); }
/// <summary> /// Styles the mesh with the given style. /// </summary> /// <param name="meshFilter">The mesh to style.</param> /// <param name="style">The styles to apply.</param> protected virtual void ApplyMeshStyle(MeshFilter meshFilter, SpatialButtonFacade.ButtonStyle style) { if (meshFilter == null) { return; } List <Color> colors = new List <Color>(); for (int colorIndex = 0; colorIndex < meshFilter.mesh.vertices.Length; colorIndex++) { colors.Add(style.MeshColor); } meshFilter.mesh.SetColors(colors); }