/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.Vector3 = hostTransform != null ? hostTransform.localPosition : Vector3.zero; return(start); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.Vector3 = hostTransform.localScale; return(start); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.String = string.Empty; if (mesh != null) { start.String = mesh.text; } else if (text != null) { start.String = text.text; } else if (meshPro != null) { start.String = meshPro.text; } else if (meshProUGUI != null) { start.String = meshProUGUI.text; } return(start); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.String = property.Values[lastIndex].String; return(start); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.Bool = Host.activeSelf; return(start); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { if (controller != null && !string.IsNullOrEmpty(value.String)) { controller.SetTrigger(value.String); } }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.Vector3 = IsLocalRotation ? hostTransform.localEulerAngles : hostTransform.eulerAngles; return(start); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { if (Host != null) { Host.transform.localScale = value.Vector3; } }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { if (spriteIndexer != null) { spriteIndexer.SetIndex(value.Int); } }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { if (renderer != null) { material = value.Material; renderer.material = material; } }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); material = renderer.material; start.Material = material; return(start); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { if (audioSource == null) { audioSource = Host.AddComponent <AudioSource>(); } audioSource.clip = value.AudioClip; audioSource.Play(); }
public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); AudioSource audioSource = Host.GetComponentInChildren <AudioSource>(); if (audioSource != null) { start.AudioClip = audioSource.clip; } return(start); }
/// <inheritdoc /> public override void Init(GameObject host, ThemeDefinition settings) { base.Init(host, settings); if (host != null) { startScaleValue = new ThemePropertyValue(); startScaleValue.Vector3 = host.transform.localScale; } timer = Ease.LerpTime; }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.Int = 0; if (spriteIndexer != null) { start.Int = spriteIndexer.GetIndex(); } return(start); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue color = new ThemePropertyValue(); if (propertyBlocks.Count > 0) { int propId = property.GetShaderPropertyId(); BlocksAndRenderer bAndR = propertyBlocks[0]; color.Color = bAndR.Block.GetVector(propId); } return(color); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { if (Host == null) { return(startScaleValue); } ThemePropertyValue prop = new ThemePropertyValue(); prop.Vector3 = Host.transform.localScale; return(prop); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { var result = new ThemePropertyValue(); int propId = property.GetShaderPropertyId(); if (renderer != null) { renderer.GetPropertyBlock(propertyBlock); switch (property.Type) { case ThemePropertyTypes.Color: result.Color = propertyBlock.GetVector(propId); break; case ThemePropertyTypes.Texture: result.Texture = propertyBlock.GetTexture(propId); break; case ThemePropertyTypes.ShaderFloat: case ThemePropertyTypes.ShaderRange: result.Float = propertyBlock.GetFloat(propId); break; default: break; } } else if (graphic != null) { switch (property.Type) { case ThemePropertyTypes.Color: result.Color = graphic.material.GetVector(propId); break; case ThemePropertyTypes.Texture: result.Texture = graphic.material.GetTexture(propId); break; case ThemePropertyTypes.ShaderFloat: case ThemePropertyTypes.ShaderRange: result.Float = graphic.material.GetFloat(propId); break; default: break; } } return(result); }
/// <inheritdoc /> public override void Init(GameObject host, ThemeDefinition settings) { if (host != null) { originalLocalScale = host.transform.localScale; #pragma warning disable 0618 // Keep initializing property to support consumers who have not migrated. startScaleValue = new ThemePropertyValue(); startScaleValue.Vector3 = host.transform.localScale; #pragma warning restore 0618 } timer = Ease.LerpTime; base.Init(host, settings); }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue color = new ThemePropertyValue(); // check if a text object exists and get the color, // set the delegate to bypass these checks in the future. // if no text objects exists then fall back to renderer based color getting. if (GetColorValue != null) { GetColorValue(property, out color.Color); return(color); } else { if (TryGetTextMeshProColor(property, out color.Color)) { GetColorValue = TryGetTextMeshProColor; return(color); } if (TryGetTextMeshProUGUIColor(property, out color.Color)) { GetColorValue = TryGetTextMeshProUGUIColor; return(color); } if (TryGetTextMeshColor(property, out color.Color)) { GetColorValue = TryGetTextMeshColor; return(color); } if (TryGetTextColor(property, out color.Color)) { GetColorValue = TryGetTextColor; return(color); } // no text components exist, fallback to renderer TryGetRendererColor(property, out color.Color); GetColorValue = TryGetRendererColor; return(color); } }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { if (mesh != null) { mesh.text = value.String; } else if (text != null) { text.text = value.String; } else if (meshPro != null) { meshPro.text = value.String; } else if (meshProUGUI != null) { meshProUGUI.text = value.String; } }
/// <inheritdoc /> public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); switch (property.Name) { case "Scale": start.Vector3 = hostTransform.localScale; break; case "Offset": start.Vector3 = hostTransform.localPosition; break; case "Color": start = base.GetProperty(property); break; default: break; } return(start); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { SetOffset(value.Vector3); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { SetRotation(value.Quaternion); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { SetColor(property, value.Color); }
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { Host.SetActive(value.Bool); }
/// <summary> /// Instruct theme to set value for current property with ThemePropertyValue value provided /// </summary> /// <param name="property">property to update value</param> /// <param name="value">Value for theme to set</param> protected abstract void SetValue(ThemeStateProperty property, ThemePropertyValue value);
/// <inheritdoc /> protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { SetShaderValue(property, value.Color, value.Texture, value.Float); }