Exemple #1
0
    private void ApplyStyle(StyleSheet.StyleSheetDeclaration specificStyle)
    {
        if (IgnoreStyle)
        {
            return;
        }

        SetColor(specificStyle);
    }
    public void ApplyStyles(StyleSheet styleSheet)
    {
        if (IgnoreStyle)
            return;

        _style = styleSheet.GetStyle(this.StyleName.ToString());
        if (_style != null)
        {
            ApplyStyle(_style);
        }
    }
 public void Start()
 {
     isEditorMode = Application.isEditor;
     styles = GameObject.FindObjectOfType<StyleSheet>();
     if (styles != null)
     {
         _style = styles.GetStyle(this.StyleName.ToString());
         if (_style != null)
         {
             ApplyStyle(_style);
         }
     }
 }
Exemple #4
0
 public void Start()
 {
     isEditorMode = Application.isEditor;
     styles       = GameObject.FindObjectOfType <StyleSheet>();
     if (styles != null)
     {
         _style = styles.GetStyle(this.StyleName.ToString());
         if (_style != null)
         {
             ApplyStyle(_style);
         }
     }
 }
Exemple #5
0
    public void ApplyStyles(StyleSheet styleSheet)
    {
        if (IgnoreStyle)
        {
            return;
        }


        _style = styleSheet.GetStyle(this.StyleName.ToString());
        if (_style != null)
        {
            ApplyStyle(_style);
        }
    }
 public void Update()
 {
     if (isEditorMode && styles.LiveUpdate)
     {
         if (_style == null)
         {
             if (styles != null)
             {
                 _style = styles.GetStyle(this.StyleName.ToString());
             }
         }
         if (_style != null)
         {
             ApplyStyle(_style);
         }
     }
 }
Exemple #7
0
 public void Update()
 {
     if (isEditorMode && styles.LiveUpdate)
     {
         if (_style == null)
         {
             if (styles != null)
             {
                 _style = styles.GetStyle(this.StyleName.ToString());
             }
         }
         if (_style != null)
         {
             ApplyStyle(_style);
         }
     }
 }
Exemple #8
0
    private void SetColor(StyleSheet.StyleSheetDeclaration rule)
    {
        if (IgnoreStyle)
        {
            return;
        }

        Text t1 = this.GetComponent <Text>();

        if (t1 != null)
        {
            t1.color = rule.ValueColor;
        }
        Image i1 = this.GetComponent <Image>();

        if (i1 != null)
        {
            i1.color = rule.ValueColor;
        }

        Button b1 = this.GetComponent <Button>();

        if (b1 != null) // has actual pressed value
        {
            if (b1.targetGraphic != null)
            {
                ColorBlock buttonColors = new ColorBlock()
                {
                    normalColor      = rule.ValueColor,
                    highlightedColor = rule.ValueColor,
                    pressedColor     = rule.ValuePressedColor,
                    colorMultiplier  = 1,
                    fadeDuration     = 0.13f
                };

                if (i1 != null)
                {
                    i1.color = Color.white;
                }

                b1.colors = buttonColors;
            }
        }
    }