コード例 #1
0
        internal static bool CanApply(int specificity, int otherSpecificity, StylePropertyApplyMode mode)
        {
            switch (mode)
            {
            case StylePropertyApplyMode.Copy:
                return(true);

            case StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity:
            {
                if (specificity == UndefinedSpecificity && otherSpecificity == UnitySpecificity)
                {
                    return(true);
                }

                return(otherSpecificity >= specificity);
            }

            case StylePropertyApplyMode.CopyIfNotInline:
                return(specificity < InlineSpecificity);

            default:
                Debug.Assert(false, "Invalid mode " + mode);
                return(false);
            }
        }
コード例 #2
0
        internal bool Apply(T otherValue, int otherSpecificity, StylePropertyApplyMode mode)
        {
            switch (mode)
            {
            case StylePropertyApplyMode.Copy:
                value       = otherValue;
                specificity = otherSpecificity;
                return(true);

            case StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity:
                if (otherSpecificity >= specificity)
                {
                    value       = otherValue;
                    specificity = otherSpecificity;
                    return(true);
                }
                return(false);

            case StylePropertyApplyMode.CopyIfNotInline:
                if (specificity < int.MaxValue)
                {
                    value       = otherValue;
                    specificity = otherSpecificity;
                    return(true);
                }
                return(false);

            default:
                Debug.Assert(false, "Invalid mode " + mode);
                return(false);
            }
        }
コード例 #3
0
ファイル: Style.cs プロジェクト: zzrx79/UnityDecompiled
 internal void Apply(Style <T> other, StylePropertyApplyMode mode)
 {
     if (mode != StylePropertyApplyMode.Copy)
     {
         if (mode != StylePropertyApplyMode.CopyIfMoreSpecific)
         {
             if (mode == StylePropertyApplyMode.CopyIfNotInline)
             {
                 if (this.specificity < 2147483647)
                 {
                     this.value       = other.value;
                     this.specificity = other.specificity;
                 }
             }
         }
         else if (other.specificity >= this.specificity)
         {
             this.value       = other.value;
             this.specificity = other.specificity;
         }
     }
     else
     {
         this.value       = other.value;
         this.specificity = other.specificity;
     }
 }
コード例 #4
0
 internal bool Apply <U>(U other, StylePropertyApplyMode mode) where U : IStyleValue <Length>
 {
     if (StyleValueExtensions.CanApply(specificity, other.specificity, mode))
     {
         value       = other.value;
         keyword     = other.keyword;
         specificity = other.specificity;
         return(true);
     }
     return(false);
 }
コード例 #5
0
 internal void Apply(VisualElementStyles other, StylePropertyApplyMode mode)
 {
     this.m_CustomProperties = other.m_CustomProperties;
     this.width.Apply(other.width, mode);
     this.height.Apply(other.height, mode);
     this.maxWidth.Apply(other.maxWidth, mode);
     this.maxHeight.Apply(other.maxHeight, mode);
     this.minWidth.Apply(other.minWidth, mode);
     this.minHeight.Apply(other.minHeight, mode);
     this.flex.Apply(other.flex, mode);
     this.overflow.Apply(other.overflow, mode);
     this.positionLeft.Apply(other.positionLeft, mode);
     this.positionTop.Apply(other.positionTop, mode);
     this.positionRight.Apply(other.positionRight, mode);
     this.positionBottom.Apply(other.positionBottom, mode);
     this.marginLeft.Apply(other.marginLeft, mode);
     this.marginTop.Apply(other.marginTop, mode);
     this.marginRight.Apply(other.marginRight, mode);
     this.marginBottom.Apply(other.marginBottom, mode);
     this.borderLeft.Apply(other.borderLeft, mode);
     this.borderTop.Apply(other.borderTop, mode);
     this.borderRight.Apply(other.borderRight, mode);
     this.borderBottom.Apply(other.borderBottom, mode);
     this.paddingLeft.Apply(other.paddingLeft, mode);
     this.paddingTop.Apply(other.paddingTop, mode);
     this.paddingRight.Apply(other.paddingRight, mode);
     this.paddingBottom.Apply(other.paddingBottom, mode);
     this.positionType.Apply(other.positionType, mode);
     this.alignSelf.Apply(other.alignSelf, mode);
     this.textAlignment.Apply(other.textAlignment, mode);
     this.fontStyle.Apply(other.fontStyle, mode);
     this.textClipping.Apply(other.textClipping, mode);
     this.fontSize.Apply(other.fontSize, mode);
     this.font.Apply(other.font, mode);
     this.wordWrap.Apply(other.wordWrap, mode);
     this.textColor.Apply(other.textColor, mode);
     this.flexDirection.Apply(other.flexDirection, mode);
     this.backgroundColor.Apply(other.backgroundColor, mode);
     this.borderColor.Apply(other.borderColor, mode);
     this.backgroundImage.Apply(other.backgroundImage, mode);
     this.backgroundSize.Apply(other.backgroundSize, mode);
     this.alignItems.Apply(other.alignItems, mode);
     this.alignContent.Apply(other.alignContent, mode);
     this.justifyContent.Apply(other.justifyContent, mode);
     this.flexWrap.Apply(other.flexWrap, mode);
     this.borderWidth.Apply(other.borderWidth, mode);
     this.borderRadius.Apply(other.borderRadius, mode);
     this.sliceLeft.Apply(other.sliceLeft, mode);
     this.sliceTop.Apply(other.sliceTop, mode);
     this.sliceRight.Apply(other.sliceRight, mode);
     this.sliceBottom.Apply(other.sliceBottom, mode);
     this.opacity.Apply(other.opacity, mode);
 }
コード例 #6
0
        internal bool Apply(T otherValue, int otherSpecificity, StylePropertyApplyMode mode)
        {
            bool result;

            switch (mode)
            {
            case StylePropertyApplyMode.Copy:
                this.value       = otherValue;
                this.specificity = otherSpecificity;
                result           = true;
                break;

            case StylePropertyApplyMode.CopyIfEqualOrGreaterSpecificity:
                if (otherSpecificity >= this.specificity)
                {
                    this.value       = otherValue;
                    this.specificity = otherSpecificity;
                    result           = true;
                }
                else
                {
                    result = false;
                }
                break;

            case StylePropertyApplyMode.CopyIfNotInline:
                if (this.specificity < 2147483647)
                {
                    this.value       = otherValue;
                    this.specificity = otherSpecificity;
                    result           = true;
                }
                else
                {
                    result = false;
                }
                break;

            default:
                Debug.Assert(false, "Invalid mode " + mode);
                result = false;
                break;
            }
            return(result);
        }
コード例 #7
0
        public void Apply(VisualElementStylesData other, StylePropertyApplyMode mode)
        {
            // Always just copy the reference to custom properties, since they can't be overriden per instance
            m_CustomProperties = other.m_CustomProperties;

            width.Apply(other.width, mode);
            height.Apply(other.height, mode);
            maxWidth.Apply(other.maxWidth, mode);
            maxHeight.Apply(other.maxHeight, mode);
            minWidth.Apply(other.minWidth, mode);
            minHeight.Apply(other.minHeight, mode);
            flexBasis.Apply(other.flexBasis, mode);
            flexGrow.Apply(other.flexGrow, mode);
            flexShrink.Apply(other.flexShrink, mode);
            overflow.Apply(other.overflow, mode);
            unityOverflowClipBox.Apply(other.unityOverflowClipBox, mode);
            left.Apply(other.left, mode);
            top.Apply(other.top, mode);
            right.Apply(other.right, mode);
            bottom.Apply(other.bottom, mode);
            marginLeft.Apply(other.marginLeft, mode);
            marginTop.Apply(other.marginTop, mode);
            marginRight.Apply(other.marginRight, mode);
            marginBottom.Apply(other.marginBottom, mode);
            paddingLeft.Apply(other.paddingLeft, mode);
            paddingTop.Apply(other.paddingTop, mode);
            paddingRight.Apply(other.paddingRight, mode);
            paddingBottom.Apply(other.paddingBottom, mode);
            position.Apply(other.position, mode);
            alignSelf.Apply(other.alignSelf, mode);
            unityTextAlign.Apply(other.unityTextAlign, mode);
            unityFontStyleAndWeight.Apply(other.unityFontStyleAndWeight, mode);
            fontSize.Apply(other.fontSize, mode);
            unityFont.Apply(other.unityFont, mode);
            whiteSpace.Apply(other.whiteSpace, mode);
            color.Apply(other.color, mode);
            flexDirection.Apply(other.flexDirection, mode);
            backgroundColor.Apply(other.backgroundColor, mode);
            backgroundImage.Apply(other.backgroundImage, mode);
            unityBackgroundScaleMode.Apply(other.unityBackgroundScaleMode, mode);
            unityBackgroundImageTintColor.Apply(other.unityBackgroundImageTintColor, mode);
            alignItems.Apply(other.alignItems, mode);
            alignContent.Apply(other.alignContent, mode);
            justifyContent.Apply(other.justifyContent, mode);
            flexWrap.Apply(other.flexWrap, mode);
            borderLeftColor.Apply(other.borderLeftColor, mode);
            borderTopColor.Apply(other.borderTopColor, mode);
            borderRightColor.Apply(other.borderRightColor, mode);
            borderBottomColor.Apply(other.borderBottomColor, mode);
            borderLeftWidth.Apply(other.borderLeftWidth, mode);
            borderTopWidth.Apply(other.borderTopWidth, mode);
            borderRightWidth.Apply(other.borderRightWidth, mode);
            borderBottomWidth.Apply(other.borderBottomWidth, mode);
            borderTopLeftRadius.Apply(other.borderTopLeftRadius, mode);
            borderTopRightRadius.Apply(other.borderTopRightRadius, mode);
            borderBottomRightRadius.Apply(other.borderBottomRightRadius, mode);
            borderBottomLeftRadius.Apply(other.borderBottomLeftRadius, mode);
            unitySliceLeft.Apply(other.unitySliceLeft, mode);
            unitySliceTop.Apply(other.unitySliceTop, mode);
            unitySliceRight.Apply(other.unitySliceRight, mode);
            unitySliceBottom.Apply(other.unitySliceBottom, mode);
            opacity.Apply(other.opacity, mode);
            cursor.Apply(other.cursor, mode);
            visibility.Apply(other.visibility, mode);
            display.Apply(other.display, mode);
        }
コード例 #8
0
 internal bool Apply(StyleValue <T> other, StylePropertyApplyMode mode)
 {
     return(this.Apply(other.value, other.specificity, mode));
 }
コード例 #9
0
 bool IStyleValue <Length> .Apply <U>(U other, StylePropertyApplyMode mode)
 {
     return(Apply(other, mode));
 }
コード例 #10
0
        public void Apply(VisualElementStylesData other, StylePropertyApplyMode mode)
        {
            // Always just copy the reference to custom properties, since they can't be overriden per instance
            m_CustomProperties = other.m_CustomProperties;

            width.Apply(other.width, mode);
            height.Apply(other.height, mode);
            maxWidth.Apply(other.maxWidth, mode);
            maxHeight.Apply(other.maxHeight, mode);
            minWidth.Apply(other.minWidth, mode);
            minHeight.Apply(other.minHeight, mode);
            flex.Apply(other.flex, mode);
            flexBasis.Apply(other.flexBasis, mode);
            flexGrow.Apply(other.flexGrow, mode);
            flexShrink.Apply(other.flexShrink, mode);
            overflow.Apply(other.overflow, mode);
            positionLeft.Apply(other.positionLeft, mode);
            positionTop.Apply(other.positionTop, mode);
            positionRight.Apply(other.positionRight, mode);
            positionBottom.Apply(other.positionBottom, mode);
            marginLeft.Apply(other.marginLeft, mode);
            marginTop.Apply(other.marginTop, mode);
            marginRight.Apply(other.marginRight, mode);
            marginBottom.Apply(other.marginBottom, mode);
            borderLeft.Apply(other.borderLeft, mode);
            borderTop.Apply(other.borderTop, mode);
            borderRight.Apply(other.borderRight, mode);
            borderBottom.Apply(other.borderBottom, mode);
            paddingLeft.Apply(other.paddingLeft, mode);
            paddingTop.Apply(other.paddingTop, mode);
            paddingRight.Apply(other.paddingRight, mode);
            paddingBottom.Apply(other.paddingBottom, mode);
            positionType.Apply(other.positionType, mode);
            alignSelf.Apply(other.alignSelf, mode);
            textAlignment.Apply(other.textAlignment, mode);
            fontStyle.Apply(other.fontStyle, mode);
            textClipping.Apply(other.textClipping, mode);
            fontSize.Apply(other.fontSize, mode);
            font.Apply(other.font, mode);
            wordWrap.Apply(other.wordWrap, mode);
            textColor.Apply(other.textColor, mode);
            flexDirection.Apply(other.flexDirection, mode);
            backgroundColor.Apply(other.backgroundColor, mode);
            borderColor.Apply(other.borderColor, mode);
            backgroundImage.Apply(other.backgroundImage, mode);
            backgroundSize.Apply(other.backgroundSize, mode);
            alignItems.Apply(other.alignItems, mode);
            alignContent.Apply(other.alignContent, mode);
            justifyContent.Apply(other.justifyContent, mode);
            flexWrap.Apply(other.flexWrap, mode);
            borderLeftWidth.Apply(other.borderLeftWidth, mode);
            borderTopWidth.Apply(other.borderTopWidth, mode);
            borderRightWidth.Apply(other.borderRightWidth, mode);
            borderBottomWidth.Apply(other.borderBottomWidth, mode);
            borderTopLeftRadius.Apply(other.borderTopLeftRadius, mode);
            borderTopRightRadius.Apply(other.borderTopRightRadius, mode);
            borderBottomRightRadius.Apply(other.borderBottomRightRadius, mode);
            borderBottomLeftRadius.Apply(other.borderBottomLeftRadius, mode);
            sliceLeft.Apply(other.sliceLeft, mode);
            sliceTop.Apply(other.sliceTop, mode);
            sliceRight.Apply(other.sliceRight, mode);
            sliceBottom.Apply(other.sliceBottom, mode);
            opacity.Apply(other.opacity, mode);
            cursor.Apply(other.cursor, mode);
        }
コード例 #11
0
 bool IStyleValue <Background> .Apply <U>(U other, StylePropertyApplyMode mode)
 {
     return(Apply(other, mode));
 }