예제 #1
0
        public override void OnUpdateStyle(object obj)
        {
            base.OnUpdateStyle(obj);
            var text = obj as Text;

            if (text == null)
            {
                return;
            }
            if (Font == null || Font.Value == null)
            {
                Font = new SFont(Resources.GetBuiltinResource <Font>("Arial.ttf"));
            }

            Font.SetTargetValue(f => text.font                 = f);
            FontStyle.SetTargetValue(fs => text.fontStyle      = fs);
            FontSize.SetTargetValue(fs => text.fontSize        = fs);
            LineSpace.SetTargetValue(ls => text.lineSpacing    = ls);
            RichText.SetTargetValue(rt => text.supportRichText = rt);

            Alignment.SetTargetValue(a => text.alignment = a);
            AlignByGeometry.SetTargetValue(abg => text.alignByGeometry      = abg);
            HorizontalOverflow.SetTargetValue(hw => text.horizontalOverflow = hw);
            VerticalOverflow.SetTargetValue(vw => text.verticalOverflow     = vw);
            BestFit.SetTargetValue(bf => text.resizeTextForBestFit          = bf);
        }
예제 #2
0
    public override void OnUpdateStyle(object obj)
    {
        var target = obj as Graphic;

        if (target == null)
        {
            throw new ArgumentNullException("target");
        }

        Color.SetTargetValue(c => target.color                 = c);
        Material.SetTargetValue(m => target.material           = m);
        RaycastTarget.SetTargetValue(r => target.raycastTarget = r);
    }