Exemplo n.º 1
0
        public void Refresh(bool invalidateCache)
        {
            if (string.IsNullOrEmpty(StyleKey))
            {
                _activeStyle = null;
                return;
            }

            if (_cachedRoot == null || invalidateCache)
            {
                _cachedRoot = GetStyleRoot();
            }

            if (_cachedRoot == null)
            {
                Debug.LogWarning("[StyleComponent] No active StyleRoot object found in parents.", this);
                _activeStyle = null;
                return;
            }

            var s = _cachedRoot.GetStyle(StyleKey);

            if (s == null)
            {
                Debug.LogWarning("[StyleComponent] Style not found ({0})".Fmt(StyleKey), this);
                _activeStyle = null;
                return;
            }

            _activeStyle = s;
            ApplyStyle();
        }