/// <inheritdoc />
        public override ThemePropertyValue GetProperty(ThemeStateProperty property)
        {
            ThemePropertyValue start = new ThemePropertyValue();

            start.Vector3 = hostTransform != null ? hostTransform.localPosition : Vector3.zero;
            return(start);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <inheritdoc />
        public override ThemePropertyValue GetProperty(ThemeStateProperty property)
        {
            ThemePropertyValue start = new ThemePropertyValue();

            start.String = property.Values[lastIndex].String;
            return(start);
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public override ThemePropertyValue GetProperty(ThemeStateProperty property)
        {
            ThemePropertyValue start = new ThemePropertyValue();

            start.Bool = Host.activeSelf;
            return(start);
        }
Exemplo n.º 6
0
 /// <inheritdoc />
 protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value)
 {
     if (controller != null && !string.IsNullOrEmpty(value.String))
     {
         controller.SetTrigger(value.String);
     }
 }
Exemplo n.º 7
0
        /// <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;
     }
 }
Exemplo n.º 9
0
 /// <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);
        }
Exemplo n.º 12
0
        /// <inheritdoc />
        protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value)
        {
            if (audioSource == null)
            {
                audioSource = Host.AddComponent <AudioSource>();
            }

            audioSource.clip = value.AudioClip;
            audioSource.Play();
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 15
0
        /// <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);
        }
Exemplo n.º 18
0
        /// <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);
            }
        }
Exemplo n.º 21
0
 /// <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;
     }
 }
Exemplo n.º 22
0
        /// <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);
 }
Exemplo n.º 24
0
 /// <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);
 }
Exemplo n.º 26
0
 /// <inheritdoc />
 protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value)
 {
     Host.SetActive(value.Bool);
 }
Exemplo n.º 27
0
 /// <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);
Exemplo n.º 28
0
 /// <inheritdoc />
 protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value)
 {
     SetShaderValue(property, value.Color, value.Texture, value.Float);
 }